Overunity.com Archives is Temporarily on Read Mode Only!



Free Energy will change the World - Free Energy will stop Climate Change - Free Energy will give us hope
and we will not surrender until free energy will be enabled all over the world, to power planes, cars, ships and trains.
Free energy will help the poor to become independent of needing expensive fuels.
So all in all Free energy will bring far more peace to the world than any other invention has already brought to the world.
Those beautiful words were written by Stefan Hartmann/Owner/Admin at overunity.com
Unfortunately now, Stefan Hartmann is very ill and He needs our help
Stefan wanted that I have all these massive data to get it back online
even being as ill as Stefan is, he transferred all databases and folders
that without his help, this Forum Archives would have never been published here
so, please, as the Webmaster and Creator of these Archives, I am asking that you help him
by making a donation on the Paypal Button above.
You can visit us or register at my main site at:
Overunity Machines Forum



LUA Script in FEMM 4.2 - please help!:-)

Started by Low-Q, September 08, 2016, 04:46:36 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Low-Q

Can I just copy the script twice in the same LUA?


I want both groups to rotate in the same script. I have tried just to add the script once more, under the first one, and changed group number, XY points etc, but got errors...


Vidar

broli

Since it's the same amount of steps just different increments you can keep it in the same for loop and try something like this (I highlighted the changes):

showconsole()
--Defining the variables
dAngle1=0.8    -- Increase of angle for group 1 ( Degrees of rotor rotation by step )
dAngle2=1.0    -- Increase of angle for group 2 ( Degrees of rotor rotation by step )
totalDegrees= 72 -- amount of total degrees to roate
X0 = 0
Y0 = 0


open("GE.FEM")
mi_saveas("GEtemp.FEM")    -- Temp file for save the original
mi_seteditmode("group")


data = {};
for n=0,((totalDegrees/dAngle1)-1) do
    alfa=dAngle1*n
    print(alfa) -- print to console for debugging and showing the progress
    --analyze the current rotation and take image
    mi_analyse(1)
    mi_loadsolution()
    mo_showdensityplot(0,0,0.5,0,"mag")        -- Obtain Image
    mo_savebitmap(format("acgen_%1$d.bmp",alfa))  -- Save Image
    --Calculate the torque
    mi_analyse(1)
    mi_loadsolution()
    mo_groupselectblock(1)
    torque = mo_blockintegral(22)
   
    --gather all data
    data[n] = {}
    data[n][1] = alfa
    data[n][2] = torque
    mo_close()
   
    -- write results to disk for further analysis, make sure the file already exist to write the results to
    fp=openfile("results.txt","a")
    write(fp,data[n][1],"\t" .. data[n][2],"\n")
    closefile(fp);
    -- rotate group 1
    mi_selectgroup(1)            -- Select Rotor group 1
    mi_move_rotate(X0,Y0,dAngle1)        -- Rotate the rotor
    -- rotate group 2
    mi_selectgroup(2)            -- Select Rotor group 2
    mi_move_rotate(X0,Y0,dAngle2)        -- Rotate the rotor

end

Low-Q

Thanks again broli! This is really helpful :D


Can I put in additional line:
X1 = 0
Y1 = -1


and change:
mi_move_rotate(X0,Y0,dAngle2) to mi_move_rotate(X1,Y1,dAngle2)?


If I want to rotate group 2 90 degrees instead, can I add:
dAngle1=0.8    -- Increase of angle for group 1 ( Degrees of rotor rotation by step )
dAngle2=1.0    -- Increase of angle for group 2 ( Degrees of rotor rotation by step )
totalDegrees= 72 -- amount of total degrees to roate
totalDegrees= 90 -- amount of total degrees to roate???[/size]


Vidar

Low-Q

Ofcourse - when outer rotor turns 72 degrees the inner rotor turns 90 by itself. Didn't think of that.


Now it all works as I want it to. Thank you!!!!!


Vidar

Apoc4lypse

I know this is an old topic, but I don't know where else to ask really. I searched around google to find this script, I'm using femm 4.2 and am also trying to get femm to rotate a couple groups of objects and output the torque values, or at least output the .ans files so I can just go look at the torque myself. Rotating everything the few degrees I need and analyzing each individually until I get to 360 takes forever.

I tried the script above but keep getting

"error: No current magnetics input in focus"
stack traceback:

1: function 'mi_saveas' [C]
2: main of string "'showconsole()..." at line 10

Yes I also made a boundary around everything and I can analyze it normally with no problems.
Yes I also gave a group value to the group I want to rotate that is the same as the group value specified in the script.

Also, in the file names, where are the files supposed to be placed? Where does FEMM end up looking for them? What folder? The installed folder? what if I installed it in a different location should I specify the entire path?