femagtools 1.6.2a0__py3-none-any.whl → 1.6.2a1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- femagtools/__init__.py +1 -1
- femagtools/machine/pm.py +44 -35
- {femagtools-1.6.2a0.dist-info → femagtools-1.6.2a1.dist-info}/METADATA +1 -1
- {femagtools-1.6.2a0.dist-info → femagtools-1.6.2a1.dist-info}/RECORD +8 -8
- {femagtools-1.6.2a0.dist-info → femagtools-1.6.2a1.dist-info}/LICENSE +0 -0
- {femagtools-1.6.2a0.dist-info → femagtools-1.6.2a1.dist-info}/WHEEL +0 -0
- {femagtools-1.6.2a0.dist-info → femagtools-1.6.2a1.dist-info}/entry_points.txt +0 -0
- {femagtools-1.6.2a0.dist-info → femagtools-1.6.2a1.dist-info}/top_level.txt +0 -0
femagtools/__init__.py
CHANGED
femagtools/machine/pm.py
CHANGED
@@ -154,10 +154,6 @@ class PmRelMachine(object):
|
|
154
154
|
return torque - self.mtpa(i1)[2]
|
155
155
|
i1 = so.fsolve(func, res.x[0])[0]
|
156
156
|
return self.mtpa(i1)[:2]
|
157
|
-
def func(iq):
|
158
|
-
return torque - self.torque_iqd(iq, 0)
|
159
|
-
return so.fsolve(func, 0)[0]
|
160
|
-
|
161
157
|
|
162
158
|
def tqiq(iq):
|
163
159
|
return torque - self.torque_iqd(float(iq), 0)
|
@@ -169,29 +165,36 @@ class PmRelMachine(object):
|
|
169
165
|
if np.abs(torque) < 1e-2:
|
170
166
|
return (0, 0)
|
171
167
|
if np.isscalar(iqd0):
|
172
|
-
|
168
|
+
tx = self.tmech_iqd(self.io[0], 0, n)
|
169
|
+
iq0 = min(0.9*self.i1range[1]/np.sqrt(2),
|
170
|
+
np.abs(torque)/tx*self.io[0])
|
171
|
+
if torque < 0:
|
172
|
+
i0 = (-iq0, 0)
|
173
|
+
else:
|
174
|
+
i0 = (iq0, 0)
|
175
|
+
logger.debug("initial guess i0 %f -> %s tx %f torque %f",
|
176
|
+
self.io[0], i0, tx, torque)
|
173
177
|
else:
|
174
178
|
i0 = iqd0
|
175
179
|
|
176
180
|
if with_mtpa:
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
181
|
+
k=0
|
182
|
+
while k < 5:
|
183
|
+
res = so.minimize(
|
184
|
+
lambda iqd: la.norm(iqd), i0, method='SLSQP',
|
185
|
+
constraints=({'type': 'eq',
|
186
|
+
'fun': lambda iqd:
|
187
|
+
self.tmech_iqd(*iqd, n) - torque}))
|
188
|
+
if res.success:
|
189
|
+
return res.x
|
190
|
+
# make new initial guess:
|
191
|
+
tx = self.tmech_iqd(*i0, n)
|
192
|
+
logger.debug("k %d new guess i0 %s tx %f torque %f",
|
193
|
+
k, i0, tx, torque)
|
194
|
+
i0=(min(0.9*self.i1range[1]/np.sqrt(2), torque/tx*i0[0]), 0)
|
195
|
+
k += 1
|
196
|
+
raise ValueError(
|
197
|
+
f'Torque {torque} speed {n} {i0} {res.message}')
|
195
198
|
def tqiq(iq):
|
196
199
|
return torque - self.tmech_iqd(float(iq), 0, n)
|
197
200
|
iq = so.fsolve(tqiq, (i0[0],))[0]
|
@@ -351,13 +354,13 @@ class PmRelMachine(object):
|
|
351
354
|
beta)[0], i1)
|
352
355
|
|
353
356
|
res = so.minimize(lambda iqd: np.linalg.norm(iqd), i0, method='SLSQP',
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
357
|
+
constraints=(
|
358
|
+
{'type': 'eq',
|
359
|
+
'fun': lambda iqd:
|
360
|
+
self.tmech_iqd(*iqd, n) - torque},
|
361
|
+
{'type': 'ineq',
|
362
|
+
'fun': lambda iqd:
|
363
|
+
np.sqrt(2)*u1max - la.norm(self.uqd(w1, *iqd))}))
|
361
364
|
iq, id = res.x
|
362
365
|
else:
|
363
366
|
iq, id = i0
|
@@ -365,12 +368,15 @@ class PmRelMachine(object):
|
|
365
368
|
try:
|
366
369
|
log((iq,id))
|
367
370
|
except:
|
368
|
-
pass
|
369
|
-
logger.debug("iqd_tmech_umax w1=%f torque=%f %f iq=%f id=%f u1
|
371
|
+
pass
|
372
|
+
logger.debug("iqd_tmech_umax w1=%f torque=%f %f iq=%f id=%f u1 %f %f",
|
370
373
|
w1, torque, self.torque_iqd(iq, id), iq, id,
|
371
374
|
u1max, np.linalg.norm(
|
372
375
|
self.uqd(w1, iq, id))/np.sqrt(2))
|
373
|
-
|
376
|
+
u1 = np.linalg.norm(
|
377
|
+
self.uqd(w1, iq, id))/np.sqrt(2)
|
378
|
+
tq = self.tmech_iqd(iq, id, n)
|
379
|
+
return iq, id, tq
|
374
380
|
|
375
381
|
def iqd_torque_umax(self, torque, w1, u1max, log=0, with_mtpa=True):
|
376
382
|
"""return d-q current and torque at stator frequency and max voltage
|
@@ -1143,7 +1149,11 @@ class PmRelMachineLdq(PmRelMachine):
|
|
1143
1149
|
if np.any(beta[beta > np.pi]):
|
1144
1150
|
beta[beta > np.pi] = beta - 2*np.pi
|
1145
1151
|
|
1146
|
-
self.
|
1152
|
+
self.betarange = min(beta), max(beta)
|
1153
|
+
if min(beta) < -np.pi/2 and max(beta) > -np.pi/2:
|
1154
|
+
self.io = iqd(-np.pi/4, np.max(i1)/2)
|
1155
|
+
else:
|
1156
|
+
self.io = iqd((np.min(beta)+max(beta))/2, np.max(i1)/2)
|
1147
1157
|
kx = ky = 3
|
1148
1158
|
if len(i1) < 4:
|
1149
1159
|
ky = len(i1)-1
|
@@ -1165,7 +1175,6 @@ class PmRelMachineLdq(PmRelMachine):
|
|
1165
1175
|
logger.warning("loss map missing: %s", e)
|
1166
1176
|
pass
|
1167
1177
|
if 'psid' in kwargs:
|
1168
|
-
self.betarange = min(beta), max(beta)
|
1169
1178
|
self.i1range = (0, np.max(i1))
|
1170
1179
|
self.psid = ip.RectBivariateSpline(
|
1171
1180
|
beta, i1, np.sqrt(2)*np.asarray(kwargs['psid']),
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: femagtools
|
3
|
-
Version: 1.6.
|
3
|
+
Version: 1.6.2a1
|
4
4
|
Summary: Python API for FEMAG
|
5
5
|
Author-email: Ronald Tanner <tar@semafor.ch>, Dapu Zhang <dzhang@gtisoft.com>, Beat Holm <hob@semafor.ch>, Günther Amsler <amg@semafor.ch>, Nicolas Mauchle <mau@semafor.ch>
|
6
6
|
License: Copyright (c) 2016-2023, Semafor Informatik & Energie AG, Basel
|
@@ -1,4 +1,4 @@
|
|
1
|
-
femagtools/__init__.py,sha256=
|
1
|
+
femagtools/__init__.py,sha256=0Czmc00qOcerVrb_HqxErbf-Nydh8tEB0bNJ7clxtWI,1617
|
2
2
|
femagtools/airgap.py,sha256=ZCIZTYf6BbuNYx68y9fUDBQo3taN8RuGl8q-jJ7ygiA,1577
|
3
3
|
femagtools/amazon.py,sha256=O1ICuv21XDAJi1qK1Sigs2TdS6hDZP19OzvmE2t76wU,12069
|
4
4
|
femagtools/amela.py,sha256=pHjfXzpANI-7oz8MtrqNcyDZ6PxVM91vCJuvYhHy1rk,13891
|
@@ -62,7 +62,7 @@ femagtools/machine/__init__.py,sha256=U8W65K7jr7jDdC1KnJh0WjYd8DFaLnIFVvlh-TKcV9
|
|
62
62
|
femagtools/machine/afpm.py,sha256=hNyDFRLGmCuWRPZl_u1ztJ4pA-Y_mxLaVvg3UJkzRuE,24766
|
63
63
|
femagtools/machine/effloss.py,sha256=I8s2Fog6klhgcRYw3448qfGvzaQ0AQUJXFdNoeDyhfE,13138
|
64
64
|
femagtools/machine/im.py,sha256=ScIOLrlc4CPLYFNx2MmJqkpmbky_HXxFGZbMWUNGBrk,37881
|
65
|
-
femagtools/machine/pm.py,sha256=
|
65
|
+
femagtools/machine/pm.py,sha256=lSZy5fQo2meI9ISRCoQGdHKoVTpreaoucZoTlQclQpI,57059
|
66
66
|
femagtools/machine/sizing.py,sha256=aN_OahewjTTBHnpRNfLh1AGFhqnoeZVuMBeb_3MCIVI,23096
|
67
67
|
femagtools/machine/sm.py,sha256=pkik913kU41PPiUpwDy_6BEKfCIhvY6FEp-fbU2Lqew,34320
|
68
68
|
femagtools/machine/utils.py,sha256=g9q4j9KxUWdb_iUOUQDuaAwwJx8XM0kZMpgnwsNz8hU,18616
|
@@ -200,9 +200,9 @@ tests/moo/__init__.py,sha256=l8HD-AY8EwxOoo_VrG3HgEZb2MaHypvnhKCVSkR-DTA,808
|
|
200
200
|
tests/moo/test_algorithm.py,sha256=Em8sFm2vzPmuIzRrBBnUQLU_TYuJHSf-kEeozw0XeX4,2563
|
201
201
|
tests/moo/test_population.py,sha256=FvX9LRCxQx0_E2GxHQ5vKwOYFBQiNbT6Lmv5GmNWjTQ,5471
|
202
202
|
tests/moo/test_problem.py,sha256=ALeP4u7g-dFhfwWL8vxivdrrYzVKPjHMCAXzzgyNZbs,467
|
203
|
-
femagtools-1.6.
|
204
|
-
femagtools-1.6.
|
205
|
-
femagtools-1.6.
|
206
|
-
femagtools-1.6.
|
207
|
-
femagtools-1.6.
|
208
|
-
femagtools-1.6.
|
203
|
+
femagtools-1.6.2a1.dist-info/LICENSE,sha256=V5OED7AzEaOtvbfgNheKOSUeNtijvKQuo84FtSJNkJU,1316
|
204
|
+
femagtools-1.6.2a1.dist-info/METADATA,sha256=oLG4odGgDU9q0mHzRwan00p1Ko9dtPy-1ReLG1-zxQI,5687
|
205
|
+
femagtools-1.6.2a1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
206
|
+
femagtools-1.6.2a1.dist-info/entry_points.txt,sha256=UXpu6KnrykN89sCUaFAIIzn_dYwuxizUS0GcPdoekro,195
|
207
|
+
femagtools-1.6.2a1.dist-info/top_level.txt,sha256=Ri4YWtU8MZTzNje9IKyXhTakNbsrCynuWdon4Yq94Dc,17
|
208
|
+
femagtools-1.6.2a1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|