FSL-Debugging

Skript-Datei

--------------------------------------------------------------------------------
-- Allgemeine Einstellungen ----------------------------------------------------
--------------------------------------------------------------------------------

exit_on_error = false   -- Verhalten nach Fehler
exit_on_end = true      -- Verhalten nach Skriptausführung
verbosity = 2           -- Grad der Bildschirmmeldungen

-------------------------------------------------------------------------------
-- Parameterdefinition --------------------------------------------------------
-------------------------------------------------------------------------------

Q = 12        -- Nutzahl
P = 10        -- Polzahl

Da = 100      -- Statoraußendurchmesser
Di = 55       -- Statorinnendurchmesser
s = 3         -- Nutschlitzbreite
ag = 1        -- Luftspaltweite
bz = 7        -- Zahnbreite
h1 = 1.5      -- Zahnkopfhöhe 1
h2 = 2        -- Zahnkopfhöhe 2
hj = 8        -- Jochhöhe
hrs = 6       -- Rückschlusshöhe
hm = 5        -- Magnethöhe
ls = 150      -- Paketlänge

Qm = Q/2      -- Nutzahl Modell
Pm = P/2      -- Polzahl Modell

urs = 1000    -- Permeabilität Stator
urr = 1000    -- Permeabilität PM-Rückschluss
Br = 1.2      -- Remanenz PM
urm = 1.05    -- Rel. Permeabilität PM

Nc = 100      -- Spulenwindungszahl

--------------------------------------------------------------------------------
-- Modellerstellung ------------------------------------------------------------
--------------------------------------------------------------------------------

new_model_force("example","PMSM IL OM, Debugging-Beispiel")

global_unit('mm')         -- Globale Einheit (m, cm, mm)
pickdist(0.001)           -- Abstand Schnappen auf Knotenpunkt
blow_up_wind(0,0,55,55)   -- Fenstergröße anpassen
cosys('cartes')

------------
-- Stator --
------------

-- Berechnung der Koordinaten

x = {}
y = {}
for i=1, 15 do
  x[i]=0
  y[i]=0
end

x[1],y[1] = pd2c(Da/2,0)
x[2],y[2] = pd2c(Da/2,180/Q)
x[3] = Di/2*math.cos(math.asin(s/Di))
y[3] = s/2
x[4] = x[3]+h1
y[4] = s/2
x[5],y[5] = pd2c(Di/2,180/Q)
x[6] = Di/2+h1+h2;
y[6] = y[5]/x[5]*x[6]-bz/2/math.cos(pi/Di)
x[7] = Da/2-hj;
y[7] = y[5]/x[5]*x[7]-bz/2/math.cos(pi/Di)
x[8] = x[7]
x[9],y[9] = pd2c(vlen(x[4],y[4]),180/Q)
x[10] = (y[6]+x[5]/y[5]*x[6])/(y[5]/x[5]+x[5]/y[5])
y[10] = y[5]/x[5]*x[10]
x[11] = (y[7]+x[5]/y[5]*x[7])/(y[5]/x[5]+x[5]/y[5])
y[11] = y[5]/x[5]*x[11]
x[12] = Di/2
x[13] = x[4]
x[14] = Di/2-ag/3
x[15],y[15] = pd2c(Di/2-ag/3,180/Q)

-- Knotenkettenerstellung

agnp = 1        -- Knotenteilung im Luftspalt
ndt(ag*2/3)

nc_circle(x[14],y[14],x[15],y[15],360/Q/2/agnp+1)
nc_circle(x[1],y[1],x[2],y[2],0)
nc_circle(x[13],y[13],x[4],y[4],0)
nc_circle(x[3],y[3],x[5],y[5],0)
nc_line(x[3],y[3],x[4],y[4],0)
nc_line_cont(x[6],y[6],0)
nc_line_cont(x[7],y[7],0)
nc_line_cont(x[8],y[8],0)
nc_line(x[12],y[12],x[13],y[13],0)
nc_line_cont(x[8],y[8],0)
nc_line_cont(x[1],y[1],0)
nc_line(x[14],y[14],x[12],y[12],0)
nc_line(x[15],y[15],x[5],y[5],0)
nc_line_cont(x[9],y[9],0)
nc_line_cont(x[10],y[10],0)
nc_line_cont(x[11],y[11],0)
nc_line_cont(x[2],y[2],0)
                                -- DEBUGGING
debug.fsl()                     -- Aktiviere Debugger

point(x[2],y[2],"red",".")      -- Ausgaben im Grafikfenster
text(x[2],y[2],"P2","red",1)
point(x[11],y[11],"red",".")
text(x[11],y[11],"P11","red",1)
line(x[11],y[11],x[2],y[2],"red")

-- Vernetzung

mesh.con1 = 0.1                 -- Vernetzungssteuerung

create_mesh_se(Da/2-hj/2,0+hj/2)
create_mesh_se((Da+Di)/4,s/4)
create_mesh_se(Di/2+h1/2,s/4)

-- Definition Subregionen

def_new_subreg(Da/2-hj/2,0+hj/2,"Stator",11)

-- Spiegeln und Kopieren

mirror_nodechains(x[2],y[2],x[15],y[15])

x0,y0 = pd2c(Di/2-ag/3,0)
x1,y1 = pd2c(Da/2,0)
x2,y2 = pd2c(Da/2,360/Q)
x3,y3 = pd2c(Di/2-ag/3,360/Q)
rotate_copy_nodechains(x0,y0,x1,y1,x2,y2,x3,y3,Qm-1)

-----------
-- Rotor --
-----------

-- Berechnung der Koordinaten

x[1],y[1] = pd2c(Di/2-ag*2/3,0)
x[2],y[2] = pd2c(Di/2-ag*2/3,360/P)
x[3],y[3] = pd2c(Di/2-ag,0)
x[4],y[4] = pd2c(Di/2-ag,360/P)
x[5],y[5] = pd2c(Di/2-ag-hm,0)
x[6],y[6] = pd2c(Di/2-ag-hm,360/P)
x[7],y[7] = pd2c(Di/2-ag-hm-hrs,0)
x[8],y[8] = pd2c(Di/2-ag-hm-hrs,360/P)

-- Knotenketten

nc_circle(x[1],y[1],x[2],y[2],360/P/agnp+1)
nc_circle(x[3],y[3],x[4],y[4],0)
nc_circle(x[5],y[5],x[6],y[6],0)
nc_circle(x[7],y[7],x[8],y[8],0)

                  -- DEBUGGING
sleep(3)          -- Warte für 3 Sekunden
set_break(157)    -- Setze Haltepunkt auf angegebene Zeile

nc_line(x[7],y[7],x[5],y[5],0)
nc_line_cont(x[3],y[3],0)
nc_line_cont(x[1],y[1],0)
nc_line(x[8],y[8],x[6],y[6],0)
nc_line_cont(x[4],y[4],0)
nc_line_cont(x[2],y[2],0)

-- Vernetzung

create_mesh_se(Di/2-ag*5/6,ag/3)
create_mesh_se(Di/2-ag-hm/2,ag)
create_mesh_se(Di/2-ag-hm-hrs/2,ag)

-- Definition Subregionen

def_new_subreg(Di/2-ag-hm-hrs/2,ag,"Rückschluss",11)

-- Spiegeln und Kopieren

rotate_copy_nodechains(x[7],y[7],x[1],y[1],x[2],y[2],x[8],y[8],Pm-1)

-- Luftspalt

x0,y0 = pd2c(Di/2-ag*2/3,0)
x1,y1 = pd2c(Di/2-ag/3,0)
nc_line(x0,y0,x1,y1,0)

x0,y0 = pd2c(Di/2-ag*2/3,360*Pm/P)
x1,y1 = pd2c(Di/2-ag/3,360*Pm/P)
nc_line(x0,y0,x1,y1,0)

                    -- DEBUGGING
set_break(here)     -- Setze Haltepunkt hier

create_mesh_se(Di/2-ag/2,ag)

---------------------
-- Randbedingungen --
---------------------

x0,y0 = pd2c(Di/2-ag-hm-hj,0)
x1,y1 = pd2c(Da/2,0)
x2,y2 = pd2c(Di/2-ag-hm-hj,360*Pm/P)
x3,y3 = pd2c(Da/2,360*Pm/P)

def_bcond_vpo(x1,y1,x3,y3,0)
def_bcond_vpo(x2,y2,x0,y0,0)
def_bcond(x3,y3,x2,y2,x0,y0,x1,y1,4)

----------------
-- Wicklungen --
----------------

tauq = 360/Q              -- Nutteilungswinkel
Rq = (Di/2+Da/2-hj)/2     -- mittlerer Nutradius

x,y = pd2c(Rq,tauq/4)
def_new_wdg(x,y,"cyan","Strang 1",Nc,0.0,wo)
x,y = pd2c(Rq,tauq-tauq/4)
add_to_wdg(x,y,wsamekey,wi,wser)
x,y = pd2c(Rq,tauq+tauq/4)
add_to_wdg(x,y,wsamekey,wi,wser)
x,y = pd2c(Rq,2*tauq-tauq/4)
add_to_wdg(x,y,wsamekey,wo,wser)

x,y = pd2c(Rq,2*tauq+tauq/4)
def_new_wdg(x,y,"magenta","Strang 2",Nc,0.0,wo)
x,y = pd2c(Rq,3*tauq-tauq/4)
add_to_wdg(x,y,wsamekey,wi,wser)
x,y = pd2c(Rq,3*tauq+tauq/4)
add_to_wdg(x,y,wsamekey,wi,wser)
x,y = pd2c(Rq,4*tauq-tauq/4)
add_to_wdg(x,y,wsamekey,wo,wser)

x,y = pd2c(Rq,4*tauq+tauq/4)
def_new_wdg(x,y,"yellow","Strang 3",Nc,0.0,wo)
x,y = pd2c(Rq,5*tauq-tauq/4)
add_to_wdg(x,y,wsamekey,wi,wser)
x,y = pd2c(Rq,5*tauq+tauq/4)
add_to_wdg(x,y,wsamekey,wi,wser)
x,y = pd2c(Rq,6*tauq-tauq/4)
add_to_wdg(x,y,wsamekey,wo,wser)

---------------------------
-- Materialeigenschaften --
---------------------------

-- Stator und PM-Rückschluss

def_mat_fm(Da/2-hj/2,ag,urs,100)
def_mat_fm(Di/2-ag-hm-hrs/2,ag,urr,100)

-- Permanentmagnete

for i=0, Pm/2 do
  x,y = pd2c(Di/2-ag-hm/2,360/P*(2*i+1)-180/P)
  def_mat_pm(x,y,"red",Br,urm,0,m.radial,100)
end
for i=1, Pm/2 do
  x,y = pd2c(Di/2-ag-hm/2,360/P*2*i-180/P)
  def_mat_pm(x,y,"green",Br,urm,180,m.radial,100)
end

--------------------------------------------------------------------------------
-- Berechnung ------------------------------------------------------------------
--------------------------------------------------------------------------------

calc_field_single(1,restored,0.01)

          -- DEBUGGING
stop()    -- Beende Skriptausführung vorzeitig

color_gradation(0,0,tot,Babs,0,2,"example_Babs.eps")
save_model('close')