Skip to content
Snippets Groups Projects
Commit 0701f73c authored by Maxime Graulich's avatar Maxime Graulich
Browse files

Add Android project

parent a2e508fa
Branches
Tags
No related merge requests found
Showing
with 1587 additions and 0 deletions
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.geuz.onelab"
android:versionCode="1"
android:versionName="1.0" >
<uses-feature android:glEsVersion="0x00010000" android:required="true"></uses-feature>
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" android:logo="@drawable/ic_launcher">
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="*" android:host="*" android:pathPattern=".*\\.geo" android:mimeType="text/plain" />
</intent-filter>
</activity>
</application>
</manifest>
\ No newline at end of file
contrib/mobile/Android/res/drawable-hdpi/ic_action_search.png

555 B

contrib/mobile/Android/res/drawable-hdpi/ic_launcher.png

865 B

contrib/mobile/Android/res/drawable-hdpi/ic_list.png

464 B

contrib/mobile/Android/res/drawable-hdpi/ic_mesh.png

760 B

contrib/mobile/Android/res/drawable-hdpi/ic_settings.png

1.38 KiB

contrib/mobile/Android/res/drawable-ldpi/ic_launcher.png

384 B

contrib/mobile/Android/res/drawable-mdpi/ic_action_search.png

2.96 KiB

contrib/mobile/Android/res/drawable-mdpi/ic_launcher.png

614 B

contrib/mobile/Android/res/drawable-mdpi/model.png

1.09 KiB

contrib/mobile/Android/res/drawable-mdpi/param.png

3.29 KiB

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/list_header_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="2dip"
android:paddingBottom="2dip"
android:paddingLeft="5dip"
style="?android:attr/listSeparatorTextViewStyle"
>
</TextView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<ImageView
android:id="@+id/icone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="icone"
android:src="@drawable/ic_launcher" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/titre"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#ffffff" />
<TextView
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ffffff" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
Function{
// nu = 100. + 10. * exp ( 1.8 * b * b )
// analytical
nu_1a[] = 100. + 10. * Exp[1.8*SquNorm[$1]] ;
dnudb2_1a[] = 18. * Exp[1.8*SquNorm[$1]] ;
h_1a[] = nu_1a[$1]*$1 ;
dhdb_1a[] = TensorDiag[1,1,1] * nu_1a[$1#1] + 2*dnudb2_1a[#1] * SquDyadicProduct[#1] ;
dhdb_1a_NL[] = 2*dnudb2_1a[$1] * SquDyadicProduct[$1] ;
// interpolated
Mat1_h = {
0.0000e+00, 5.5023e+00, 1.1018e+01, 1.6562e+01, 2.2149e+01, 2.7798e+01, 3.3528e+01,
3.9363e+01, 4.5335e+01, 5.1479e+01, 5.7842e+01, 6.4481e+01, 7.1470e+01, 7.8906e+01,
8.6910e+01, 9.5644e+01, 1.0532e+02, 1.1620e+02, 1.2868e+02, 1.4322e+02, 1.6050e+02,
1.8139e+02, 2.0711e+02, 2.3932e+02, 2.8028e+02, 3.3314e+02, 4.0231e+02, 4.9395e+02,
6.1678e+02, 7.8320e+02, 1.0110e+03, 1.3257e+03, 1.7645e+03, 2.3819e+03, 3.2578e+03,
4.5110e+03, 6.3187e+03, 8.9478e+03, 1.2802e+04, 1.8500e+04, 2.6989e+04, 3.9739e+04,
5.9047e+04, 8.8520e+04, 1.3388e+05, 2.0425e+05, 3.1434e+05, 4.8796e+05, 7.6403e+05
} ;
Mat1_b = {
0.0000e+00, 5.0000e-02, 1.0000e-01, 1.5000e-01, 2.0000e-01, 2.5000e-01, 3.0000e-01,
3.5000e-01, 4.0000e-01, 4.5000e-01, 5.0000e-01, 5.5000e-01, 6.0000e-01, 6.5000e-01,
7.0000e-01, 7.5000e-01, 8.0000e-01, 8.5000e-01, 9.0000e-01, 9.5000e-01, 1.0000e+00,
1.0500e+00, 1.1000e+00, 1.1500e+00, 1.2000e+00, 1.2500e+00, 1.3000e+00, 1.3500e+00,
1.4000e+00, 1.4500e+00, 1.5000e+00, 1.5500e+00, 1.6000e+00, 1.6500e+00, 1.7000e+00,
1.7500e+00, 1.8000e+00, 1.8500e+00, 1.9000e+00, 1.9500e+00, 2.0000e+00, 2.0500e+00,
2.1000e+00, 2.1500e+00, 2.2000e+00, 2.2500e+00, 2.3000e+00, 2.3500e+00, 2.4000e+00
} ;
Mat1_b2 = {
0.0000e+00, 2.5000e-03, 1.0000e-02, 2.2500e-02, 4.0000e-02, 6.2500e-02, 9.0000e-02,
1.2250e-01, 1.6000e-01, 2.0250e-01, 2.5000e-01, 3.0250e-01, 3.6000e-01, 4.2250e-01,
4.9000e-01, 5.6250e-01, 6.4000e-01, 7.2250e-01, 8.1000e-01, 9.0250e-01, 1.0000e+00,
1.1025e+00, 1.2100e+00, 1.3225e+00, 1.4400e+00, 1.5625e+00, 1.6900e+00, 1.8225e+00,
1.9600e+00, 2.1025e+00, 2.2500e+00, 2.4025e+00, 2.5600e+00, 2.7225e+00, 2.8900e+00,
3.0625e+00, 3.2400e+00, 3.4225e+00, 3.6100e+00, 3.8025e+00, 4.0000e+00, 4.2025e+00,
4.4100e+00, 4.6225e+00, 4.8400e+00, 5.0625e+00, 5.2900e+00, 5.5225e+00, 5.7600e+00
} ;
Mat1_nu = {
1.1005e+02, 1.1005e+02, 1.1018e+02, 1.1041e+02, 1.1075e+02, 1.1119e+02, 1.1176e+02,
1.1247e+02, 1.1334e+02, 1.1440e+02, 1.1568e+02, 1.1724e+02, 1.1912e+02, 1.2139e+02,
1.2416e+02, 1.2752e+02, 1.3165e+02, 1.3671e+02, 1.4297e+02, 1.5076e+02, 1.6050e+02,
1.7275e+02, 1.8829e+02, 2.0810e+02, 2.3356e+02, 2.6651e+02, 3.0947e+02, 3.6589e+02,
4.4056e+02, 5.4014e+02, 6.7397e+02, 8.5528e+02, 1.1028e+03, 1.4436e+03, 1.9164e+03,
2.5777e+03, 3.5104e+03, 4.8366e+03, 6.7381e+03, 9.4870e+03, 1.3494e+04, 1.9385e+04,
2.8118e+04, 4.1172e+04, 6.0854e+04, 9.0779e+04, 1.3667e+05, 2.0764e+05, 3.1835e+05
} ;
Mat1_nu_b2 = ListAlt[Mat1_b2, Mat1_nu] ;
nu_1[] = InterpolationLinear[$1]{List[Mat1_nu_b2]} ;
dnudb2_1[] = dInterpolationLinear[$1]{List[Mat1_nu_b2]} ;
h_1[] = nu_1[(SquNorm[$1])] * $1 ;
dhdb_1[] = TensorDiag[1,1,1] * nu_1[SquNorm[$1]#1] + 2*dnudb2_1[#1] * SquDyadicProduct[$1] ;
}
Group {
DefineGroup[ DomainM, DomainB, DomainS ];
DefineGroup[ DomainL, DomainNL, Dummy ];
DefineGroup[ Rotor_Inds, Rotor_IndsP, Rotor_IndsN, Rotor_Magnets, Rotor_Bars ];
DefineGroup[ Surf_bn0, Rotor_Bnd_MBaux] ;
DefineGroup[ Resistance_Cir, Inductance_Cir, Capacitance_Cir, DomainZt_Cir, DomainSource_Cir ];
}
Function{
DefineConstant[ Flag_Cir, Flag_NL, Flag_ParkTransformation ];
DefineConstant[ Term_vxb ];
DefineConstant[ AxialLength = {1, Visible 0},
FillFactor_Winding = {1, Visible 0},
Factor_R_3DEffects = {1, Visible 0},
SymmetryFactor = {1, Visible 0} ];
Flag_Symmetry = (SymmetryFactor==1) ? 0 : 1 ;
DefineConstant[ Nb_max_iter = {20, Visible 0},
relaxation_factor = {1, Visible 0},
stop_criterion = {1e-5, Visible 0},
reltol = {1e-7, Visible 0},
abstol = {1e-5, Visible 0} ];
DefineConstant[ II, VV, pA, pB, pC, Ie, ID, IQ, I0 ];
DefineFunction[ br, js, Resistance, Inductance, Capacitance ];
DefineFunction[ Theta_Park, Theta_Park_deg, RotorPosition, RotorPosition_deg ] ;
DefineConstant[ Flag_SrcType_Rotor = {0, Visible 0} ];
DefineConstant[ Clean_Results = { 1, Choices {0,1},
Label "Remove previous result files",
Path "Input/1", Visible 1 } ] ;
DefineConstant[ Flag_SaveAllSteps = {0, Label "Save all time steps",
Path "Input/0", Choices {0,1}} ];
DefineConstant[ my_output={"Output/40T_rotor", Visible 0}];
}
Include "bh.pro"; // nonlinear BH caracteristic of magnetic material
Group {
Inds = Region[ {Stator_Inds, Rotor_Inds} ] ;
DomainB = Region[ {Inds} ] ;
DomainM = Region[ {Rotor_Magnets} ] ;
Stator = Region[{ StatorC, StatorCC }] ;
Rotor = Region[{ RotorC, RotorCC }] ;
Rotor_Moving = Region[{ Rotor, Rotor_Air, Rotor_Airgap, Rotor_Inds, Rotor_Bnd_MBaux} ] ; // Use in ChangeOfCoordinates
MB = MovingBand2D[ MovingBand_PhysicalNb, Stator_Bnd_MB, Rotor_Bnd_MB, SymmetryFactor] ;
Air = Region[{ Rotor_Air, Rotor_Airgap, Stator_Air, Stator_Airgap, MB } ] ;
Inds = Region[{ Rotor_Inds, Stator_Inds } ] ;
DomainV = Region[{}]; // Speed considered either with term v/\b
If(Term_vxb) // or not dynamics in time domain + mechanics
DomainV = Region[{ RotorC }];
EndIf
DomainCC = Region[{ Air, Inds, StatorCC, RotorCC }];
DomainC = Region[{ StatorC, RotorC }];
Domain = Region[{ DomainCC, DomainC }] ;
If(Flag_NL)
DomainNL = Region[ {Stator_Fe, Rotor_Fe } ];
DomainL = Region[ {Domain,-DomainNL} ];
EndIf
DomainKin = #1234 ; // Dummy region number for mechanical equation
DomainDummy = #12345 ; // Dummy region number for mechanical equation
}
Function {
mu0 = 4.e-7 * Pi ;
sigma_al = 3.72e7 ; // conductivity of aluminum [S/m]
sigma_cu = 5.9e7 ; // conductivity of copper [S/m]
nu [#{Air, Inds, Stator_Al, Rotor_Al, Stator_Cu, Rotor_Cu, Rotor_Magnets, Rotor_Bars}] = 1. / mu0 ;
If(!Flag_NL)
nu [#{Stator_Fe, Rotor_Fe }] = 1 / (mur_fe * mu0) ;
EndIf
If(Flag_NL)
nu [#{Stator_Fe, Rotor_Fe }] = nu_1a[$1] ;
EndIf
dhdb_NL [ DomainNL ] = dhdb_1a_NL[$1];
sigma[#{Rotor_Fe}] = sigma_fe ;
sigma[#{Rotor_Al, Stator_Al}] = sigma_al ;
sigma[#{Rotor_Cu, Stator_Cu}] = sigma_cu ;
sigma[#{Inds}] = sigma_cu ;
rho[] = 1/sigma[] ;
Rb[] = Factor_R_3DEffects*AxialLength*FillFactor_Winding*NbWires[]^2/SurfCoil[]/sigma[] ;
Resistance[#{Stator_Inds, Rotor_Inds}] = Rb[] ;
T = 1/Freq ; // Fundamental period in s
Idir[#{Stator_IndsP, Rotor_IndsP}] = 1 ;
Idir[#{Stator_IndsN, Rotor_IndsN}] = -1 ;
// Functions for Park transformation
Idq0[] = Vector[ ID, IQ, I0 ] ;
Pinv[] = Tensor[ Sin[Theta_Park[]], Cos[Theta_Park[]], 1,
Sin[Theta_Park[]-2*Pi/3], Cos[Theta_Park[]-2*Pi/3], 1,
Sin[Theta_Park[]+2*Pi/3], Cos[Theta_Park[]+2*Pi/3], 1 ];
P[] = 2/3 * Tensor[ Sin[Theta_Park[]], Sin[Theta_Park[]-2*Pi/3], Sin[Theta_Park[]+2*Pi/3],
Cos[Theta_Park[]], Cos[Theta_Park[]-2*Pi/3], Cos[Theta_Park[]+2*Pi/3],
1/2, 1/2, 1/2 ] ;
Iabc[] = Pinv[] * Idq0[] ;
Flux_dq0[] = P[] * Vector[#11, #22, #33] ;
If(Flag_ParkTransformation)
II = 1 ;
IA[] = CompX[ Iabc[] ] ;
IB[] = CompY[ Iabc[] ] ;
IC[] = CompZ[ Iabc[] ] ;
EndIf
If(!Flag_ParkTransformation)
IA[] = F_Sin_wt_p[]{2*Pi*Freq, pA} ;
IB[] = F_Sin_wt_p[]{2*Pi*Freq, pB} ;
IC[] = F_Sin_wt_p[]{2*Pi*Freq, pC} ;
js[PhaseA] = II * NbWires[]/SurfCoil[] * IA[] * Idir[] * Vector[0, 0, 1] ;
js[PhaseB] = II * NbWires[]/SurfCoil[] * IB[] * Idir[] * Vector[0, 0, 1] ;
js[PhaseC] = II * NbWires[]/SurfCoil[] * IC[] * Idir[] * Vector[0, 0, 1] ;
EndIf
Velocity[] = wr*XYZ[]/\Vector[0,0,1] ;
// Maxwell stress tensor
T_max[] = ( SquDyadicProduct[$1] - SquNorm[$1] * TensorDiag[0.5, 0.5, 0.5] ) / mu0 ;
T_max_cplx[] = ( TensorV[CompX[$1]*Conj[$1],CompY[$1]*Conj[$1],CompZ[$1]*Conj[$1]] - $1*Conj[$1] * TensorDiag[0.5, 0.5, 0.5] ) / mu0 ; // Check if valid
AngularPosition[] = (Atan2[$Y,$X]#7 >= 0.)? #7 : #7+2*Pi ;
RotatePZ[] = Rotate[ Vector[$X,$Y,$Z], 0, 0, $1 ] ;//Watch out: Do not use XYZ[]!
// Kinematics
Inertia = 8.3e-3 ; //87
Friction[] = 0 ;
Fmag[] = #55 ; // Computed in postprocessing
}
//-------------------------------------------------------------------------------------
Jacobian {
{ Name Vol; Case { { Region All ; Jacobian Vol; } } }
}
Integration {
{ Name I1 ; Case {
{ Type Gauss ;
Case {
{ GeoElement Triangle ; NumberOfPoints 6 ; }
{ GeoElement Quadrangle ; NumberOfPoints 4 ; }
{ GeoElement Line ; NumberOfPoints 13 ; }
}
}
}
}
}
//-------------------------------------------------------------------------------------
Constraint {
{ Name MVP_2D ;
Case {
{ Region Surf_Inf ; Type Assign; Value 0. ; }
{ Region Surf_bn0 ; Type Assign; Value 0. ; }
If(Flag_Symmetry)
{ Region Surf_cutA1; SubRegion Region[{Surf_Inf,Surf_bn0}]; Type Link;
RegionRef Surf_cutA0; SubRegionRef Region[{Surf_Inf,Surf_bn0}];
Coefficient (NbrPoles%2)?-1:1 ; Function RotatePZ[-NbrPoles*2*Pi/NbrPolesTot]; }
{ Region Surf_cutA1; Type Link; RegionRef Surf_cutA0;
Coefficient (NbrPoles%2)?-1:1 ; Function RotatePZ[-NbrPoles*2*Pi/NbrPolesTot]; }
//For the moving band
For k In {1:SymmetryFactor-1}
{ Region Rotor_Bnd_MB~{k+1} ; SubRegion Rotor_Bnd_MB~{(k!=SymmetryFactor-1)?k+2:1}; Type Link;
RegionRef Rotor_Bnd_MB_1; SubRegionRef Rotor_Bnd_MB_2;
Coefficient ((NbrPoles%2)?-1:1)^(k); Function RotatePZ[-k*NbrPoles*2*Pi/NbrPolesTot]; }
EndFor
EndIf
}
}
{ Name Current_2D ;
Case {
If(Flag_SrcType_Stator==1)
{ Region PhaseA ; Value II*Idir[] ; TimeFunction IA[]; }
{ Region PhaseB ; Value II*Idir[] ; TimeFunction IB[]; }
{ Region PhaseC ; Value II*Idir[] ; TimeFunction IC[]; }
EndIf
If(Flag_SrcType_Rotor==1)
{ Region Rotor_Inds ; Value Ie*Idir[] ; }
EndIf
}
}
{ Name Voltage_2D ;
Case {
{ Region RotorC ; Value 0. ; } // Not needed if Global equation not in formulation
{ Region StatorC ; Value 0. ; } // Not needed if Global equation not in formulation
}
}
{ Name Current_Cir ;
Case {
If(Flag_Cir && Flag_SrcType_Stator==1)
{ Region Input1 ; Value II ; TimeFunction IA[]; }
{ Region Input2 ; Value II ; TimeFunction IB[]; }
{ Region Input3 ; Value II ; TimeFunction IC[]; }
EndIf
}
}
{ Name Voltage_Cir ; // Example induction machine
Case {
If(Flag_Cir && Flag_SrcType_Stator==2 && !Flag_NL)
{ Region Input1 ; Value VV ; TimeFunction IA[]; }
{ Region Input2 ; Value VV ; TimeFunction IB[]; }
{ Region Input3 ; Value VV ; TimeFunction IC[]; }
EndIf
If(Flag_Cir && Flag_SrcType_Stator==2 && Flag_NL)
{ Region Input1 ; Value VV ; TimeFunction IA[]*Frelax[]; }
{ Region Input2 ; Value VV ; TimeFunction IB[]*Frelax[]; }
{ Region Input3 ; Value VV ; TimeFunction IC[]*Frelax[]; }
EndIf
}
}
//Kinetics
{ Name CurrentPosition ;
Case {
{ Region DomainKin ; Type Init ; Value 0.#66 ; }
}
}
{ Name CurrentVelocity ;
Case {
{ Region DomainKin ; Type Init ; Value wr ; } // wr in [0,1200] rad/s
}
}
}
//-----------------------------------------------------------------------------------------------
FunctionSpace {
{ Name Hcurl_a_2D ; Type Form1P ;
BasisFunction {
{ Name se1 ; NameOfCoef ae1 ; Function BF_PerpendicularEdge ;
Support Region[{ Domain, Rotor_Bnd_MBaux }] ; Entity NodesOf [ All ] ; }
}
Constraint {
{ NameOfCoef ae1 ; EntityType NodesOf ; NameOfConstraint MVP_2D ; }
}
}
// Gradient of Electric scalar potential (2D)
{ Name Hregion_u_Mag_2D ; Type Form1P ;
BasisFunction {
{ Name sr ; NameOfCoef ur ; Function BF_RegionZ ;
Support DomainC ; Entity DomainC ; }
}
GlobalQuantity {
{ Name U ; Type AliasOf ; NameOfCoef ur ; }
{ Name I ; Type AssociatedWith ; NameOfCoef ur ; }
}
Constraint {
{ NameOfCoef U ; EntityType GroupsOfNodesOf ; NameOfConstraint Voltage_2D ; }
{ NameOfCoef I ; EntityType GroupsOfNodesOf ; NameOfConstraint Current_2D ; }
}
}
{ Name Hregion_i_Mag_2D ; Type Vector ;
BasisFunction {
{ Name sr ; NameOfCoef ir ; Function BF_RegionZ ;
Support DomainB ; Entity DomainB ; }
}
GlobalQuantity {
{ Name Ib ; Type AliasOf ; NameOfCoef ir ; }
{ Name Ub ; Type AssociatedWith ; NameOfCoef ir ; }
}
Constraint {
{ NameOfCoef Ub ; EntityType Region ; NameOfConstraint Voltage_2D ; }
{ NameOfCoef Ib ; EntityType Region ; NameOfConstraint Current_2D ; }
}
}
{ Name Hregion_Z ; Type Scalar ; // Circuit equations
BasisFunction {
{ Name sr ; NameOfCoef ir ; Function BF_Region ;
Support DomainZt_Cir ; Entity DomainZt_Cir ; }
}
GlobalQuantity {
{ Name Iz ; Type AliasOf ; NameOfCoef ir ; }
{ Name Uz ; Type AssociatedWith ; NameOfCoef ir ; }
}
Constraint {
{ NameOfCoef Uz ; EntityType Region ; NameOfConstraint Voltage_Cir ; }
{ NameOfCoef Iz ; EntityType Region ; NameOfConstraint Current_Cir ; }
}
}
// For use in Mechanical equation
{ Name Position ; Type Scalar ;
BasisFunction {
{ Name sr ; NameOfCoef ir ; Function BF_Region ;
Support DomainKin ; Entity DomainKin ; }
}
GlobalQuantity {
{ Name P ; Type AliasOf ; NameOfCoef ir ; }
}
Constraint {
{ NameOfCoef P ; EntityType Region ; NameOfConstraint CurrentPosition ; }
}
}
{ Name Velocity ; Type Scalar ;
BasisFunction {
{ Name sr ; NameOfCoef ir ; Function BF_Region ;
Support DomainKin ; Entity DomainKin ; } }
GlobalQuantity {
{ Name V ; Type AliasOf ; NameOfCoef ir ; }
}
Constraint {
{ NameOfCoef V ; EntityType Region ; NameOfConstraint CurrentVelocity ; }
}
}
}
//-----------------------------------------------------------------------------------------------
Formulation {
{ Name MagSta_a_2D ; Type FemEquation ;
Quantity {
{ Name a ; Type Local ; NameOfSpace Hcurl_a_2D ; }
{ Name ir ; Type Local ; NameOfSpace Hregion_i_Mag_2D ; }
{ Name Ub ; Type Global ; NameOfSpace Hregion_i_Mag_2D [Ub] ; }
{ Name Ib ; Type Global ; NameOfSpace Hregion_i_Mag_2D [Ib] ; }
{ Name Uz ; Type Global ; NameOfSpace Hregion_Z [Uz] ; }
{ Name Iz ; Type Global ; NameOfSpace Hregion_Z [Iz] ; }
}
Equation {
Galerkin { [ nu[{d a}] * Dof{d a} , {d a} ] ;
In Domain ; Jacobian Vol ; Integration I1 ; }
Galerkin { JacNL [ dhdb_NL[{d a}] * Dof{d a} , {d a} ] ;
In DomainNL ; Jacobian Vol ; Integration I1 ; }
Galerkin { [ 0*Dof{d a} , {d a} ] ; // DO NOT REMOVE!!! - Keeping track of Dofs in auxiliary line of MB if Symmetry=1
In Rotor_Bnd_MBaux; Jacobian Vol; Integration I1; }
Galerkin { [ -nu[] * br[] , {d a} ] ;
In DomainM ; Jacobian Vol ; Integration I1 ; }
Galerkin { [ -js[] , {a} ] ;
In DomainS ; Jacobian Vol ; Integration I1 ; }
Galerkin { [ -NbWires[]/SurfCoil[] * Dof{ir} , {a} ] ;
In DomainB ; Jacobian Vol ; Integration I1 ; }
Galerkin { DtDof [ AxialLength * NbWires[]/SurfCoil[] * Dof{a} , {ir} ] ;
In DomainB ; Jacobian Vol ; Integration I1 ; }
GlobalTerm { [ Dof{Ub}/SymmetryFactor, {Ib} ] ; In DomainB ; }
Galerkin { [ Rb[]/SurfCoil[]* Dof{ir} , {ir} ] ;
In DomainB ; Jacobian Vol ; Integration I1 ; }
// GlobalTerm { [ Resistance[] * Dof{Ib} , {Ib} ] ; In DomainB ; }
// The above term can replace:
// Galerkin{ [ NbWires[]/SurfCoil[] / sigma[] * NbWires[]/SurfCoil[] * Dof{ir}, {ir} ]
// if we have an estimation of the resistance of DomainB, via e.g. measurements
If(Flag_Cir)
GlobalTerm { NeverDt[ Dof{Uz} , {Iz} ] ; In Resistance_Cir ; }
GlobalTerm { NeverDt[ Resistance[] * Dof{Iz} , {Iz} ] ; In Resistance_Cir ; }
GlobalTerm { [ 0. * Dof{Iz} , {Iz} ] ; In DomainSource_Cir ; }
GlobalTerm { [ 0. * Dof{Uz} , {Iz} ] ; In DomainZt_Cir ; }
GlobalEquation {
Type Network ; NameOfConstraint ElectricalCircuit ;
{ Node {Iz}; Loop {Uz}; Equation {Uz}; In DomainZt_Cir ; }
{ Node {Ib}; Loop {Ub}; Equation {Ub}; In DomainB ; }
}
EndIf
}
}
{ Name MagDyn_a_2D ; Type FemEquation ;
Quantity {
{ Name a ; Type Local ; NameOfSpace Hcurl_a_2D ; }
{ Name ur ; Type Local ; NameOfSpace Hregion_u_Mag_2D ; }
{ Name I ; Type Global ; NameOfSpace Hregion_u_Mag_2D [I] ; }
{ Name U ; Type Global ; NameOfSpace Hregion_u_Mag_2D [U] ; }
{ Name ir ; Type Local ; NameOfSpace Hregion_i_Mag_2D ; }
{ Name Ub ; Type Global ; NameOfSpace Hregion_i_Mag_2D [Ub] ; }
{ Name Ib ; Type Global ; NameOfSpace Hregion_i_Mag_2D [Ib] ; }
{ Name Uz ; Type Global ; NameOfSpace Hregion_Z [Uz] ; }
{ Name Iz ; Type Global ; NameOfSpace Hregion_Z [Iz] ; }
}
Equation {
Galerkin { [ nu[{d a}] * Dof{d a} , {d a} ] ;
In Domain ; Jacobian Vol ; Integration I1 ; }
Galerkin { JacNL [ dhdb_NL[{d a}] * Dof{d a} , {d a} ] ;
In DomainNL ; Jacobian Vol ; Integration I1 ; }
Galerkin { [ 0*Dof{d a} , {d a} ] ; // DO NOT REMOVE!!! - Keeping track of Dofs in auxiliary line of MB if Symmetry=1
In Rotor_Bnd_MBaux; Jacobian Vol; Integration I1; }
Galerkin { [ -nu[] * br[] , {d a} ] ;
In DomainM ; Jacobian Vol ; Integration I1 ; }
Galerkin { DtDof[ sigma[] * Dof{a} , {a} ] ;
In DomainC ; Jacobian Vol ; Integration I1 ; }
Galerkin { [ sigma[] * Dof{ur}, {a} ] ;
In DomainC ; Jacobian Vol ; Integration I1 ; }
Galerkin { [ -sigma[] * (Velocity[] *^ Dof{d a}) , {a} ] ;
In DomainV ; Jacobian Vol ; Integration I1 ; }
Galerkin { [ -js[] , {a} ] ;
In DomainS ; Jacobian Vol ; Integration I1 ; }
Galerkin { DtDof[ sigma[] * Dof{a} , {ur} ] ;
In DomainC ; Jacobian Vol ; Integration I1 ; }
Galerkin { [ sigma[] * Dof{ur} , {ur} ] ;
In DomainC ; Jacobian Vol ; Integration I1 ; }
GlobalTerm { [ Dof{I} , {U} ] ; In DomainC ; }
Galerkin { [ -NbWires[]/SurfCoil[] * Dof{ir} , {a} ] ;
In DomainB ; Jacobian Vol ; Integration I1 ; }
Galerkin { DtDof [ AxialLength * NbWires[]/SurfCoil[] * Dof{a} , {ir} ] ;
In DomainB ; Jacobian Vol ; Integration I1 ; }
GlobalTerm { [ Dof{Ub}/SymmetryFactor , {Ib} ] ; In DomainB ; }
Galerkin { [ Rb[]/SurfCoil[]* Dof{ir} , {ir} ] ;
In DomainB ; Jacobian Vol ; Integration I1 ; } // Resistance term
// GlobalTerm { [ Resistance[] * Dof{Ib} , {Ib} ] ; In DomainB ; }
// The above term can replace the resistance term:
// if we have an estimation of the resistance of DomainB, via e.g. measurements
// which is better to account for the end windings...
If(Flag_Cir)
GlobalTerm { NeverDt[ Dof{Uz} , {Iz} ] ; In Resistance_Cir ; }
GlobalTerm { NeverDt[ Resistance[] * Dof{Iz} , {Iz} ] ; In Resistance_Cir ; }
GlobalTerm { [ Dof{Uz} , {Iz} ] ; In Inductance_Cir ; }
GlobalTerm { DtDof [ Inductance[] * Dof{Iz} , {Iz} ] ; In Inductance_Cir ; }
GlobalTerm { NeverDt[ Dof{Iz} , {Iz} ] ; In Capacitance_Cir ; }
GlobalTerm { DtDof [ Capacitance[] * Dof{Uz} , {Iz} ] ; In Capacitance_Cir ; }
GlobalTerm { [ 0. * Dof{Iz} , {Iz} ] ; In DomainZt_Cir ; }
GlobalTerm { [ 0. * Dof{Uz} , {Iz} ] ; In DomainZt_Cir ; }
GlobalEquation {
Type Network ; NameOfConstraint ElectricalCircuit ;
{ Node {I}; Loop {U}; Equation {I}; In DomainC ; }
{ Node {Ib}; Loop {Ub}; Equation {Ub}; In DomainB ; }
{ Node {Iz}; Loop {Uz}; Equation {Uz}; In DomainZt_Cir ; }
}
EndIf
}
}
//--------------------------------------------------------------------------
// Mechanics
//--------------------------------------------------------------------------
{ Name Mechanical ; Type FemEquation ;
Quantity {
{ Name V ; Type Global ; NameOfSpace Velocity [V] ; } // velocity
{ Name P ; Type Global ; NameOfSpace Position [P] ; } // position
}
Equation {
GlobalTerm { DtDof [ Inertia * Dof{V} , {V} ] ; In DomainKin ; }
GlobalTerm { [ Friction[] * Dof{V} , {V} ] ; In DomainKin ; }
GlobalTerm { [ -Fmag[] , {V} ] ; In DomainKin ; }
GlobalTerm { DtDof [ Dof{P} , {P} ] ; In DomainKin ; }
GlobalTerm { [-Dof{V} , {P} ] ; In DomainKin ; }
}
}
}
//-----------------------------------------------------------------------------------------------
Resolution {
{ Name TimeDomain ;
System {
{ Name A ; NameOfFormulation MagDyn_a_2D ; }
}
Operation {
CreateDir["res/"];
If[ Clean_Results==1 ]{
DeleteFile["res/temp.dat"];
DeleteFile["res/Tr.dat"]; DeleteFile["res/Ts.dat"]; DeleteFile["res/Tmb.dat"];
DeleteFile["res/Ua.dat"]; DeleteFile["res/Ub.dat"]; DeleteFile["res/Uc.dat"];
DeleteFile["res/Ia.dat"]; DeleteFile["res/Ib.dat"]; DeleteFile["res/Ic.dat"];
DeleteFile["res/Flux_a.dat"]; DeleteFile["res/Flux_b.dat"]; DeleteFile["res/Flux_c.dat"];
DeleteFile["res/Flux_d.dat"]; DeleteFile["res/Flux_q.dat"]; DeleteFile["res/Flux_0.dat"];
}
InitMovingBand2D[MB] ;
MeshMovingBand2D[MB] ;
InitSolution[A] ;
If[Flag_ParkTransformation && Flag_SrcType_Stator==1]{ PostOperation[ThetaPark_IABC] ; }
If[!Flag_NL]{
Generate[A] ; Solve[A] ;
}
Else{
//IterativeLoop[Nb_max_iter, stop_criterion, relaxation_factor]
// { GenerateJac[A] ; SolveJac[A] ; }
IterativeLoopN[ Nb_max_iter, relaxation_factor,
System { {A, reltol, abstol, Solution MeanL2Norm}} ]
{ GenerateJac[A] ; SolveJac[A] ; }
}
SaveSolution[A] ;
PostOperation[Get_LocalFields] ;
PostOperation[Get_GlobalQuantities] ;
}
}
{ Name TimeDomain_Loop ;
System {
{ Name A ; NameOfFormulation MagDyn_a_2D ; }
}
Operation {
CreateDir["res/"];
If[ Clean_Results==1 ]{
DeleteFile["res/temp.dat"];
DeleteFile["res/Tr.dat"]; DeleteFile["res/Ts.dat"]; DeleteFile["res/Tmb.dat"];
DeleteFile["res/Ua.dat"]; DeleteFile["res/Ub.dat"]; DeleteFile["res/Uc.dat"];
DeleteFile["res/Ia.dat"]; DeleteFile["res/Ib.dat"]; DeleteFile["res/Ic.dat"];
DeleteFile["res/Flux_a.dat"]; DeleteFile["res/Flux_b.dat"]; DeleteFile["res/Flux_c.dat"];
DeleteFile["res/Flux_d.dat"]; DeleteFile["res/Flux_q.dat"]; DeleteFile["res/Flux_0.dat"];
}
InitMovingBand2D[MB] ;
MeshMovingBand2D[MB] ;
InitSolution[A] ;
TimeLoopTheta[time0, timemax, delta_time, 1.]{ // Euler implicit (1) -- Crank-Nicolson (0.5)
If[Flag_ParkTransformation && Flag_SrcType_Stator==1]{ PostOperation[ThetaPark_IABC] ; }
If[!Flag_NL]{
Generate[A]; Solve[A];
}
Else{
// IterativeLoop[Nb_max_iter, stop_criterion, relaxation_factor] {
// GenerateJac[A] ; SolveJac[A] ; }
IterativeLoopN[
Nb_max_iter, relaxation_factor, System { {A, reltol, abstol, Solution MeanL2Norm}} ]{
GenerateJac[A] ; SolveJac[A] ; }
}
SaveSolution[A];
PostOperation[Get_LocalFields] ;
If[ $TimeStep > 1 ]{
PostOperation[Get_GlobalQuantities] ;
}
ChangeOfCoordinates[ NodesOf[Rotor_Moving], RotatePZ[delta_theta]] ;
MeshMovingBand2D[MB] ;
}
}
}
{ Name FrequencyDomain ;
System {
{ Name A ; NameOfFormulation MagDyn_a_2D ; Type ComplexValue ; Frequency Freq ; }
}
Operation {
If[ Clean_Results==1 && wr == 0.]{
DeleteFile["res/Tr.dat"]; DeleteFile["res/Ts.dat"]; DeleteFile["res/Tmb.dat"];
DeleteFile["res/Ua.dat"]; DeleteFile["res/Ub.dat"]; DeleteFile["res/Uc.dat"];
DeleteFile["res/Ia.dat"]; DeleteFile["res/Ib.dat"]; DeleteFile["res/Ic.dat"];
}
SetTime[wr];
InitMovingBand2D[MB] ;
MeshMovingBand2D[MB] ;
Generate[A] ; Solve[A] ; SaveSolution[A];
PostOperation[Map_LocalFields] ;
PostOperation[Torque_Emf_Flux] ;
}
}
/*
{ Name MagDyn_Kin ;
System {
{ Name A ; NameOfFormulation MagDyn_a_2D ; }
{ Name M ; NameOfFormulation Mechanical ; }
}
Operation {
ChangeOfCoordinates [ NodesOf[Rotor_Moving], RotatePZ[theta0] ] ; // Initial position (supposing initial mesh with angleR=0)
InitMovingBand2D[MB] ; MeshMovingBand2D[MB] ;
InitSolution[A] ; SaveSolution[A] ;
InitSolution[M] ; SaveSolution[M] ;
TimeLoopTheta[time0, timemax, delta_time, 1.]{
Generate[A] ; Solve[A] ; SaveSolution[A] ;
PostOperation[MagDyn_a_2D] ;
Generate[M] ; Solve[M] ; SaveSolution[M] ;
PostOperation[Mechanical] ;
ChangeOfCoordinates [ NodesOf[Rotor_Moving], RotatePZ[#77-#66] ] ;
Evaluate[ #77#66 ] ; //Keep track of previous angular position
MeshMovingBand2D[MB] ;
}
}
}
*/
}
//-----------------------------------------------------------------------------------------------
PostProcessing {
{ Name MagSta_a_2D ; NameOfFormulation MagSta_a_2D ;
PostQuantity {
{ Name a ; Value { Term { [ {a} ] ; In Domain ; Jacobian Vol ; } } }
{ Name az ; Value { Term { [ CompZ[{a}] ] ; In Domain ; Jacobian Vol ; } } }
{ Name b ; Value { Term { [ {d a} ] ; In Domain ; Jacobian Vol ; } } }
{ Name boundary ; Value { Term { [ {d a} ] ; In Dummy ; Jacobian Vol ; } } }
{ Name br ; Value { Term { [ br[] ] ; In DomainM ; Jacobian Vol ; } } }
{ Name Flux ; Value { Integral { [ SymmetryFactor*AxialLength*Idir[]*NbWires[]/SurfCoil[]* CompZ[{a}] ] ;
In Inds ; Jacobian Vol ; Integration I1 ; } } }
{ Name Force_vw ; Value {
Integral { Type Global ; [ 0.5 * nu[] * VirtualWork [{d a}] * AxialLength ];
In ElementsOf[Rotor_Airgap, OnOneSideOf Rotor_Bnd_MB];
Jacobian Vol ; Integration I1 ; } } }
{ Name Torque_Maxwell ; Value {
Integral {
[ CompZ [ XYZ[] /\ (T_max[{d a}] * XYZ[]) ]*2*Pi*AxialLength/SurfaceArea[] ] ;
In Domain ; Jacobian Vol ; Integration I1; } } }
{ Name Torque_vw ; Value {
Integral { Type Global ;
[ CompZ[ 0.5 * nu[] * XYZ[] /\ VirtualWork[{d a}] ] * AxialLength ];
In ElementsOf[Rotor_Airgap, OnOneSideOf Rotor_Bnd_MB];
Jacobian Vol ; Integration I1 ; } } }
{ Name U ; Value {
Term { [ {Ub} ] ; In DomainB ; }
Term { [ {Uz} ] ; In DomainZt_Cir ; }
} }
{ Name I ; Value {
Term { [ {Ib} ] ; In DomainB ; }
Term { [ {Iz} ] ; In DomainZt_Cir ; }
} }
}
}
{ Name MagDyn_a_2D ; NameOfFormulation MagDyn_a_2D ;
PostQuantity {
{ Name a ; Value { Term { [ {a} ] ; In Domain ; Jacobian Vol ; } } }
{ Name az ; Value { Term { [ CompZ[{a}] ] ; In Domain ; Jacobian Vol ; } } }
{ Name b ; Value { Term { [ {d a} ] ; In Domain ; Jacobian Vol ; } } }
{ Name boundary ; Value { Term { [ 1 ] ; In Dummy ; Jacobian Vol ; } } } // Dummy quantity
{ Name b_radial ; Value { Term { [ {d a}* Vector[ Cos[AngularPosition[]#4], Sin[#4], 0.] ] ; In Domain ; Jacobian Vol ; } } }
{ Name b_tangent ; Value { Term { [ {d a}* Vector[ -Sin[AngularPosition[]#4], Cos[#4], 0.] ] ; In Domain ; Jacobian Vol ; } } }
{ Name js ; Value { Term { [ js[] ] ; In DomainS ; Jacobian Vol ; } } }
{ Name br ; Value { Term { [ br[] ] ; In DomainM ; Jacobian Vol ; } } }
{ Name j ; Value {
Term { [ -sigma[]*(Dt[{a}]+{ur}) ] ; In DomainC ; Jacobian Vol ; }
Term { [ sigma[]*(Velocity[] *^ {d a}) ] ; In DomainV ; Jacobian Vol ; }
}
}
{ Name ir ; Value { Term { [ {ir} ] ; In Inds ; Jacobian Vol ; } } }
{ Name jz ; Value {
Term { [ CompZ[-sigma[]*(Dt[{a}]+{ur})] ] ; In DomainC ; Jacobian Vol ; }
Term { [ CompZ[ sigma[]*(Velocity[]*^{d a}) ] ] ; In DomainV ; Jacobian Vol ; }
}
}
{ Name rhoj2 ;
Value {
Term { [ sigma[]*SquNorm[ Dt[{a}]+{ur}] ] ; In Region[{DomainC,-DomainV}] ; Jacobian Vol ; }
Term { [ sigma[]*SquNorm[ Dt[{a}]+{ur}-Velocity[]*^{d a} ] ] ; In DomainV ; Jacobian Vol ; }
Term { [ 1./sigma[]*SquNorm[ IA[]*{ir} ] ] ; In PhaseA ; Jacobian Vol ; }
Term { [ 1./sigma[]*SquNorm[ IB[]*{ir} ] ] ; In PhaseB ; Jacobian Vol ; }
Term { [ 1./sigma[]*SquNorm[ IC[]*{ir} ] ] ; In PhaseC ; Jacobian Vol ; }
}
}
{ Name JouleLosses ;
Value {
Integral { [ sigma[] * SquNorm[ Dt[{a}]+{ur}-Velocity[]*^{d a} ] ] ; In Region[{DomainC,-DomainV}] ; Jacobian Vol ; Integration I1 ; }
Integral { [ sigma[] * SquNorm[ Dt[{a}]+{ur}-Velocity[]*^{d a} ] ] ; In DomainV ; Jacobian Vol ; Integration I1 ; }
Integral { [ 1./sigma[]*SquNorm[ IA[]*{ir} ] ] ; In PhaseA ; Jacobian Vol ; Integration I1 ; }
Integral { [ 1./sigma[]*SquNorm[ IB[]*{ir} ] ] ; In PhaseB ; Jacobian Vol ; Integration I1 ; }
Integral { [ 1./sigma[]*SquNorm[ IC[]*{ir} ] ] ; In PhaseC ; Jacobian Vol ; Integration I1 ; }
}
}
{ Name Flux ; Value { Integral { [ SymmetryFactor*AxialLength*Idir[]*NbWires[]/SurfCoil[]* CompZ[{a}] ] ;
In Inds ; Jacobian Vol ; Integration I1 ; } } }
{ Name Force_vw ; // Force computation by Virtual Works
Value {
Integral {
Type Global ; [ 0.5 * nu[] * VirtualWork [{d a}] * AxialLength ];
In ElementsOf[Rotor_Airgap, OnOneSideOf Rotor_Bnd_MB]; Jacobian Vol ; Integration I1 ; }
}
}
{ Name Torque_vw ; Value { // Torque computation via Virtual Works
Integral { Type Global ;
[ CompZ[ 0.5 * nu[] * XYZ[] /\ VirtualWork[{d a}] ] * AxialLength ];
In ElementsOf[Rotor_Airgap, OnOneSideOf Rotor_Bnd_MB]; Jacobian Vol ; Integration I1 ; }
}
}
{ Name Torque_Maxwell ; // Torque computation via Maxwell stress tensor
Value {
Integral {
[ CompZ [ XYZ[] /\ (T_max[{d a}] * XYZ[]) ] * 2*Pi*AxialLength/SurfaceArea[] ] ;
In Domain ; Jacobian Vol ; Integration I1; }
}
}
{ Name Torque_Maxwell_cplx ; // Torque computation via Maxwell stress tensor
Value {
Integral {
[ CompZ [ XYZ[] /\ (T_max_cplx[{d a}] * XYZ[]) ] * 2*Pi*AxialLength/SurfaceArea[] ] ;
In Domain ; Jacobian Vol ; Integration I1; }
}
}
{ Name ComplexPower ; // S = P + i*Q
Value {
Integral { [ Complex[ sigma[]*SquNorm[Dt[{a}]+{ur}], nu[]*SquNorm[{d a}] ] ] ;
In Region[{DomainC,-DomainV}] ; Jacobian Vol ; Integration I1 ; }
Integral { [ Complex[ sigma[]*SquNorm[Dt[{a}]+{ur}-Velocity[]*^{d a}], nu[]*SquNorm[{d a}] ] ] ;
In DomainV ; Jacobian Vol ; Integration I1 ; }
}
}
{ Name U ; Value {
Term { [ {U} ] ; In DomainC ; }
Term { [ {Ub} ] ; In DomainB ; }
Term { [ {Uz} ] ; In DomainZt_Cir ; }
} }
{ Name I ; Value {
Term { [ {I} ] ; In DomainC ; }
Term { [ {Ib} ] ; In DomainB ; }
Term { [ {Iz} ] ; In DomainZt_Cir ; }
} }
{ Name S ; Value {
Term { [ {U}*Conj[{I}] ] ; In DomainC ; }
Term { [ {Ub}*Conj[{Ib}] ] ; In DomainB ; }
Term { [ {Uz}*Conj[{Iz}] ] ; In DomainZt_Cir ; }
} }
{ Name Velocity ; Value {
Term { [ Velocity[] ] ; In Domain ; Jacobian Vol ; }
}
}
// For getting the value of some functions:
{ Name RotorPosition_deg ; Value { Term { Type Global; [ RotorPosition_deg[] ] ; In DomainDummy ; } } }
{ Name Theta_Park_deg ; Value { Term { Type Global; [ Theta_Park_deg[] ] ; In DomainDummy ; } } }
{ Name IA ; Value { Term { Type Global; [ IA[] ] ; In DomainDummy ; } } }
{ Name IB ; Value { Term { Type Global; [ IB[] ] ; In DomainDummy ; } } }
{ Name IC ; Value { Term { Type Global; [ IC[] ] ; In DomainDummy ; } } }
{ Name Flux_d ; Value { Term { Type Global; [ CompX[Flux_dq0[]] ] ; In DomainDummy ; } } }
{ Name Flux_q ; Value { Term { Type Global; [ CompY[Flux_dq0[]] ] ; In DomainDummy ; } } }
{ Name Flux_0 ; Value { Term { Type Global; [ CompZ[Flux_dq0[]] ] ; In DomainDummy ; } } }
}
}
{ Name Mechanical ; NameOfFormulation Mechanical ;
PostQuantity {
{ Name P ; Value { Term { [ {P} ] ; In DomainKin ; } } } //Position
{ Name V ; Value { Term { [ {V} ] ; In DomainKin ; } } } //Velocity
{ Name Vrpm ; Value { Term { [ {V}*30/Pi ] ; In DomainKin ; } } } //Velocity in rpm
}
}
}
//-----------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------
If (Flag_ParkTransformation)
PostOperation ThetaPark_IABC UsingPost MagDyn_a_2D {
Print[ RotorPosition_deg, OnRegion DomainDummy, Format Table, LastTimeStepOnly, File StrCat[Dir, StrCat["temp",ExtGnuplot]],
SendToServer "Output/1RotorPosition", Color "LightYellow" ];
Print[ Theta_Park_deg, OnRegion DomainDummy, Format Table, LastTimeStepOnly, File StrCat[Dir, StrCat["temp",ExtGnuplot]],
SendToServer "Output/1Theta_Park", Color "LightYellow" ];
Print[ IA, OnRegion DomainDummy, Format Table, LastTimeStepOnly, File StrCat[Dir, StrCat["temp",ExtGnuplot]], SendToServer "Output/2IA", Color "Pink" ];
Print[ IB, OnRegion DomainDummy, Format Table, LastTimeStepOnly, File StrCat[Dir, StrCat["temp",ExtGnuplot]], SendToServer "Output/2IB", Color "Yellow" ];
Print[ IC, OnRegion DomainDummy, Format Table, LastTimeStepOnly, File StrCat[Dir, StrCat["temp",ExtGnuplot]], SendToServer "Output/2IC", Color "LightGreen" ];
}
EndIf
PostOperation Get_LocalFields UsingPost MagDyn_a_2D {
Print[ ir, OnElementsOf Stator_Inds, File StrCat[Dir, StrCat["ir_stator",ExtGmsh]], LastTimeStepOnly, AppendTimeStepToFileName Flag_SaveAllSteps] ;
Print[ ir, OnElementsOf Rotor_Inds, File StrCat[Dir, StrCat["ir_rotor",ExtGmsh]], LastTimeStepOnly, AppendTimeStepToFileName Flag_SaveAllSteps] ;
//Print[ br, OnElementsOf #{DomainM}, File StrCat[Dir, StrCat["b",ExtGmsh]], LastTimeStepOnly, AppendTimeStepToFileName Flag_SaveAllSteps] ;
Print[ b, OnElementsOf Domain, File StrCat[Dir, StrCat["b",ExtGmsh]], LastTimeStepOnly, AppendTimeStepToFileName Flag_SaveAllSteps] ;
Print[ boundary, OnElementsOf Dummy, File StrCat[Dir, StrCat["bnd",ExtGmsh]], LastTimeStepOnly, AppendTimeStepToFileName Flag_SaveAllSteps] ;
Print[ az, OnElementsOf Domain, File StrCat[Dir, StrCat["a",ExtGmsh]], LastTimeStepOnly, AppendTimeStepToFileName Flag_SaveAllSteps ] ;
}
PostOperation Get_GlobalQuantities UsingPost MagDyn_a_2D {
If(!Flag_Cir)
If(!Flag_ParkTransformation)
Print[ I, OnRegion PhaseA_pos, Format Table,
File > StrCat[Dir, StrCat["Ia",ExtGnuplot]], LastTimeStepOnly, SendToServer "Output/2IA", Color "Pink" ];
Print[ I, OnRegion PhaseB_pos, Format Table,
File > StrCat[Dir, StrCat["Ib",ExtGnuplot]], LastTimeStepOnly, SendToServer "Output/2IB", Color "Yellow" ];
Print[ I, OnRegion PhaseC_pos, Format Table,
File > StrCat[Dir, StrCat["Ic",ExtGnuplot]], LastTimeStepOnly, SendToServer "Output/2IC", Color "LightGreen" ];
EndIf
Print[ U, OnRegion PhaseA_pos, Format Table,
File > StrCat[Dir, StrCat["Ua",ExtGnuplot]], LastTimeStepOnly, SendToServer "Output/30UA", Color "Pink" ];
Print[ U, OnRegion PhaseB_pos, Format Table,
File > StrCat[Dir, StrCat["Ub",ExtGnuplot]], LastTimeStepOnly, SendToServer "Output/31UB", Color "Yellow" ];
Print[ U, OnRegion PhaseC_pos, Format Table,
File > StrCat[Dir, StrCat["Uc",ExtGnuplot]], LastTimeStepOnly, SendToServer "Output/32UC", Color "LightGreen" ];
EndIf
If(Flag_Cir && Flag_SrcType_Stator==2)
Print[ I, OnRegion Input1, Format Table,
File > StrCat[Dir, StrCat["Ia",ExtGnuplot]], LastTimeStepOnly, SendToServer "Output/2IA", Color "Pink" ];
Print[ I, OnRegion Input2, Format Table,
File > StrCat[Dir, StrCat["Ib",ExtGnuplot]], LastTimeStepOnly, SendToServer "Output/2IB", Color "Yellow" ];
Print[ I, OnRegion Input3, Format Table,
File > StrCat[Dir, StrCat["Ic",ExtGnuplot]], LastTimeStepOnly, SendToServer "Output/2IC", Color "LightGreen" ];
Print[ U, OnRegion Input1, Format Table,
File > StrCat[Dir, StrCat["Ua",ExtGnuplot]], LastTimeStepOnly, SendToServer "Output/30UA", Color "Pink" ];
Print[ U, OnRegion Input2, Format Table,
File > StrCat[Dir, StrCat["Ub",ExtGnuplot]], LastTimeStepOnly, SendToServer "Output/31UB", Color "Yellow" ];
Print[ U, OnRegion Input3, Format Table,
File > StrCat[Dir, StrCat["Uc",ExtGnuplot]], LastTimeStepOnly, SendToServer "Output/32UC", Color "LightGreen" ];
EndIf
If(Flag_Cir && Flag_SrcType_Stator==0)
Print[ I, OnRegion R1, Format Table,
File > StrCat[Dir, StrCat["Ia",ExtGnuplot]], LastTimeStepOnly, SendToServer "Output/2IA", Color "Pink" ];
Print[ I, OnRegion R2, Format Table,
File > StrCat[Dir, StrCat["Ib",ExtGnuplot]], LastTimeStepOnly, SendToServer "Output/2IB", Color "Yellow" ];
Print[ I, OnRegion R3, Format Table,
File > StrCat[Dir, StrCat["Ic",ExtGnuplot]], LastTimeStepOnly, SendToServer "Output/2IC", Color "LightGreen" ];
Print[ U, OnRegion R1, Format Table,
File > StrCat[Dir, StrCat["Ua",ExtGnuplot]], LastTimeStepOnly, SendToServer "Output/30UA", Color "Pink" ];
Print[ U, OnRegion R2, Format Table,
File > StrCat[Dir, StrCat["Ub",ExtGnuplot]], LastTimeStepOnly, SendToServer "Output/31UB", Color "Yellow" ];
Print[ U, OnRegion R3, Format Table,
File > StrCat[Dir, StrCat["Uc",ExtGnuplot]], LastTimeStepOnly, SendToServer "Output/32UC", Color "LightGreen" ];
EndIf
Print[ I, OnRegion RotorC, Format Table,
File > StrCat[Dir, StrCat["Irotor",ExtGnuplot]], LastTimeStepOnly, SendToServer "Output/2Ir", Color "LightYellow" ];
Print[ Torque_Maxwell[Rotor_Airgap], OnGlobal, Format TimeTable,
File > StrCat[Dir, StrCat["Tr",ExtGnuplot]], LastTimeStepOnly, Store 54, SendToServer my_output, Color "LightYellow" ];
Print[ Torque_Maxwell[Stator_Airgap], OnGlobal, Format TimeTable,
File > StrCat[Dir, StrCat["Ts",ExtGnuplot]], LastTimeStepOnly, Store 55, SendToServer "Output/41T_stator", Color "LightYellow" ];
Print[ Torque_Maxwell[MB], OnGlobal, Format TimeTable,
File > StrCat[Dir, StrCat["Tmb",ExtGnuplot]], LastTimeStepOnly, Store 56, SendToServer "Output/42T_mb", Color "LightYellow" ];
//Print[ Torque_vw, OnRegion NodesOf[Rotor_Bnd_MB], Format RegionValue,
// File > StrCat[Dir, StrCat["Tr_vw",ExtGnuplot]], LastTimeStepOnly, Store 54, SendToServer "Output/1T_rotor_vw" ];
If(Flag_SrcType_Stator)
Print[ Flux[PhaseA], OnGlobal, Format TimeTable,
File > StrCat[Dir, StrCat["Flux_a",ExtGnuplot]], LastTimeStepOnly, Store 11, SendToServer "Output/50Flux_a", Color "Pink" ];
Print[ Flux[PhaseB], OnGlobal, Format TimeTable,
File > StrCat[Dir, StrCat["Flux_b",ExtGnuplot]], LastTimeStepOnly, Store 22, SendToServer "Output/51Flux_b", Color "Yellow" ];
Print[ Flux[PhaseC], OnGlobal, Format TimeTable,
File > StrCat[Dir, StrCat["Flux_c",ExtGnuplot]], LastTimeStepOnly, Store 33, SendToServer "Output/52Flux_c", Color "LightGreen"];
If(Flag_ParkTransformation && Flag_SrcType_Stator)
Print[ Flux_d, OnRegion DomainDummy, Format TimeTable,
File > StrCat[Dir, StrCat["Flux_d",ExtGnuplot]], LastTimeStepOnly, SendToServer "Output/60Flux_d", Color "LightYellow" ];
Print[ Flux_q, OnRegion DomainDummy, Format TimeTable,
File > StrCat[Dir, StrCat["Flux_q",ExtGnuplot]], LastTimeStepOnly, SendToServer "Output/61Flux_q", Color "LightYellow" ];
Print[ Flux_0, OnRegion DomainDummy, Format TimeTable,
File > StrCat[Dir, StrCat["Flux_0",ExtGnuplot]], LastTimeStepOnly, SendToServer "Output/62Flux_0", Color "LightYellow" ];
EndIf
EndIf
}
PostOperation Joule_Losses UsingPost MagDyn_a_2D {
Print[ JouleLosses[Rotor], OnGlobal, Format TimeTable,
File > StrCat[Dir, StrCat["P",ExtGnuplot]], LastTimeStepOnly, SendToServer "Output/3P_rotor" ];
Print[ JouleLosses[Rotor_Fe], OnGlobal, Format TimeTable,
File > StrCat[Dir, StrCat["P_Fe",ExtGnuplot]], LastTimeStepOnly, SendToServer "Output/3P_rotor_fe" ];
}
/*
PostOperation Mechanical UsingPost Mechanical {
Print[ P, OnRegion DomainKin, File > StrCat[Dir, StrCat["P", ExtGnuplot]],
Format Table, Store 77, LastTimeStepOnly, SendToServer "Output/3Position"] ;
Print[ V, OnRegion DomainKin, File > StrCat[Dir, StrCat["V", ExtGnuplot]],
Format Table, LastTimeStepOnly, SendToServer "Output/4Velocity"] ;
}
*/
DefineConstant[ Val_Rint = {0.15, Min 0.2, Max 1, Step 0.1,
Path "Parameters/Geometry/1",
Label "Internal shell radius (m)"} ];
DefineConstant[ Val_Rext = {0.25, Min Val_Rint, Max 0.5, Step 0.1,
Path "Parameters/Geometry/2",
Label "External shell radius (m)"}];
AIR = 100;
AIR_INF = 101;
AIR_GAP = 102;
MAGNET = 103;
CORE = 104;
LINE_INF = 105;
LINE_X = 106;
Include "magnet_data.pro";
DefineConstant[ h = {0.14, Min 0.1, Max 0.2, Step 0.01,
Path "Parameters/Geometry",
Label "Core height (m)"} ] ;
DefineConstant[ l = {0.14, Min 0.05, Max 0.2, Step 0.01,
Path "Parameters/Geometry",
Label "Core width (m)"} ] ;
DefineConstant[ d = {0.03, Min 0.01, Max 0.05, Step 0.002,
Path "Parameters/Geometry",
Label "Core tickness (m)"} ] ;
DefineConstant[ e = {5e-3, Min 5e-4, Max d, Step 1e-3,
Path "Parameters/Geometry",
Label "Air gap (m)", Highlight "LightYellow"} ] ;
DefineConstant[ ha = {0.03, Min 0.01, Max 0.1, Step 0.01,
Path "Parameters/Geometry",
Label "Magnet height (m)"} ] ;
lc0 = d / 5 ;
lc1 = e / 2 ;
lc2 = (Val_Rext - Val_Rint) / 8. ;
Point(1) = {0, 0, 0, lc0};
Point(2) = {-l/2, 0, 0, lc0};
Point(3) = {-l/2, h/2, 0, lc0};
Point(4) = {l/2, 0, 0, lc1};
Point(5) = {l/2, h/2, 0, lc0};
Point(6) = {-l/2, ha/2, 0, lc0};
Point(7) = {-l/2+d, ha/2, 0, lc0};
Point(8) = {-l/2+d, 0, 0, lc0};
Point(9) = {l/2-d, 0, 0, lc1};
Point(10) = {l/2-d, h/2-d, 0, lc0};
Point(11) = {-l/2+d, h/2-d, 0, lc0};
Point(12) = {l/2, e/2, 0, lc1};
Point(13) = {l/2-d, e/2, 0, lc1};
Point(30) = {Val_Rint, 0, 0, lc2};
Point(31) = {Val_Rext, 0, 0, lc2};
Point(32) = {0, Val_Rint, 0, lc2};
Point(33) = {0, Val_Rext, 0, lc2};
Point(34) = {-Val_Rext, 0, 0, lc2};
Point(35) = {-Val_Rint, 0, 0, lc2};
Line(1) = {34, 35};
Line(2) = {35, 2};
Line(3) = {2, 8};
Line(4) = {8, 1};
Line(5) = {1, 9};
Line(6) = {9, 4};
Line(7) = {4, 30};
Line(8) = {30, 31};
Line(9) = {2, 6};
Line(10) = {6, 3};
Line(11) = {3, 5};
Line(12) = {5, 12};
Line(13) = {12, 4};
Line(14) = {9, 13};
Line(15) = {13, 10};
Line(16) = {10, 11};
Line(17) = {11, 7};
Line(18) = {7, 8};
Line(19) = {7, 6};
Line(20) = {13, 12};
Circle(21) = {35, 1, 32};
Circle(22) = {32, 1, 30};
Circle(23) = {34, 1, 33};
Circle(24) = {33, 1, 31};
Line Loop(25) = {21, 22, 8, -24, -23, 1};
Plane Surface(26) = {25};
Line Loop(27) = - {22, -7, -13, -12, -11, -10, -9, -2, 21};
Plane Surface(28) = {27};
Line Loop(29) = - {11, 12, -20, 15, 16, 17, 19, 10};
Plane Surface(30) = {29};
Line Loop(31) = {19, -9, 3, -18};
Plane Surface(32) = {31};
Line Loop(33) = - {20, 13, -6, 14};
Plane Surface(34) = {33};
Line Loop(35) = {15, 16, 17, 18, 4, 5, 14};
Plane Surface(36) = {35};
// physical entities (for which elements will be saved)
Physical Surface(AIR) = {28, 36};
Physical Surface(AIR_INF) = {26};
Physical Surface(AIR_GAP) = {34};
Physical Surface(MAGNET) = {32};
Physical Surface(CORE) = {30};
Physical Line(LINE_INF) = {23, 24};
Physical Line(LINE_X) = {1:8};
/*
To solve the problem
with scalar potential, type 'getdp test -solve MagSta_phi -pos phi'
with vector potential, type 'getdp test -solve MagSta_a -pos a'
*/
Include "magnet_data.pro";
Group {
// AIR, AIR_INF, etc. are variables defined in core.txt, and correspond to the
// tags of physical regions in the mesh
Air = Region[ AIR ];
AirInf = Region[ AIR_INF ];
Core = Region[ CORE ];
AirGap = Region[ AIR_GAP ];
Magnet = Region[ MAGNET ];
// These are the generic group names that are used in "Magnetostatics.pro"
Domain_S = Region[ {} ] ;
Domain_Inf = Region[ AirInf ] ;
Domain_M = Region[ Magnet ] ;
Domain_Mag = Region[ {Air, Core, AirGap} ] ;
Dirichlet_a_0 = Region[ LINE_INF ] ;
Dirichlet_phi_0 = Region[ {LINE_X, LINE_INF} ] ;
}
Function {
mu0 = 4.e-7 * Pi ;
// DefineConstant is used to define a default value for murCore; this value
// can be changed interactively by the ONELAB server
DefineConstant[ murCore = {200., Min 1, Max 1000, Step 10,
Label "Core relative permeability",
Path "Parameters/Materials"} ];
nu [ Region[{Air, AirInf, AirGap, Magnet}] ] = 1. / mu0 ;
nu [ Core ] = 1. / (murCore * mu0) ;
mu [ Region[{Air, AirInf, AirGap, Magnet}] ] = mu0 ;
mu [ Core ] = murCore * mu0;
DefineConstant[ Hc = {920000, Label "Magnet coercive field (A/m)",
Path "Parameters/Materials"} ];
hc [ Magnet ] = Vector[0., Hc, 0.] ;
}
Include "magnetostatics.pro"
eps = 1.e-5 ;
Printf[ "murCore: %f",murCore ] ;
PostOperation {
{ Name phi ; NameOfPostProcessing MagSta_phi;
Operation {
Print[ phi, OnElementsOf Domain, File "phi.pos" ] ;
Print[ b, OnElementsOf Domain, File "b_phi.pos" ] ;
Print[ b, OnLine {{-0.07,eps,0}{0.09,eps,0}} {500}, File "b_phi.txt", Format Table ] ;
}
}
{ Name a ; NameOfPostProcessing MagSta_a;
Operation {
Print[ a, OnElementsOf Domain, File "a.pos"] ;
Print[ b, OnElementsOf Domain, File "b_a.pos" ] ;
Print[ h, OnElementsOf Domain, File "h_a.pos" ] ;
Print[ b, OnLine {{-0.07,eps,0}{0.09,eps,0}} {500}, File "b_a.txt" , Format Table ] ;
}
}
}
Group {
// Input groups:
DefineGroup[ Domain_M = {{}, Label "Permanent magnets",
Path "Regions/0Sources"},
Domain_S = {{}, Label "Inductor (imposed j_s)",
Path "Regions/0Sources"},
Domain_Inf = {{}, Label "Infinite domain (spherical shell)",
Path "Regions/0Special regions", Closed "1"},
Domain_Mag = {{}, Label "Passive magnetic regions",
Path "Regions/Other regions"},
Dirichlet_phi_0 = {{}, Label "h_t = 0", Closed "1",
Path "Regions/0Boundary conditions"},
Dirichlet_a_0 = {{}, Label "b_n = 0",
Path "Regions/0Boundary conditions"} ];
DefineGroup[ Domain = {{Domain_Mag, Domain_M, Domain_S, Domain_Inf},
Label "Computational domain", Path "Regions", Visible 0} ];
}
Function{
// Input constants:
DefineConstant[ Val_Rint, Val_Rext // interior/exterior radius of Domain_Inf
];
// Input functions:
DefineFunction[ mu, // magnetic permeability
nu, // magnetic reluctivity
hc, // coercive magnetic field
js // source current density
];
// remove this: only for demo
//DefineConstant[ hcx = {0, Label "Coercive field h_x", Path "Sources"}];
//DefineConstant[ hcy = {1000, Label "Coercive field h_y", Path "Sources"}];
//hc[] = Vector[hcx,hcy,0];
//mu[] = 4*Pi*10^-7;
//nu[] = 1/mu[];
}
Jacobian {
{ Name JVol ;
Case {
{ Region Domain_Inf ; Jacobian VolSphShell{Val_Rint, Val_Rext} ; }
{ Region All ; Jacobian Vol ; }
}
}
}
Integration {
{ Name I1 ;
Case {
{ Type Gauss ;
Case {
{ GeoElement Triangle ; NumberOfPoints 4 ; }
{ GeoElement Quadrangle ; NumberOfPoints 4 ; }
}
}
}
}
}
/* --------------------------------------------------------------------------
MagSta_phi : Magnetic scalar potential phi formulation
-------------------------------------------------------------------------- */
Constraint {
{ Name phi ;
Case {
{ Region Dirichlet_phi_0 ; Value 0. ; }
}
}
}
FunctionSpace {
{ Name Hgrad_phi ; Type Form0 ;
BasisFunction {
{ Name sn ; NameOfCoef phin ; Function BF_Node ;
Support Domain ; Entity NodesOf[ All ] ; }
}
Constraint {
{ NameOfCoef phin ; EntityType NodesOf ; NameOfConstraint phi ; }
}
}
}
Formulation {
{ Name MagSta_phi ; Type FemEquation ;
Quantity {
{ Name phi ; Type Local ; NameOfSpace Hgrad_phi ; }
}
Equation {
Galerkin { [ - mu[] * Dof{d phi} , {d phi} ] ;
In Domain ; Jacobian JVol ; Integration I1 ; }
Galerkin { [ - mu[] * hc[] , {d phi} ] ;
In Domain_M ; Jacobian JVol ; Integration I1 ; }
}
}
}
Resolution {
{ Name MagSta_phi ;
System {
{ Name A ; NameOfFormulation MagSta_phi ; }
}
Operation {
Generate[A] ; Solve[A] ; SaveSolution[A] ;
}
}
}
PostProcessing {
{ Name MagSta_phi ; NameOfFormulation MagSta_phi ;
Quantity {
{ Name b ; Value { Local { [ - mu[] * {d phi} ] ; In Domain ; Jacobian JVol ; }
Local { [ - mu[] * hc[] ] ; In Domain_M ; Jacobian JVol ; } } }
{ Name h ; Value { Local { [ - {d phi} ] ; In Domain ; Jacobian JVol ; } } }
{ Name phi ; Value { Local { [ {phi} ] ; In Domain ; Jacobian JVol ; } } }
}
}
}
PostOperation {
{ Name MagSta_phi ; NameOfPostProcessing MagSta_phi;
Operation {
Print[ b, OnElementsOf Domain, File "MagSta_phi_b.pos" ] ;
Print[ h, OnElementsOf Domain, File "MagSta_phi_h.pos" ] ;
Print[ phi, OnElementsOf Domain, File "MagSta_phi_phi.pos" ] ;
}
}
}
/* --------------------------------------------------------------------------
MagSta_a : Magnetic vector potential a formulation (2D)
-------------------------------------------------------------------------- */
Constraint {
{ Name a ;
Case {
{ Region Dirichlet_a_0 ; Value 0. ; }
}
}
}
FunctionSpace {
{ Name Hcurl_a ; Type Form1P ;
BasisFunction {
{ Name se ; NameOfCoef ae ; Function BF_PerpendicularEdge ;
Support Domain ; Entity NodesOf[ All ] ; }
}
Constraint {
{ NameOfCoef ae ; EntityType NodesOf ; NameOfConstraint a ; }
}
}
}
Formulation {
{ Name MagSta_a ; Type FemEquation ;
Quantity {
{ Name a ; Type Local ; NameOfSpace Hcurl_a ; }
}
Equation {
Galerkin { [ nu[] * Dof{d a} , {d a} ] ;
In Domain ; Jacobian JVol ; Integration I1 ; }
Galerkin { [ hc[] , {d a} ] ;
In Domain_M ; Jacobian JVol ; Integration I1 ; }
Galerkin { [ -js[] , {a} ] ;
In Domain_S ; Jacobian JVol ; Integration I1 ; }
}
}
}
Resolution {
{ Name MagSta_a ;
System {
{ Name A ; NameOfFormulation MagSta_a ; }
}
Operation {
Generate[A] ; Solve[A] ; SaveSolution[A];
}
}
}
PostProcessing {
{ Name MagSta_a ; NameOfFormulation MagSta_a ;
Quantity {
{ Name a ; Value { Local { [ CompZ[{a}] ] ; In Domain ; Jacobian JVol ; } } }
{ Name b ; Value { Local { [ {d a} ] ; In Domain ; Jacobian JVol ; } } }
{ Name a ; Value { Local { [ {a} ] ; In Domain ; Jacobian JVol ; } } }
{ Name h ; Value { Local { [ nu[] * {d a} ] ; In Domain ; Jacobian JVol ; }
Local { [ hc[] ] ; In Domain_M ; Jacobian JVol ; } } }
}
}
}
PostOperation {
{ Name MagSta_a ; NameOfPostProcessing MagSta_a;
Operation {
Print[ b, OnElementsOf Domain, File "MagSta_a_b.pos" ] ;
Print[ h, OnElementsOf Domain, File "MagSta_a_h.pos" ] ;
Print[ a, OnElementsOf Domain, File "MagSta_a_a.pos" ] ;
}
}
}
//
// Circuit for Permanent Magnet Synchronous Generator - cbmag
//
Group{
// Dummy numbers for circuit definition
R1 = #55551 ;
R2 = #55552 ;
R3 = #55553 ;
Input1 = #10001 ;
Input2 = #10002 ;
Input3 = #10003 ;
Input4 = #10004 ;
Resistance_Cir = Region[{R1, R2, R3}];
DomainZ_Cir = Region[ {Resistance_Cir} ];
DomainSource_Cir = Region[ {} ] ;
If(Flag_SrcType_Stator>1)
DomainSource_Cir += Region[ {Input1, Input2, Input3} ] ;
EndIf
DomainZt_Cir = Region[ {DomainZ_Cir, DomainSource_Cir} ];
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
Function {
// Open circuit - load - short circuit
DefineConstant[ ZR = {200,
Choices{1e-8, 200, 1e8}, Label "Load resistance", Path "Input/", Highlight "AliceBlue"} ];
Resistance[#{R1, R2, R3}] = ZR ;
}
// --------------------------------------------------------------------------
Constraint {
If (SymmetryFactor<8)
If(Flag_SrcType_Stator==0)
{ Name ElectricalCircuit ; Type Network ;
Case Circuit1 {
{ Region Stator_Ind_Ap ; Branch {100,102} ; }
{ Region Stator_Ind_Am ; Branch {103,102} ; }
{ Region R1 ; Branch {103,100} ; }
}
Case Circuit2 {
{ Region Stator_Ind_Bp ; Branch {200,202} ; }
{ Region Stator_Ind_Bm ; Branch {203,202} ; }
{ Region R2 ; Branch {203,200} ; }
}
Case Circuit3 {
{ Region Stator_Ind_Cp ; Branch {300,302} ; }
{ Region Stator_Ind_Cm ; Branch {303,302} ; }
{ Region R3 ; Branch {303,300} ; }
}
}
EndIf
If (Flag_SrcType_Stator==2)
{ Name ElectricalCircuit ; Type Network ;
Case Circuit1 {
{ Region Input1 ; Branch {100,101} ; }
{ Region Stator_Ind_Ap ; Branch {101,102} ; }
{ Region Stator_Ind_Am ; Branch {103,102} ; }
{ Region R1 ; Branch {103,100} ; }
}
Case Circuit2 {
{ Region Input2 ; Branch {200,201} ; }
{ Region Stator_Ind_Bp ; Branch {201,202} ; }
{ Region Stator_Ind_Bm ; Branch {203,202} ; }
{ Region R2 ; Branch {203,200} ; }
}
Case Circuit3 {
{ Region Input3 ; Branch {300,301} ; }
{ Region Stator_Ind_Cp ; Branch {301,302} ; }
{ Region Stator_Ind_Cm ; Branch {303,302} ; }
{ Region R3 ; Branch {303,300} ; }
}
}
EndIf
EndIf
If(SymmetryFactor==8)
If(Flag_SrcType_Stator==0) // Only one physical region in geo allow per branch
{ Name ElectricalCircuit ; Type Network ;
Case Circuit1 {
{ Region PhaseA ; Branch {100,102} ; }
{ Region R1 ; Branch {102,100} ; }
}
Case Circuit2 {
{ Region PhaseB ; Branch {200,202} ; }
{ Region R2 ; Branch {202,200} ; }
}
Case Circuit3 {
{ Region PhaseC ; Branch {300,302} ; }
{ Region R3 ; Branch {302,300} ; }
}
}
EndIf
If(Flag_SrcType_Stator==2) // Only one physical region in geo allow per branch
{ Name ElectricalCircuit ; Type Network ;
Case Circuit1 {
{ Region Input1 ; Branch {100,101} ; }
{ Region PhaseA ; Branch {101,102} ; }
{ Region R1 ; Branch {102,100} ; }
}
Case Circuit2 {
{ Region Input2 ; Branch {200,201} ; }
{ Region PhaseB ; Branch {201,202} ; }
{ Region R2 ; Branch {202,200} ; }
}
Case Circuit3 {
{ Region Input3 ; Branch {300,301} ; }
{ Region PhaseC ; Branch {302,301} ; }
{ Region R3 ; Branch {302,300} ; }
}
}
EndIf
EndIf
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment