femagtools 1.7.8__py3-none-any.whl → 1.8.0__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.
Files changed (54) hide show
  1. femagtools/__init__.py +1 -1
  2. femagtools/amela.py +2 -2
  3. femagtools/dxfsl/area.py +142 -9
  4. femagtools/dxfsl/conv.py +2 -9
  5. femagtools/dxfsl/converter.py +33 -9
  6. femagtools/dxfsl/fslrenderer.py +13 -12
  7. femagtools/dxfsl/geom.py +39 -6
  8. femagtools/dxfsl/journal.py +2 -2
  9. femagtools/dxfsl/machine.py +14 -13
  10. femagtools/dxfsl/shape.py +3 -0
  11. femagtools/dxfsl/svgparser.py +31 -4
  12. femagtools/ecloss.py +381 -2
  13. femagtools/femag.py +55 -0
  14. femagtools/fsl.py +74 -47
  15. femagtools/isa7.py +41 -0
  16. femagtools/job.py +2 -2
  17. femagtools/machine/afpm.py +5 -1
  18. femagtools/machine/pm.py +1 -1
  19. femagtools/machine/sm.py +14 -0
  20. femagtools/machine/utils.py +4 -3
  21. femagtools/mcv.py +128 -124
  22. femagtools/me.py +13 -13
  23. femagtools/model.py +14 -1
  24. femagtools/moo/population.py +9 -7
  25. femagtools/nc.py +12 -0
  26. femagtools/plot/__init__.py +1 -1
  27. femagtools/plot/fieldlines.py +1 -1
  28. femagtools/plot/mcv.py +18 -0
  29. femagtools/plot/nc.py +22 -5
  30. femagtools/plot/wdg.py +40 -7
  31. femagtools/svgfsl/converter.py +6 -0
  32. femagtools/templates/gen_hairpin_winding.mako +36 -45
  33. femagtools/templates/gen_winding.mako +7 -0
  34. femagtools/templates/magnetIron.mako +30 -46
  35. femagtools/templates/magnetIron2.mako +39 -0
  36. femagtools/templates/magnetIron3.mako +39 -0
  37. femagtools/templates/magnetIron4.mako +39 -0
  38. femagtools/templates/magnetIron5.mako +39 -0
  39. femagtools/templates/magnetIronV.mako +34 -54
  40. femagtools/templates/magnetSector.mako +32 -47
  41. femagtools/templates/mesh-airgap.mako +12 -6
  42. femagtools/templates/prepare_thermal.mako +354 -0
  43. femagtools/templates/statorRotor3.mako +3 -22
  44. femagtools/windings.py +92 -59
  45. {femagtools-1.7.8.dist-info → femagtools-1.8.0.dist-info}/METADATA +20 -18
  46. {femagtools-1.7.8.dist-info → femagtools-1.8.0.dist-info}/RECORD +53 -53
  47. {femagtools-1.7.8.dist-info → femagtools-1.8.0.dist-info}/WHEEL +1 -1
  48. tests/test_fsl.py +1 -1
  49. tests/test_mcv.py +106 -1
  50. tests/test_windings.py +18 -2
  51. tests/test_mcvwriter.py +0 -96
  52. {femagtools-1.7.8.dist-info → femagtools-1.8.0.dist-info}/LICENSE +0 -0
  53. {femagtools-1.7.8.dist-info → femagtools-1.8.0.dist-info}/entry_points.txt +0 -0
  54. {femagtools-1.7.8.dist-info → femagtools-1.8.0.dist-info}/top_level.txt +0 -0
femagtools/plot/wdg.py CHANGED
@@ -9,14 +9,38 @@ import numpy as np
9
9
  import matplotlib.pyplot as plt
10
10
 
11
11
 
12
+ def currdist(wdg, title='', k='all', phi=0, ax=0):
13
+ """plot current distribution of winding
14
+ Arguments:
15
+ k: (int) winding key (all if 0 or 'all', default all)
16
+ phi: (float) current angle (default 0)
17
+ """
18
+ if ax == 0:
19
+ ax = plt.gca()
20
+ if title:
21
+ ax.set_title(title)
22
+ cdist = wdg.currdist(k=k, phi=phi)
23
+ taus = 360/wdg.Q
24
+ c = np.sum([cdist[j] for j in cdist], axis=0)
25
+ pos = np.arange(0, len(cdist[1]))*taus + taus/2
26
+ cbars = ax.bar(pos, c/np.max(c), width=taus/4)
27
+ ax.set_xlabel("Position / Deg")
28
+ ax.grid()
29
+ return cbars
30
+
31
+
12
32
  def mmf(f, title='', ax=0):
13
- """plot magnetomotive force (mmf) of winding"""
33
+ """plot magnetomotive force (mmf) of winding
34
+ Arguments
35
+ f: (dict) windings mmf
36
+ title: (str) plot title
37
+ """
14
38
  if ax == 0:
15
39
  ax = plt.gca()
16
40
  if title:
17
41
  ax.set_title(title)
18
- ax.plot(np.array(f['pos'])/np.pi*180, f['mmf'])
19
- ax.plot(np.array(f['pos_fft'])/np.pi*180, f['mmf_fft'])
42
+ yphi = ax.plot(np.array(f['pos'])/np.pi*180, f['mmf'])
43
+ yfft = ax.plot(np.array(f['pos_fft'])/np.pi*180, f['mmf_fft'])
20
44
  ax.set_xlabel('Position / Deg')
21
45
 
22
46
  phi = [f['alfa0']/np.pi*180, f['alfa0']/np.pi*180]
@@ -28,7 +52,7 @@ def mmf(f, title='', ax=0):
28
52
  ax.annotate(f"", xy=(phi[0], y[0]),
29
53
  xytext=(0, y[0]), arrowprops=dict(arrowstyle="->"))
30
54
  ax.grid()
31
-
55
+ return yphi, yfft
32
56
 
33
57
  def mmf_fft(f, title='', mmfmin=1e-2, ax=0):
34
58
  """plot winding mmf harmonics"""
@@ -37,7 +61,16 @@ def mmf_fft(f, title='', mmfmin=1e-2, ax=0):
37
61
  if title:
38
62
  ax.set_title(title)
39
63
  else:
40
- ax.set_title('MMF Harmonics (per phase)')
64
+ def single_phase(f):
65
+ try:
66
+ return len(f['currdens']) == 1
67
+ except KeyError:
68
+ return True
69
+ if single_phase(f):
70
+ ax.set_title('MMF Harmonics (single phase)')
71
+ else:
72
+ ax.set_title('MMF Harmonics')
73
+
41
74
  ax.grid(True)
42
75
  order, mmf = np.array([(n, m) for n, m in zip(f['nue'],
43
76
  f['mmf_nue']) if m > mmfmin]).T
@@ -120,11 +153,11 @@ def winding_factors(wdg, n=8, ax=0):
120
153
  wdg.kwd(n),
121
154
  wdg.kw(n))]).T
122
155
  try:
123
- markerline1, stemlines1, _ = ax.stem(order-1, kwp,
156
+ markerline1, stemlines1, _ = ax.stem(order-0.5, kwp,
124
157
  'C1:', basefmt=" ",
125
158
  markerfmt='C1.',
126
159
  label='Pitch')
127
- markerline2, stemlines2, _ = ax.stem(order+1, kwd,
160
+ markerline2, stemlines2, _ = ax.stem(order+0.5, kwd,
128
161
  'C2:', basefmt=" ",
129
162
  markerfmt='C2.',
130
163
  label='Distribution')
@@ -20,6 +20,11 @@ def main():
20
20
  help='stator without airgap in/out',
21
21
  dest='stator',
22
22
  default='')
23
+ argparser.add_argument('--EESM',
24
+ help='Electric Excited Synchronous Motor',
25
+ dest='EESM',
26
+ action="store_true",
27
+ default=False)
23
28
  argparser.add_argument('-p', '--plot',
24
29
  help='show plots',
25
30
  dest='show_plots',
@@ -61,6 +66,7 @@ def main():
61
66
 
62
67
  res = convert(args.svgfile, # SVG-Filename
63
68
  part=part,
69
+ EESM=args.EESM,
64
70
  view_only=args.view,
65
71
  show_plots=args.show_plots,
66
72
  show_areas=args.show_areas,
@@ -1,9 +1,13 @@
1
1
  -- hairpin winding template
2
2
 
3
- rcoil, phi_coil = c2pd(m.xcoil_1, m.ycoil_1)
4
-
5
3
  slot_div_angle = 360/m.tot_num_slot
6
4
 
5
+ if m.xcoil_1 ~= nil and m.ycoil_1 ~= nil then
6
+ rcoil, phi_coil = c2pd(m.xcoil_1, m.ycoil_1)
7
+ else
8
+ rcoil, phi_coil = da1/2 + m.slot_height/2, slot_div_angle/2
9
+ end
10
+
7
11
  -- delete existing mesh in the slot
8
12
  for i = 1, m.num_sl_gen do
9
13
  xc, yc = pd2c(rcoil, phi_coil+(i-1)*slot_div_angle)
@@ -12,7 +16,7 @@ end
12
16
  -- wire params
13
17
  wire_height = ${model['wire']["wire_height"]*1e3}
14
18
  wire_width = ${model['wire']["wire_width"]*1e3}
15
- wire_corner_r = ${model['wire']["corner_radius"]*1e3}
19
+ wire_corner_r = 0.0
16
20
  wire_gap = ${model['wire']["wire_separation"]*1e3}
17
21
  TH1 = ${model['wire']["wire_th1"]*1e3} -- distance to the bore radius
18
22
  nwires = ${model['wire']["num_layers"]}
@@ -128,7 +132,7 @@ for j = 1, m.num_sl_gen do
128
132
  end
129
133
  end
130
134
 
131
- ndt(agndst)
135
+ ndt(agndst*1.5)
132
136
  for j = 1, m.num_sl_gen do
133
137
  for i = 1, nwires do
134
138
  dx, dy = x0+(wire_gap+wire_height)*(i-1), y0
@@ -142,8 +146,8 @@ create_mesh()
142
146
 
143
147
  -- create winding
144
148
 
145
- widfile = io.open("wid.fsl", 'r')
146
-
149
+ --widfile = io.open("wid.fsl", 'r')
150
+ widfile = io.open("wid.txt", 'r')
147
151
  nrows = 1
148
152
  winding = {}
149
153
 
@@ -158,52 +162,39 @@ for i in widfile:lines() do
158
162
  end
159
163
 
160
164
  --[[
161
-
162
165
  winding table
163
-
164
- 1 slot_go pos_in_slot slot_ret pos_in_slot
165
-
166
+ key slot layer dir
166
167
  ]]--
167
168
  dir = 'wi'
168
169
  cols = {"green", "yellow", "cyan"}
169
170
  wk = 1
170
171
  for i = 1, #winding do
171
- idx = winding[i][2]
172
- idxp = winding[i][3]
173
- idy = winding[i][4]
174
- idyp = winding[i][5]
175
-
176
- if i == 1 then
177
- if idx <= m.num_sl_gen then
178
- wkey = def_new_wdg(wire_xy[idx][idxp].x, wire_xy[idx][idxp].y, cols[winding[i][1]], "Phase"..winding[i][1], 1, 0, 0, dir)
179
- end
180
-
181
- if math.abs(idy) <= m.num_sl_gen then
182
- add_to_wdg (wire_xy[math.abs(idy)][idyp].x, wire_xy[math.abs(idy)][idyp].y, "wsamekey", "wo", "wser")
183
- end
184
- else
185
- if winding[i][1] == winding[i-1][1] and winding[i][1] == wk then
186
- if idx <= m.num_sl_gen then
187
- add_to_wdg (wire_xy[idx][idxp].x, wire_xy[idx][idxp].y, "wsamekey", dir, "wser")
188
- end
189
- if math.abs(idy) <= m.num_sl_gen then
190
- add_to_wdg (wire_xy[math.abs(idy)][idyp].x, wire_xy[math.abs(idy)][idyp].y, "wsamekey", "wo", "wser")
191
- end
192
- else
193
- if idx <= m.num_sl_gen then
194
- wkey = def_new_wdg(wire_xy[idx][idxp].x, wire_xy[idx][idxp].y, cols[winding[i][1]], "Phase"..winding[i][1], 1, 0, 0, dir)
195
- wk = wk + 1
196
- end
197
- if math.abs(idy) <= m.num_sl_gen then
198
- if wk == winding[i][1] then
199
- add_to_wdg (wire_xy[math.abs(idy)][idyp].x, wire_xy[math.abs(idy)][idyp].y, "wsamekey", "wo", "wser")
200
- else
201
- wkey = def_new_wdg(wire_xy[math.abs(idy)][idyp].x, wire_xy[math.abs(idy)][idyp].y, cols[winding[i][1]], "Phase"..winding[i][1], 1, 0, 0, "wo")
172
+ windingskey = winding[i][1]
173
+ slot_nr = winding[i][2]
174
+ layer = winding[i][3]
175
+ direction = winding[i][4]
176
+ if direction < 0 then
177
+ dir = 'wo'
178
+ else
179
+ dir = 'wi'
180
+ end
181
+ if i == 1 then
182
+ if slot_nr <= m.num_sl_gen then
183
+ wkey = def_new_wdg(wire_xy[slot_nr][layer].x, wire_xy[slot_nr][layer].y, cols[winding[i][1]], "Phase"..winding[i][1], 1, 0, 0, dir)
184
+ end
185
+
186
+ else
187
+ if winding[i][1] == winding[i-1][1] and winding[i][1] == wk then
188
+ if slot_nr <= m.num_sl_gen then
189
+ add_to_wdg (wire_xy[slot_nr][layer].x, wire_xy[slot_nr][layer].y, "wsamekey", dir, "wser")
190
+ end
191
+
192
+ else
193
+ if slot_nr <= m.num_sl_gen then
194
+ wkey = def_new_wdg(wire_xy[slot_nr][layer].x, wire_xy[slot_nr][layer].y, cols[winding[i][1]], "Phase"..winding[i][1], 1, 0, 0, dir)
202
195
  wk = wk + 1
203
- end
204
- end
205
- end
196
+ end
197
+ end
206
198
  end
207
199
  end
208
-
209
200
  m.num_par_wdgs = ${model.get('num_par_wdgs', 1)}
@@ -88,6 +88,12 @@ m.num_poles = ${model.poles}
88
88
 
89
89
  % if 'thcap' in model.winding:
90
90
  -- Thermal Material properties
91
+
92
+ conductor_density = ${model.winding['spmaweight']*1e3}
93
+ conductor_thcond = ${model.winding['thcond']}
94
+ conductor_thcap = ${model.winding['thcap']}
95
+
96
+ --[[
91
97
  if m.slot_height ~= nil then
92
98
  -- FEMAG slot model
93
99
  -- TODO: slot model from user
@@ -114,4 +120,5 @@ if m.slot_height ~= nil then
114
120
  end
115
121
  end
116
122
  end
123
+ ]]--
117
124
  %endif
@@ -1,4 +1,3 @@
1
-
2
1
  m.magn_rad = da2/2
3
2
  m.yoke_rad = dy2/2
4
3
 
@@ -39,58 +38,43 @@ for i = 0, m.npols_gen-1 do
39
38
  end
40
39
  end
41
40
  %endif
42
- %if model.get('thcond', 0) and model.get('thcap', 0):
41
+
42
+ %if model.get('thcond', 0) and model.get('thcap', 0) and model.get('density', 0):
43
+ if m.shaft_rad == nil then
44
+ m.shaft_rad = dy2/2
45
+ end
46
+ if m.shaft_rad > dy2/2 then
47
+ m.shaft_rad = dy2/2
48
+ end
43
49
  beta = math.pi/m.num_poles
44
- xrb,yrb = pr2c(m.yoke_rad+0.1, beta) -- rotor lamination
45
- thcond = ${model['thcond']}
46
- thcap = ${model['thcap']}
47
- density = ${model.get('density')*1e3}
48
- def_mat_therm(xrb,yrb,'blue',density,thcond,thcap,1)
50
+ rotor_thcond = ${model['thcond']}
51
+ rotor_thcap = ${model['thcap']}
52
+ rotor_density = ${model.get('density')}
49
53
 
50
54
  %if model.get('thcond_shaft', 0) and model.get('thcap_shaft', 0):
51
55
  if m.shaft_rad < m.yoke_rad then
52
- thcond = ${model['thcond_shaft']}
53
- thcap = ${model['thcap_shaft']}
54
- density = ${model['spmaweight_shaft']*1e3}
55
- def_mat_therm(m.yoke_rad/2,0.1,'blue',density,thcond,thcap,1) -- Shaft
56
+ shaft_thcond = ${model['thcond_shaft']}
57
+ shaft_thcap = ${model['thcap_shaft']}
58
+ shaft_density = ${model['spmaweight_shaft']*1e3}
59
+ r_shaft = (m.shaft_rad + m.yoke_rad)/2
60
+ x0_shaft, y0_shaft = pd2c(r_shaft, beta/2)
56
61
  end
57
62
  %endif
58
- rm = m.magn_rad*math.cos(beta)
59
- density = ${model['spmaweight_magnet']*1e3}
60
- thcond = ${model.get('thcond_magnet', 8)}
61
- thcap = ${model.get('thcap_magnet', 440)}
62
- for i = 1,m.npols_gen do -- Magnete
63
- alfa = (2*i-1) * beta
64
- xmx,ymx = pr2c(rm,alfa)
65
- def_mat_therm(xmx,ymx,darkgreen-i%2,density,thcond,thcap,1)
66
- end
67
-
68
- if m.air_triangle > 0 then
69
- rs = math.sqrt(rm^2 + m.magn_width^2/4)
70
- gam = math.atan(m.magn_width/2, rm)
71
- for i = 1,m.npols_gen do -- air triangle
72
- alfa = (2*i-1) * beta
73
- xsx,ysx = pr2c(rs,alfa + gam + 1e-2)
74
- def_mat_therm(xsx,ysx,skyblue,1.12,0.026,1007,1)
75
- xsx,ysx = pr2c(rs,alfa - gam - 1e-2)
76
- def_mat_therm(xsx,ysx,skyblue,1.12,0.026,1007,1)
77
- end
78
- end
79
-
80
63
 
81
- -- add air layer (inside) for heat transfer
82
- h = 3.8
83
- beta = 360*m.npols_gen/m.num_poles
64
+ if x0_shaft == nil then
65
+ -- add air layer (inside) for heat transfer
66
+ h = 3.8
67
+ beta = 360*m.npols_gen/m.num_poles
84
68
 
85
-
86
- x0, y0 = pd2c(m.shaft_rad, m.zeroangl)
87
- x1, y1 = pd2c(m.shaft_rad-h, m.zeroangl)
88
- x2, y2 = pd2c(m.shaft_rad-h, beta+m.zeroangl)
89
- x3, y3 = pd2c(m.shaft_rad, beta+m.zeroangl)
90
- nc_line(x0, y0, x1, y1, 0)
91
- nc_circle(x1, y1, x2, y2, 0)
92
- nc_line(x2, y2, x3, y3, 0)
93
- x0, y0 = pd2c(m.shaft_rad-h/2, beta/2+m.zeroangl)
94
- create_mesh_se(x0, y0)
69
+ x0, y0 = pd2c(m.shaft_rad, m.zeroangl)
70
+ x1, y1 = pd2c(m.shaft_rad-h, m.zeroangl)
71
+ x2, y2 = pd2c(m.shaft_rad-h, beta+m.zeroangl)
72
+ x3, y3 = pd2c(m.shaft_rad, beta+m.zeroangl)
73
+ nc_line(x0, y0, x1, y1, 0)
74
+ nc_circle(x1, y1, x2, y2, 0)
75
+ nc_line(x2, y2, x3, y3, 0)
76
+ x0, y0 = pd2c(m.shaft_rad-h/2, beta/2+m.zeroangl)
77
+ create_mesh_se(x0, y0)
78
+ end
95
79
 
96
80
  %endif
@@ -41,3 +41,42 @@ for i = 0, m.npols_gen-1 do
41
41
  end
42
42
  end
43
43
  %endif
44
+ %if model.get('thcond', 0) and model.get('thcap', 0) and model.get('density', 0):
45
+ if m.shaft_rad == nil then
46
+ m.shaft_rad = dy2/2
47
+ end
48
+ if m.shaft_rad > dy2/2 then
49
+ m.shaft_rad = dy2/2
50
+ end
51
+ beta = math.pi/m.num_poles
52
+ rotor_thcond = ${model['thcond']}
53
+ rotor_thcap = ${model['thcap']}
54
+ rotor_density = ${model.get('density')}
55
+
56
+ %if model.get('thcond_shaft', 0) and model.get('thcap_shaft', 0):
57
+ if m.shaft_rad < m.yoke_rad then
58
+ shaft_thcond = ${model['thcond_shaft']}
59
+ shaft_thcap = ${model['thcap_shaft']}
60
+ shaft_density = ${model['spmaweight_shaft']*1e3}
61
+ r_shaft = (m.shaft_rad + m.yoke_rad)/2
62
+ x0_shaft, y0_shaft = pd2c(r_shaft, beta/2)
63
+ end
64
+ %endif
65
+
66
+ if x0_shaft == nil then
67
+ -- add air layer (inside) for heat transfer
68
+ h = 3.8
69
+ beta = 360*m.npols_gen/m.num_poles
70
+
71
+ x0, y0 = pd2c(m.shaft_rad, m.zeroangl)
72
+ x1, y1 = pd2c(m.shaft_rad-h, m.zeroangl)
73
+ x2, y2 = pd2c(m.shaft_rad-h, beta+m.zeroangl)
74
+ x3, y3 = pd2c(m.shaft_rad, beta+m.zeroangl)
75
+ nc_line(x0, y0, x1, y1, 0)
76
+ nc_circle(x1, y1, x2, y2, 0)
77
+ nc_line(x2, y2, x3, y3, 0)
78
+ x0, y0 = pd2c(m.shaft_rad-h/2, beta/2+m.zeroangl)
79
+ create_mesh_se(x0, y0)
80
+ end
81
+
82
+ %endif
@@ -65,3 +65,42 @@ end
65
65
  end
66
66
 
67
67
  %endif
68
+ %if model.get('thcond', 0) and model.get('thcap', 0) and model.get('density', 0):
69
+ if m.shaft_rad == nil then
70
+ m.shaft_rad = dy2/2
71
+ end
72
+ if m.shaft_rad > dy2/2 then
73
+ m.shaft_rad = dy2/2
74
+ end
75
+ beta = math.pi/m.num_poles
76
+ rotor_thcond = ${model['thcond']}
77
+ rotor_thcap = ${model['thcap']}
78
+ rotor_density = ${model.get('density')}
79
+
80
+ %if model.get('thcond_shaft', 0) and model.get('thcap_shaft', 0):
81
+ if m.shaft_rad < m.yoke_rad then
82
+ shaft_thcond = ${model['thcond_shaft']}
83
+ shaft_thcap = ${model['thcap_shaft']}
84
+ shaft_density = ${model['spmaweight_shaft']*1e3}
85
+ r_shaft = (m.shaft_rad + m.yoke_rad)/2
86
+ x0_shaft, y0_shaft = pd2c(r_shaft, beta/2)
87
+ end
88
+ %endif
89
+
90
+ if x0_shaft == nil then
91
+ -- add air layer (inside) for heat transfer
92
+ h = 3.8
93
+ beta = 360*m.npols_gen/m.num_poles
94
+
95
+ x0, y0 = pd2c(m.shaft_rad, m.zeroangl)
96
+ x1, y1 = pd2c(m.shaft_rad-h, m.zeroangl)
97
+ x2, y2 = pd2c(m.shaft_rad-h, beta+m.zeroangl)
98
+ x3, y3 = pd2c(m.shaft_rad, beta+m.zeroangl)
99
+ nc_line(x0, y0, x1, y1, 0)
100
+ nc_circle(x1, y1, x2, y2, 0)
101
+ nc_line(x2, y2, x3, y3, 0)
102
+ x0, y0 = pd2c(m.shaft_rad-h/2, beta/2+m.zeroangl)
103
+ create_mesh_se(x0, y0)
104
+ end
105
+
106
+ %endif
@@ -40,3 +40,42 @@ for i = 0, m.npols_gen-1 do
40
40
  end
41
41
  end
42
42
  %endif
43
+ %if model.get('thcond', 0) and model.get('thcap', 0):
44
+ if m.shaft_rad == nil then
45
+ m.shaft_rad = dy2/2
46
+ end
47
+ if m.shaft_rad > dy2/2 then
48
+ m.shaft_rad = dy2/2
49
+ end
50
+ beta = math.pi/m.num_poles
51
+ rotor_thcond = ${model['thcond']}
52
+ rotor_thcap = ${model['thcap']}
53
+ rotor_density = ${model.get('density')}
54
+
55
+ %if model.get('thcond_shaft', 0) and model.get('thcap_shaft', 0) and model.get('density', 0):
56
+ if m.shaft_rad < m.yoke_rad then
57
+ shaft_thcond = ${model['thcond_shaft']}
58
+ shaft_thcap = ${model['thcap_shaft']}
59
+ shaft_density = ${model['spmaweight_shaft']*1e3}
60
+ r_shaft = (m.shaft_rad + m.yoke_rad)/2
61
+ x0_shaft, y0_shaft = pd2c(r_shaft, beta/2)
62
+ end
63
+ %endif
64
+
65
+ if x0_shaft == nil then
66
+ -- add air layer (inside) for heat transfer
67
+ h = 3.8
68
+ beta = 360*m.npols_gen/m.num_poles
69
+
70
+ x0, y0 = pd2c(m.shaft_rad, m.zeroangl)
71
+ x1, y1 = pd2c(m.shaft_rad-h, m.zeroangl)
72
+ x2, y2 = pd2c(m.shaft_rad-h, beta+m.zeroangl)
73
+ x3, y3 = pd2c(m.shaft_rad, beta+m.zeroangl)
74
+ nc_line(x0, y0, x1, y1, 0)
75
+ nc_circle(x1, y1, x2, y2, 0)
76
+ nc_line(x2, y2, x3, y3, 0)
77
+ x0, y0 = pd2c(m.shaft_rad-h/2, beta/2+m.zeroangl)
78
+ create_mesh_se(x0, y0)
79
+ end
80
+
81
+ %endif
@@ -40,3 +40,42 @@ for i = 0, m.npols_gen-1 do
40
40
  end
41
41
  end
42
42
  %endif
43
+ %if model.get('thcond', 0) and model.get('thcap', 0) and model.get('density', 0):
44
+ if m.shaft_rad == nil then
45
+ m.shaft_rad = dy2/2
46
+ end
47
+ if m.shaft_rad > dy2/2 then
48
+ m.shaft_rad = dy2/2
49
+ end
50
+ beta = math.pi/m.num_poles
51
+ rotor_thcond = ${model['thcond']}
52
+ rotor_thcap = ${model['thcap']}
53
+ rotor_density = ${model.get('density')}
54
+
55
+ %if model.get('thcond_shaft', 0) and model.get('thcap_shaft', 0):
56
+ if m.shaft_rad < m.yoke_rad then
57
+ shaft_thcond = ${model['thcond_shaft']}
58
+ shaft_thcap = ${model['thcap_shaft']}
59
+ shaft_density = ${model['spmaweight_shaft']*1e3}
60
+ r_shaft = (m.shaft_rad + m.yoke_rad)/2
61
+ x0_shaft, y0_shaft = pd2c(r_shaft, beta/2)
62
+ end
63
+ %endif
64
+
65
+ if x0_shaft == nil then
66
+ -- add air layer (inside) for heat transfer
67
+ h = 3.8
68
+ beta = 360*m.npols_gen/m.num_poles
69
+
70
+ x0, y0 = pd2c(m.shaft_rad, m.zeroangl)
71
+ x1, y1 = pd2c(m.shaft_rad-h, m.zeroangl)
72
+ x2, y2 = pd2c(m.shaft_rad-h, beta+m.zeroangl)
73
+ x3, y3 = pd2c(m.shaft_rad, beta+m.zeroangl)
74
+ nc_line(x0, y0, x1, y1, 0)
75
+ nc_circle(x1, y1, x2, y2, 0)
76
+ nc_line(x2, y2, x3, y3, 0)
77
+ x0, y0 = pd2c(m.shaft_rad-h/2, beta/2+m.zeroangl)
78
+ create_mesh_se(x0, y0)
79
+ end
80
+
81
+ %endif
@@ -68,62 +68,42 @@ for i = 0, m.npols_gen-1 do
68
68
  end
69
69
  %endif
70
70
 
71
- %if model.get('thcond', 0) and model.get('thcap', 0):
72
- beta = math.pi/m.num_poles + m.zeroangl/180*math.pi
73
- xrb,yrb = pr2c(m.yoke_rad+0.1, beta) -- rotor lamination
74
- thcond = ${model['thcond']}
75
- thcap = ${model['thcap']}
76
- def_mat_therm(xrb,yrb,'blue',7700,thcond,thcap,1)
77
- --def_mat_therm(m.yoke_rad/2,0.1,'blue',7700,thcond,thcap,1) -- Shaft
78
-
79
- gam = m.magn_angle/2/180*math.pi
80
- y = m.rotor_rad*math.sin(beta)
81
- x = m.rotor_rad*math.cos(beta)
82
- rr = y/math.sin(gam)
83
- xx = x - math.sqrt(rr^2 - y^2)
84
- rm = xx/(math.cos(beta/2) - math.sin(beta/2)/math.tan(gam))
85
- thcon = 8
86
- thcap = 440
87
- for i = 1,m.npols_gen do -- Magnets
88
- alfa = (2*i-1) * beta
89
- xmx,ymx = pr2c(rm,alfa-beta/2)
90
- def_mat_therm(xmx,ymx,darkgreen-i%2,7500,thcond,thcap,1)
91
- xmx,ymx = pr2c(rm,alfa+beta/2)
92
- def_mat_therm(xmx,ymx,darkgreen-i%2,7500,thcond,thcap,1)
71
+ %if model.get('thcond', 0) and model.get('thcap', 0) and model.get('density', 0):
72
+ if m.shaft_rad == nil then
73
+ m.shaft_rad = dy2/2
74
+ end
75
+ if m.shaft_rad > dy2/2 then
76
+ m.shaft_rad = dy2/2
77
+ end
78
+ beta = math.pi/m.num_poles
79
+ rotor_thcond = ${model['thcond']}
80
+ rotor_thcap = ${model['thcap']}
81
+ rotor_density = ${model.get('density')}
82
+
83
+ %if model.get('thcond_shaft', 0) and model.get('thcap_shaft', 0):
84
+ if m.shaft_rad < m.yoke_rad then
85
+ shaft_thcond = ${model['thcond_shaft']}
86
+ shaft_thcap = ${model['thcap_shaft']}
87
+ shaft_density = ${model['spmaweight_shaft']*1e3}
88
+ r_shaft = (m.shaft_rad + m.yoke_rad)/2
89
+ x0_shaft, y0_shaft = pd2c(r_shaft, beta/2)
93
90
  end
91
+ %endif
94
92
 
95
- thcond = 0.026 -- air
96
- thcap = 1007
97
- get_spel_keys("sekeys") -- Get all subregions of the model
98
- for i=1, #sekeys do
99
- srkey = get_spel_data("srkey", sekeys[i])
100
- if srkey > 0 then
101
- srname = get_sreg_data("name",srkey)
102
- if srname == ' ' then
103
- srkey = 0
104
- end
105
- end
106
- if srkey == 0 then
107
- elkeys = get_spel_data("elkeys", sekeys[i])
108
- Ex, Ey = get_elem_data("xycp", elkeys[1])
109
- r, phi = c2pr(Ex, Ey)
110
- if r < m.rotor_rad then -- rotor only
111
- def_mat_therm(Ex,Ey,'skyblue',1.12,thcond,thcap,1)
112
- end
113
- end
93
+ if x0_shaft == nil then
94
+ -- add air layer (inside) for heat transfer
95
+ h = 3.8
96
+ beta = 360*m.npols_gen/m.num_poles
97
+
98
+ x0, y0 = pd2c(m.shaft_rad, m.zeroangl)
99
+ x1, y1 = pd2c(m.shaft_rad-h, m.zeroangl)
100
+ x2, y2 = pd2c(m.shaft_rad-h, beta+m.zeroangl)
101
+ x3, y3 = pd2c(m.shaft_rad, beta+m.zeroangl)
102
+ nc_line(x0, y0, x1, y1, 0)
103
+ nc_circle(x1, y1, x2, y2, 0)
104
+ nc_line(x2, y2, x3, y3, 0)
105
+ x0, y0 = pd2c(m.shaft_rad-h/2, beta/2+m.zeroangl)
106
+ create_mesh_se(x0, y0)
114
107
  end
115
108
 
116
- -- add air layer (inside) for heat transfer
117
- h = 3.8
118
- beta = 360*m.npols_gen/m.num_poles
119
- x0, y0 = pd2c(dy2/2, m.zeroangl)
120
- x1, y1 = pd2c(dy2/2-h, m.zeroangl)
121
- x2, y2 = pd2c(dy2/2-h, beta+m.zeroangl)
122
- x3, y3 = pd2c(dy2/2, beta+m.zeroangl)
123
- nc_line(x0, y0, x1, y1, 0)
124
- nc_circle(x1, y1, x2, y2, 0)
125
- nc_line(x2, y2, x3, y3, 0)
126
- x0, y0 = pd2c(dy2/2-h/2, beta/2+m.zeroangl)
127
- create_mesh_se(x0, y0)
128
-
129
109
  %endif