Skip to content

Commit 6ebd852

Browse files
committed
[NF] Adding set_I0_Phi0
1 parent e2557ad commit 6ebd852

File tree

7 files changed

+74
-1
lines changed

7 files changed

+74
-1
lines changed

pyleecan/Classes/Class_Dict.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7656,6 +7656,7 @@
76567656
"get_slip",
76577657
"get_Ud_Uq",
76587658
"set_Id_Iq",
7659+
"set_I0_Phi0",
76597660
"get_I0_Phi0"
76607661
],
76617662
"mother": "OP",
@@ -7718,7 +7719,8 @@
77187719
"get_Ud_Uq",
77197720
"set_Id_Iq",
77207721
"get_I0_Phi0",
7721-
"get_slip"
7722+
"get_slip",
7723+
"set_I0_Phi0"
77227724
],
77237725
"mother": "OP",
77247726
"name": "OPslip",

pyleecan/Classes/OPdq.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@
4747
except ImportError as error:
4848
set_Id_Iq = error
4949

50+
try:
51+
from ..Methods.Simulation.OPdq.set_I0_Phi0 import set_I0_Phi0
52+
except ImportError as error:
53+
set_I0_Phi0 = error
54+
5055
try:
5156
from ..Methods.Simulation.OPdq.get_I0_Phi0 import get_I0_Phi0
5257
except ImportError as error:
@@ -116,6 +121,15 @@ class OPdq(OP):
116121
)
117122
else:
118123
set_Id_Iq = set_Id_Iq
124+
# cf Methods.Simulation.OPdq.set_I0_Phi0
125+
if isinstance(set_I0_Phi0, ImportError):
126+
set_I0_Phi0 = property(
127+
fget=lambda x: raise_(
128+
ImportError("Can't use OPdq method set_I0_Phi0: " + str(set_I0_Phi0))
129+
)
130+
)
131+
else:
132+
set_I0_Phi0 = set_I0_Phi0
119133
# cf Methods.Simulation.OPdq.get_I0_Phi0
120134
if isinstance(get_I0_Phi0, ImportError):
121135
get_I0_Phi0 = property(

pyleecan/Classes/OPslip.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@
5252
except ImportError as error:
5353
get_slip = error
5454

55+
try:
56+
from ..Methods.Simulation.OPslip.set_I0_Phi0 import set_I0_Phi0
57+
except ImportError as error:
58+
set_I0_Phi0 = error
59+
5560

5661
from ._check import InitUnKnowClassError
5762

@@ -125,6 +130,15 @@ class OPslip(OP):
125130
)
126131
else:
127132
get_slip = get_slip
133+
# cf Methods.Simulation.OPslip.set_I0_Phi0
134+
if isinstance(set_I0_Phi0, ImportError):
135+
set_I0_Phi0 = property(
136+
fget=lambda x: raise_(
137+
ImportError("Can't use OPslip method set_I0_Phi0: " + str(set_I0_Phi0))
138+
)
139+
)
140+
else:
141+
set_I0_Phi0 = set_I0_Phi0
128142
# save and copy methods are available in all object
129143
save = save
130144
copy = copy

pyleecan/Generator/ClassesRef/Simulation/OPdq.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ Ud_ref,Vrms,d-axis voltage rms value,1,float,None,,,,,,get_N0,,,
55
Uq_ref,Vrms,q-axis voltage rms value,1,float,None,,,,,,get_slip,,,
66
,,,,,,,,,,,get_Ud_Uq,,,
77
,,,,,,,,,,,set_Id_Iq,,,
8+
,,,,,,,,,,,set_I0_Phi0,,,
89
,,,,,,,,,,,get_I0_Phi0,,,

pyleecan/Generator/ClassesRef/Simulation/OPslip.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ U0_ref,Vrms,stator voltage (phase to neutral),,float,None,,,,,,get_Ud_Uq,,,
66
UPhi0_ref,rad,Voltage phase,,float,None,,,,,,set_Id_Iq,,,
77
,,,,,,,,,,,get_I0_Phi0,,,
88
,,,,,,,,,,,get_slip,,,
9+
,,,,,,,,,,,set_I0_Phi0,,,
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from numpy import exp
2+
3+
4+
def set_I0_Phi0(self, I0, Phi0):
5+
"""Set the value for I0 and IPhi0
6+
7+
Parameters
8+
----------
9+
self : OPdq
10+
An OPdq object
11+
I0 : float
12+
I0 value to set [Arms]
13+
Phi0 : float
14+
IPhi0 value to set [rad]
15+
"""
16+
17+
if I0 == 0:
18+
self.Id_ref = 0
19+
self.Iq_ref = 0
20+
else:
21+
Z = I0 * exp(1j * Phi0)
22+
self.Id_ref = Z.real
23+
self.Iq_ref = Z.imag
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from numpy import exp
2+
3+
4+
def set_I0_Phi0(self, I0, Phi0):
5+
"""Set the value for I0 and IPhi0
6+
7+
Parameters
8+
----------
9+
self : OPslip
10+
An OPslip object
11+
I0 : float
12+
I0 value to set [Arms]
13+
Phi0 : float
14+
IPhi0 value to set [rad]
15+
"""
16+
17+
self.I0_ref = I0
18+
self.IPhi0_ref = Phi0

0 commit comments

Comments
 (0)