<% If request("calc") = "y" then if request("f1")<>"" then CoreDiaMM = cDBl(request("f1")) else if request("txtCoreDiaMM") = "" then CoreDiaMM = 0 else CoreDiaMM = cDBl(request("txtCoreDiaMM")) end if end if if request("f2")<>"" then CoreLenMM = cDBl(request("f2")) else if request("txtCoreLenMM") = "" then CoreLenMM = 0 else CoreLenMM = cDBl(request("txtCoreLenMM")) end if end if if request("f3")<>"" then CoilLenMM = cDBl(request("f3")) else if request("txtCoilLenMM") = "" then CoilLenMM = 0 else CoilLenMM = cDBl(request("txtCoilLenMM")) end if end if if request("f4")<>"" then WireDiaMM = cDBl(request("f4")) else if request("txtWireDiaMM") = "" then WireDiaMM = 0 else WireDiaMM = cDBl(request("txtWireDiaMM")) end if end if if request("f5")<>"" then WireLenMtr = cDBl(request("f5")) else if request("txtWireLenMtr") = "" then WireLenMtr = 0 else WireLenMtr = cDBl(request("txtWireLenMtr")) end if end if strCoreDiaMM = cstr(CoreDiaMM) strCoreLenMM = cstr(CoreLenMM) strCoilLenMM = cstr(CoilLenMM) strWireDiaMM = cstr(WireDiaMM) strWireLenMtr = cstr(WireLenMtr) InError = 0 If CoreDiaMM <= 0 or CoreLenMM <= 0 or CoilLenMM <= 0 or WireDiaMM <= 0 or WireLenMtr <= 0 then InError = 1 else InError = 0 end if else strCoreDiaMM = "15" strCoreLenMM = "100" strCoilLenMM = "70" strWireDiaMM = "1" strWireLenMtr = "60" end if If request("calc") = "y" and InError = 0 then Layer = 0 Turns = 0 CalcWireLenMtr = 0 TurnsPerLayer = CoilLenMM / WireDiaMM do while CalcWireLenMtr < WireLenMtr Layer = Layer + 1 DiaIn = CoreDiaMM + ((layer - 1) * WireDiaMM * 2) CoilDiaMM = CoreDiaMM + (layer * WireDiaMM * 2) UsedPerWinding = DiaIn * 3.14 UsedWireThisLayer = UsedPerWinding * TurnsPerLayer + CoilLenMM Turns = Turns + TurnsPerLayer CalcWireLenMtr = CalcWireLenMtr + (UsedWireThisLayer/1000) loop leftCore = Cint((CoreLenMM - CoilLenMM) / 2) zoom = int(200 / CoilDiaMM) %>

Results for Coil Diameter Calculator

The shapes are scaled, not the sizes!
width=<%=leftCore * zoom%>> width=<%=CoilLenMM * zoom%>> width=<%=leftCore * zoom%>>
<% totPerc=0 Pattern=0 for i=1 to Layer Perc = CLng((100/Layer)*10000)/10000 totPerc = totPerc + Perc if i < layer then %> "> <%end if%> <% Pattern=Pattern + 1 if Pattern = 4 then Pattern = 1 select case Pattern case 1%> <%case 2%> <%case 3%> <%end select Rest = replace(cstr(cdbl(100 - TotPerc)),",",".") next%>

Number of layers:
Number of turns per layer:
Total number of turns:
Total used wire in meter:
Coil diameter in mm:
 

<% end if %>

Coil Diameter Calculator

Core diameter in mm: <%If strCoreDiaMM = "0" then%>*<%InError = 1%><%end if%>
Core length in mm: <%If strCoreLenMM = "0" then%>*<%InError = 1%><%end if%>
 
Coil length in mm: <%If strCoilLenMM = "0" then%>*<%InError = 1%><%end if%>
 
Wire diameter in mm: <%If strWireDiaMM = "0" then%>*<%InError = 1%><%end if%>
Wire length in meter: <%If strWireLenMtr = "0" then%>*<%InError = 1%><%end if%>
 
0>