femagtools 1.2.5__py3-none-any.whl → 1.2.6__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/effloss.py +18 -14
- femagtools/machine/pm.py +2 -2
- femagtools/multiproc.py +13 -4
- femagtools/parstudy.py +15 -7
- femagtools/plot.py +5 -5
- {femagtools-1.2.5.dist-info → femagtools-1.2.6.dist-info}/METADATA +1 -1
- {femagtools-1.2.5.dist-info → femagtools-1.2.6.dist-info}/RECORD +12 -12
- {femagtools-1.2.5.dist-info → femagtools-1.2.6.dist-info}/LICENSE +0 -0
- {femagtools-1.2.5.dist-info → femagtools-1.2.6.dist-info}/WHEEL +0 -0
- {femagtools-1.2.5.dist-info → femagtools-1.2.6.dist-info}/entry_points.txt +0 -0
- {femagtools-1.2.5.dist-info → femagtools-1.2.6.dist-info}/top_level.txt +0 -0
femagtools/__init__.py
CHANGED
femagtools/machine/effloss.py
CHANGED
@@ -2,6 +2,7 @@ import numpy as np
|
|
2
2
|
import scipy.interpolate as ip
|
3
3
|
import logging
|
4
4
|
from .utils import betai1
|
5
|
+
from .pm import PmRelMachineLdq
|
5
6
|
from . import create_from_eecpars
|
6
7
|
|
7
8
|
logger = logging.getLogger("femagtools.effloss")
|
@@ -67,29 +68,28 @@ def efficiency_losses_map(eecpars, u1, T, temp, n, npoints=(50, 40)):
|
|
67
68
|
else:
|
68
69
|
xtemp = [temp, temp]
|
69
70
|
m = create_from_eecpars(xtemp, eecpars)
|
70
|
-
else: # must be
|
71
|
+
else: # must be an instance of Machine
|
71
72
|
m = eecpars
|
72
73
|
if isinstance(T, list):
|
73
74
|
r = {'T': T, 'n': n}
|
74
75
|
rb = {'T': [], 'n': []}
|
75
|
-
else:
|
76
|
+
else: # calculate speed,torque charactersics
|
76
77
|
nmax = n
|
77
|
-
|
78
|
-
|
79
|
-
if min(
|
78
|
+
r = m.characteristics(T, nmax, u1) # driving mode
|
79
|
+
if isinstance(m, PmRelMachineLdq):
|
80
|
+
if min(m.betarange) >= -np.pi/2: # driving mode only
|
80
81
|
rb = {}
|
81
82
|
rb['n'] = None
|
82
83
|
rb['T'] = None
|
83
84
|
else:
|
84
85
|
rb = m.characteristics(-T, max(r['n']), u1) # braking mode
|
85
86
|
else:
|
86
|
-
r = m.characteristics(T, nmax, u1) # driving mode
|
87
87
|
rb = m.characteristics(-T, max(r['n']), u1) # braking mode
|
88
88
|
|
89
89
|
ntmesh = _generate_mesh(r['n'], r['T'],
|
90
90
|
rb['n'], rb['T'], npoints)
|
91
91
|
|
92
|
-
if
|
92
|
+
if isinstance(m, PmRelMachineLdq):
|
93
93
|
iqd = np.array([
|
94
94
|
m.iqd_torque_umax(
|
95
95
|
nt[1],
|
@@ -118,19 +118,17 @@ def efficiency_losses_map(eecpars, u1, T, temp, n, npoints=(50, 40)):
|
|
118
118
|
r['plcu1'].append(m.m*np.abs(i1)**2*m.rstat(w1))
|
119
119
|
r['plcu2'].append(m.m*np.abs(i2)**2*m.rrot(w1-m.p*wm))
|
120
120
|
|
121
|
-
tfric = eecpars['kfric_b']*eecpars['rotor_mass']*30e-3/np.pi
|
122
|
-
plfric = 2*np.pi*ntmesh[0]*tfric
|
123
|
-
ntmesh[1] -= tfric
|
124
|
-
pmech = np.array(
|
125
|
-
[2*np.pi*nt[0]*nt[1]
|
126
|
-
for nt in ntmesh.T])
|
127
121
|
|
128
|
-
if
|
122
|
+
if isinstance(m, PmRelMachineLdq):
|
129
123
|
plfe1 = m.iqd_plfe1(*iqd, f1)
|
130
124
|
plfe2 = m.iqd_plfe2(iqd[0], iqd[1], f1)
|
131
125
|
plmag = m.iqd_plmag(iqd[0], iqd[1], f1)
|
132
126
|
plcu1 = m.iqd_plcu1(iqd[0], iqd[1], 2*np.pi*f1)
|
133
127
|
plcu2 = m.iqd_plcu2(*iqd)
|
128
|
+
try:
|
129
|
+
tfric = eecpars['kfric_b']*eecpars['rotor_mass']*30e-3/np.pi
|
130
|
+
except:
|
131
|
+
tfric = 0
|
134
132
|
else:
|
135
133
|
plfe1 = np.array(r['plfe1'])
|
136
134
|
plfe2 = np.zeros(ntmesh.shape[1])
|
@@ -140,7 +138,13 @@ def efficiency_losses_map(eecpars, u1, T, temp, n, npoints=(50, 40)):
|
|
140
138
|
iqd = np.zeros(ntmesh.shape)
|
141
139
|
u1 = np.array(r['u1'])
|
142
140
|
i1 = np.array(r['i1'])
|
141
|
+
tfric = 0
|
143
142
|
|
143
|
+
plfric = 2*np.pi*ntmesh[0]*tfric
|
144
|
+
ntmesh[1] -= tfric
|
145
|
+
pmech = np.array(
|
146
|
+
[2*np.pi*nt[0]*nt[1]
|
147
|
+
for nt in ntmesh.T])
|
144
148
|
ploss = plfe1+plfe2+plmag+plcu1+plcu2+plfric
|
145
149
|
|
146
150
|
eta = []
|
femagtools/machine/pm.py
CHANGED
@@ -369,7 +369,7 @@ class PmRelMachine(object):
|
|
369
369
|
for nn in np.linspace(r['n'][-1]+dn, n2, nstab[1]):
|
370
370
|
w1 = 2*np.pi*nn*self.p
|
371
371
|
logger.debug("fieldweakening: n %g T %g i1max %g w1 %g u1 %g",
|
372
|
-
|
372
|
+
nn*60, T, i1max, w1, u1max)
|
373
373
|
iq, id = self.iqd_imax_umax(i1max, w1, u1max,
|
374
374
|
maxtorque=T > 0)
|
375
375
|
tq = self.torque_iqd(iq, id)
|
@@ -380,7 +380,7 @@ class PmRelMachine(object):
|
|
380
380
|
r['T'].append(tq)
|
381
381
|
else:
|
382
382
|
logger.warning("fieldweakening: n %g T %g i1max %g w1 %g u1 %g",
|
383
|
-
nn*60,
|
383
|
+
nn*60, T, i1max, w1, u1max)
|
384
384
|
|
385
385
|
if n2 < n3:
|
386
386
|
for nn in np.linspace(r['n'][-1]+dn/2, n3, nstab[2]):
|
femagtools/multiproc.py
CHANGED
@@ -28,6 +28,8 @@ logger = logging.getLogger(__name__)
|
|
28
28
|
|
29
29
|
numpat = re.compile(r'([+-]?\d+(?:\.\d+)?(?:[eE][+-]\d+)?)\s*')
|
30
30
|
|
31
|
+
class LicenseError(Exception):
|
32
|
+
pass
|
31
33
|
|
32
34
|
class ProtFile:
|
33
35
|
def __init__(self, dirname, num_cur_steps):
|
@@ -133,13 +135,20 @@ def run_femag(cmd, workdir, fslfile):
|
|
133
135
|
proc.wait()
|
134
136
|
os.remove(os.path.join(workdir, 'femag.pid'))
|
135
137
|
|
136
|
-
logger.info("Finished pid: %d return %d",
|
137
|
-
|
138
|
-
return proc.returncode
|
138
|
+
#logger.info("Finished pid: %d return %d",
|
139
|
+
# proc.pid, proc.returncode)
|
140
|
+
#return proc.returncode
|
139
141
|
except OSError as e:
|
140
142
|
logger.error("Starting process failed: %s, Command: %s", e, cmd)
|
141
143
|
raise
|
142
|
-
|
144
|
+
|
145
|
+
# raise License Error
|
146
|
+
if proc.returncode != 0:
|
147
|
+
with open(os.path.join(workdir, "femag.err"), "r") as err:
|
148
|
+
for line in err:
|
149
|
+
if 'license' in line:
|
150
|
+
raise LicenseError(line)
|
151
|
+
|
143
152
|
logger.info("Finished pid: %d return %d", proc.pid, proc.returncode)
|
144
153
|
return proc.returncode
|
145
154
|
|
femagtools/parstudy.py
CHANGED
@@ -258,6 +258,14 @@ class ParameterStudy(object):
|
|
258
258
|
prob.prepare(x, [fea, self.femag.magnets])
|
259
259
|
for m in modelfiles:
|
260
260
|
task.add_file(m)
|
261
|
+
set_magnet_properties(model, fea, self.femag.magnets)
|
262
|
+
task.add_file(
|
263
|
+
'femag.fsl',
|
264
|
+
builder.create_open(model) +
|
265
|
+
builder.create_fe_losses(model) +
|
266
|
+
builder.create_analysis(fea) +
|
267
|
+
['save_model("close")'])
|
268
|
+
|
261
269
|
else:
|
262
270
|
prob.prepare(x, [model, fea, self.femag.magnets])
|
263
271
|
logger.info("prepare %s", x)
|
@@ -266,13 +274,13 @@ class ParameterStudy(object):
|
|
266
274
|
dir=task.directory,
|
267
275
|
recsin=fea.recsin):
|
268
276
|
task.add_file(mc)
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
277
|
+
set_magnet_properties(model, fea, self.femag.magnets)
|
278
|
+
task.add_file(
|
279
|
+
'femag.fsl',
|
280
|
+
builder.create_model(model, self.femag.magnets) +
|
281
|
+
builder.create_analysis(fea) +
|
282
|
+
['save_model("close")'])
|
283
|
+
|
276
284
|
if hasattr(fea, 'poc'):
|
277
285
|
task.add_file(fea.pocfilename,
|
278
286
|
fea.poc.content())
|
femagtools/plot.py
CHANGED
@@ -1770,19 +1770,19 @@ def losses_map(rmap, ax=0, title='Losses Map / kW'):
|
|
1770
1770
|
plot_contour(rmap['n'], rmap['T'], np.asarray(rmap['losses'])/1e3, ax,
|
1771
1771
|
title=title, levels=14)
|
1772
1772
|
|
1773
|
-
def eigenmode(reigen, num_modes=12):
|
1773
|
+
def eigenmode(reigen, num_modes=12):
|
1774
1774
|
"""plot eigenmode"""
|
1775
1775
|
cols = 4
|
1776
1776
|
rows = int((num_modes - num_modes%cols)/cols + 1)
|
1777
1777
|
fig, ax = plt.subplots(rows, cols)
|
1778
1778
|
ctr = 0
|
1779
|
-
for i in range(rows):
|
1780
|
-
for j in range(cols):
|
1781
|
-
if ctr < num_modes:
|
1779
|
+
for i in range(rows):
|
1780
|
+
for j in range(cols):
|
1781
|
+
if ctr < num_modes:
|
1782
1782
|
ax[i, j].imshow(reigen[0][ctr])
|
1783
1783
|
ax[i, j].set_title(f'Freq: {reigen[1][ctr]:.2f} Hz')
|
1784
1784
|
ax[i, j].axis('off')
|
1785
|
-
else:
|
1785
|
+
else:
|
1786
1786
|
ax[i, j].remove()
|
1787
1787
|
ax[i, j] = None
|
1788
1788
|
ctr+=1
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: femagtools
|
3
|
-
Version: 1.2.
|
3
|
+
Version: 1.2.6
|
4
4
|
Summary: Python API for FEMAG
|
5
5
|
Author-email: Ronald Tanner <tar@semafor.ch>, Dapu Zhang <d.zhan@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=D8otEc8xuOdu07QoHG52Sy0kZeiKTeAr_zSFfuJoaoE,1630
|
2
2
|
femagtools/airgap.py,sha256=E3VywQpzJ5aaw7StGaf0xgbDqrWqO7vWhFXPh0I76bY,2250
|
3
3
|
femagtools/amazon.py,sha256=r9RRZVjKe6A7HUoRHmVpP-y1zfgJNvcPgW7mmeukvpk,12122
|
4
4
|
femagtools/amela.py,sha256=3z5X0DIF560CjrKH9xUeejDzCVyBkbCUg6ZbK5uoU1Q,9741
|
@@ -31,14 +31,14 @@ femagtools/mcv.py,sha256=SgrwppH61dJ653TTtTdjuvKZMOZBt9Tf3-8ApV_NK8s,38043
|
|
31
31
|
femagtools/me.py,sha256=XNK0l-aroNYfKyxV_uslE8q3vJb_KuntAYTWd-4FQaQ,1833
|
32
32
|
femagtools/model.py,sha256=OtQDZGGr4GlrprWbOPf1TJ-VF65kq2ix-02yFv7QD_g,14106
|
33
33
|
femagtools/moproblem.py,sha256=kOP8pRdD8YXz28_M2WKnFgl3eeJ7tqg49ohoazsmUOg,2825
|
34
|
-
femagtools/multiproc.py,sha256=
|
34
|
+
femagtools/multiproc.py,sha256=WWx0Tmm9O5VqF5nKH7n_9cqSuvXZ95i4VJ26MzTYI0c,8265
|
35
35
|
femagtools/mxw2msh.py,sha256=6FytyRtxMAO5vWRgZRWCQs04RFq7qiRy6hjOGb8NwpM,1841
|
36
36
|
femagtools/nc.py,sha256=o2-pjhl6EBh0ffriYkAVkvxQYwcmeEv_tlaeQ9ZD1X4,12781
|
37
37
|
femagtools/netlist.py,sha256=CSCl8setLZ_L8DCnNWaNA3-wLe1yo-fmzARZoVvYfaA,2052
|
38
38
|
femagtools/ntib.py,sha256=76g1ZO3Fq_kN-HTMBvaKvJmMMlJMyEPFeNAcJPq3w7Y,3099
|
39
39
|
femagtools/opt.py,sha256=Oak-C1_5iFZonwokB3ezB52fcZi5yiUEffjG1Tmgag8,8685
|
40
|
-
femagtools/parstudy.py,sha256=
|
41
|
-
femagtools/plot.py,sha256=
|
40
|
+
femagtools/parstudy.py,sha256=pxK3nBtYTSA9fbVdLUYB7Ic5N34bv7vl2qD8h3GnDSM,18733
|
41
|
+
femagtools/plot.py,sha256=b0FFLK3s72FhM1NVaGnytdSq7VfyAI7ZF_pba2eSQu0,57795
|
42
42
|
femagtools/poc.py,sha256=MN5DRL4vHycNzXSTt9kjuZP1yZ2I02NmrKQFsmRcbF0,6536
|
43
43
|
femagtools/tks.py,sha256=jgQ5dpKNPZg0ydwNGLBVjsL5WRsjfk9FtkZt3eoX79I,5791
|
44
44
|
femagtools/ts.py,sha256=vm3GzLG6lzkg_Z84U-ZCgYHhev-PPtNuGs1q-CKJ4rA,47280
|
@@ -58,9 +58,9 @@ femagtools/dxfsl/machine.py,sha256=nSWp0CaGrqBNSXEUDZ5qbuSVw5zUTsb7H1LfnNj0syY,2
|
|
58
58
|
femagtools/dxfsl/plotrenderer.py,sha256=f7ZTnD0HCLBzurUsVAqqZskTzLeKfhqtfHL32mXZcA4,12311
|
59
59
|
femagtools/dxfsl/shape.py,sha256=Y8P30bCHwUFsL4j-dy2hFiKi_1SPH9b6pNFI3vt9b0A,43088
|
60
60
|
femagtools/machine/__init__.py,sha256=xGjvNHfqZAuReCN98-6CpqwRIyfXPQAMZiSqAdqo9V8,5613
|
61
|
-
femagtools/machine/effloss.py,sha256=
|
61
|
+
femagtools/machine/effloss.py,sha256=UyoGT4UJkhQH8XLeNNp2z1HeojSeNTyj28D-PSV7ZWs,5604
|
62
62
|
femagtools/machine/im.py,sha256=hZlt66sf8x9H2Z5jdSzYoLPVUE11i1G1frPpYYuDi64,34847
|
63
|
-
femagtools/machine/pm.py,sha256=
|
63
|
+
femagtools/machine/pm.py,sha256=MfVYidX4ds2m0k9xt9iKf_H6csriwQOB0MK-WWH15kA,30631
|
64
64
|
femagtools/machine/sizing.py,sha256=4y4nShJYHBJTepl70tGUNqKhR2rd1bY5jZ0wektiDng,21743
|
65
65
|
femagtools/machine/sm.py,sha256=tYGqTuA49GUUsqGKurxUhgH5oCBNF0kjZ8SOjViN7Kc,14584
|
66
66
|
femagtools/machine/utils.py,sha256=QPmc7KbH6WuIMfroVO5h70LLcAPx2ioejxEvsS2cZzs,16143
|
@@ -129,9 +129,9 @@ femagtools/templates/statorRing.mako,sha256=sDgDmk71EoE8d4e9cmyqKqRldfC8uKMmpHEj
|
|
129
129
|
femagtools/templates/statorRotor3.mako,sha256=ipLrcve3Fjf3kWJB3hGmeoMgxmqLlX3gEfCuO3Zi2HI,4073
|
130
130
|
femagtools/templates/stator_msh.mako,sha256=Neze1ielMCk7TrARyhOra91fFQVT8Phsgk2Omt_aMG8,1799
|
131
131
|
femagtools/templates/torq_calc.mako,sha256=9Dxrf8XeMhA7mz2orBRGq8s1RG6Tn2RTAdDaBQkqzxg,1761
|
132
|
-
femagtools-1.2.
|
133
|
-
femagtools-1.2.
|
134
|
-
femagtools-1.2.
|
135
|
-
femagtools-1.2.
|
136
|
-
femagtools-1.2.
|
137
|
-
femagtools-1.2.
|
132
|
+
femagtools-1.2.6.dist-info/LICENSE,sha256=V5OED7AzEaOtvbfgNheKOSUeNtijvKQuo84FtSJNkJU,1316
|
133
|
+
femagtools-1.2.6.dist-info/METADATA,sha256=nT7PaH7xSrJ5H-52OGi3GhSptzzoKLyeky-W2SzpIH4,5714
|
134
|
+
femagtools-1.2.6.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
135
|
+
femagtools-1.2.6.dist-info/entry_points.txt,sha256=FZpd7JumQdJo-AZUyRA8-aJthK85jg37_qjRoDTY-Mo,191
|
136
|
+
femagtools-1.2.6.dist-info/top_level.txt,sha256=DScrn5RiUYKtaEVgcG3AMSWDUd2N8uqxk-gZY-2CaYk,11
|
137
|
+
femagtools-1.2.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|