Board Thread:Support Requests - Getting Technical/@comment-84.64.159.204-20200513111600

Hi everyone,

I'm relatively new to lua and  the FEMM software. I have defined a problem that is two coils, they are assgined to different groups, and I vary the current in each of them by nested loops. Then after I get FEMM to analyse the problem I define a square I wish to record the flux denisty in and do so appending to a file.

My problem is that I get an error of 'nill' value. I know this shouldn't happen because I've done the same anlsyes on a fixed current system that I set up manuallly. Would anyone be able to spot where I've gone wrong.

The code is as follows

NumberOfCoilCurrents = 100 DeltaCurrent = 0.1 FirstCoilCurrent = -5

-- loop on the first coil for Icurrent=1,NumberOfCoilCurrents do G2Current=FirstCoilCurrent+((Icurrent-1)*DeltaCurrent) mi_clearselected mi_selectgroup(2) mi_modifycircprop('Coil',1,G2Current) -- loop on the second coil for Icurrent=1,NumberOfCoilCurrents do     G1Current=FirstCoilCurrent+((Icurrent-1)*DeltaCurrent) mi_clearselected mi_selectgroup(1) mi_modifycircprop('Coil',1,G1Current) -- get FEMM to anaylse mi_analyze -- define desired square x1=0 x2=1 dx=0.001 y1=0 y2=1 dy=0.001 ni = (x2-x1)/dx+2 nj = (y2-y1)/dy+2 handle=openfile("B.txt","a+") -- record flux density at each each point of my desired square for j=0,nj-1,1 do       for i=0,ni-1,1 do       x=x1+i*dx y=y1+j*dy B1,B2=mo_getpointvalues(x,y) write(handle,B1,",",B2,"\n") end end end end closefile(handle)  