fiqus 2026.1.0__py3-none-any.whl → 2026.1.2__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.
- fiqus/MainFiQuS.py +1 -8
- fiqus/data/DataConductor.py +4 -8
- fiqus/data/DataFiQuSMultipole.py +358 -167
- fiqus/data/DataModelCommon.py +30 -15
- fiqus/data/DataMultipole.py +33 -10
- fiqus/data/DataWindingsCCT.py +37 -37
- fiqus/data/RegionsModelFiQuS.py +1 -1
- fiqus/geom_generators/GeometryMultipole.py +751 -54
- fiqus/getdp_runners/RunGetdpMultipole.py +181 -31
- fiqus/mains/MainMultipole.py +109 -17
- fiqus/mesh_generators/MeshCCT.py +209 -209
- fiqus/mesh_generators/MeshMultipole.py +938 -263
- fiqus/parsers/ParserCOND.py +2 -1
- fiqus/parsers/ParserDAT.py +16 -16
- fiqus/parsers/ParserGetDPOnSection.py +212 -212
- fiqus/parsers/ParserGetDPTimeTable.py +134 -134
- fiqus/parsers/ParserMSH.py +53 -53
- fiqus/parsers/ParserRES.py +142 -142
- fiqus/plotters/PlotPythonCCT.py +133 -133
- fiqus/plotters/PlotPythonMultipole.py +18 -18
- fiqus/post_processors/PostProcessMultipole.py +16 -6
- fiqus/pre_processors/PreProcessCCT.py +175 -175
- fiqus/pro_assemblers/ProAssembler.py +3 -3
- fiqus/pro_material_functions/ironBHcurves.pro +246 -246
- fiqus/pro_templates/combined/CC_Module.pro +1213 -0
- fiqus/pro_templates/combined/ConductorAC_template.pro +1025 -0
- fiqus/pro_templates/combined/Multipole_template.pro +2738 -1338
- fiqus/pro_templates/combined/TSA_materials.pro +102 -2
- fiqus/pro_templates/combined/materials.pro +54 -3
- fiqus/utils/Utils.py +18 -25
- fiqus/utils/update_data_settings.py +1 -1
- {fiqus-2026.1.0.dist-info → fiqus-2026.1.2.dist-info}/METADATA +64 -68
- {fiqus-2026.1.0.dist-info → fiqus-2026.1.2.dist-info}/RECORD +42 -40
- {fiqus-2026.1.0.dist-info → fiqus-2026.1.2.dist-info}/WHEEL +1 -1
- tests/test_geometry_generators.py +29 -32
- tests/test_mesh_generators.py +35 -34
- tests/test_solvers.py +32 -31
- tests/utils/fiqus_test_classes.py +396 -147
- tests/utils/generate_reference_files_ConductorAC.py +57 -57
- tests/utils/helpers.py +76 -1
- {fiqus-2026.1.0.dist-info → fiqus-2026.1.2.dist-info}/LICENSE.txt +0 -0
- {fiqus-2026.1.0.dist-info → fiqus-2026.1.2.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,1213 @@
|
|
|
1
|
+
|
|
2
|
+
// Resistivities for magnetostatic simulations:
|
|
3
|
+
{% macro MATERIAL_Resistivity_Copper_T_B(RRR="None", RRRRefTemp="None", T="None", BMagnitude="Norm[$1]") -%}
|
|
4
|
+
CFUN_rhoCu_T_B[<<T>>, <<BMagnitude>>]{<<RRR>>}
|
|
5
|
+
{%- endmacro %}
|
|
6
|
+
{% macro MATERIAL_Resistivity_Copper_T(RRR="None", RRRRefTemp="None", T="$1", BMagnitude="5") -%}
|
|
7
|
+
CFUN_rhoCu_T[<<T>>]{<<BMagnitude>>, <<RRR>>}
|
|
8
|
+
{%- endmacro %}
|
|
9
|
+
|
|
10
|
+
{% macro MATERIAL_Resistivity_Hastelloy_T(RRR="None", RRRRefTemp="None", T="$1", BMagnitude="5") -%}
|
|
11
|
+
CFUN_rhoHast_T[<<T>>]
|
|
12
|
+
{%- endmacro %}
|
|
13
|
+
|
|
14
|
+
{% macro MATERIAL_Resistivity_Silver_T_B(RRR="None", RRRRefTemp="None", T="None", BMagnitude="Norm[$1]") -%}
|
|
15
|
+
CFUN_rhoAg_T_B[<<T>>, <<BMagnitude>>]{<<RRR>>, <<RRRRefTemp>>}
|
|
16
|
+
{%- endmacro %}
|
|
17
|
+
{% macro MATERIAL_Resistivity_Silver_T(RRR="None", RRRRefTemp="None", T="$1", BMagnitude="5") -%}
|
|
18
|
+
CFUN_rhoAg_T[<<T>>]{<<BMagnitude>>, <<RRR>>, <<RRRRefTemp>>}
|
|
19
|
+
{%- endmacro %}
|
|
20
|
+
|
|
21
|
+
{% macro MATERIAL_Resistivity_Indium_T(RRR="None", RRRRefTemp="None", T="$1", BMagnitude="5") -%}
|
|
22
|
+
CFUN_rhoIn_T[<<T>>]
|
|
23
|
+
{%- endmacro %}
|
|
24
|
+
|
|
25
|
+
{% macro MATERIAL_Resistivity_SSteel_T(RRR="None", RRRRefTemp="None", T="$1", BMagnitude="5") -%}
|
|
26
|
+
CFUN_rhoSS_T[<<T>>]
|
|
27
|
+
{%- endmacro %}
|
|
28
|
+
// AUX Function
|
|
29
|
+
{%- macro increment(dct, key, inc=1)-%}
|
|
30
|
+
{%- do dct.update({key: dct[key] + inc}) -%}
|
|
31
|
+
{%- endmacro -%}
|
|
32
|
+
//Regions
|
|
33
|
+
{%- macro cliq_regions(dm,CLIQ_dict,aux) %}
|
|
34
|
+
{% set counter = {"counter1": 0} %}
|
|
35
|
+
{% set CLIQ_groups = [] -%}
|
|
36
|
+
|
|
37
|
+
{%- set group_to_coil_section = dm.magnet.solve.coil_windings.group_to_coil_section %}
|
|
38
|
+
{% set unique_coils = group_to_coil_section | unique %}
|
|
39
|
+
{% set max_coil = group_to_coil_section | max %}
|
|
40
|
+
{% set elec_order = dm.magnet.solve.coil_windings.electrical_pairs.overwrite_electrical_order %}
|
|
41
|
+
{% set group_together = dm.magnet.solve.coil_windings.electrical_pairs.group_together %}
|
|
42
|
+
{% set helper = {"first_group": none, "last_group": none} %}
|
|
43
|
+
|
|
44
|
+
{%- set CLIQ_leads = [] %}
|
|
45
|
+
{% set CLIQ_groups = [] %}
|
|
46
|
+
{% set CLIQ_Units = 0 -%}
|
|
47
|
+
|
|
48
|
+
{#- Iterate over unique coil numbers greater than 1 #}
|
|
49
|
+
{% for coil in unique_coils if coil > 1 %}
|
|
50
|
+
{% set coil_groups = [] %}
|
|
51
|
+
{%- for group in group_to_coil_section %}
|
|
52
|
+
{% if group == coil %}
|
|
53
|
+
{% do coil_groups.append(loop.index) %} {# Use loop.index0 for zero-based index #}
|
|
54
|
+
{% endif %}
|
|
55
|
+
{% endfor -%}
|
|
56
|
+
|
|
57
|
+
{#- Find the first and last groups in electrical order #}
|
|
58
|
+
{% do helper.update({"first_group": none, "last_group": none}) %}
|
|
59
|
+
{% for pair in group_together %}
|
|
60
|
+
{% if pair[0] in coil_groups or pair[1] in coil_groups %}
|
|
61
|
+
{% if helper["first_group"] is none %}
|
|
62
|
+
{% do helper.update({"first_group": pair[0] if pair[0] in coil_groups else pair[1]}) %}
|
|
63
|
+
{% endif %}
|
|
64
|
+
{% do helper.update({"last_group": pair[1] if pair[1] in coil_groups else pair[0]}) %}
|
|
65
|
+
{% endif %}
|
|
66
|
+
{% endfor %}
|
|
67
|
+
|
|
68
|
+
{#- Get the first and last leads for the current coil based on electrical order #}
|
|
69
|
+
{% set first_lead = aux.half_turns.ht[helper["first_group"]][0] %}
|
|
70
|
+
{% set last_lead = aux.half_turns.ht[helper["last_group"]][-1] -%}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
{#- Determine the indices of the leads in elec_order #}
|
|
74
|
+
{% set first_lead_index = elec_order.index(first_lead) %}
|
|
75
|
+
{% set last_lead_index = elec_order.index(last_lead) %}
|
|
76
|
+
|
|
77
|
+
{#- Append the indices to the appropriate list -#}
|
|
78
|
+
{% do CLIQ_leads.append(first_lead_index) %}
|
|
79
|
+
{% do CLIQ_leads.append(last_lead_index) %}
|
|
80
|
+
{%- do CLIQ_groups.append(coil_groups) -%}
|
|
81
|
+
<< increment(counter, "counter1") >>
|
|
82
|
+
{%- endfor -%}
|
|
83
|
+
|
|
84
|
+
{%- set CLIQ_Units = counter["counter1"] -%}
|
|
85
|
+
|
|
86
|
+
{#- Update CLIQ_dict with the required information #}
|
|
87
|
+
{% do CLIQ_dict.update({
|
|
88
|
+
"Units": CLIQ_Units,
|
|
89
|
+
"groups": CLIQ_groups,
|
|
90
|
+
"leads": CLIQ_leads
|
|
91
|
+
}) %}
|
|
92
|
+
{%- endmacro -%}
|
|
93
|
+
|
|
94
|
+
{%- macro esc_regions(dm,ESC_dict,aux) %}
|
|
95
|
+
{% set counter = {"counter1": 0} %}
|
|
96
|
+
{% set ESC_groups = [] -%}
|
|
97
|
+
{%- set ESC_leads = [] %}
|
|
98
|
+
{% set ESC_groups = [] %}
|
|
99
|
+
{% set ESC_Units = 0 -%}
|
|
100
|
+
|
|
101
|
+
{%- set group_to_coil_section = dm.magnet.solve.coil_windings.group_to_coil_section %}
|
|
102
|
+
{% set group_together = dm.magnet.solve.coil_windings.electrical_pairs.group_together %}
|
|
103
|
+
|
|
104
|
+
{% set unique_coils = group_to_coil_section | unique %}
|
|
105
|
+
{% set max_coil = group_to_coil_section | max %}
|
|
106
|
+
{% set elec_order = aux.half_turns.ADD_COILS %}
|
|
107
|
+
|
|
108
|
+
{% set helper = {"first_group": none, "last_group": none} %}
|
|
109
|
+
|
|
110
|
+
{#- Iterate over unique coil numbers greater than 1 #}
|
|
111
|
+
{% for coil in unique_coils if coil > 1 %}
|
|
112
|
+
{% set coil_groups = [] %}
|
|
113
|
+
{%- for group in group_to_coil_section %}
|
|
114
|
+
{% if group == coil %}
|
|
115
|
+
{% do coil_groups.append(loop.index) %} {# Use loop.index0 for zero-based index #}
|
|
116
|
+
{% endif %}
|
|
117
|
+
{% endfor -%}
|
|
118
|
+
|
|
119
|
+
{#- Find the first and last groups in electrical order #}
|
|
120
|
+
{% do helper.update({"first_group": none, "last_group": none}) %}
|
|
121
|
+
{% for pair in group_together %}
|
|
122
|
+
{% if pair[0] in coil_groups or pair[1] in coil_groups %}
|
|
123
|
+
{% if helper["first_group"] is none %}
|
|
124
|
+
{% do helper.update({"first_group": pair[0] if pair[0] in coil_groups else pair[1]}) %}
|
|
125
|
+
{% endif %}
|
|
126
|
+
{% do helper.update({"last_group": pair[1] if pair[1] in coil_groups else pair[0]}) %}
|
|
127
|
+
{% endif %}
|
|
128
|
+
{% endfor %}
|
|
129
|
+
|
|
130
|
+
{#- Get the first and last leads for the current coil based on electrical order #}
|
|
131
|
+
{% set first_lead = aux.half_turns.ht[helper["first_group"]][0] %}
|
|
132
|
+
{% set last_lead = aux.half_turns.ht[helper["last_group"]][-1] -%}
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
{#- Determine the indices of the leads in elec_order #}
|
|
136
|
+
{% set first_lead_index = elec_order.index(first_lead) %}
|
|
137
|
+
{% set last_lead_index = elec_order.index(last_lead) %}
|
|
138
|
+
|
|
139
|
+
{#- Append the indices to the appropriate list -#}
|
|
140
|
+
{% do ESC_leads.append(first_lead_index) %}
|
|
141
|
+
{% do ESC_leads.append(last_lead_index) %}
|
|
142
|
+
{%- do ESC_groups.append(coil_groups) -%}
|
|
143
|
+
<< increment(counter, "counter1") >>
|
|
144
|
+
{%- endfor -%}
|
|
145
|
+
|
|
146
|
+
{%- set ESC_Units = counter["counter1"] -%}
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
{#- Update ESC_dict with the required information #}
|
|
151
|
+
{% do ESC_dict.update({
|
|
152
|
+
"Units": ESC_Units,
|
|
153
|
+
"groups": ESC_groups,
|
|
154
|
+
"leads": ESC_leads
|
|
155
|
+
}) %}
|
|
156
|
+
{%- endmacro -%}
|
|
157
|
+
|
|
158
|
+
{%- macro ecliq_regions(dm,ECLIQ_dict,aux) %}
|
|
159
|
+
{% set counter = {"counter1": 0} %}
|
|
160
|
+
{% set ECLIQ_groups = [] -%}
|
|
161
|
+
|
|
162
|
+
{%- set group_to_coil_section = dm.magnet.solve.coil_windings.group_to_coil_section %}
|
|
163
|
+
{% set unique_coils = group_to_coil_section | unique %}
|
|
164
|
+
{% set max_coil = group_to_coil_section | max %}
|
|
165
|
+
{% set elec_order = aux.half_turns.ADD_COILS %}
|
|
166
|
+
{% set group_together = dm.magnet.solve.coil_windings.electrical_pairs.group_together %}
|
|
167
|
+
{% set helper = {"first_group": none, "last_group": none} %}
|
|
168
|
+
|
|
169
|
+
{%- set ECLIQ_leads = [] %}
|
|
170
|
+
{% set ECLIQ_groups = [] %}
|
|
171
|
+
{% set ECLIQ_Units = 0 -%}
|
|
172
|
+
|
|
173
|
+
{#- Iterate over unique coil numbers greater than 1 #}
|
|
174
|
+
{% for coil in unique_coils if coil > 1 %}
|
|
175
|
+
{% set coil_groups = [] %}
|
|
176
|
+
{%- for group in group_to_coil_section %}
|
|
177
|
+
{% if group == coil %}
|
|
178
|
+
{% do coil_groups.append(loop.index) %} {# Use loop.index0 for zero-based index #}
|
|
179
|
+
{% endif %}
|
|
180
|
+
{% endfor -%}
|
|
181
|
+
|
|
182
|
+
{#- Find the first and last groups in electrical order #}
|
|
183
|
+
{% do helper.update({"first_group": none, "last_group": none}) %}
|
|
184
|
+
{% for pair in group_together %}
|
|
185
|
+
{% if pair[0] in coil_groups or pair[1] in coil_groups %}
|
|
186
|
+
{% if helper["first_group"] is none %}
|
|
187
|
+
{% do helper.update({"first_group": pair[0] if pair[0] in coil_groups else pair[1]}) %}
|
|
188
|
+
{% endif %}
|
|
189
|
+
{% do helper.update({"last_group": pair[1] if pair[1] in coil_groups else pair[0]}) %}
|
|
190
|
+
{% endif %}
|
|
191
|
+
{% endfor %}
|
|
192
|
+
|
|
193
|
+
{#- Get the first and last leads for the current coil based on electrical order #}
|
|
194
|
+
{% set first_lead = aux.half_turns.ht[helper["first_group"]][0] %}
|
|
195
|
+
{% set last_lead = aux.half_turns.ht[helper["last_group"]][-1] -%}
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
{#- Determine the indices of the leads in elec_order #}
|
|
199
|
+
{% set first_lead_index = elec_order.index(first_lead) %}
|
|
200
|
+
{% set last_lead_index = elec_order.index(last_lead) %}
|
|
201
|
+
|
|
202
|
+
{#- Append the indices to the appropriate list -#}
|
|
203
|
+
{% do ECLIQ_leads.append(first_lead_index) %}
|
|
204
|
+
{% do ECLIQ_leads.append(last_lead_index) %}
|
|
205
|
+
{%- do ECLIQ_groups.append(coil_groups) -%}
|
|
206
|
+
<< increment(counter, "counter1") >>
|
|
207
|
+
{%- endfor -%}
|
|
208
|
+
|
|
209
|
+
{%- set ECLIQ_Units = counter["counter1"] -%}
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
{#- Update ECLIQ_dict with the required information #}
|
|
214
|
+
{% do ECLIQ_dict.update({
|
|
215
|
+
"Units": ECLIQ_Units,
|
|
216
|
+
"groups": ECLIQ_groups,
|
|
217
|
+
"leads": ECLIQ_leads
|
|
218
|
+
}) %}
|
|
219
|
+
{%- endmacro -%}
|
|
220
|
+
|
|
221
|
+
{%- macro generate_polarity_groups(dm, rm_EM,aux,pol_) -%}
|
|
222
|
+
{% set polarities = dm.magnet.solve.coil_windings.polarities_in_group -%}
|
|
223
|
+
{% set Omega_p_EM_r = [] -%}
|
|
224
|
+
{% set Omega_p_EM_l = [] -%}
|
|
225
|
+
|
|
226
|
+
{#- Iterate over the indices of polarities and assign regions to the appropriate group -#}
|
|
227
|
+
{% if len(polarities)>0 %}
|
|
228
|
+
{% for i in range(polarities | length) -%}
|
|
229
|
+
{% set polarity = polarities[i] -%}
|
|
230
|
+
{% set half_turns = aux.half_turns.ht[i+1] -%}
|
|
231
|
+
{% for half_turn in half_turns -%}
|
|
232
|
+
{% if polarity == 1 -%}
|
|
233
|
+
{% do Omega_p_EM_r.append('ht' ~ half_turn ~ '_EM') -%}
|
|
234
|
+
{% elif polarity == -1 -%}
|
|
235
|
+
{% do Omega_p_EM_l.append('ht' ~ half_turn ~ '_EM') -%}
|
|
236
|
+
{% endif -%}
|
|
237
|
+
{% endfor -%}
|
|
238
|
+
{% endfor -%}
|
|
239
|
+
{% do pol_.update({"first": dm.magnet.solve.coil_windings.polarities_in_group[dm.magnet.solve.coil_windings.electrical_pairs.group_together[0][0]-1]}) %}
|
|
240
|
+
{% else %}
|
|
241
|
+
{#- Fallback mechanism when dm.magnet.solve.coil_windings is not available -#}
|
|
242
|
+
{% for name, current in zip(
|
|
243
|
+
rm_EM.powered['r1_a1'].vol.names + rm_EM.powered['r1_a2'].vol.names + rm_EM.powered['r2_a1'].vol.names + rm_EM.powered['r2_a2'].vol.names,
|
|
244
|
+
rm_EM.powered['r1_a1'].vol.currents + rm_EM.powered['r1_a2'].vol.currents + rm_EM.powered['r2_a1'].vol.currents + rm_EM.powered['r2_a2'].vol.currents
|
|
245
|
+
) %}
|
|
246
|
+
{% if current > 0 %}
|
|
247
|
+
{% do Omega_p_EM_r.append(name) %}
|
|
248
|
+
{% elif current < 0 %}
|
|
249
|
+
{% do Omega_p_EM_l.append(name) %}
|
|
250
|
+
{% endif %}
|
|
251
|
+
{% endfor %}
|
|
252
|
+
{% endif %}
|
|
253
|
+
{% do pol_.update({"right": Omega_p_EM_r[0]}) %}
|
|
254
|
+
{% if len(Omega_p_EM_l)>0%}
|
|
255
|
+
{% do pol_.update({"left": Omega_p_EM_l[0]}) %}
|
|
256
|
+
{% else %}
|
|
257
|
+
{% do pol_.update({"left": Omega_p_EM_r[1]}) %}
|
|
258
|
+
{% endif %}
|
|
259
|
+
|
|
260
|
+
{#- Generate the regions dynamically #}
|
|
261
|
+
Omega_p_EM_r = Region[{ << Omega_p_EM_r | join(', ') >> }];
|
|
262
|
+
Omega_p_EM_l = Region[{ << Omega_p_EM_l | join(', ') >> }];
|
|
263
|
+
{% endmacro%}
|
|
264
|
+
|
|
265
|
+
{%- macro generate_polarity_groups_TH(dm,aux,rm_EM,rm_TH) -%}
|
|
266
|
+
{% set polarities = dm.magnet.solve.coil_windings.polarities_in_group -%}
|
|
267
|
+
{% set Omega_p_TH_r = [] -%}
|
|
268
|
+
{% set Omega_p_TH_l = [] -%}
|
|
269
|
+
|
|
270
|
+
{#- Iterate over the indices of polarities and assign regions to the appropriate group -#}
|
|
271
|
+
{% if len(polarities)>0 %}
|
|
272
|
+
{% for i in range(polarities | length) -%}
|
|
273
|
+
{% set polarity = polarities[i] -%}
|
|
274
|
+
{% set half_turns = aux.half_turns.ht[i+1] -%}
|
|
275
|
+
{% for half_turn in half_turns -%}
|
|
276
|
+
{% if polarity == 1 -%}
|
|
277
|
+
{% do Omega_p_TH_r.append('ht' ~ half_turn ~ '_TH') -%}
|
|
278
|
+
{% elif polarity == -1 -%}
|
|
279
|
+
{% do Omega_p_TH_l.append('ht' ~ half_turn ~ '_TH') -%}
|
|
280
|
+
{% endif -%}
|
|
281
|
+
{% endfor -%}
|
|
282
|
+
{% endfor -%}
|
|
283
|
+
{% else %}
|
|
284
|
+
{#- Fallback mechanism when dm.magnet.solve.coil_windings is not available -#}
|
|
285
|
+
{% for name, current in zip(
|
|
286
|
+
rm_TH.powered['r1_a1'].vol.names + rm_TH.powered['r1_a2'].vol.names + rm_TH.powered['r2_a1'].vol.names + rm_TH.powered['r2_a2'].vol.names,
|
|
287
|
+
rm_EM.powered['r1_a1'].vol.currents + rm_EM.powered['r1_a2'].vol.currents + rm_EM.powered['r2_a1'].vol.currents + rm_EM.powered['r2_a2'].vol.currents
|
|
288
|
+
) %}
|
|
289
|
+
{% if current > 0 %}
|
|
290
|
+
{% do Omega_p_TH_r.append(name) %}
|
|
291
|
+
{% elif current < 0 %}
|
|
292
|
+
{% do Omega_p_TH_l.append(name) %}
|
|
293
|
+
{% endif %}
|
|
294
|
+
{% endfor %}
|
|
295
|
+
{% endif %}
|
|
296
|
+
|
|
297
|
+
{#- Generate the regions dynamically #}
|
|
298
|
+
Omega_p_TH_r = Region[{ << Omega_p_TH_r | join(', ') >> }];
|
|
299
|
+
Omega_p_TH_l = Region[{ << Omega_p_TH_l | join(', ') >> }];
|
|
300
|
+
{% endmacro %}
|
|
301
|
+
|
|
302
|
+
{# MAIN MACROS #}
|
|
303
|
+
|
|
304
|
+
{% macro regions_FCC(dm,rm_EM,flag_active,regions_CC,end_ht,CLIQ_dict,ECLIQ_dict,ESC_dict,CC_dict,aux) -%}
|
|
305
|
+
|
|
306
|
+
{%- set N_ht = end_ht %}
|
|
307
|
+
{% set magnet_reg_lim = aux.half_turns.max_reg %}
|
|
308
|
+
{% set group_to_coil_section = dm.magnet.solve.coil_windings.group_to_coil_section %}
|
|
309
|
+
{% set max_coil = group_to_coil_section | max -%}
|
|
310
|
+
|
|
311
|
+
{%- do flag_active.update({"ECLIQ": 0}) %}
|
|
312
|
+
{% do flag_active.update({"CLIQ": 0}) %}
|
|
313
|
+
{% do flag_active.update({"ESC": 0}) %}
|
|
314
|
+
{% do flag_active.update({"EE": 0}) %}
|
|
315
|
+
|
|
316
|
+
{#- Check if there are no quench protection mechanisms #}
|
|
317
|
+
{% set t_trigger_EE = [dm.quench_protection.energy_extraction.t_trigger, dm.quench_protection.energy_extraction.t_trigger_n] %}
|
|
318
|
+
{% if (t_trigger_EE | max <= dm.magnet.solve.electromagnetics.time_stepping.final_time or t_trigger_EE | max <= dm.magnet.solve.thermal.time_stepping.final_time or t_trigger_EE | max <= dm.magnet.solve.time_stepping.final_time ) %}
|
|
319
|
+
{% do flag_active.update({"EE": 1})%}
|
|
320
|
+
{% endif%}
|
|
321
|
+
{% if max_coil == 1 %}
|
|
322
|
+
{% do flag_active.update({"CLIQ": 0, "ESC": 0}) %}
|
|
323
|
+
{% else%}
|
|
324
|
+
{% if max_coil >1 and (dm.quench_protection.cliq.t_trigger<dm.magnet.solve.electromagnetics.time_stepping.final_time or dm.quench_protection.cliq.t_trigger<dm.magnet.solve.thermal.time_stepping.final_time or dm.quench_protection.cliq.t_trigger<dm.magnet.solve.time_stepping.final_time) %}
|
|
325
|
+
{% do flag_active.update({"CLIQ": 1}) %}
|
|
326
|
+
<<cliq_regions(dm,CLIQ_dict,aux)>>
|
|
327
|
+
{% endif%}
|
|
328
|
+
{% if max_coil >1 and (dm.quench_protection.esc.t_trigger | max < dm.magnet.solve.electromagnetics.time_stepping.final_time or dm.quench_protection.esc.t_trigger | max < dm.magnet.solve.thermal.time_stepping.final_time or dm.quench_protection.esc.t_trigger | max < dm.magnet.solve.time_stepping.final_time) %}
|
|
329
|
+
{% do flag_active.update({"ESC": 1}) %}
|
|
330
|
+
<<esc_regions(dm,ESC_dict,aux)>>
|
|
331
|
+
{% elif max_coil >1 and (dm.quench_protection.e_cliq.t_trigger | max < dm.magnet.solve.electromagnetics.time_stepping.final_time or dm.quench_protection.e_cliq.t_trigger | max < dm.magnet.solve.thermal.time_stepping.final_time or dm.quench_protection.e_cliq.t_trigger | max < dm.magnet.solve.time_stepping.final_time) %}
|
|
332
|
+
{% do flag_active.update({"ECLIQ": 1}) %}
|
|
333
|
+
<<ecliq_regions(dm,ECLIQ_dict,aux)>>
|
|
334
|
+
{# do ECLIQ_dict.update({"Units": len(dm.quench_protection.e_cliq.t_trigger)}) #}
|
|
335
|
+
{% endif%}
|
|
336
|
+
{%- endif -%}
|
|
337
|
+
|
|
338
|
+
{#- Initialize dictionaries for each region type #}
|
|
339
|
+
{% set inductance_regions = {"PS": [], "circuit": [], "EE": [], "ESC": [], "CLIQ": [], "ECLIQ": []} %}
|
|
340
|
+
{% set capacitance_regions = {"PS": [], "circuit": [], "EE": [], "ESC": [], "CLIQ": [], "ECLIQ": []} %}
|
|
341
|
+
{% set resistance_regions = {"PS": [], "circuit": [], "EE": [], "ESC": [], "CLIQ": [], "ECLIQ": []} %}
|
|
342
|
+
{% set diode_regions = {"PS": [], "EE": [], "ESC": []} %}
|
|
343
|
+
{% set voltagesource_regions = {"CLIQ": []} %}
|
|
344
|
+
{% set currentsource_regions = {"PS": [], "ECLIQ": []} %}
|
|
345
|
+
{% set thyristor_regions = {"ESC": [], "CLIQ": []} %}
|
|
346
|
+
{% set varistor_regions = {"EE": []} %}
|
|
347
|
+
{% set switch_regions = {"EE":[],"CLIQ":[],"ESC":[]} -%}
|
|
348
|
+
|
|
349
|
+
{#- Power Supply Regions #}
|
|
350
|
+
{% do inductance_regions["PS"].extend(["L_1", "L_2", "L_3", "L_crowbar", "L_c_r"]) %}
|
|
351
|
+
{% do capacitance_regions["PS"].append("C") %}
|
|
352
|
+
{% do resistance_regions["PS"].extend(["R_1", "R_2", "R_3", "R_crowbar", "R_c_r"]) %}
|
|
353
|
+
{% do diode_regions["PS"].extend(["Ud_crowbar", "Ud_c_r"]) %}
|
|
354
|
+
{% do currentsource_regions["PS"].append("currentsource") -%}
|
|
355
|
+
|
|
356
|
+
{#- circuit#}
|
|
357
|
+
{%- if dm.circuit.R_circuit %}
|
|
358
|
+
{% do resistance_regions["circuit"].append("R_circuit") -%}
|
|
359
|
+
{% endif -%}
|
|
360
|
+
|
|
361
|
+
{#- Energy Extraction Regions #}
|
|
362
|
+
{%- if flag_active["EE"] == 1 %}
|
|
363
|
+
{% do inductance_regions["EE"].extend(["L", "L_c", "L_s","L_n", "L_c_n", "L_s_n"]) %}
|
|
364
|
+
{% do capacitance_regions["EE"].extend(["C","C_n"]) %}
|
|
365
|
+
{% do resistance_regions["EE"].extend(["R_c", "R_s","R_c_n", "R_s_n"]) %}
|
|
366
|
+
{% do diode_regions["EE"].extend(["Ud_snubber", "Ud_switch","Ud_snubber_n", "Ud_switch_n"]) %}
|
|
367
|
+
{% do varistor_regions["EE"].extend(["V_EE","V_EE_n"]) %}
|
|
368
|
+
{% do switch_regions["EE"].extend(["R_switch","R_switch_n"])%}
|
|
369
|
+
{% endif -%}
|
|
370
|
+
|
|
371
|
+
{#- CLIQ Regions #}
|
|
372
|
+
{%- if flag_active["CLIQ"] == 1 %}
|
|
373
|
+
{% for i in range(1, CLIQ_dict["Units"] + 1) %}
|
|
374
|
+
{% do resistance_regions["CLIQ"].extend(["R_" ~ i]) %}
|
|
375
|
+
{% do inductance_regions["CLIQ"].append("L_" ~ i) %}
|
|
376
|
+
{% do capacitance_regions["CLIQ"].append("C_" ~ i) %}
|
|
377
|
+
{% do switch_regions["CLIQ"].append("R_switch_" ~ i)%}
|
|
378
|
+
{% endfor %}
|
|
379
|
+
{% endif -%}
|
|
380
|
+
|
|
381
|
+
{#- ESC Regions #}
|
|
382
|
+
{% if flag_active["ESC"] == 1 %}
|
|
383
|
+
{% for i in range(1, ESC_dict["Units"] + 1) %}
|
|
384
|
+
{% do capacitance_regions["ESC"].extend(["C1_" ~ i, "C2_" ~ i]) %}
|
|
385
|
+
{% do resistance_regions["ESC"].extend([ "R_leads_" ~ i, "R_unit_" ~ i]) %}
|
|
386
|
+
{% do inductance_regions["ESC"].extend(["L_" ~ i,"L_Diode_" ~ i]) %}
|
|
387
|
+
{% do diode_regions["ESC"].append("Ud_Diode_" ~ i) %}
|
|
388
|
+
{% do switch_regions["ESC"].append("R_switch_" ~ i)%}
|
|
389
|
+
{% endfor %}
|
|
390
|
+
{% endif %}
|
|
391
|
+
|
|
392
|
+
{#- ECLIQ Regions #}
|
|
393
|
+
{% if flag_active["ECLIQ"] == 1 %}
|
|
394
|
+
{% for i in range(1, ECLIQ_dict["Units"] + 1) %}
|
|
395
|
+
{% do currentsource_regions["ECLIQ"].append("currentsource_" ~ i) %}
|
|
396
|
+
{% do inductance_regions["ECLIQ"].append("L_leads_" ~ i) %}
|
|
397
|
+
{% do resistance_regions["ECLIQ"].append("R_leads_" ~ i) %}
|
|
398
|
+
{% endfor %}
|
|
399
|
+
{% endif -%}
|
|
400
|
+
|
|
401
|
+
{%- set counter = {"counter_regions": 0} -%}
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
{#- Power Supply #}
|
|
405
|
+
{%- for ind,elem in enumerate(currentsource_regions["PS"]) -%}
|
|
406
|
+
{% do regions_CC.update({"Omega_PS_" ~ elem:magnet_reg_lim +counter["counter_regions"] + 1}) -%} << increment(counter, "counter_regions") >>
|
|
407
|
+
{%- endfor -%}
|
|
408
|
+
{% for ind,elem in enumerate(resistance_regions["PS"]) -%}
|
|
409
|
+
{% do regions_CC.update({"Omega_PS_" ~ elem:magnet_reg_lim +counter["counter_regions"] + 1}) -%} << increment(counter, "counter_regions") >>
|
|
410
|
+
{%- endfor -%}
|
|
411
|
+
{% for ind,elem in enumerate(inductance_regions["PS"]) -%}
|
|
412
|
+
{% do regions_CC.update({"Omega_PS_" ~ elem:magnet_reg_lim +counter["counter_regions"] + 1}) -%} << increment(counter, "counter_regions") >>
|
|
413
|
+
{%- endfor -%}
|
|
414
|
+
{% for ind,elem in enumerate(diode_regions["PS"]) -%}
|
|
415
|
+
{% do regions_CC.update({"Omega_PS_" ~ elem:magnet_reg_lim +counter["counter_regions"] + 1}) -%} << increment(counter, "counter_regions") >>
|
|
416
|
+
{%- endfor -%}
|
|
417
|
+
{% for ind,elem in enumerate(capacitance_regions["PS"]) -%}
|
|
418
|
+
{% do regions_CC.update({"Omega_PS_" ~ elem:magnet_reg_lim +counter["counter_regions"] + 1}) -%} << increment(counter, "counter_regions") >>
|
|
419
|
+
{%- endfor -%}
|
|
420
|
+
|
|
421
|
+
{%- do flag_active.update({"CS": 1}) %}
|
|
422
|
+
{% do flag_active.update({"R": 1}) %}
|
|
423
|
+
{% do flag_active.update({"L": 1}) %}
|
|
424
|
+
{% do flag_active.update({"C": 1}) %}
|
|
425
|
+
{% do flag_active.update({"D": 1}) %}
|
|
426
|
+
|
|
427
|
+
{#- Energy Extraction #}
|
|
428
|
+
{% if flag_active["EE"]==1%}
|
|
429
|
+
{% for ind,elem in enumerate(varistor_regions["EE"]) -%}
|
|
430
|
+
{% do regions_CC.update({"Omega_EE_" ~ elem:magnet_reg_lim +counter["counter_regions"] + 1}) -%} << increment(counter, "counter_regions") >>
|
|
431
|
+
{%- endfor -%}
|
|
432
|
+
{% for ind,elem in enumerate(resistance_regions["EE"]) -%}
|
|
433
|
+
{% do regions_CC.update({"Omega_EE_" ~ elem:magnet_reg_lim +counter["counter_regions"] + 1}) -%} << increment(counter, "counter_regions") >>
|
|
434
|
+
{%- endfor -%}
|
|
435
|
+
{% for ind,elem in enumerate(inductance_regions["EE"]) -%}
|
|
436
|
+
{% do regions_CC.update({"Omega_EE_" ~ elem:magnet_reg_lim +counter["counter_regions"] + 1}) -%} << increment(counter, "counter_regions") >>
|
|
437
|
+
{%- endfor -%}
|
|
438
|
+
{% for ind,elem in enumerate(diode_regions["EE"]) -%}
|
|
439
|
+
{% do regions_CC.update({"Omega_EE_" ~ elem:magnet_reg_lim +counter["counter_regions"] + 1}) -%} << increment(counter, "counter_regions") >>
|
|
440
|
+
{%- endfor -%}
|
|
441
|
+
{% for ind,elem in enumerate(capacitance_regions["EE"]) -%}
|
|
442
|
+
{% do regions_CC.update({"Omega_EE_" ~ elem:magnet_reg_lim +counter["counter_regions"] + 1}) -%} << increment(counter, "counter_regions") >>
|
|
443
|
+
{%- endfor -%}
|
|
444
|
+
{% for ind,elem in enumerate(switch_regions["EE"]) -%}
|
|
445
|
+
{% do regions_CC.update({"Omega_EE_" ~ elem:magnet_reg_lim +counter["counter_regions"] + 1}) -%} << increment(counter, "counter_regions") >>
|
|
446
|
+
{%- endfor -%}
|
|
447
|
+
{% do flag_active.update({"SW": 1}) %}
|
|
448
|
+
{% do flag_active.update({"V": 1}) %}
|
|
449
|
+
{% else%}
|
|
450
|
+
{% do flag_active.update({"V": 0}) %}
|
|
451
|
+
{% do flag_active.update({"SW": 0}) %}
|
|
452
|
+
{% endif%}
|
|
453
|
+
|
|
454
|
+
{#- Circuit#}
|
|
455
|
+
{% if dm.circuit.R_circuit %}
|
|
456
|
+
{% for ind,elem in enumerate(resistance_regions["circuit"]) -%}
|
|
457
|
+
{% do regions_CC.update({"Omega_circuit_" ~ elem:magnet_reg_lim +counter["counter_regions"] + 1}) -%}
|
|
458
|
+
<< increment(counter, "counter_regions") >>
|
|
459
|
+
{%- endfor -%}
|
|
460
|
+
{% endif -%}
|
|
461
|
+
|
|
462
|
+
{#- CLIQ #}
|
|
463
|
+
{% if flag_active["CLIQ"]==1 -%}
|
|
464
|
+
{% for i in range(1, CLIQ_dict["Units"] + 1) %}{# It uses N_ht so that it would potentially allow to have up to N_ht/2 CLIQ units(defined by CLIQ units) #}
|
|
465
|
+
{% for ind,elem in enumerate(resistance_regions["CLIQ"]) -%}
|
|
466
|
+
{% do regions_CC.update({"Omega_CLIQ_" ~ elem :magnet_reg_lim +counter["counter_regions"] + 1}) -%} << increment(counter, "counter_regions") >>
|
|
467
|
+
{%- endfor -%}
|
|
468
|
+
{% for ind,elem in enumerate(inductance_regions["CLIQ"]) -%}
|
|
469
|
+
{% do regions_CC.update({"Omega_CLIQ_" ~ elem :magnet_reg_lim +counter["counter_regions"] + 1}) -%} << increment(counter, "counter_regions") >>
|
|
470
|
+
{%- endfor -%}
|
|
471
|
+
{% for ind,elem in enumerate(capacitance_regions["CLIQ"]) -%}
|
|
472
|
+
{% do regions_CC.update({"Omega_CLIQ_" ~ elem :magnet_reg_lim +counter["counter_regions"] + 1}) -%} << increment(counter, "counter_regions") >>
|
|
473
|
+
{%- endfor -%}
|
|
474
|
+
{% for ind,elem in enumerate(switch_regions["CLIQ"]) -%}
|
|
475
|
+
{% do regions_CC.update({"Omega_CLIQ_" ~ elem :magnet_reg_lim +counter["counter_regions"] + 1}) -%} << increment(counter, "counter_regions") >>
|
|
476
|
+
{%- endfor -%}
|
|
477
|
+
{% endfor %}
|
|
478
|
+
{% do flag_active.update({"SW": 1}) %}
|
|
479
|
+
{% endif %}
|
|
480
|
+
|
|
481
|
+
{#- E-CLIQ #}
|
|
482
|
+
{% if flag_active["ECLIQ"]==1 -%}
|
|
483
|
+
{% for i in range(1, ECLIQ_dict["Units"] + 1) %}{# It uses N_ht so that it would potentially allow to have up to N_ht ECLIQ units(defined by ECLIQ units) #}
|
|
484
|
+
{% for ind,elem in enumerate(currentsource_regions["ECLIQ"]) -%}
|
|
485
|
+
{% do regions_CC.update({"Omega_ECLIQ_" ~ elem:magnet_reg_lim +counter["counter_regions"] + 1}) -%} << increment(counter, "counter_regions") >>
|
|
486
|
+
{%- endfor -%}
|
|
487
|
+
{% for ind,elem in enumerate(resistance_regions["ECLIQ"]) -%}
|
|
488
|
+
{% do regions_CC.update({"Omega_ECLIQ_" ~ elem:magnet_reg_lim +counter["counter_regions"] + 1}) -%} << increment(counter, "counter_regions") >>
|
|
489
|
+
{%- endfor -%}
|
|
490
|
+
{% for ind,elem in enumerate(inductance_regions["ECLIQ"]) -%}
|
|
491
|
+
{% do regions_CC.update({"Omega_ECLIQ_" ~ elem:magnet_reg_lim +counter["counter_regions"] + 1}) -%} << increment(counter, "counter_regions") >>
|
|
492
|
+
{%- endfor -%}
|
|
493
|
+
{% endfor %}
|
|
494
|
+
{% endif %}
|
|
495
|
+
|
|
496
|
+
{#- ESC #}
|
|
497
|
+
{% if flag_active["ESC"]==1 -%}
|
|
498
|
+
{% for i in range(1, ESC_dict["Units"] + 1) %}{# It uses N_ht so that it would potentially allow to have up to N_ht ESC units(defined by ESC units) #}
|
|
499
|
+
{% for ind,elem in enumerate(capacitance_regions["ESC"]) -%}
|
|
500
|
+
{% do regions_CC.update({"Omega_ESC_" ~ elem:magnet_reg_lim +counter["counter_regions"] + 1}) -%} << increment(counter, "counter_regions") >>
|
|
501
|
+
{%- endfor -%}
|
|
502
|
+
{% for ind,elem in enumerate(resistance_regions["ESC"]) -%}
|
|
503
|
+
{% do regions_CC.update({"Omega_ESC_" ~ elem:magnet_reg_lim +counter["counter_regions"] + 1}) -%} << increment(counter, "counter_regions") >>
|
|
504
|
+
{%- endfor -%}
|
|
505
|
+
{% for ind,elem in enumerate(inductance_regions["ESC"]) -%}
|
|
506
|
+
{% do regions_CC.update({"Omega_ESC_" ~ elem:magnet_reg_lim +counter["counter_regions"] + 1}) -%} << increment(counter, "counter_regions") >>
|
|
507
|
+
{%- endfor -%}
|
|
508
|
+
{% for ind,elem in enumerate(diode_regions["ESC"]) -%}
|
|
509
|
+
{% do regions_CC.update({"Omega_ESC_" ~ elem:magnet_reg_lim +counter["counter_regions"] + 1}) -%} << increment(counter, "counter_regions") >>
|
|
510
|
+
{%- endfor -%}
|
|
511
|
+
{% for ind,elem in enumerate(switch_regions["ESC"]) -%}
|
|
512
|
+
{% do regions_CC.update({"Omega_ESC_" ~ elem:magnet_reg_lim +counter["counter_regions"] + 1}) -%} << increment(counter, "counter_regions") >>
|
|
513
|
+
{%- endfor -%}
|
|
514
|
+
{% endfor -%}
|
|
515
|
+
{% do flag_active.update({"SW": 1}) %}
|
|
516
|
+
{% endif -%}
|
|
517
|
+
|
|
518
|
+
{%- for region, number in regions_CC.items() %}
|
|
519
|
+
<< region >> = Region[<< number >>];
|
|
520
|
+
{% endfor -%}
|
|
521
|
+
{% set name_components = ["resistance","inductance","capacitance","diode","varistor","currentsource","switch"]%}
|
|
522
|
+
{% do CC_dict.extend([name_components,resistance_regions,inductance_regions,capacitance_regions, diode_regions, varistor_regions, currentsource_regions,switch_regions])%}
|
|
523
|
+
{%- endmacro -%}
|
|
524
|
+
|
|
525
|
+
{% macro groups_FCC(dm,rm_EM, flag_active,CLIQ_dict,ECLIQ_dict,ESC_dict,CC_dict,aux) %}
|
|
526
|
+
|
|
527
|
+
{%- set regions = [] %}
|
|
528
|
+
|
|
529
|
+
{%- for i in range(len(CC_dict)-1)%}
|
|
530
|
+
{% for j in CC_dict[i+1].items()%}
|
|
531
|
+
{% for k in j[1]%}
|
|
532
|
+
{% do regions.append("Omega_" ~ j[0] ~ "_" ~ k)%}
|
|
533
|
+
{% endfor %}
|
|
534
|
+
{% endfor%}
|
|
535
|
+
Omega_<<CC_dict[0][i]>> = Region[{<< regions|join(', ')>>}];
|
|
536
|
+
{% do regions.clear() %}
|
|
537
|
+
{% endfor%}
|
|
538
|
+
|
|
539
|
+
// Omega_resistance += Region[{Omega_switch}];
|
|
540
|
+
|
|
541
|
+
Omega_circuit = Region[{ Omega_currentsource{% if flag_active["R"] == 1 -%}, Omega_resistance{% endif %}
|
|
542
|
+
{% if flag_active["D"] == 1 -%}, Omega_diode{% endif %}
|
|
543
|
+
{% if flag_active["C"] == 1 -%}, Omega_capacitance{% endif %}
|
|
544
|
+
{% if flag_active["L"] == 1 -%}, Omega_inductance{% endif %}
|
|
545
|
+
{% if flag_active["Th"] == 1 -%}, Omega_thyristor{% endif %}
|
|
546
|
+
{% if flag_active["V"] == 1 -%}, Omega_varistor{% endif %}
|
|
547
|
+
{% if flag_active["VS"] == 1 -%}, Omega_voltagesource{% endif %}, Omega_switch }];
|
|
548
|
+
|
|
549
|
+
//----------------------------
|
|
550
|
+
{% for i in range(len(CC_dict)-1)%}
|
|
551
|
+
{% for j in CC_dict[i+1].items()%}
|
|
552
|
+
{% for k in j[1] if j[0] == "PS"%}
|
|
553
|
+
{% do regions.append("Omega_" ~ j[0] ~ "_" ~ k)%}
|
|
554
|
+
{% endfor %}
|
|
555
|
+
{% endfor%}
|
|
556
|
+
{% endfor%}
|
|
557
|
+
Omega_PS = Region[{<<regions|join(', ')>>}];
|
|
558
|
+
{% do regions.clear() %}
|
|
559
|
+
|
|
560
|
+
{%- if flag_active["EE"] == 1%}
|
|
561
|
+
{% for i in range(len(CC_dict)-1)%}
|
|
562
|
+
{% for j in CC_dict[i+1].items()%}
|
|
563
|
+
{% for k in j[1] if j[0] == "EE"%}
|
|
564
|
+
{% do regions.append("Omega_" ~ j[0] ~ "_" ~ k)%}
|
|
565
|
+
{% endfor %}
|
|
566
|
+
{% endfor%}
|
|
567
|
+
{% endfor%}
|
|
568
|
+
Omega_EE = Region[{<<regions|join(', ')>>}];
|
|
569
|
+
{% do regions.clear() %}
|
|
570
|
+
{% endif%}
|
|
571
|
+
|
|
572
|
+
{%- if flag_active["CLIQ"] == 1%}
|
|
573
|
+
{% for i in range(len(CC_dict)-1)%}
|
|
574
|
+
{% for j in CC_dict[i+1].items()%}
|
|
575
|
+
{% for k in j[1] if j[0] == "CLIQ"%}
|
|
576
|
+
{% do regions.append("Omega_" ~ j[0] ~ "_" ~ k)%}
|
|
577
|
+
{% endfor %}
|
|
578
|
+
{% endfor%}
|
|
579
|
+
{% endfor%}
|
|
580
|
+
Omega_CLIQ = Region[{<<regions|join(', ')>>}];
|
|
581
|
+
{% do regions.clear() %}
|
|
582
|
+
{% endif%}
|
|
583
|
+
|
|
584
|
+
{%- if flag_active["ECLIQ"] == 1%}
|
|
585
|
+
{% for i in range(len(CC_dict)-1)%}
|
|
586
|
+
{% for j in CC_dict[i+1].items()%}
|
|
587
|
+
{% for k in j[1] if j[0] == "ECLIQ"%}
|
|
588
|
+
{% do regions.append("Omega_" ~ j[0] ~ "_" ~ k)%}
|
|
589
|
+
{% endfor %}
|
|
590
|
+
{% endfor%}
|
|
591
|
+
{% endfor%}
|
|
592
|
+
Omega_ECLIQ = Region[{<<regions|join(', ')>>}];
|
|
593
|
+
{% do regions.clear() %}
|
|
594
|
+
// ECLIQ coils
|
|
595
|
+
{% set ecliq_ht_names_EM = [] %}
|
|
596
|
+
{% set ecliq_ht_names_TH = [] %}
|
|
597
|
+
{% for ht in aux.half_turns.ADD_COILS %}
|
|
598
|
+
{% do ecliq_ht_names_EM.append('ht' ~ ht ~ '_EM') %}
|
|
599
|
+
{% do ecliq_ht_names_TH.append('ht' ~ ht ~ '_TH') %}
|
|
600
|
+
{% endfor %}
|
|
601
|
+
Omega_ECLIQ_ht_EM = Region[{<< ecliq_ht_names_EM | join(', ') >>}];
|
|
602
|
+
Omega_ECLIQ_ht_TH = Region[{<< ecliq_ht_names_TH | join(', ') >>}];
|
|
603
|
+
{% endif%}
|
|
604
|
+
|
|
605
|
+
{%- if flag_active["ESC"] == 1%}
|
|
606
|
+
{% for i in range(len(CC_dict)-1)%}
|
|
607
|
+
{% for j in CC_dict[i+1].items()%}
|
|
608
|
+
{% for k in j[1] if j[0] == "ESC"%}
|
|
609
|
+
{% do regions.append("Omega_" ~ j[0] ~ "_" ~ k)%}
|
|
610
|
+
{% do ESC_dict.Comp.append("Omega_" ~ j[0] ~ "_" ~ k) %}
|
|
611
|
+
{% endfor %}
|
|
612
|
+
{% endfor%}
|
|
613
|
+
{% endfor%}
|
|
614
|
+
Omega_ESC = Region[{<<regions|join(', ')>>}];
|
|
615
|
+
{% do regions.clear() %}
|
|
616
|
+
|
|
617
|
+
{% set esc_ht_names = [] %}
|
|
618
|
+
{% for ht in aux.half_turns.ADD_COILS %}
|
|
619
|
+
{% do esc_ht_names.append('ht' ~ ht ~ '_EM') %}
|
|
620
|
+
{% endfor %}
|
|
621
|
+
Omega_ESC_ht = Region[{<< esc_ht_names | join(', ') >>}];
|
|
622
|
+
{% endif%}
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
{% endmacro %}
|
|
626
|
+
|
|
627
|
+
{%- macro function_FCC(nc,dm,rm_EM, flag_active,CLIQ_dict,ECLIQ_dict,ESC_dict,CC_dict,aux) -%}
|
|
628
|
+
// Current source
|
|
629
|
+
source_current_fct[] =
|
|
630
|
+
$Time <= <<dm.power_supply.t_control_LUT[ 0 ]>> ? <<dm.power_supply.I_control_LUT[ 0 ]>> :
|
|
631
|
+
{% for i in range(len(dm.power_supply.t_control_LUT) - 1) %}
|
|
632
|
+
$Time <= <<dm.power_supply.t_control_LUT[i + 1]>> ?
|
|
633
|
+
<<dm.power_supply.I_control_LUT[i]>> +
|
|
634
|
+
(<<dm.power_supply.I_control_LUT[i + 1]>> - <<dm.power_supply.I_control_LUT[i]>>) /
|
|
635
|
+
(<<dm.power_supply.t_control_LUT[i + 1]>> - <<dm.power_supply.t_control_LUT[i]>>) *
|
|
636
|
+
($Time - <<dm.power_supply.t_control_LUT[i]>>) :
|
|
637
|
+
{% endfor %}
|
|
638
|
+
<<dm.power_supply.I_control_LUT[-1]>>; // Default fallback
|
|
639
|
+
|
|
640
|
+
{% if flag_active["ECLIQ"] %}
|
|
641
|
+
//ECLIQ - CSV Piecewise currentsources
|
|
642
|
+
{% if dm.quench_protection.e_cliq.source_type == 'piecewise' and dm.quench_protection.e_cliq.piecewise.csv_file is not none %}
|
|
643
|
+
{% if dm.quench_protection.e_cliq.piecewise.time_multiplier %}t_coeff = <<dm.quench_protection.e_cliq.piecewise.time_multiplier>>; {%else%} t_coeff = 1;{%endif%}
|
|
644
|
+
{% if dm.quench_protection.e_cliq.piecewise.current_multiplier %}I_coeff = <<dm.quench_protection.e_cliq.piecewise.current_multiplier>>; {%else%} I_coeff = 1;{%endif%}
|
|
645
|
+
|
|
646
|
+
{% for i in range(1,ECLIQ_dict["Units"]+1)%}
|
|
647
|
+
<<'Omega_ECLIQ_currentsource_'~i>>_fct[] =
|
|
648
|
+
$Time < t_coeff * <<aux.e_cliq['source_current_'~i]['t_control_LUT'][ 0 ]>> ? I_coeff * <<aux.e_cliq['source_current_'~i]['I_control_LUT'][ 0 ]>>:
|
|
649
|
+
{% for j in range(len(aux.e_cliq['source_current_'~i]['t_control_LUT']) - 1) %}
|
|
650
|
+
$Time < t_coeff * <<aux.e_cliq['source_current_'~i]['t_control_LUT'][ j+1 ]>> ?
|
|
651
|
+
I_coeff * <<aux.e_cliq['source_current_'~i]['I_control_LUT'][ j ]>>+
|
|
652
|
+
I_coeff * (<<aux.e_cliq['source_current_'~i]['I_control_LUT'][ j+1 ]>> - <<aux.e_cliq['source_current_'~i]['I_control_LUT'][ j ]>>) /
|
|
653
|
+
(<<aux.e_cliq['source_current_'~i]['t_control_LUT'][ j+1 ]>> - <<aux.e_cliq['source_current_'~i]['t_control_LUT'][ j ]>>) *
|
|
654
|
+
($Time - <<aux.e_cliq['source_current_'~i]['t_control_LUT'][ j ]>>) :
|
|
655
|
+
{% endfor %}
|
|
656
|
+
I_coeff * <<aux.e_cliq['source_current_'~i]['I_control_LUT'][ -1 ]>>; // Default fallback
|
|
657
|
+
{% endfor %}
|
|
658
|
+
{% else%}
|
|
659
|
+
{% if dm.quench_protection.e_cliq.source_type == 'piecewise'%}
|
|
660
|
+
{% if dm.quench_protection.e_cliq.piecewise.time_multiplier %}t_coeff = <<dm.quench_protection.e_cliq.piecewise.time_multiplier>>; {%else%} t_coeff = 1;{%endif%}
|
|
661
|
+
{% if dm.quench_protection.e_cliq.piecewise.current_multiplier %}I_coeff = <<dm.quench_protection.e_cliq.piecewise.current_multiplier>>; {%else%} I_coeff = 1;{%endif%}
|
|
662
|
+
|
|
663
|
+
{% for i in range(1,ECLIQ_dict["Units"]+1)%}
|
|
664
|
+
<<'Omega_ECLIQ_currentsource_'~i>>_fct[] =
|
|
665
|
+
$Time < t_coeff * <<dm.quench_protection.e_cliq.piecewise.times[ 0 ]>> ? I_coeff * <<dm.quench_protection.e_cliq.piecewise.currents[ 0 ]>>:
|
|
666
|
+
{% for i in range(len(dm.quench_protection.e_cliq.piecewise.times) - 1) %}
|
|
667
|
+
$Time < t_coeff * <<dm.quench_protection.e_cliq.piecewise.times[ i + 1 ]>> ?
|
|
668
|
+
I_coeff * <<dm.quench_protection.e_cliq.piecewise.currents[ i ]>> +
|
|
669
|
+
I_coeff * (<<dm.quench_protection.e_cliq.piecewise.currents[ i + 1 ]>> - <<dm.quench_protection.e_cliq.piecewise.currents[ i ]>>) /
|
|
670
|
+
(<<dm.quench_protection.e_cliq.piecewise.times[ i + 1 ]>> - <<dm.quench_protection.e_cliq.piecewise.times[ i ]>>) *
|
|
671
|
+
($Time - <<dm.quench_protection.e_cliq.piecewise.times[ i ]>>) :
|
|
672
|
+
{% endfor %}
|
|
673
|
+
I_coeff * <<dm.quench_protection.e_cliq.piecewise.currents[-1]>>; // Default fallback
|
|
674
|
+
{% endfor %}
|
|
675
|
+
{% elif dm.quench_protection.e_cliq.source_type == 'sine'%}
|
|
676
|
+
{% for i in range(1,ECLIQ_dict["Units"]+1)%}
|
|
677
|
+
<<'Omega_ECLIQ_currentsource_'~i>>_fct[]=$Time<=<<dm.quench_protection.e_cliq.t_trigger[i-1]>>?0:$Time<= <<dm.quench_protection.e_cliq.sine.number_of_periods>> /<<dm.quench_protection.e_cliq.sine.frequency>> ? <<dm.quench_protection.e_cliq.sine.current_amplitude>>*<<dm.quench_protection.e_cliq.sine.number_of_turns>> * Sin[2*Pi*<<dm.quench_protection.e_cliq.sine.frequency>> * $Time] : 0.0;
|
|
678
|
+
|
|
679
|
+
{% endfor%}
|
|
680
|
+
|
|
681
|
+
{% endif %}
|
|
682
|
+
{% endif%}
|
|
683
|
+
{% endif%}
|
|
684
|
+
|
|
685
|
+
// Diode Shockley model w/ V(I) U0 can only be 0.7 volts
|
|
686
|
+
{% if flag_active['D']== 1 %}
|
|
687
|
+
VTh = 25.86e-3;
|
|
688
|
+
Is = 10e-12;
|
|
689
|
+
eps = 1e-9;
|
|
690
|
+
V_ref = 0.7;
|
|
691
|
+
n[Omega_PS_Ud_crowbar] = <<dm.power_supply.Ud_crowbar>>/V_ref;
|
|
692
|
+
n[Omega_PS_Ud_c_r] = <<dm.power_supply.Ud_c_r>>/V_ref;
|
|
693
|
+
{% if flag_active["EE"] == 1%}
|
|
694
|
+
n[Omega_EE_Ud_snubber] = <<dm.quench_protection.energy_extraction.Ud_snubber>>/V_ref;
|
|
695
|
+
n[Omega_EE_Ud_switch] = <<dm.quench_protection.energy_extraction.Ud_switch>>/V_ref;
|
|
696
|
+
n[Omega_EE_Ud_snubber_n] = <<dm.quench_protection.energy_extraction.Ud_snubber_n>>/V_ref;
|
|
697
|
+
n[Omega_EE_Ud_switch_n] = <<dm.quench_protection.energy_extraction.Ud_switch_n>>/V_ref;
|
|
698
|
+
{% endif%}
|
|
699
|
+
{% if flag_active["ESC"] == 1%}
|
|
700
|
+
{% for i in range(1,ESC_dict["Units"]+1)%}
|
|
701
|
+
n[<<'Omega_ESC_Ud_Diode_'~i>>] = <<dm.quench_protection.esc.Ud_Diode[i-1]>>/V_ref;
|
|
702
|
+
{% endfor %}
|
|
703
|
+
{% endif%}
|
|
704
|
+
R[Omega_diode] = $1 < eps ? 1e6 : VTh * n[] * Log[1 + $1 / Is] > n[]*V_ref ? n[]*V_ref/$1 : VTh * n[] * Log[1 + $1 / Is]/ $1;
|
|
705
|
+
//dRdI[Omega_diode] = $1 < eps ? -1e6 : n[] * Vth * ($1 / (Is + $1)-Log[1 + $1 /Is]) / $1 ^2
|
|
706
|
+
{% endif %}
|
|
707
|
+
|
|
708
|
+
// Thyristor model
|
|
709
|
+
{% if flag_active['Th']== 1 %}
|
|
710
|
+
R_th_off=1e12;
|
|
711
|
+
eps = 1e-9;
|
|
712
|
+
{% if flag_active["CLIQ"]==1 -%}
|
|
713
|
+
th_switch_time = << dm.quench_protection.cliq.t_trigger >>;
|
|
714
|
+
R[Omega_thyristor] = $Time < th_switch_time ? R_th_off : $1 < eps ? 1e6 : V_ref * Log[1 + $1 / Is] / $1;
|
|
715
|
+
//dRdI[Omega_thyristor] = $1 < eps ? -V_ref * (2 - Is) / 2 / Is^2 : -V_ref * (($1 + Is) * Log[1 + $1 / Is] - $1) / ($1)^2 / ($1 + Is);
|
|
716
|
+
{% else %}
|
|
717
|
+
{% for i in range(1,ESC_dict["Units"]+1) %}
|
|
718
|
+
th_switch_time = << dm.quench_protection.esc.t_trigger[i-1] >>;
|
|
719
|
+
R[Omega_ESC_thyristor1_<<i>>] = $Time < th_switch_time ? R_th_off : $1 < eps ? 1e6 : V_ref * Log[1 + $1 / Is] / $1;
|
|
720
|
+
R[Omega_ESC_thyristor2_<<i>>] = $Time < th_switch_time ? R_th_off : $1 < eps ? 1e6 : V_ref * Log[1 + $1 / Is] / $1;
|
|
721
|
+
{% endfor %}
|
|
722
|
+
{% endif %}
|
|
723
|
+
{% endif %}
|
|
724
|
+
|
|
725
|
+
// Varistor model
|
|
726
|
+
{% if flag_active['V']== 1 %}
|
|
727
|
+
power_R_EE[Omega_EE_V_EE] = <<dm.quench_protection.energy_extraction.power_R_EE>>;
|
|
728
|
+
power_R_EE[Omega_EE_V_EE_n] = <<dm.quench_protection.energy_extraction.power_R_EE_n>>;
|
|
729
|
+
R_EE[Omega_EE_V_EE] = <<dm.quench_protection.energy_extraction.R_EE>>;
|
|
730
|
+
R_EE[Omega_EE_V_EE_n] = <<dm.quench_protection.energy_extraction.R_EE_n>>;
|
|
731
|
+
EE_resistance_inactive = 1e-6;
|
|
732
|
+
R[Omega_EE_V_EE] = $Time < <<dm.quench_protection.energy_extraction.t_trigger>>? EE_resistance_inactive : R_EE[] * ($1)^power_R_EE[]; // Varistor model
|
|
733
|
+
R[Omega_EE_V_EE_n] = $Time < <<dm.quench_protection.energy_extraction.t_trigger_n>>? EE_resistance_inactive : R_EE[] * ($1)^power_R_EE[]; // Varistor model
|
|
734
|
+
{% endif %}
|
|
735
|
+
|
|
736
|
+
// Fixed inductances
|
|
737
|
+
{% if flag_active['L'] == 1 %}
|
|
738
|
+
{% for i in CC_dict[2]["PS"] %}
|
|
739
|
+
L[<<"Omega_PS_" ~ i>>] = <<dm.power_supply[i]>>;
|
|
740
|
+
{% endfor %}
|
|
741
|
+
{% if flag_active["CLIQ"]==1 %}
|
|
742
|
+
{% for i in CC_dict[2]["CLIQ"] %}
|
|
743
|
+
L[<<"Omega_CLIQ_" ~ i>>] ={%if dm.quench_protection.cliq.L %} << dm.quench_protection.cliq.L >>{% else %}0.0 {% endif %};
|
|
744
|
+
{% endfor %}
|
|
745
|
+
{% endif%}
|
|
746
|
+
{% if flag_active["EE"]==1 %}
|
|
747
|
+
{% for i in CC_dict[2]["EE"] %}
|
|
748
|
+
L[<<"Omega_EE_" ~ i>>] ={%if dm.quench_protection.energy_extraction[i] %} << dm.quench_protection.energy_extraction[i] >>{% else %}0.0 {% endif %};
|
|
749
|
+
{% endfor %}
|
|
750
|
+
{% endif %}
|
|
751
|
+
{% if flag_active["ECLIQ"]==1 %}
|
|
752
|
+
{% for ind,elem in enumerate(CC_dict[2]["ECLIQ"]) %}
|
|
753
|
+
L[<<"Omega_ECLIQ_" ~ elem>>] ={%if dm.quench_protection.e_cliq.L_leads[ind] %} << dm.quench_protection.e_cliq.L_leads[ind] >>{% else %}0.0 {% endif %};
|
|
754
|
+
{% endfor %}
|
|
755
|
+
{% endif %}
|
|
756
|
+
{% if flag_active["ESC"]==1 %}
|
|
757
|
+
{% set counter ={"counter_esc":1}%}
|
|
758
|
+
{% for i in range(1,ESC_dict["Units"]+1)%}
|
|
759
|
+
L[<<'Omega_ESC_L_'~i>>] = <<dm.quench_protection.esc.L[i-1]>>;
|
|
760
|
+
L[<<'Omega_ESC_L_Diode_'~i>>] = <<dm.quench_protection.esc.L_Diode[i-1]>>;
|
|
761
|
+
{% endfor %}
|
|
762
|
+
{% endif %}
|
|
763
|
+
{% endif %}
|
|
764
|
+
|
|
765
|
+
// Fixed capacitances
|
|
766
|
+
{% if flag_active['C'] == 1 %}
|
|
767
|
+
{% for i in CC_dict[3]["PS"] %}
|
|
768
|
+
C[<<"Omega_PS_" ~ i>>] = <<dm.power_supply[i]>>;
|
|
769
|
+
{% endfor %}
|
|
770
|
+
{% if flag_active["CLIQ"]==1 %}
|
|
771
|
+
{% for i in CC_dict[3]["CLIQ"] %}
|
|
772
|
+
C[<<"Omega_CLIQ_" ~ i>>] ={%if dm.quench_protection.cliq.C %} << dm.quench_protection.cliq.C >>{% else %}0.0 {% endif %};
|
|
773
|
+
{% endfor %}
|
|
774
|
+
{% endif%}
|
|
775
|
+
{% if flag_active["EE"]==1 %}
|
|
776
|
+
{% for i in CC_dict[3]["EE"] %}
|
|
777
|
+
C[<<"Omega_EE_" ~ i>>] ={%if dm.quench_protection.energy_extraction[i] %} << dm.quench_protection.energy_extraction[i] >>{% else %}0.0 {% endif %};
|
|
778
|
+
{% endfor %}
|
|
779
|
+
{% endif %}
|
|
780
|
+
{% if flag_active["ESC"]==1 %}
|
|
781
|
+
{% for i in range(1,ESC_dict["Units"]+1)%}
|
|
782
|
+
C[<<'Omega_ESC_C1_'~i>>] = 2 * <<dm.quench_protection.esc.C[i-1]>>;
|
|
783
|
+
C[<<'Omega_ESC_C2_'~i>>] = 2 * <<dm.quench_protection.esc.C[i-1]>>;
|
|
784
|
+
{% endfor %}
|
|
785
|
+
{% endif %}
|
|
786
|
+
{% endif %}
|
|
787
|
+
|
|
788
|
+
// Fixed resistances / switches
|
|
789
|
+
R_switch_off = 1e6;
|
|
790
|
+
R_switch_on = 1e-10;
|
|
791
|
+
{% if flag_active['R'] == 1 %}
|
|
792
|
+
{% for i in CC_dict[1]["PS"] %}
|
|
793
|
+
R[<<"Omega_PS_" ~ i>>] = <<dm.power_supply[i]>>;
|
|
794
|
+
{% endfor %}
|
|
795
|
+
{% for i in CC_dict[1]["circuit"] %}
|
|
796
|
+
R[<<"Omega_circuit_" ~ i>>] = <<dm.circuit[i]>>;
|
|
797
|
+
{% endfor %}
|
|
798
|
+
{% if flag_active["CLIQ"]==1 %}
|
|
799
|
+
{% for i in CC_dict[1]["CLIQ"] %}
|
|
800
|
+
R[<<"Omega_CLIQ_" ~ i>>] ={%if dm.quench_protection.cliq.R %} << dm.quench_protection.cliq.R >>{% else %}0.0 {% endif %};
|
|
801
|
+
{% endfor %}
|
|
802
|
+
{% for i in CC_dict[7]["CLIQ"] %}
|
|
803
|
+
R[<<"Omega_CLIQ_" ~ i>>] =$Time<= <<dm.quench_protection.cliq.t_trigger>> ? R_switch_off : R_switch_on;
|
|
804
|
+
Coef_switch[<<"Omega_CLIQ_" ~ i>>]=$Time < <<dm.quench_protection.cliq.t_trigger>> ? 0:1 ;
|
|
805
|
+
{% endfor %}
|
|
806
|
+
{% endif%}
|
|
807
|
+
{% if flag_active["EE"]==1 %}
|
|
808
|
+
{% for i in CC_dict[1]["EE"] %}
|
|
809
|
+
R[<<"Omega_EE_" ~ i>>] ={%if dm.quench_protection.energy_extraction[i] %} << dm.quench_protection.energy_extraction[i] >>{% else %}0.0 {% endif %};
|
|
810
|
+
{% endfor %}
|
|
811
|
+
R[Omega_EE_R_switch] = $Time<= <<dm.quench_protection.energy_extraction.t_trigger>> ? R_switch_on : R_switch_off;
|
|
812
|
+
R[Omega_EE_R_switch_n] = $Time<= <<dm.quench_protection.energy_extraction.t_trigger_n>> ? R_switch_on : R_switch_off;
|
|
813
|
+
Coef_switch[Omega_EE_R_switch_n]=$Time < <<dm.quench_protection.energy_extraction.t_trigger_n>> ? 1:0 ;
|
|
814
|
+
Coef_switch[Omega_EE_R_switch]=$Time < <<dm.quench_protection.energy_extraction.t_trigger>> ? 1:0 ;
|
|
815
|
+
{% endif %}
|
|
816
|
+
{% if flag_active["ECLIQ"]==1 %}
|
|
817
|
+
{% for ind,elem in enumerate(CC_dict[1]["ECLIQ"]) %}
|
|
818
|
+
R[<<"Omega_ECLIQ_" ~ elem>>] ={%if dm.quench_protection.e_cliq.R_leads[ind] %} << dm.quench_protection.e_cliq.R_leads[ind] >>{% else %}0.0 {% endif %};
|
|
819
|
+
{% endfor %}
|
|
820
|
+
{% endif %}
|
|
821
|
+
{% if flag_active["ESC"]==1 %}
|
|
822
|
+
{% for i in range(1,ESC_dict["Units"]+1)%}
|
|
823
|
+
R[<<'Omega_ESC_R_leads_'~i>>] = <<dm.quench_protection.esc.R_leads[i-1]>>;
|
|
824
|
+
R[<<'Omega_ESC_R_unit_'~i>>] = <<dm.quench_protection.esc.R_unit[i-1]>>;
|
|
825
|
+
R[<<"Omega_ESC_R_switch_" ~ i>>] =$Time<= <<dm.quench_protection.esc.t_trigger[i-1]>> ? R_switch_off : R_switch_on;
|
|
826
|
+
Coef_switch[<<"Omega_ESC_R_switch_" ~ i>>]=$Time < <<dm.quench_protection.esc.t_trigger[i-1]>> ? 0:1 ;
|
|
827
|
+
{% endfor %}
|
|
828
|
+
{% endif %}
|
|
829
|
+
{% endif %}
|
|
830
|
+
{% endmacro %}
|
|
831
|
+
|
|
832
|
+
{%- macro constraints_FCC(dm,rm_EM, flag_active, init_ht, end_ht,CLIQ_dict,ECLIQ_dict, ESC_dict,CC_dict,aux,pol_) %}
|
|
833
|
+
{% set magnet_reg_lim = aux.half_turns.max_reg %} {# Define the end of the magnet regions numbering #}
|
|
834
|
+
{% set N_ht = end_ht -%}
|
|
835
|
+
// Power Supply
|
|
836
|
+
// Circuit coupling constraints
|
|
837
|
+
{ Name ElectricalCircuit; Type Network;
|
|
838
|
+
Case Circuit1 { // Describes node connection of branches
|
|
839
|
+
{% set count={"count_br":2}%}
|
|
840
|
+
//Main Loop
|
|
841
|
+
// Power supply
|
|
842
|
+
{ Region Omega_PS_currentsource; Branch {1, 2}; }
|
|
843
|
+
{ Region Omega_PS_R_1; Branch {2,3}; }
|
|
844
|
+
{ Region Omega_PS_L_1; Branch {3,4}; }
|
|
845
|
+
{ Region Omega_PS_R_2; Branch {4,5}; }
|
|
846
|
+
{ Region Omega_PS_L_2; Branch {5,6}; }
|
|
847
|
+
{% set br_circ_end = 6%}
|
|
848
|
+
|
|
849
|
+
// EE & Circuit
|
|
850
|
+
{% if flag_active["EE"] == 1%}
|
|
851
|
+
{ Region Omega_EE_L; Branch {6,7}; }
|
|
852
|
+
{ Region Omega_EE_V_EE; Branch {7,8}; }
|
|
853
|
+
|
|
854
|
+
{% set br_circ_end = 8%}
|
|
855
|
+
{% if dm.circuit.R_circuit %}
|
|
856
|
+
{ Region Omega_circuit_R_circuit; Branch {8,9}; }
|
|
857
|
+
{% set br_circ_end = 9%}
|
|
858
|
+
{% endif%}
|
|
859
|
+
{% else%}
|
|
860
|
+
{% if dm.circuit.R_circuit %}
|
|
861
|
+
{ Region Omega_circuit_R_circuit; Branch {6,7}; }
|
|
862
|
+
{% set br_circ_end = 7%}
|
|
863
|
+
{% endif%}
|
|
864
|
+
{% endif%}
|
|
865
|
+
|
|
866
|
+
// Magnet
|
|
867
|
+
{% set br_mag_end = N_ht + br_circ_end %}
|
|
868
|
+
{% if pol_["first"] == 1%}
|
|
869
|
+
{% set count_polarity = 0 %}
|
|
870
|
+
{% else %}
|
|
871
|
+
{% set count_polarity = 1 %}
|
|
872
|
+
{% endif %}
|
|
873
|
+
{% for elec, lead in zip(dm.magnet.solve.coil_windings.electrical_pairs.overwrite_electrical_order[init_ht:end_ht], range(len(dm.magnet.solve.coil_windings.electrical_pairs.overwrite_electrical_order[init_ht:end_ht]))) %}
|
|
874
|
+
{% if loop.last %}
|
|
875
|
+
{% if count_polarity == 0 %}
|
|
876
|
+
{% if flag_active["EE"] == 1 or flag_active["CLIQ"] == 1 %}
|
|
877
|
+
{ Region ht<< elec >>_EM; Branch { << lead + br_circ_end+1 >>, << lead + br_circ_end >> }; }
|
|
878
|
+
{% else %}
|
|
879
|
+
{ Region ht<< elec >>_EM; Branch { 1, << lead + br_circ_end >> }; }
|
|
880
|
+
{% endif %}
|
|
881
|
+
{% else %}
|
|
882
|
+
{% if flag_active["EE"] == 1 or flag_active["CLIQ"] == 1 %}
|
|
883
|
+
{ Region ht<< elec >>_EM; Branch { << lead + br_circ_end >>,<< lead + br_circ_end+1 >> }; }
|
|
884
|
+
{% else %}
|
|
885
|
+
{ Region ht<< elec >>_EM; Branch { << lead + br_circ_end >>, 1 }; }
|
|
886
|
+
{% endif %}
|
|
887
|
+
{% endif %}
|
|
888
|
+
{% else %}
|
|
889
|
+
{% if (loop.index+count_polarity) is even %}
|
|
890
|
+
{ Region ht<< elec >>_EM; Branch { << lead + br_circ_end+1 >>, << lead + br_circ_end >> }; }
|
|
891
|
+
{% else %}
|
|
892
|
+
{ Region ht<< elec >>_EM; Branch { << lead + br_circ_end >>, << lead + br_circ_end+1 >> }; }
|
|
893
|
+
{% endif %}
|
|
894
|
+
{% endif %}
|
|
895
|
+
{% endfor %}
|
|
896
|
+
{% set br_ML_end = br_mag_end%}
|
|
897
|
+
// FQPCs
|
|
898
|
+
|
|
899
|
+
//EE_n
|
|
900
|
+
{% if flag_active["EE"] == 1%}
|
|
901
|
+
{ Region Omega_EE_V_EE_n; Branch {<<br_mag_end>>,<<br_mag_end+1>>}; }
|
|
902
|
+
{ Region Omega_EE_L_n; Branch {<<br_mag_end+1>>,1}; }
|
|
903
|
+
{% set br_ML_end = br_mag_end+1%}
|
|
904
|
+
{% endif%}
|
|
905
|
+
|
|
906
|
+
//Parallel loops
|
|
907
|
+
{ Region Omega_PS_C; Branch {4,<<br_ML_end+1>>}; }
|
|
908
|
+
{ Region Omega_PS_R_3; Branch {<<br_ML_end+1>>,<<br_ML_end+2>>}; }
|
|
909
|
+
{ Region Omega_PS_L_3; Branch {<<br_ML_end+2>>,1}; }
|
|
910
|
+
{ Region Omega_PS_R_crowbar; Branch {<<br_ML_end+3>>,2}; }
|
|
911
|
+
{ Region Omega_PS_Ud_crowbar; Branch {<<br_ML_end+4>>,<<br_ML_end+3>>}; }
|
|
912
|
+
{ Region Omega_PS_L_crowbar; Branch {1,<<br_ML_end+4>>}; }
|
|
913
|
+
{ Region Omega_PS_R_c_r; Branch {6,<<br_ML_end+5>>}; }
|
|
914
|
+
{ Region Omega_PS_Ud_c_r; Branch {<<br_ML_end+5>>,<<br_ML_end+6>>}; }
|
|
915
|
+
{ Region Omega_PS_L_c_r; Branch {<<br_ML_end+6>>,1}; }
|
|
916
|
+
{% set br_PL_end = br_ML_end+6%}
|
|
917
|
+
//EE
|
|
918
|
+
|
|
919
|
+
{% if flag_active["EE"] == 1%}
|
|
920
|
+
{ Region Omega_EE_Ud_snubber; Branch {8,<<br_PL_end+1>>}; }
|
|
921
|
+
{ Region Omega_EE_C; Branch {<<br_PL_end+1>>,<<br_PL_end+2>>}; }
|
|
922
|
+
{ Region Omega_EE_R_c; Branch {<<br_PL_end+2>>,<<br_PL_end+3>>}; }
|
|
923
|
+
{ Region Omega_EE_L_c; Branch {<<br_PL_end+3>>,6}; }
|
|
924
|
+
{ Region Omega_EE_R_switch; Branch {6,<<br_PL_end+4>>}; }
|
|
925
|
+
{ Region Omega_EE_L_s; Branch {<<br_PL_end+4>>,<<br_PL_end+5>>}; }
|
|
926
|
+
{ Region Omega_EE_R_s; Branch {<<br_PL_end+5>>,<<br_PL_end+6>>}; }
|
|
927
|
+
{ Region Omega_EE_Ud_switch; Branch {<<br_PL_end+6>>,8}; }
|
|
928
|
+
|
|
929
|
+
{ Region Omega_EE_L_c_n; Branch {1,<<br_PL_end+7>>}; }
|
|
930
|
+
{ Region Omega_EE_R_c_n; Branch {<<br_PL_end+7>>,<<br_PL_end+8>>}; }
|
|
931
|
+
{ Region Omega_EE_C_n; Branch {<<br_PL_end+8>>,<<br_PL_end+9>>}; }
|
|
932
|
+
{ Region Omega_EE_Ud_snubber_n; Branch {<<br_PL_end+9>>,<<br_mag_end>>}; }
|
|
933
|
+
{ Region Omega_EE_Ud_switch_n; Branch {<<br_mag_end>>,<<br_PL_end+10>>}; }
|
|
934
|
+
{ Region Omega_EE_R_s_n; Branch {<<br_PL_end+10>>,<<br_PL_end+11>>}; }
|
|
935
|
+
{ Region Omega_EE_L_s_n; Branch {<<br_PL_end+11>>,<<br_PL_end+12>>}; }
|
|
936
|
+
{ Region Omega_EE_R_switch_n; Branch {<<br_PL_end+12>>,1}; }
|
|
937
|
+
{% set br_PL_end = br_PL_end+12%}
|
|
938
|
+
{% endif%}
|
|
939
|
+
|
|
940
|
+
// CLIQ
|
|
941
|
+
{% if flag_active["CLIQ"] %}
|
|
942
|
+
{% for i in range( CLIQ_dict["Units"]) %}
|
|
943
|
+
{% set cliq_count=4*(i) %}
|
|
944
|
+
{ Region Omega_CLIQ_R_<< i+1 >>; Branch { << br_circ_end + CLIQ_dict["leads"][2*i+1] + 1>>, << br_PL_end + cliq_count +1>> }; }
|
|
945
|
+
{ Region Omega_CLIQ_L_<< i+1 >>; Branch { << br_PL_end + cliq_count +1>>, << br_PL_end + cliq_count +2 >> }; }
|
|
946
|
+
{ Region Omega_CLIQ_C_<< i+1 >>; Branch { << br_PL_end + cliq_count +2>>, << br_PL_end + cliq_count +3>> }; }
|
|
947
|
+
{ Region Omega_CLIQ_R_switch_<< i+1 >>; Branch { <<br_PL_end + cliq_count +3 >>, <<br_circ_end+CLIQ_dict["leads"][2*i]>> }; }
|
|
948
|
+
{% if loop.last %}
|
|
949
|
+
{% endif%}
|
|
950
|
+
{% endfor %}
|
|
951
|
+
{% set br_PL_end = br_PL_end + 4*CLIQ_dict["Units"] %}
|
|
952
|
+
{% endif %}
|
|
953
|
+
// ESC
|
|
954
|
+
{% if flag_active["ESC"]==1 %}
|
|
955
|
+
{% for i in range( ESC_dict["Units"] ) %}
|
|
956
|
+
{% set esc_count=(6+len(aux.half_turns.ADD_COILS[ESC_dict.leads[2*i]:ESC_dict.leads[2*i+1]+1]))*(i) %}
|
|
957
|
+
{ Region Omega_ESC_C1_<< i+1 >>; Branch { 1 , << br_PL_end + esc_count +1 >> }; }
|
|
958
|
+
{ Region Omega_ESC_R_switch_<< i+1 >>; Branch { << br_PL_end + esc_count + 1 >> , << br_PL_end + esc_count + 2 >> }; }
|
|
959
|
+
{% for lead,elec in enumerate(aux.half_turns.ADD_COILS[ESC_dict.leads[2*i]:ESC_dict.leads[2*i+1]+1]) %}
|
|
960
|
+
{% if loop.index is even %}
|
|
961
|
+
{ Region ht<< elec >>_EM; Branch { << lead + br_PL_end + esc_count + 2 + 1 >>, << lead + br_PL_end + esc_count + 2 >> }; }
|
|
962
|
+
{% else %}
|
|
963
|
+
{ Region ht<< elec >>_EM; Branch { << lead + br_PL_end + esc_count + 2 >>, << lead + br_PL_end + esc_count + 2 + 1 >> }; }
|
|
964
|
+
{% endif %}
|
|
965
|
+
{#{ Region Omega_ESC_L_<< i+1 >>; Branch { << br_PL_end + esc_count + 2 >> , << br_PL_end + esc_count + 3 >> }; }#}
|
|
966
|
+
{% endfor %}
|
|
967
|
+
{% set ESC_coil_l = len(aux.half_turns.ADD_COILS[ESC_dict.leads[2*i]:ESC_dict.leads[2*i+1]+1]) %}
|
|
968
|
+
{ Region Omega_ESC_R_leads_<< i +1>>; Branch { << br_PL_end+ESC_coil_l + esc_count + 2 >>, << br_PL_end+ESC_coil_l + esc_count + 3 >> }; }
|
|
969
|
+
{ Region Omega_ESC_R_unit_<< i +1>>; Branch { << br_PL_end+ESC_coil_l + esc_count + 3>>, << br_PL_end+ESC_coil_l + esc_count + 4 >> }; }
|
|
970
|
+
{ Region Omega_ESC_L_<< i +1>>; Branch { << br_PL_end+ESC_coil_l + esc_count + 4>>, << br_PL_end+ESC_coil_l + esc_count + 5 >> }; }
|
|
971
|
+
{ Region Omega_ESC_C2_<< i +1>>; Branch { << br_PL_end+ESC_coil_l + esc_count + 5 >>, 1 }; }
|
|
972
|
+
{ Region Omega_ESC_L_Diode_<< i+1 >>; Branch { << br_PL_end + esc_count + ESC_coil_l + 3>>, << br_PL_end + esc_count +ESC_coil_l+ 6 >> }; }
|
|
973
|
+
{ Region Omega_ESC_Ud_Diode_<< i +1>>; Branch { << br_PL_end + esc_count+ESC_coil_l + 6>>, << br_PL_end+ + esc_count + 2 >> }; }
|
|
974
|
+
|
|
975
|
+
{% endfor %}
|
|
976
|
+
{% set br_PL_end = br_PL_end + 7*ESC_dict["Units"] + len(aux.half_turns.ADD_COILS) %}
|
|
977
|
+
{% endif %}
|
|
978
|
+
|
|
979
|
+
// ECLIQ
|
|
980
|
+
{% if flag_active["ECLIQ"]==1 %}
|
|
981
|
+
{% for i in range( ECLIQ_dict["Units"] ) %}
|
|
982
|
+
{% set ecliq_count=(2+len(aux.half_turns.ADD_COILS[ECLIQ_dict.leads[2*i]:ECLIQ_dict.leads[2*i+1]+1]))*(i) %}
|
|
983
|
+
{ Region Omega_ECLIQ_currentsource_<< i+1 >>; Branch { 1 , << br_PL_end + ecliq_count + 1 >> }; }
|
|
984
|
+
{ Region Omega_ECLIQ_L_leads_<< i+1 >>; Branch { << br_PL_end + ecliq_count + 1 >> , << br_PL_end + ecliq_count + 2 >> }; }
|
|
985
|
+
{ Region Omega_ECLIQ_R_leads_<< i+1 >>; Branch { << br_PL_end + ecliq_count + 2 >> , << br_PL_end + ecliq_count + 3 >> }; }
|
|
986
|
+
{% for lead,elec in enumerate(aux.half_turns.ADD_COILS[ECLIQ_dict.leads[2*i]:ECLIQ_dict.leads[2*i+1]+1]) %}
|
|
987
|
+
{% if loop.last %}
|
|
988
|
+
{ Region ht<< elec >>_EM; Branch { 1, << lead + br_PL_end + ecliq_count + 3 >> }; }
|
|
989
|
+
{% else %}
|
|
990
|
+
{% if loop.index is even %}
|
|
991
|
+
{ Region ht<< elec >>_EM; Branch { << lead + br_PL_end + ecliq_count + 3 + 1 >>, << lead + br_PL_end + ecliq_count + 3 >> }; }
|
|
992
|
+
{% else %}
|
|
993
|
+
{ Region ht<< elec >>_EM; Branch { << lead + br_PL_end + ecliq_count + 3 >>, << lead + br_PL_end + ecliq_count + 3 + 1 >> }; }
|
|
994
|
+
{% endif %}
|
|
995
|
+
{% endif %}
|
|
996
|
+
{% endfor %}
|
|
997
|
+
{% set ECLIQ_coil_l = len(aux.half_turns.ADD_COILS[ECLIQ_dict.leads[2*i]:ECLIQ_dict.leads[2*i+1]+1]) %}
|
|
998
|
+
{% endfor %}
|
|
999
|
+
{% endif %}
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
{ Name source_current;
|
|
1003
|
+
Case{
|
|
1004
|
+
{ Region Omega_PS_currentsource; Type Assign; Value 1; TimeFunction source_current_fct[]; }
|
|
1005
|
+
{% if flag_active["ECLIQ"]==1 %}
|
|
1006
|
+
{% for i in CC_dict[6]["ECLIQ"]%}
|
|
1007
|
+
{ Region <<'Omega_ECLIQ_' ~ i>>; Type Assign; Value 1; TimeFunction <<'Omega_ECLIQ_' ~ i ~'_fct[]'>>; }
|
|
1008
|
+
{% endfor%}
|
|
1009
|
+
{% endif %}
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
{ Name source_voltage;
|
|
1013
|
+
Case{
|
|
1014
|
+
{% if flag_active["CLIQ"]==1 %}
|
|
1015
|
+
{% for i in CC_dict[3]["CLIQ"]%}
|
|
1016
|
+
{ Region <<'Omega_CLIQ_' ~ i>>; Type Assign; Value <<dm.quench_protection.cliq.U0>>; }
|
|
1017
|
+
{% endfor%}
|
|
1018
|
+
{% endif %}
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
{% endmacro %}
|
|
1022
|
+
|
|
1023
|
+
{% macro function_space_FCC(nc,dm,flag_active,SIM_MODE) %}
|
|
1024
|
+
{ Name CircuitSpace; Type Scalar;
|
|
1025
|
+
BasisFunction {
|
|
1026
|
+
{
|
|
1027
|
+
Name iBF ; NameOfCoef ir ; Function BF_Region ;
|
|
1028
|
+
Support Omega_circuit ; Entity Omega_circuit ;
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
GlobalQuantity {
|
|
1033
|
+
{ Name Iz; Type AliasOf ; NameOfCoef ir; }
|
|
1034
|
+
{ Name Uz; Type AssociatedWith; NameOfCoef ir; }
|
|
1035
|
+
|
|
1036
|
+
}
|
|
1037
|
+
Constraint {
|
|
1038
|
+
{ NameOfCoef Iz; EntityType Region; NameOfConstraint source_current; }
|
|
1039
|
+
{ NameOfCoef Uz; EntityType Region; NameOfConstraint source_voltage; }
|
|
1040
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Mag_dyn' %}
|
|
1041
|
+
{ NameOfCoef Iz; EntityType Region;
|
|
1042
|
+
NameOfConstraint Init_from_Static2; }
|
|
1043
|
+
{ NameOfCoef Uz; EntityType Region;
|
|
1044
|
+
NameOfConstraint Init_from_Static2; }
|
|
1045
|
+
|
|
1046
|
+
{% endif %}
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
{% endmacro %}
|
|
1051
|
+
|
|
1052
|
+
{%- macro formulation_FCC(dm) %}
|
|
1053
|
+
{ Name is; Type Local; NameOfSpace Hregion_j_Mag_2D; }
|
|
1054
|
+
{ Name I_mag; Type Global; NameOfSpace Hregion_j_Mag_2D[I_mag]; }
|
|
1055
|
+
{ Name U_mag; Type Global; NameOfSpace Hregion_j_Mag_2D[U_mag]; }
|
|
1056
|
+
{ Name Iz; Type Global; NameOfSpace CircuitSpace[Iz]; }
|
|
1057
|
+
{ Name Uz; Type Global; NameOfSpace CircuitSpace[Uz]; }
|
|
1058
|
+
{% endmacro %}
|
|
1059
|
+
|
|
1060
|
+
{% macro resolution_FCC(dm,rm_EM,flag_active,ESC_dict,ECLIQ_dict) %}
|
|
1061
|
+
CreateDirectory["CC_output"];
|
|
1062
|
+
{% set I_PostPrc_Mult = { 'I_EQ': 'Omega_ECLIQ_currentsource', 'I_ESC': 'Omega_ESC_R_leads', 'I_ESC_Diode': 'Omega_ESC_L_Diode', 'I_ESC_C': 'Omega_ESC_R_unit'} %}
|
|
1063
|
+
{% set U_PostPrc_ESC = ['ESC_C1','ESC_C2','ESC_R_leads','ESC_R_unit','ESC_L','ESC_L_Diode','ESC_Ud_Diode'] %}
|
|
1064
|
+
{% set U_PostPrc_ECLIQ = ['ECLIQ_L_leads','ECLIQ_R_leads','ECLIQ_currentsource'] %}
|
|
1065
|
+
|
|
1066
|
+
|
|
1067
|
+
{% set header_I = [] %}
|
|
1068
|
+
{% for i in dm.magnet.postproc.circuit_coupling.variables_I %}
|
|
1069
|
+
{% if i in I_PostPrc_Mult.keys() and (flag_active["ESC"] == 1 or flag_active["ECLIQ"] == 1) %}
|
|
1070
|
+
{% for j in range(1, ESC_dict["Units"]+1) %}
|
|
1071
|
+
{% do header_I.append(i ~ '_' ~ j) %}
|
|
1072
|
+
{% endfor %}
|
|
1073
|
+
{% for j in range(1, ECLIQ_dict["Units"]+1) %}
|
|
1074
|
+
{% do header_I.append(i ~ '_' ~ j) %}
|
|
1075
|
+
{% endfor %}
|
|
1076
|
+
{% else %}
|
|
1077
|
+
{% do header_I.append(i) %}
|
|
1078
|
+
{% endif %}
|
|
1079
|
+
{% endfor %}
|
|
1080
|
+
|
|
1081
|
+
Print["time [s],<< header_I | join(' [A], ') >> [A]", File "CC_output/I.csv"];
|
|
1082
|
+
|
|
1083
|
+
{% set header_U = [] %}
|
|
1084
|
+
{% for i in dm.magnet.postproc.circuit_coupling.variables_U %}
|
|
1085
|
+
{% if i in U_PostPrc_ESC and flag_active["ESC"] == 1 %}
|
|
1086
|
+
{% for j in range(1, ESC_dict["Units"]+1) %}
|
|
1087
|
+
{% do header_U.append(i ~ '_' ~ j) %}
|
|
1088
|
+
{% endfor %}
|
|
1089
|
+
{% else %}
|
|
1090
|
+
{% do header_U.append(i) %}
|
|
1091
|
+
{% endif %}
|
|
1092
|
+
{% if i in U_PostPrc_ECLIQ and flag_active["ECLIQ"] == 1 %}
|
|
1093
|
+
{% for j in range(1, ECLIQ_dict["Units"]+1) %}
|
|
1094
|
+
{% do header_U.append(i ~ '_' ~ j) %}
|
|
1095
|
+
{% endfor %}
|
|
1096
|
+
{% else %}
|
|
1097
|
+
{% do header_U.append(i) %}
|
|
1098
|
+
{% endif %}
|
|
1099
|
+
{% endfor %}
|
|
1100
|
+
|
|
1101
|
+
Print["time [s],<< header_U | join(' [V], ') >> [V]", File "CC_output/U.csv"];
|
|
1102
|
+
Print["time [s],R_mag (Ohm)", File "CC_output/R_mag.csv"];
|
|
1103
|
+
Print["time [s],{% if rm_EM.powered['r1_a1'].vol.names %}<<rm_EM.powered['r1_a1'].vol.names|join(' [A], ')>> [A]{% endif %}
|
|
1104
|
+
{% if rm_EM.powered['r1_a2'].vol.names %}, <<rm_EM.powered['r1_a2'].vol.names|join(' [A], ')>> [A]{% endif %}
|
|
1105
|
+
{% if rm_EM.powered['r2_a1'].vol.names %}, <<rm_EM.powered['r2_a1'].vol.names|join(' [A], ')>> [A]{% endif %}
|
|
1106
|
+
{% if rm_EM.powered['r2_a2'].vol.names %}, <<rm_EM.powered['r2_a2'].vol.names|join(' [A], ')>> [A]{% endif %}", File "CC_output/I_mag.csv"];
|
|
1107
|
+
Print["time [s],{% if rm_EM.powered['r1_a1'].vol.names %}<<rm_EM.powered['r1_a1'].vol.names|join(' [V], ')>> [V]{% endif %}
|
|
1108
|
+
{% if rm_EM.powered['r1_a2'].vol.names %}, <<rm_EM.powered['r1_a2'].vol.names|join(' [V], ')>> [V]{% endif %}
|
|
1109
|
+
{% if rm_EM.powered['r2_a1'].vol.names %}, <<rm_EM.powered['r2_a1'].vol.names|join(' [V], ')>> [V]{% endif %}
|
|
1110
|
+
{% if rm_EM.powered['r2_a2'].vol.names %}, <<rm_EM.powered['r2_a2'].vol.names|join(' [V], ')>> [V]{% endif %}", File "CC_output/U_mag.csv"];
|
|
1111
|
+
{% endmacro %}
|
|
1112
|
+
|
|
1113
|
+
{%- macro postPr_FCC(nc,dm,flag_active,init_ht,end_ht,aux) %}
|
|
1114
|
+
{ Name I_;
|
|
1115
|
+
Value {
|
|
1116
|
+
Term { [ {Iz} ]; In Omega_circuit; }
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
{ Name U_;
|
|
1120
|
+
Value {
|
|
1121
|
+
Term { [ {Uz} ]; In Omega_circuit; }
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
// Interesting resistances
|
|
1125
|
+
{% if flag_active['D'] == 1 %}
|
|
1126
|
+
{ Name R_diode;
|
|
1127
|
+
Value {
|
|
1128
|
+
Term { [ R[{Iz}] ]; In Omega_diode; }
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
{% endif %}
|
|
1132
|
+
{% if flag_active["V"] == 1 %}
|
|
1133
|
+
{ Name R_v;
|
|
1134
|
+
Value {
|
|
1135
|
+
Term { [ R[{Iz}] ]; In Omega_varistor; }
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
{% endif %}
|
|
1139
|
+
{ Name js;
|
|
1140
|
+
Value {
|
|
1141
|
+
Term { [ {is}/area_fct[] ]; In <<nc.omega>><<nc.powered>>_EM; Jacobian Jac_Vol_EM; }
|
|
1142
|
+
{% if dm.magnet.solve.electromagnetics.solve_type == "transient" %}
|
|
1143
|
+
// Term { [ -sigma[] * (Dt[{a}]) ]; In <<nc.omega>><<nc.induced>>_EM; Jacobian Jac_Vol_EM; }
|
|
1144
|
+
{% endif %}
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
{ Name R_mag;
|
|
1148
|
+
Value {
|
|
1149
|
+
{%if dm.magnet.solve.thermal.solve_type%}
|
|
1150
|
+
Integral{[(Ns/area_fct[])^2 * rho[T_EM_fct[], Norm[{d a}]]*TestQuench[T_EM_fct[],Norm[{d a}],{is}] ]; In <<nc.omega>><<nc.powered>>_EM; Jacobian Jac_Vol_EM; Integration Int_EM; }
|
|
1151
|
+
{%else%}
|
|
1152
|
+
Integral{[(Ns/area_fct[])^2 * rho[<<dm.magnet.solve.electromagnetics.time_stepping.T_sim>>, Norm[{d a}]]*TestQuench[<<dm.magnet.solve.electromagnetics.time_stepping.T_sim>>,Norm[{d a}],{is}] ]; In <<nc.omega>><<nc.powered>>_EM; Jacobian Jac_Vol_EM; Integration Int_EM; }
|
|
1153
|
+
|
|
1154
|
+
{%endif%}
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
{#
|
|
1158
|
+
// { Name R_mag;
|
|
1159
|
+
// Value {
|
|
1160
|
+
// {%- for block, ht in aux.half_turns.block.items() %}
|
|
1161
|
+
// {%if dm.magnet.solve.thermal.solve_type%}
|
|
1162
|
+
// Integral{[(Ns[]/area_fct[])^2 * rho[T_EM_fct[], Norm[{d a}]]*TestQuench[T_EM_fct[],Norm[{d a}]*L_ht[],{is}] ]; In <<'Omega_Block_'~block>>; Jacobian Jac_Vol_EM; Integration Int_EM; }
|
|
1163
|
+
// {%else%}
|
|
1164
|
+
// Integral{[(Ns[]/area_fct[])^2 *rho[{d a}] ]; In <<nc.omega>><<nc.powered>>_EM; Jacobian Jac_Vol_EM; Integration Int_EM; }
|
|
1165
|
+
// {%endif%}
|
|
1166
|
+
// {% endfor %}
|
|
1167
|
+
// }
|
|
1168
|
+
// }
|
|
1169
|
+
#}
|
|
1170
|
+
{ Name U_mag;
|
|
1171
|
+
Value {
|
|
1172
|
+
Term { [ {U_mag} ]; In <<nc.omega>><<nc.powered>>_EM; Jacobian Jac_Vol_EM; }//Jacobian Jac_Vol_EM;
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
{ Name I_mag;
|
|
1176
|
+
Value {
|
|
1177
|
+
Term { [ {I_mag} ]; In <<nc.omega>><<nc.powered>>_EM; Jacobian Jac_Vol_EM; }//Jacobian Jac_Vol_EM;
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
{% endmacro %}
|
|
1181
|
+
|
|
1182
|
+
{%- macro postOP_FCC(nc,rm_EM,dm,flag_active,regions_CC,init_ht,SIM_MODE,ESC_dict,ECLIQ_dict) %}
|
|
1183
|
+
{%- set I_PostPrc = {'I_PC':'Omega_PS_currentsource','I_1':'Omega_PS_R_1','I_2':'Omega_PS_R_2', 'I_cpc': 'Omega_PS_R_3', 'I_crowbar': 'Omega_PS_R_crowbar', 'I_c_r': 'Omega_PS_R_c_r', 'I_EE': 'Omega_EE_V_EE', 'I_c': 'Omega_EE_R_c', 'I_s': 'Omega_EE_R_s', 'I_EE_n': 'Omega_EE_V_EE_n', 'I_c_n': 'Omega_EE_R_c_n', 'I_s_n': 'Omega_EE_R_s_n', 'I_C': 'Omega_CLIQ_R' }%}
|
|
1184
|
+
{% set I_PostPrc_ADDCOILS = { 'I_EQ': 'Omega_ECLIQ_R_leads', 'I_ESC': 'Omega_ESC_R_leads', 'I_ESC_Diode': 'Omega_ESC_L_Diode', 'I_ESC_C': 'Omega_ESC_R_unit'} %}
|
|
1185
|
+
{% set U_PostPrc_ESC = ['ESC_C1','ESC_C2','ESC_R_leads','ESC_R_unit','ESC_L','ESC_L_Diode','ESC_Ud_Diode','Omega_ESC_R_switch'] %}
|
|
1186
|
+
{% set U_PostPrc_ECLIQ = ['ECLIQ_L_leads','ECLIQ_R_leads','ECLIQ_currentsource'] %}
|
|
1187
|
+
{% set U_PostPrc = U_PostPrc_ECLIQ + U_PostPrc_ESC %}
|
|
1188
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Mag_dyn' or SIM_MODE == 'Th_Mag_sta' or SIM_MODE == 'Mag_sta'%}
|
|
1189
|
+
{ Name circuit_coupling_sta; NameOfPostProcessing MagSta_a_2D ;
|
|
1190
|
+
Operation {
|
|
1191
|
+
Print[ I_, OnRegion Region[{{% for i in I_PostPrc.keys() if i in dm.magnet.postproc.circuit_coupling.variables_I %}<<I_PostPrc[i]>> {% endfor %} {% for i in I_PostPrc_ADDCOILS.keys() if i in dm.magnet.postproc.circuit_coupling.variables_I %}{% for j in range(1,ESC_dict["Units"]+1) %} <<I_PostPrc_ADDCOILS[i]~'_'~j>>{% endfor %}{% for j in range(1,ECLIQ_dict["Units"]+1) %} <<I_PostPrc_ADDCOILS[i]~'_'~j>>{% endfor %}{% endfor %}}], File "CC_output/I.csv", Format Table, Comma, AppendToExistingFile 1, SendToServer "No"] ;
|
|
1192
|
+
|
|
1193
|
+
Print[ U_, OnRegion Region[{{% for i in dm.magnet.postproc.circuit_coupling.variables_U if i not in U_PostPrc %} <<'Omega_'~i>>{% endfor %}{% for i in dm.magnet.postproc.circuit_coupling.variables_U if i in U_PostPrc_ESC %}{% for j in range(1,ESC_dict["Units"]+1) %} <<'Omega_'~i~'_'~j>>{% endfor %}{% endfor %}{% for i in dm.magnet.postproc.circuit_coupling.variables_U if i in U_PostPrc_ECLIQ %}{% for j in range(1,ECLIQ_dict["Units"]+1) %} <<'Omega_'~i~'_'~j>>{% endfor %}{% endfor %}}] , File "CC_output/U.csv", Format Table, Comma, AppendToExistingFile 1, SendToServer "No"] ;
|
|
1194
|
+
|
|
1195
|
+
Print[ I_mag, OnRegion <<nc.omega>><<nc.powered>>_EM, File "CC_output/I_mag.csv", Format Table, Comma, SendToServer "No", AppendToExistingFile 1] ;
|
|
1196
|
+
Print[ U_mag, OnRegion <<nc.omega>><<nc.powered>>_EM , File "CC_output/U_mag.csv", Format Table, Comma, SendToServer "No", AppendToExistingFile 1] ;
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
{% endif %}
|
|
1200
|
+
{% if SIM_MODE != 'Th_Mag_sta' and SIM_MODE != 'Mag_sta'%}
|
|
1201
|
+
{ Name circuit_coupling; NameOfPostProcessing MagDyn_a_2D;
|
|
1202
|
+
Operation {
|
|
1203
|
+
|
|
1204
|
+
Print[ I_, OnRegion Region[{{% for i in I_PostPrc.keys() if i in dm.magnet.postproc.circuit_coupling.variables_I %}<<I_PostPrc[i]>> {% endfor %} {% for i in I_PostPrc_ADDCOILS.keys() if i in dm.magnet.postproc.circuit_coupling.variables_I %}{% for j in range(1,ESC_dict["Units"]+1) %} <<I_PostPrc_ADDCOILS[i]~'_'~j>>{% endfor %}{% for j in range(1,ECLIQ_dict["Units"]+1) %} <<I_PostPrc_ADDCOILS[i]~'_'~j>>{% endfor %}{% endfor %}}], File "CC_output/I.csv", Format Table, Comma, AppendToExistingFile 1, SendToServer "No"] ;
|
|
1205
|
+
|
|
1206
|
+
Print[ U_, OnRegion Region[{{% for i in dm.magnet.postproc.circuit_coupling.variables_U if i not in U_PostPrc %} <<'Omega_'~i>>{% endfor %}{% for i in dm.magnet.postproc.circuit_coupling.variables_U if i in U_PostPrc_ESC %}{% for j in range(1,ESC_dict["Units"]+1) %} <<'Omega_'~i~'_'~j>>{% endfor %}{% endfor %}{% for i in dm.magnet.postproc.circuit_coupling.variables_U if i in U_PostPrc_ECLIQ %}{% for j in range(1,ECLIQ_dict["Units"]+1) %} <<'Omega_'~i~'_'~j>>{% endfor %}{% endfor %}}] , File "CC_output/U.csv", Format Table, Comma, AppendToExistingFile 1, SendToServer "No"] ;
|
|
1207
|
+
|
|
1208
|
+
Print[ I_mag, OnRegion <<nc.omega>><<nc.powered>>_EM, File "CC_output/I_mag.csv", Format Table, Comma, SendToServer "No", AppendToExistingFile 1] ;
|
|
1209
|
+
Print[ U_mag, OnRegion <<nc.omega>><<nc.powered>>_EM , File "CC_output/U_mag.csv", Format Table, Comma, SendToServer "No", AppendToExistingFile 1] ;
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
{% endif %}
|
|
1213
|
+
{% endmacro %}
|