User Tools

Site Tools


magnetic_coupling_factor_lua

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

magnetic_coupling_factor_lua [2021/09/17 20:22]
stanzurek created
magnetic_coupling_factor_lua [2021/11/04 22:45] (current)
stanzurek
Line 1: Line 1:
 ==== Magnetic coupling factor ==== ==== Magnetic coupling factor ====
-LUA script for calculating magnetic coupling coefficient between two windings. The windings have to be set up as described in the comments in the code below:+LUA script for calculating magnetic coupling coefficient between two windings. The windings have to be set up as described in the comments in the code below
 + 
 +| **Download the FEM+LUA files{{/examples/coupling_coefficient.zip}}** | 
 + 
  
 <code> <code>
Line 11: Line 15:
 clearconsole() clearconsole()
 showconsole() showconsole()
 +
 +-- mi_modifycircprop takes three parameters
 +-- 1st = circuit name to be changed, 2nd = 1 = change current value, 3rd = new current value (A)
 +-- change the curent value to your own, here it is assume that prim=0.01A, sec=10.0A
 +
 -- Simulate first with only secondary current: -- Simulate first with only secondary current:
-mi_modifycircprop("pri",1,0) +mi_modifycircprop("pri", 1, 0)    
-mi_modifycircprop("sec",1,1)+mi_modifycircprop("sec", 1, 10  -- change "10" to your own I2 in "sec"
 mi_analyze() mi_analyze()
 mi_loadsolution() mi_loadsolution()
 print(mo_getcircuitproperties("sec"))  -- Optional display of intermediate results print(mo_getcircuitproperties("sec"))  -- Optional display of intermediate results
 print(mo_getcircuitproperties("pri"))  -- Optional display of intermediate results print(mo_getcircuitproperties("pri"))  -- Optional display of intermediate results
-i, Vsec, Lsec = mo_getcircuitproperties("sec"+i, Vsec, Lsec = mo_getcircuitproperties("sec" -- extract inductance 
-i, Vpri_sec, Lpri_sec = mo_getcircuitproperties("pri")+i, Vpri_sec, Lpri_sec = mo_getcircuitproperties("pri") -- extract inductance 
 -- Simulate next with only primary current: -- Simulate next with only primary current:
-mi_modifycircprop("pri",1,1+mi_modifycircprop("pri", 1, 0.01  -- change "0.01" to your own I1 in "prim" 
-mi_modifycircprop("sec",1,0)+mi_modifycircprop("sec", 1, 0)
 mi_analyze() mi_analyze()
 mi_loadsolution() mi_loadsolution()
 print(mo_getcircuitproperties("sec"))  -- Optional display of intermediate results print(mo_getcircuitproperties("sec"))  -- Optional display of intermediate results
 print(mo_getcircuitproperties("pri"))  -- Optional display of intermediate results print(mo_getcircuitproperties("pri"))  -- Optional display of intermediate results
-i, Vsec_pri, Lsec_pri = mo_getcircuitproperties("sec"+i, Vsec_pri, Lsec_pri = mo_getcircuitproperties("sec"  -- extract inductance 
-i, Vpri, Lpri = mo_getcircuitproperties("pri")+i, Vpri, Lpri = mo_getcircuitproperties("pri"    -- extract inductance 
 -- Calculate and print coupling factor: -- Calculate and print coupling factor:
 coupling_factor = sqrt(Lsec_pri * Lpri_sec / (Lpri * Lsec)) coupling_factor = sqrt(Lsec_pri * Lpri_sec / (Lpri * Lsec))
magnetic_coupling_factor_lua.1631902945.txt.gz · Last modified: 2021/09/17 20:22 by stanzurek