CoreDataX 0.9.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.
CoreDataX/CDX.py ADDED
@@ -0,0 +1,3928 @@
1
+ from dataclasses import dataclass
2
+ from typing import Optional, Any, List, Dict, Union, TypeVar, Callable, Type, cast
3
+ from enum import Enum
4
+
5
+
6
+ T = TypeVar("T")
7
+ EnumT = TypeVar("EnumT", bound=Enum)
8
+
9
+
10
+ def from_str(x: Any) -> str:
11
+ assert isinstance(x, str)
12
+ return x
13
+
14
+
15
+ def from_float(x: Any) -> float:
16
+ assert isinstance(x, (float, int)) and not isinstance(x, bool)
17
+ return float(x)
18
+
19
+
20
+ def from_none(x: Any) -> Any:
21
+ assert x is None
22
+ return x
23
+
24
+
25
+ def from_union(fs, x):
26
+ for f in fs:
27
+ try:
28
+ return f(x)
29
+ except:
30
+ pass
31
+ assert False
32
+
33
+
34
+ def to_float(x: Any) -> float:
35
+ assert isinstance(x, (int, float))
36
+ return x
37
+
38
+
39
+ def from_bool(x: Any) -> bool:
40
+ assert isinstance(x, bool)
41
+ return x
42
+
43
+
44
+ def from_list(f: Callable[[Any], T], x: Any) -> List[T]:
45
+ assert isinstance(x, list)
46
+ return [f(y) for y in x]
47
+
48
+
49
+ def to_enum(c: Type[EnumT], x: Any) -> EnumT:
50
+ assert isinstance(x, c)
51
+ return x.value
52
+
53
+
54
+ def from_int(x: Any) -> int:
55
+ assert isinstance(x, int) and not isinstance(x, bool)
56
+ return x
57
+
58
+
59
+ def to_class(c: Type[T], x: Any) -> dict:
60
+ assert isinstance(x, c)
61
+ return cast(Any, x).to_dict()
62
+
63
+
64
+ def from_dict(f: Callable[[Any], T], x: Any) -> Dict[str, T]:
65
+ assert isinstance(x, dict)
66
+ return { k: f(v) for (k, v) in x.items() }
67
+
68
+
69
+ @dataclass
70
+ class DistributorInfo:
71
+ """Data from the distributor for a given part"""
72
+
73
+ name: str
74
+ """The name of the distributor of the part"""
75
+
76
+ quantity: float
77
+ """The number of individual pieces available in the distributor"""
78
+
79
+ reference: str
80
+ """The distributor's reference of this part"""
81
+
82
+ cost: Optional[float] = None
83
+ """The distributor's price for this part"""
84
+
85
+ country: Optional[str] = None
86
+ """The country of the distributor of the part"""
87
+
88
+ distributedArea: Optional[str] = None
89
+ """The area where the distributor doistributes"""
90
+
91
+ email: Optional[str] = None
92
+ """The distributor's email"""
93
+
94
+ link: Optional[str] = None
95
+ """The distributor's link"""
96
+
97
+ phone: Optional[str] = None
98
+ """The distributor's phone"""
99
+
100
+ updatedAt: Optional[str] = None
101
+ """The date that this information was updated"""
102
+
103
+ @staticmethod
104
+ def from_dict(obj: Any) -> 'DistributorInfo':
105
+ assert isinstance(obj, dict)
106
+ name = from_str(obj.get("name"))
107
+ quantity = from_float(obj.get("quantity"))
108
+ reference = from_str(obj.get("reference"))
109
+ cost = from_union([from_float, from_none], obj.get("cost"))
110
+ country = from_union([from_str, from_none], obj.get("country"))
111
+ distributedArea = from_union([from_str, from_none], obj.get("distributedArea"))
112
+ email = from_union([from_str, from_none], obj.get("email"))
113
+ link = from_union([from_str, from_none], obj.get("link"))
114
+ phone = from_union([from_str, from_none], obj.get("phone"))
115
+ updatedAt = from_union([from_str, from_none], obj.get("updatedAt"))
116
+ return DistributorInfo(name, quantity, reference, cost, country, distributedArea, email, link, phone, updatedAt)
117
+
118
+ def to_dict(self) -> dict:
119
+ result: dict = {}
120
+ result["name"] = from_str(self.name)
121
+ result["quantity"] = to_float(self.quantity)
122
+ result["reference"] = from_str(self.reference)
123
+ if self.cost is not None:
124
+ result["cost"] = from_union([to_float, from_none], self.cost)
125
+ if self.country is not None:
126
+ result["country"] = from_union([from_str, from_none], self.country)
127
+ if self.distributedArea is not None:
128
+ result["distributedArea"] = from_union([from_str, from_none], self.distributedArea)
129
+ if self.email is not None:
130
+ result["email"] = from_union([from_str, from_none], self.email)
131
+ if self.link is not None:
132
+ result["link"] = from_union([from_str, from_none], self.link)
133
+ if self.phone is not None:
134
+ result["phone"] = from_union([from_str, from_none], self.phone)
135
+ if self.updatedAt is not None:
136
+ result["updatedAt"] = from_union([from_str, from_none], self.updatedAt)
137
+ return result
138
+
139
+
140
+ @dataclass
141
+ class PinWIndingConnection:
142
+ pin: Optional[str] = None
143
+ """The name of the connected pin"""
144
+
145
+ winding: Optional[str] = None
146
+ """The name of the connected winding"""
147
+
148
+ @staticmethod
149
+ def from_dict(obj: Any) -> 'PinWIndingConnection':
150
+ assert isinstance(obj, dict)
151
+ pin = from_union([from_str, from_none], obj.get("pin"))
152
+ winding = from_union([from_str, from_none], obj.get("winding"))
153
+ return PinWIndingConnection(pin, winding)
154
+
155
+ def to_dict(self) -> dict:
156
+ result: dict = {}
157
+ if self.pin is not None:
158
+ result["pin"] = from_union([from_str, from_none], self.pin)
159
+ if self.winding is not None:
160
+ result["winding"] = from_union([from_str, from_none], self.winding)
161
+ return result
162
+
163
+
164
+ @dataclass
165
+ class DimensionWithTolerance:
166
+ """The maximum thickness of the insulation around the wire, in m
167
+
168
+ The conducting area of the wire, in m². Used for some rectangular shapes where the area
169
+ is smaller than expected due to rounded corners
170
+
171
+ The conducting diameter of the wire, in m
172
+
173
+ The outer diameter of the wire, in m
174
+
175
+ The conducting height of the wire, in m
176
+
177
+ The conducting width of the wire, in m
178
+
179
+ The outer height of the wire, in m
180
+
181
+ The outer width of the wire, in m
182
+
183
+ The radius of the edge, in case of rectangular wire, in m
184
+
185
+ Heat capacity value according to manufacturer, in J/Kg/K
186
+
187
+ Heat conductivity value according to manufacturer, in W/m/K
188
+
189
+ A dimension of with minimum, nominal, and maximum values
190
+ """
191
+ excludeMaximum: Optional[bool] = None
192
+ """True is the maximum value must be excluded from the range"""
193
+
194
+ excludeMinimum: Optional[bool] = None
195
+ """True is the minimum value must be excluded from the range"""
196
+
197
+ maximum: Optional[float] = None
198
+ """The maximum value of the dimension"""
199
+
200
+ minimum: Optional[float] = None
201
+ """The minimum value of the dimension"""
202
+
203
+ nominal: Optional[float] = None
204
+ """The nominal value of the dimension"""
205
+
206
+ @staticmethod
207
+ def from_dict(obj: Any) -> 'DimensionWithTolerance':
208
+ assert isinstance(obj, dict)
209
+ excludeMaximum = from_union([from_bool, from_none], obj.get("excludeMaximum"))
210
+ excludeMinimum = from_union([from_bool, from_none], obj.get("excludeMinimum"))
211
+ maximum = from_union([from_float, from_none], obj.get("maximum"))
212
+ minimum = from_union([from_float, from_none], obj.get("minimum"))
213
+ nominal = from_union([from_float, from_none], obj.get("nominal"))
214
+ return DimensionWithTolerance(excludeMaximum, excludeMinimum, maximum, minimum, nominal)
215
+
216
+ def to_dict(self) -> dict:
217
+ result: dict = {}
218
+ if self.excludeMaximum is not None:
219
+ result["excludeMaximum"] = from_union([from_bool, from_none], self.excludeMaximum)
220
+ if self.excludeMinimum is not None:
221
+ result["excludeMinimum"] = from_union([from_bool, from_none], self.excludeMinimum)
222
+ if self.maximum is not None:
223
+ result["maximum"] = from_union([to_float, from_none], self.maximum)
224
+ if self.minimum is not None:
225
+ result["minimum"] = from_union([to_float, from_none], self.minimum)
226
+ if self.nominal is not None:
227
+ result["nominal"] = from_union([to_float, from_none], self.nominal)
228
+ return result
229
+
230
+
231
+ class BobbinFamily(Enum):
232
+ """The family of a bobbin"""
233
+
234
+ e = "e"
235
+ ec = "ec"
236
+ efd = "efd"
237
+ el = "el"
238
+ ep = "ep"
239
+ er = "er"
240
+ etd = "etd"
241
+ p = "p"
242
+ pm = "pm"
243
+ pq = "pq"
244
+ rm = "rm"
245
+ u = "u"
246
+
247
+
248
+ class PinShape(Enum):
249
+ """The shape of the pin"""
250
+
251
+ irregular = "irregular"
252
+ rectangular = "rectangular"
253
+ round = "round"
254
+
255
+
256
+ class PinDescriptionType(Enum):
257
+ """Type of pin"""
258
+
259
+ smd = "smd"
260
+ tht = "tht"
261
+
262
+
263
+ @dataclass
264
+ class Pin:
265
+ """Data describing one pin in a bobbin"""
266
+
267
+ dimensions: List[float]
268
+ """Dimensions of the rectangle defining the pin"""
269
+
270
+ shape: PinShape
271
+ """The shape of the pin"""
272
+
273
+ type: PinDescriptionType
274
+ """Type of pin"""
275
+
276
+ coordinates: Optional[List[float]] = None
277
+ """The coordinates of the center of the pin, referred to the center of the main column"""
278
+
279
+ name: Optional[str] = None
280
+ """Name given to the pin"""
281
+
282
+ rotation: Optional[List[float]] = None
283
+ """The rotation of the pin, default is vertical"""
284
+
285
+ @staticmethod
286
+ def from_dict(obj: Any) -> 'Pin':
287
+ assert isinstance(obj, dict)
288
+ dimensions = from_list(from_float, obj.get("dimensions"))
289
+ shape = PinShape(obj.get("shape"))
290
+ type = PinDescriptionType(obj.get("type"))
291
+ coordinates = from_union([lambda x: from_list(from_float, x), from_none], obj.get("coordinates"))
292
+ name = from_union([from_str, from_none], obj.get("name"))
293
+ rotation = from_union([lambda x: from_list(from_float, x), from_none], obj.get("rotation"))
294
+ return Pin(dimensions, shape, type, coordinates, name, rotation)
295
+
296
+ def to_dict(self) -> dict:
297
+ result: dict = {}
298
+ result["dimensions"] = from_list(to_float, self.dimensions)
299
+ result["shape"] = to_enum(PinShape, self.shape)
300
+ result["type"] = to_enum(PinDescriptionType, self.type)
301
+ if self.coordinates is not None:
302
+ result["coordinates"] = from_union([lambda x: from_list(to_float, x), from_none], self.coordinates)
303
+ if self.name is not None:
304
+ result["name"] = from_union([from_str, from_none], self.name)
305
+ if self.rotation is not None:
306
+ result["rotation"] = from_union([lambda x: from_list(to_float, x), from_none], self.rotation)
307
+ return result
308
+
309
+
310
+ @dataclass
311
+ class Pinout:
312
+ """Data describing the pinout of a bobbin"""
313
+
314
+ numberPins: int
315
+ """The number of pins"""
316
+
317
+ pinDescription: Pin
318
+ pitch: List[float]
319
+ """The distance between pins, per row, by pin order"""
320
+
321
+ rowDistance: float
322
+ """The distance between a row of pins and the center of the bobbin"""
323
+
324
+ centralPitch: Optional[float] = None
325
+ """The distance between central pins"""
326
+
327
+ numberPinsPerRow: Optional[List[int]] = None
328
+ """List of pins per row"""
329
+
330
+ numberRows: Optional[int] = None
331
+ """The number of rows of a bobbin, typically 2"""
332
+
333
+ @staticmethod
334
+ def from_dict(obj: Any) -> 'Pinout':
335
+ assert isinstance(obj, dict)
336
+ numberPins = from_int(obj.get("numberPins"))
337
+ pinDescription = Pin.from_dict(obj.get("pinDescription"))
338
+ pitch = from_list(from_float, obj.get("pitch"))
339
+ rowDistance = from_float(obj.get("rowDistance"))
340
+ centralPitch = from_union([from_float, from_none], obj.get("centralPitch"))
341
+ numberPinsPerRow = from_union([lambda x: from_list(from_int, x), from_none], obj.get("numberPinsPerRow"))
342
+ numberRows = from_union([from_int, from_none], obj.get("numberRows"))
343
+ return Pinout(numberPins, pinDescription, pitch, rowDistance, centralPitch, numberPinsPerRow, numberRows)
344
+
345
+ def to_dict(self) -> dict:
346
+ result: dict = {}
347
+ result["numberPins"] = from_int(self.numberPins)
348
+ result["pinDescription"] = to_class(Pin, self.pinDescription)
349
+ result["pitch"] = from_list(to_float, self.pitch)
350
+ result["rowDistance"] = to_float(self.rowDistance)
351
+ if self.centralPitch is not None:
352
+ result["centralPitch"] = from_union([to_float, from_none], self.centralPitch)
353
+ if self.numberPinsPerRow is not None:
354
+ result["numberPinsPerRow"] = from_union([lambda x: from_list(from_int, x), from_none], self.numberPinsPerRow)
355
+ if self.numberRows is not None:
356
+ result["numberRows"] = from_union([from_int, from_none], self.numberRows)
357
+ return result
358
+
359
+
360
+ class FunctionalDescriptionType(Enum):
361
+ """The type of a bobbin
362
+
363
+ The type of a magnetic shape
364
+ """
365
+ custom = "custom"
366
+ standard = "standard"
367
+
368
+
369
+ @dataclass
370
+ class BobbinFunctionalDescription:
371
+ """The data from the bobbin based on its function, in a way that can be used by analytical
372
+ models.
373
+ """
374
+ dimensions: Dict[str, Union[DimensionWithTolerance, float]]
375
+ """The dimensions of a bobbin, keys must be as defined in EN 62317"""
376
+
377
+ family: BobbinFamily
378
+ """The family of a bobbin"""
379
+
380
+ shape: str
381
+ """The name of a bobbin that this bobbin belongs to"""
382
+
383
+ type: FunctionalDescriptionType
384
+ """The type of a bobbin"""
385
+
386
+ connections: Optional[List[PinWIndingConnection]] = None
387
+ """List of connections between windings and pins"""
388
+
389
+ familySubtype: Optional[str] = None
390
+ """The subtype of the shape, in case there are more than one"""
391
+
392
+ pinout: Optional[Pinout] = None
393
+
394
+ @staticmethod
395
+ def from_dict(obj: Any) -> 'BobbinFunctionalDescription':
396
+ assert isinstance(obj, dict)
397
+ dimensions = from_dict(lambda x: from_union([DimensionWithTolerance.from_dict, from_float], x), obj.get("dimensions"))
398
+ family = BobbinFamily(obj.get("family"))
399
+ shape = from_str(obj.get("shape"))
400
+ type = FunctionalDescriptionType(obj.get("type"))
401
+ connections = from_union([lambda x: from_list(PinWIndingConnection.from_dict, x), from_none], obj.get("connections"))
402
+ familySubtype = from_union([from_str, from_none], obj.get("familySubtype"))
403
+ pinout = from_union([Pinout.from_dict, from_none], obj.get("pinout"))
404
+ return BobbinFunctionalDescription(dimensions, family, shape, type, connections, familySubtype, pinout)
405
+
406
+ def to_dict(self) -> dict:
407
+ result: dict = {}
408
+ result["dimensions"] = from_dict(lambda x: from_union([lambda x: to_class(DimensionWithTolerance, x), to_float], x), self.dimensions)
409
+ result["family"] = to_enum(BobbinFamily, self.family)
410
+ result["shape"] = from_str(self.shape)
411
+ result["type"] = to_enum(FunctionalDescriptionType, self.type)
412
+ if self.connections is not None:
413
+ result["connections"] = from_union([lambda x: from_list(lambda x: to_class(PinWIndingConnection, x), x), from_none], self.connections)
414
+ if self.familySubtype is not None:
415
+ result["familySubtype"] = from_union([from_str, from_none], self.familySubtype)
416
+ if self.pinout is not None:
417
+ result["pinout"] = from_union([lambda x: to_class(Pinout, x), from_none], self.pinout)
418
+ return result
419
+
420
+
421
+ class Status(Enum):
422
+ """The production status of a part according to its manufacturer"""
423
+
424
+ obsolete = "obsolete"
425
+ production = "production"
426
+ prototype = "prototype"
427
+
428
+
429
+ @dataclass
430
+ class ManufacturerInfo:
431
+ """Data from the manufacturer for a given part"""
432
+
433
+ name: str
434
+ """The name of the manufacturer of the part"""
435
+
436
+ cost: Optional[str] = None
437
+ """The manufacturer's price for this part"""
438
+
439
+ datasheetUrl: Optional[str] = None
440
+ """The manufacturer's URL to the datasheet of the product"""
441
+
442
+ family: Optional[str] = None
443
+ """The family of a magnetic, as defined by the manufacturer"""
444
+
445
+ orderCode: Optional[str] = None
446
+ """The manufacturer's order code of this part"""
447
+
448
+ reference: Optional[str] = None
449
+ """The manufacturer's reference of this part"""
450
+
451
+ status: Optional[Status] = None
452
+ """The production status of a part according to its manufacturer"""
453
+
454
+ @staticmethod
455
+ def from_dict(obj: Any) -> 'ManufacturerInfo':
456
+ assert isinstance(obj, dict)
457
+ name = from_str(obj.get("name"))
458
+ cost = from_union([from_str, from_none], obj.get("cost"))
459
+ datasheetUrl = from_union([from_str, from_none], obj.get("datasheetUrl"))
460
+ family = from_union([from_str, from_none], obj.get("family"))
461
+ orderCode = from_union([from_str, from_none], obj.get("orderCode"))
462
+ reference = from_union([from_str, from_none], obj.get("reference"))
463
+ status = from_union([Status, from_none], obj.get("status"))
464
+ return ManufacturerInfo(name, cost, datasheetUrl, family, orderCode, reference, status)
465
+
466
+ def to_dict(self) -> dict:
467
+ result: dict = {}
468
+ result["name"] = from_str(self.name)
469
+ if self.cost is not None:
470
+ result["cost"] = from_union([from_str, from_none], self.cost)
471
+ if self.datasheetUrl is not None:
472
+ result["datasheetUrl"] = from_union([from_str, from_none], self.datasheetUrl)
473
+ if self.family is not None:
474
+ result["family"] = from_union([from_str, from_none], self.family)
475
+ if self.orderCode is not None:
476
+ result["orderCode"] = from_union([from_str, from_none], self.orderCode)
477
+ if self.reference is not None:
478
+ result["reference"] = from_union([from_str, from_none], self.reference)
479
+ if self.status is not None:
480
+ result["status"] = from_union([lambda x: to_enum(Status, x), from_none], self.status)
481
+ return result
482
+
483
+
484
+ class ColumnShape(Enum):
485
+ """Shape of the column, also used for gaps"""
486
+
487
+ irregular = "irregular"
488
+ oblong = "oblong"
489
+ rectangular = "rectangular"
490
+ round = "round"
491
+
492
+
493
+ class WindingOrientation(Enum):
494
+ """Way in which the sections are oriented inside the winding window
495
+
496
+ Way in which the layer is oriented inside the section
497
+
498
+ Way in which the layers are oriented inside the section
499
+ """
500
+ contiguous = "contiguous"
501
+ overlapping = "overlapping"
502
+
503
+
504
+ class WindingWindowShape(Enum):
505
+ rectangular = "rectangular"
506
+ round = "round"
507
+
508
+
509
+ @dataclass
510
+ class WindingWindowElement:
511
+ """List of rectangular winding windows
512
+
513
+ It is the area between the winding column and the closest lateral column, and it
514
+ represents the area where all the wires of the magnetic will have to fit, and
515
+ equivalently, where all the current must circulate once, in the case of inductors, or
516
+ twice, in the case of transformers
517
+
518
+ List of radial winding windows
519
+
520
+ It is the area between the delimited between a height from the surface of the toroidal
521
+ core at a given angle, and it represents the area where all the wires of the magnetic
522
+ will have to fit, and equivalently, where all the current must circulate once, in the
523
+ case of inductors, or twice, in the case of transformers
524
+ """
525
+ area: Optional[float] = None
526
+ """Area of the winding window"""
527
+
528
+ coordinates: Optional[List[float]] = None
529
+ """The coordinates of the center of the winding window, referred to the center of the main
530
+ column. In the case of half-sets, the center will be in the top point, where it would
531
+ join another half-set
532
+
533
+ The coordinates of the point of the winding window where the middle height touches the
534
+ main column, referred to the center of the main column. In the case of half-sets, the
535
+ center will be in the top point, where it would join another half-set
536
+ """
537
+ height: Optional[float] = None
538
+ """Vertical height of the winding window"""
539
+
540
+ sectionsOrientation: Optional[WindingOrientation] = None
541
+ """Way in which the sections are oriented inside the winding window"""
542
+
543
+ shape: Optional[WindingWindowShape] = None
544
+ """Shape of the winding window"""
545
+
546
+ width: Optional[float] = None
547
+ """Horizontal width of the winding window"""
548
+
549
+ angle: Optional[float] = None
550
+ """Total angle of the window"""
551
+
552
+ radialHeight: Optional[float] = None
553
+ """Radial height of the winding window"""
554
+
555
+ @staticmethod
556
+ def from_dict(obj: Any) -> 'WindingWindowElement':
557
+ assert isinstance(obj, dict)
558
+ area = from_union([from_float, from_none], obj.get("area"))
559
+ coordinates = from_union([lambda x: from_list(from_float, x), from_none], obj.get("coordinates"))
560
+ height = from_union([from_float, from_none], obj.get("height"))
561
+ sectionsOrientation = from_union([WindingOrientation, from_none], obj.get("sectionsOrientation"))
562
+ shape = from_union([WindingWindowShape, from_none], obj.get("shape"))
563
+ width = from_union([from_float, from_none], obj.get("width"))
564
+ angle = from_union([from_float, from_none], obj.get("angle"))
565
+ radialHeight = from_union([from_float, from_none], obj.get("radialHeight"))
566
+ return WindingWindowElement(area, coordinates, height, sectionsOrientation, shape, width, angle, radialHeight)
567
+
568
+ def to_dict(self) -> dict:
569
+ result: dict = {}
570
+ if self.area is not None:
571
+ result["area"] = from_union([to_float, from_none], self.area)
572
+ if self.coordinates is not None:
573
+ result["coordinates"] = from_union([lambda x: from_list(to_float, x), from_none], self.coordinates)
574
+ if self.height is not None:
575
+ result["height"] = from_union([to_float, from_none], self.height)
576
+ if self.sectionsOrientation is not None:
577
+ result["sectionsOrientation"] = from_union([lambda x: to_enum(WindingOrientation, x), from_none], self.sectionsOrientation)
578
+ if self.shape is not None:
579
+ result["shape"] = from_union([lambda x: to_enum(WindingWindowShape, x), from_none], self.shape)
580
+ if self.width is not None:
581
+ result["width"] = from_union([to_float, from_none], self.width)
582
+ if self.angle is not None:
583
+ result["angle"] = from_union([to_float, from_none], self.angle)
584
+ if self.radialHeight is not None:
585
+ result["radialHeight"] = from_union([to_float, from_none], self.radialHeight)
586
+ return result
587
+
588
+
589
+ @dataclass
590
+ class CoreBobbinProcessedDescription:
591
+ columnDepth: float
592
+ """The depth of the central column wall, including thickness, in the z axis"""
593
+
594
+ columnShape: ColumnShape
595
+ columnThickness: float
596
+ """The thicknes of the central column wall, where the wire is wound, in the X axis"""
597
+
598
+ wallThickness: float
599
+ """The thicknes of the walls that hold the wire on both sides of the column"""
600
+
601
+ windingWindows: List[WindingWindowElement]
602
+ """List of winding windows, all elements in the list must be of the same type"""
603
+
604
+ columnWidth: Optional[float] = None
605
+ """The width of the central column wall, including thickness, in the x axis"""
606
+
607
+ coordinates: Optional[List[float]] = None
608
+ """The coordinates of the center of the bobbin central wall, whre the wires are wound,
609
+ referred to the center of the main column.
610
+ """
611
+ pins: Optional[List[Pin]] = None
612
+ """List of pins, geometrically defining how and where it is"""
613
+
614
+ @staticmethod
615
+ def from_dict(obj: Any) -> 'CoreBobbinProcessedDescription':
616
+ assert isinstance(obj, dict)
617
+ columnDepth = from_float(obj.get("columnDepth"))
618
+ columnShape = ColumnShape(obj.get("columnShape"))
619
+ columnThickness = from_float(obj.get("columnThickness"))
620
+ wallThickness = from_float(obj.get("wallThickness"))
621
+ windingWindows = from_list(WindingWindowElement.from_dict, obj.get("windingWindows"))
622
+ columnWidth = from_union([from_float, from_none], obj.get("columnWidth"))
623
+ coordinates = from_union([lambda x: from_list(from_float, x), from_none], obj.get("coordinates"))
624
+ pins = from_union([lambda x: from_list(Pin.from_dict, x), from_none], obj.get("pins"))
625
+ return CoreBobbinProcessedDescription(columnDepth, columnShape, columnThickness, wallThickness, windingWindows, columnWidth, coordinates, pins)
626
+
627
+ def to_dict(self) -> dict:
628
+ result: dict = {}
629
+ result["columnDepth"] = to_float(self.columnDepth)
630
+ result["columnShape"] = to_enum(ColumnShape, self.columnShape)
631
+ result["columnThickness"] = to_float(self.columnThickness)
632
+ result["wallThickness"] = to_float(self.wallThickness)
633
+ result["windingWindows"] = from_list(lambda x: to_class(WindingWindowElement, x), self.windingWindows)
634
+ if self.columnWidth is not None:
635
+ result["columnWidth"] = from_union([to_float, from_none], self.columnWidth)
636
+ if self.coordinates is not None:
637
+ result["coordinates"] = from_union([lambda x: from_list(to_float, x), from_none], self.coordinates)
638
+ if self.pins is not None:
639
+ result["pins"] = from_union([lambda x: from_list(lambda x: to_class(Pin, x), x), from_none], self.pins)
640
+ return result
641
+
642
+
643
+ @dataclass
644
+ class Bobbin:
645
+ """The description of a bobbin"""
646
+
647
+ distributorsInfo: Optional[List[DistributorInfo]] = None
648
+ """The lists of distributors of the magnetic bobbin"""
649
+
650
+ functionalDescription: Optional[BobbinFunctionalDescription] = None
651
+ """The data from the bobbin based on its function, in a way that can be used by analytical
652
+ models.
653
+ """
654
+ manufacturerInfo: Optional[ManufacturerInfo] = None
655
+ name: Optional[str] = None
656
+ """The name of bobbin"""
657
+
658
+ processedDescription: Optional[CoreBobbinProcessedDescription] = None
659
+
660
+ @staticmethod
661
+ def from_dict(obj: Any) -> 'Bobbin':
662
+ assert isinstance(obj, dict)
663
+ distributorsInfo = from_union([lambda x: from_list(DistributorInfo.from_dict, x), from_none], obj.get("distributorsInfo"))
664
+ functionalDescription = from_union([BobbinFunctionalDescription.from_dict, from_none], obj.get("functionalDescription"))
665
+ manufacturerInfo = from_union([ManufacturerInfo.from_dict, from_none], obj.get("manufacturerInfo"))
666
+ name = from_union([from_str, from_none], obj.get("name"))
667
+ processedDescription = from_union([CoreBobbinProcessedDescription.from_dict, from_none], obj.get("processedDescription"))
668
+ return Bobbin(distributorsInfo, functionalDescription, manufacturerInfo, name, processedDescription)
669
+
670
+ def to_dict(self) -> dict:
671
+ result: dict = {}
672
+ if self.distributorsInfo is not None:
673
+ result["distributorsInfo"] = from_union([lambda x: from_list(lambda x: to_class(DistributorInfo, x), x), from_none], self.distributorsInfo)
674
+ if self.functionalDescription is not None:
675
+ result["functionalDescription"] = from_union([lambda x: to_class(BobbinFunctionalDescription, x), from_none], self.functionalDescription)
676
+ if self.manufacturerInfo is not None:
677
+ result["manufacturerInfo"] = from_union([lambda x: to_class(ManufacturerInfo, x), from_none], self.manufacturerInfo)
678
+ if self.name is not None:
679
+ result["name"] = from_union([from_str, from_none], self.name)
680
+ if self.processedDescription is not None:
681
+ result["processedDescription"] = from_union([lambda x: to_class(CoreBobbinProcessedDescription, x), from_none], self.processedDescription)
682
+ return result
683
+
684
+
685
+ class ConnectionType(Enum):
686
+ """Type of the terminal"""
687
+
688
+ FlyingLead = "Flying Lead"
689
+ Pin = "Pin"
690
+ SMT = "SMT"
691
+ Screw = "Screw"
692
+
693
+
694
+ @dataclass
695
+ class ConnectionElement:
696
+ """Data describing the connection of the a wire"""
697
+
698
+ length: Optional[float] = None
699
+ """Length of the connection, counted from the exit of the last turn until the terminal, in m"""
700
+
701
+ metric: Optional[int] = None
702
+ """Metric of the terminal, if applicable"""
703
+
704
+ pinName: Optional[str] = None
705
+ """Name of the pin where it is connected, if applicable"""
706
+
707
+ type: Optional[ConnectionType] = None
708
+
709
+ @staticmethod
710
+ def from_dict(obj: Any) -> 'ConnectionElement':
711
+ assert isinstance(obj, dict)
712
+ length = from_union([from_float, from_none], obj.get("length"))
713
+ metric = from_union([from_int, from_none], obj.get("metric"))
714
+ pinName = from_union([from_str, from_none], obj.get("pinName"))
715
+ type = from_union([ConnectionType, from_none], obj.get("type"))
716
+ return ConnectionElement(length, metric, pinName, type)
717
+
718
+ def to_dict(self) -> dict:
719
+ result: dict = {}
720
+ if self.length is not None:
721
+ result["length"] = from_union([to_float, from_none], self.length)
722
+ if self.metric is not None:
723
+ result["metric"] = from_union([from_int, from_none], self.metric)
724
+ if self.pinName is not None:
725
+ result["pinName"] = from_union([from_str, from_none], self.pinName)
726
+ if self.type is not None:
727
+ result["type"] = from_union([lambda x: to_enum(ConnectionType, x), from_none], self.type)
728
+ return result
729
+
730
+
731
+ class IsolationSide(Enum):
732
+ """Tag to identify windings that are sharing the same ground"""
733
+
734
+ denary = "denary"
735
+ duodenary = "duodenary"
736
+ nonary = "nonary"
737
+ octonary = "octonary"
738
+ primary = "primary"
739
+ quaternary = "quaternary"
740
+ quinary = "quinary"
741
+ secondary = "secondary"
742
+ senary = "senary"
743
+ septenary = "septenary"
744
+ tertiary = "tertiary"
745
+ undenary = "undenary"
746
+
747
+
748
+ @dataclass
749
+ class DielectricStrengthElement:
750
+ """data for describing one point of dieletric strength"""
751
+
752
+ value: float
753
+ """Dieletric strength value, in V / m"""
754
+
755
+ humidity: Optional[float] = None
756
+ """Humidity for the field value, in proportion over 1"""
757
+
758
+ temperature: Optional[float] = None
759
+ """Temperature for the field value, in Celsius"""
760
+
761
+ thickness: Optional[float] = None
762
+ """Thickness of the material"""
763
+
764
+ @staticmethod
765
+ def from_dict(obj: Any) -> 'DielectricStrengthElement':
766
+ assert isinstance(obj, dict)
767
+ value = from_float(obj.get("value"))
768
+ humidity = from_union([from_float, from_none], obj.get("humidity"))
769
+ temperature = from_union([from_float, from_none], obj.get("temperature"))
770
+ thickness = from_union([from_float, from_none], obj.get("thickness"))
771
+ return DielectricStrengthElement(value, humidity, temperature, thickness)
772
+
773
+ def to_dict(self) -> dict:
774
+ result: dict = {}
775
+ result["value"] = to_float(self.value)
776
+ if self.humidity is not None:
777
+ result["humidity"] = from_union([to_float, from_none], self.humidity)
778
+ if self.temperature is not None:
779
+ result["temperature"] = from_union([to_float, from_none], self.temperature)
780
+ if self.thickness is not None:
781
+ result["thickness"] = from_union([to_float, from_none], self.thickness)
782
+ return result
783
+
784
+
785
+ @dataclass
786
+ class ResistivityPoint:
787
+ """data for describing one point of resistivity"""
788
+
789
+ value: float
790
+ """Resistivity value, in Ohm * m"""
791
+
792
+ temperature: Optional[float] = None
793
+ """temperature for the field value, in Celsius"""
794
+
795
+ @staticmethod
796
+ def from_dict(obj: Any) -> 'ResistivityPoint':
797
+ assert isinstance(obj, dict)
798
+ value = from_float(obj.get("value"))
799
+ temperature = from_union([from_float, from_none], obj.get("temperature"))
800
+ return ResistivityPoint(value, temperature)
801
+
802
+ def to_dict(self) -> dict:
803
+ result: dict = {}
804
+ result["value"] = to_float(self.value)
805
+ if self.temperature is not None:
806
+ result["temperature"] = from_union([to_float, from_none], self.temperature)
807
+ return result
808
+
809
+
810
+ @dataclass
811
+ class InsulationMaterial:
812
+ """A material for insulation"""
813
+
814
+ dielectricStrength: List[DielectricStrengthElement]
815
+ name: str
816
+ """The name of a insulation material"""
817
+
818
+ aliases: Optional[List[str]] = None
819
+ """Alternative names of the material"""
820
+
821
+ composition: Optional[str] = None
822
+ """The composition of a insulation material"""
823
+
824
+ dielectricConstant: Optional[float] = None
825
+ """The dielectric constant of the insulation material"""
826
+
827
+ manufacturer: Optional[str] = None
828
+ """The manufacturer of the insulation material"""
829
+
830
+ meltingPoint: Optional[float] = None
831
+ """The melting temperature of the insulation material, in Celsius"""
832
+
833
+ resistivity: Optional[List[ResistivityPoint]] = None
834
+ """Resistivity value according to manufacturer"""
835
+
836
+ specificHeat: Optional[float] = None
837
+ """The specific heat of the insulation material, in J / (Kg * K)"""
838
+
839
+ temperatureClass: Optional[float] = None
840
+ """The temperature class of the insulation material, in Celsius"""
841
+
842
+ thermalConductivity: Optional[float] = None
843
+ """The thermal conductivity of the insulation material, in W / (m * K)"""
844
+
845
+ @staticmethod
846
+ def from_dict(obj: Any) -> 'InsulationMaterial':
847
+ assert isinstance(obj, dict)
848
+ dielectricStrength = from_list(DielectricStrengthElement.from_dict, obj.get("dielectricStrength"))
849
+ name = from_str(obj.get("name"))
850
+ aliases = from_union([lambda x: from_list(from_str, x), from_none], obj.get("aliases"))
851
+ composition = from_union([from_str, from_none], obj.get("composition"))
852
+ dielectricConstant = from_union([from_float, from_none], obj.get("dielectricConstant"))
853
+ manufacturer = from_union([from_str, from_none], obj.get("manufacturer"))
854
+ meltingPoint = from_union([from_float, from_none], obj.get("meltingPoint"))
855
+ resistivity = from_union([lambda x: from_list(ResistivityPoint.from_dict, x), from_none], obj.get("resistivity"))
856
+ specificHeat = from_union([from_float, from_none], obj.get("specificHeat"))
857
+ temperatureClass = from_union([from_float, from_none], obj.get("temperatureClass"))
858
+ thermalConductivity = from_union([from_float, from_none], obj.get("thermalConductivity"))
859
+ return InsulationMaterial(dielectricStrength, name, aliases, composition, dielectricConstant, manufacturer, meltingPoint, resistivity, specificHeat, temperatureClass, thermalConductivity)
860
+
861
+ def to_dict(self) -> dict:
862
+ result: dict = {}
863
+ result["dielectricStrength"] = from_list(lambda x: to_class(DielectricStrengthElement, x), self.dielectricStrength)
864
+ result["name"] = from_str(self.name)
865
+ if self.aliases is not None:
866
+ result["aliases"] = from_union([lambda x: from_list(from_str, x), from_none], self.aliases)
867
+ if self.composition is not None:
868
+ result["composition"] = from_union([from_str, from_none], self.composition)
869
+ if self.dielectricConstant is not None:
870
+ result["dielectricConstant"] = from_union([to_float, from_none], self.dielectricConstant)
871
+ if self.manufacturer is not None:
872
+ result["manufacturer"] = from_union([from_str, from_none], self.manufacturer)
873
+ if self.meltingPoint is not None:
874
+ result["meltingPoint"] = from_union([to_float, from_none], self.meltingPoint)
875
+ if self.resistivity is not None:
876
+ result["resistivity"] = from_union([lambda x: from_list(lambda x: to_class(ResistivityPoint, x), x), from_none], self.resistivity)
877
+ if self.specificHeat is not None:
878
+ result["specificHeat"] = from_union([to_float, from_none], self.specificHeat)
879
+ if self.temperatureClass is not None:
880
+ result["temperatureClass"] = from_union([to_float, from_none], self.temperatureClass)
881
+ if self.thermalConductivity is not None:
882
+ result["thermalConductivity"] = from_union([to_float, from_none], self.thermalConductivity)
883
+ return result
884
+
885
+
886
+ class InsulationWireCoatingType(Enum):
887
+ """The type of the coating"""
888
+
889
+ bare = "bare"
890
+ enamelled = "enamelled"
891
+ extruded = "extruded"
892
+ insulated = "insulated"
893
+ served = "served"
894
+ taped = "taped"
895
+
896
+
897
+ @dataclass
898
+ class InsulationWireCoating:
899
+ """A coating for a wire"""
900
+
901
+ breakdownVoltage: Optional[float] = None
902
+ """The minimum voltage that causes a portion of an insulator to experience electrical
903
+ breakdown and become electrically conductive, in V
904
+ """
905
+ grade: Optional[int] = None
906
+ """The grade of the insulation around the wire"""
907
+
908
+ material: Optional[Union[InsulationMaterial, str]] = None
909
+ numberLayers: Optional[int] = None
910
+ """The number of layers of the insulation around the wire"""
911
+
912
+ temperatureRating: Optional[float] = None
913
+ """The maximum temperature that the wire coating can withstand"""
914
+
915
+ thickness: Optional[DimensionWithTolerance] = None
916
+ """The maximum thickness of the insulation around the wire, in m"""
917
+
918
+ thicknessLayers: Optional[float] = None
919
+ """The thickness of the layers of the insulation around the wire, in m"""
920
+
921
+ type: Optional[InsulationWireCoatingType] = None
922
+ """The type of the coating"""
923
+
924
+ @staticmethod
925
+ def from_dict(obj: Any) -> 'InsulationWireCoating':
926
+ assert isinstance(obj, dict)
927
+ breakdownVoltage = from_union([from_float, from_none], obj.get("breakdownVoltage"))
928
+ grade = from_union([from_int, from_none], obj.get("grade"))
929
+ material = from_union([InsulationMaterial.from_dict, from_str, from_none], obj.get("material"))
930
+ numberLayers = from_union([from_int, from_none], obj.get("numberLayers"))
931
+ temperatureRating = from_union([from_float, from_none], obj.get("temperatureRating"))
932
+ thickness = from_union([DimensionWithTolerance.from_dict, from_none], obj.get("thickness"))
933
+ thicknessLayers = from_union([from_float, from_none], obj.get("thicknessLayers"))
934
+ type = from_union([InsulationWireCoatingType, from_none], obj.get("type"))
935
+ return InsulationWireCoating(breakdownVoltage, grade, material, numberLayers, temperatureRating, thickness, thicknessLayers, type)
936
+
937
+ def to_dict(self) -> dict:
938
+ result: dict = {}
939
+ if self.breakdownVoltage is not None:
940
+ result["breakdownVoltage"] = from_union([to_float, from_none], self.breakdownVoltage)
941
+ if self.grade is not None:
942
+ result["grade"] = from_union([from_int, from_none], self.grade)
943
+ if self.material is not None:
944
+ result["material"] = from_union([lambda x: to_class(InsulationMaterial, x), from_str, from_none], self.material)
945
+ if self.numberLayers is not None:
946
+ result["numberLayers"] = from_union([from_int, from_none], self.numberLayers)
947
+ if self.temperatureRating is not None:
948
+ result["temperatureRating"] = from_union([to_float, from_none], self.temperatureRating)
949
+ if self.thickness is not None:
950
+ result["thickness"] = from_union([lambda x: to_class(DimensionWithTolerance, x), from_none], self.thickness)
951
+ if self.thicknessLayers is not None:
952
+ result["thicknessLayers"] = from_union([to_float, from_none], self.thicknessLayers)
953
+ if self.type is not None:
954
+ result["type"] = from_union([lambda x: to_enum(InsulationWireCoatingType, x), from_none], self.type)
955
+ return result
956
+
957
+
958
+ @dataclass
959
+ class Resistivity:
960
+ """data for describing the resistivity of a wire"""
961
+
962
+ referenceTemperature: float
963
+ """Temperature reference value, in Celsius"""
964
+
965
+ referenceValue: float
966
+ """Resistivity reference value, in Ohm * m"""
967
+
968
+ temperatureCoefficient: float
969
+ """Temperature coefficient value, alpha, in 1 / Celsius"""
970
+
971
+ @staticmethod
972
+ def from_dict(obj: Any) -> 'Resistivity':
973
+ assert isinstance(obj, dict)
974
+ referenceTemperature = from_float(obj.get("referenceTemperature"))
975
+ referenceValue = from_float(obj.get("referenceValue"))
976
+ temperatureCoefficient = from_float(obj.get("temperatureCoefficient"))
977
+ return Resistivity(referenceTemperature, referenceValue, temperatureCoefficient)
978
+
979
+ def to_dict(self) -> dict:
980
+ result: dict = {}
981
+ result["referenceTemperature"] = to_float(self.referenceTemperature)
982
+ result["referenceValue"] = to_float(self.referenceValue)
983
+ result["temperatureCoefficient"] = to_float(self.temperatureCoefficient)
984
+ return result
985
+
986
+
987
+ @dataclass
988
+ class ThermalConductivityElement:
989
+ """data for describing one point of thermal conductivity"""
990
+
991
+ temperature: float
992
+ """Temperature for the field value, in Celsius"""
993
+
994
+ value: float
995
+ """Thermal conductivity value, in W / m * K"""
996
+
997
+ @staticmethod
998
+ def from_dict(obj: Any) -> 'ThermalConductivityElement':
999
+ assert isinstance(obj, dict)
1000
+ temperature = from_float(obj.get("temperature"))
1001
+ value = from_float(obj.get("value"))
1002
+ return ThermalConductivityElement(temperature, value)
1003
+
1004
+ def to_dict(self) -> dict:
1005
+ result: dict = {}
1006
+ result["temperature"] = to_float(self.temperature)
1007
+ result["value"] = to_float(self.value)
1008
+ return result
1009
+
1010
+
1011
+ @dataclass
1012
+ class WireMaterial:
1013
+ """A material for wire"""
1014
+
1015
+ name: str
1016
+ """The name of a wire material"""
1017
+
1018
+ permeability: float
1019
+ """The permeability of a wire material"""
1020
+
1021
+ resistivity: Resistivity
1022
+ thermalConductivity: Optional[List[ThermalConductivityElement]] = None
1023
+
1024
+ @staticmethod
1025
+ def from_dict(obj: Any) -> 'WireMaterial':
1026
+ assert isinstance(obj, dict)
1027
+ name = from_str(obj.get("name"))
1028
+ permeability = from_float(obj.get("permeability"))
1029
+ resistivity = Resistivity.from_dict(obj.get("resistivity"))
1030
+ thermalConductivity = from_union([lambda x: from_list(ThermalConductivityElement.from_dict, x), from_none], obj.get("thermalConductivity"))
1031
+ return WireMaterial(name, permeability, resistivity, thermalConductivity)
1032
+
1033
+ def to_dict(self) -> dict:
1034
+ result: dict = {}
1035
+ result["name"] = from_str(self.name)
1036
+ result["permeability"] = to_float(self.permeability)
1037
+ result["resistivity"] = to_class(Resistivity, self.resistivity)
1038
+ if self.thermalConductivity is not None:
1039
+ result["thermalConductivity"] = from_union([lambda x: from_list(lambda x: to_class(ThermalConductivityElement, x), x), from_none], self.thermalConductivity)
1040
+ return result
1041
+
1042
+
1043
+ class WireStandard(Enum):
1044
+ """The standard of wire"""
1045
+
1046
+ IEC60317 = "IEC 60317"
1047
+ IPC6012 = "IPC-6012"
1048
+ NEMAMW1000C = "NEMA MW 1000 C"
1049
+
1050
+
1051
+ class WireType(Enum):
1052
+ """The type of wire"""
1053
+
1054
+ foil = "foil"
1055
+ litz = "litz"
1056
+ planar = "planar"
1057
+ rectangular = "rectangular"
1058
+ round = "round"
1059
+
1060
+
1061
+ @dataclass
1062
+ class WireRound:
1063
+ """The description of a solid round magnet wire
1064
+
1065
+ The description of a basic magnet wire
1066
+ """
1067
+ conductingDiameter: DimensionWithTolerance
1068
+ """The conducting diameter of the wire, in m"""
1069
+
1070
+ type: WireType
1071
+ material: Optional[Union[WireMaterial, str]] = None
1072
+ outerDiameter: Optional[DimensionWithTolerance] = None
1073
+ """The outer diameter of the wire, in m"""
1074
+
1075
+ coating: Optional[Union[InsulationWireCoating, str]] = None
1076
+ conductingArea: Optional[DimensionWithTolerance] = None
1077
+ """The conducting area of the wire, in m². Used for some rectangular shapes where the area
1078
+ is smaller than expected due to rounded corners
1079
+ """
1080
+ manufacturerInfo: Optional[ManufacturerInfo] = None
1081
+ name: Optional[str] = None
1082
+ """The name of wire"""
1083
+
1084
+ numberConductors: Optional[int] = None
1085
+ """The number of conductors in the wire"""
1086
+
1087
+ standard: Optional[WireStandard] = None
1088
+ """The standard of wire"""
1089
+
1090
+ standardName: Optional[str] = None
1091
+ """Name according to the standard of wire"""
1092
+
1093
+ @staticmethod
1094
+ def from_dict(obj: Any) -> 'WireRound':
1095
+ assert isinstance(obj, dict)
1096
+ conductingDiameter = DimensionWithTolerance.from_dict(obj.get("conductingDiameter"))
1097
+ type = WireType(obj.get("type"))
1098
+ material = from_union([WireMaterial.from_dict, from_str, from_none], obj.get("material"))
1099
+ outerDiameter = from_union([DimensionWithTolerance.from_dict, from_none], obj.get("outerDiameter"))
1100
+ coating = from_union([InsulationWireCoating.from_dict, from_str, from_none], obj.get("coating"))
1101
+ conductingArea = from_union([DimensionWithTolerance.from_dict, from_none], obj.get("conductingArea"))
1102
+ manufacturerInfo = from_union([ManufacturerInfo.from_dict, from_none], obj.get("manufacturerInfo"))
1103
+ name = from_union([from_str, from_none], obj.get("name"))
1104
+ numberConductors = from_union([from_int, from_none], obj.get("numberConductors"))
1105
+ standard = from_union([WireStandard, from_none], obj.get("standard"))
1106
+ standardName = from_union([from_str, from_none], obj.get("standardName"))
1107
+ return WireRound(conductingDiameter, type, material, outerDiameter, coating, conductingArea, manufacturerInfo, name, numberConductors, standard, standardName)
1108
+
1109
+ def to_dict(self) -> dict:
1110
+ result: dict = {}
1111
+ result["conductingDiameter"] = to_class(DimensionWithTolerance, self.conductingDiameter)
1112
+ result["type"] = to_enum(WireType, self.type)
1113
+ if self.material is not None:
1114
+ result["material"] = from_union([lambda x: to_class(WireMaterial, x), from_str, from_none], self.material)
1115
+ if self.outerDiameter is not None:
1116
+ result["outerDiameter"] = from_union([lambda x: to_class(DimensionWithTolerance, x), from_none], self.outerDiameter)
1117
+ if self.coating is not None:
1118
+ result["coating"] = from_union([lambda x: to_class(InsulationWireCoating, x), from_str, from_none], self.coating)
1119
+ if self.conductingArea is not None:
1120
+ result["conductingArea"] = from_union([lambda x: to_class(DimensionWithTolerance, x), from_none], self.conductingArea)
1121
+ if self.manufacturerInfo is not None:
1122
+ result["manufacturerInfo"] = from_union([lambda x: to_class(ManufacturerInfo, x), from_none], self.manufacturerInfo)
1123
+ if self.name is not None:
1124
+ result["name"] = from_union([from_str, from_none], self.name)
1125
+ if self.numberConductors is not None:
1126
+ result["numberConductors"] = from_union([from_int, from_none], self.numberConductors)
1127
+ if self.standard is not None:
1128
+ result["standard"] = from_union([lambda x: to_enum(WireStandard, x), from_none], self.standard)
1129
+ if self.standardName is not None:
1130
+ result["standardName"] = from_union([from_str, from_none], self.standardName)
1131
+ return result
1132
+
1133
+
1134
+ @dataclass
1135
+ class Wire:
1136
+ """The description of a solid round magnet wire
1137
+
1138
+ The description of a basic magnet wire
1139
+
1140
+ The description of a solid foil magnet wire
1141
+
1142
+ The description of a solid rectangular magnet wire
1143
+
1144
+ The description of a stranded litz magnet wire
1145
+
1146
+ The description of a solid planar magnet wire
1147
+ """
1148
+ type: WireType
1149
+ conductingDiameter: Optional[DimensionWithTolerance] = None
1150
+ """The conducting diameter of the wire, in m"""
1151
+
1152
+ material: Optional[Union[WireMaterial, str]] = None
1153
+ outerDiameter: Optional[DimensionWithTolerance] = None
1154
+ """The outer diameter of the wire, in m"""
1155
+
1156
+ coating: Optional[Union[InsulationWireCoating, str]] = None
1157
+ conductingArea: Optional[DimensionWithTolerance] = None
1158
+ """The conducting area of the wire, in m². Used for some rectangular shapes where the area
1159
+ is smaller than expected due to rounded corners
1160
+ """
1161
+ manufacturerInfo: Optional[ManufacturerInfo] = None
1162
+ name: Optional[str] = None
1163
+ """The name of wire"""
1164
+
1165
+ numberConductors: Optional[int] = None
1166
+ """The number of conductors in the wire"""
1167
+
1168
+ standard: Optional[WireStandard] = None
1169
+ """The standard of wire"""
1170
+
1171
+ standardName: Optional[str] = None
1172
+ """Name according to the standard of wire"""
1173
+
1174
+ conductingHeight: Optional[DimensionWithTolerance] = None
1175
+ """The conducting height of the wire, in m"""
1176
+
1177
+ conductingWidth: Optional[DimensionWithTolerance] = None
1178
+ """The conducting width of the wire, in m"""
1179
+
1180
+ outerHeight: Optional[DimensionWithTolerance] = None
1181
+ """The outer height of the wire, in m"""
1182
+
1183
+ outerWidth: Optional[DimensionWithTolerance] = None
1184
+ """The outer width of the wire, in m"""
1185
+
1186
+ edgeRadius: Optional[DimensionWithTolerance] = None
1187
+ """The radius of the edge, in case of rectangular wire, in m"""
1188
+
1189
+ strand: Optional[Union[WireRound, str]] = None
1190
+ """The wire used as strands"""
1191
+
1192
+ @staticmethod
1193
+ def from_dict(obj: Any) -> 'Wire':
1194
+ assert isinstance(obj, dict)
1195
+ type = WireType(obj.get("type"))
1196
+ conductingDiameter = from_union([DimensionWithTolerance.from_dict, from_none], obj.get("conductingDiameter"))
1197
+ material = from_union([WireMaterial.from_dict, from_str, from_none], obj.get("material"))
1198
+ outerDiameter = from_union([DimensionWithTolerance.from_dict, from_none], obj.get("outerDiameter"))
1199
+ coating = from_union([InsulationWireCoating.from_dict, from_str, from_none], obj.get("coating"))
1200
+ conductingArea = from_union([DimensionWithTolerance.from_dict, from_none], obj.get("conductingArea"))
1201
+ manufacturerInfo = from_union([ManufacturerInfo.from_dict, from_none], obj.get("manufacturerInfo"))
1202
+ name = from_union([from_str, from_none], obj.get("name"))
1203
+ numberConductors = from_union([from_int, from_none], obj.get("numberConductors"))
1204
+ standard = from_union([WireStandard, from_none], obj.get("standard"))
1205
+ standardName = from_union([from_str, from_none], obj.get("standardName"))
1206
+ conductingHeight = from_union([DimensionWithTolerance.from_dict, from_none], obj.get("conductingHeight"))
1207
+ conductingWidth = from_union([DimensionWithTolerance.from_dict, from_none], obj.get("conductingWidth"))
1208
+ outerHeight = from_union([DimensionWithTolerance.from_dict, from_none], obj.get("outerHeight"))
1209
+ outerWidth = from_union([DimensionWithTolerance.from_dict, from_none], obj.get("outerWidth"))
1210
+ edgeRadius = from_union([DimensionWithTolerance.from_dict, from_none], obj.get("edgeRadius"))
1211
+ strand = from_union([WireRound.from_dict, from_str, from_none], obj.get("strand"))
1212
+ return Wire(type, conductingDiameter, material, outerDiameter, coating, conductingArea, manufacturerInfo, name, numberConductors, standard, standardName, conductingHeight, conductingWidth, outerHeight, outerWidth, edgeRadius, strand)
1213
+
1214
+ def to_dict(self) -> dict:
1215
+ result: dict = {}
1216
+ result["type"] = to_enum(WireType, self.type)
1217
+ if self.conductingDiameter is not None:
1218
+ result["conductingDiameter"] = from_union([lambda x: to_class(DimensionWithTolerance, x), from_none], self.conductingDiameter)
1219
+ if self.material is not None:
1220
+ result["material"] = from_union([lambda x: to_class(WireMaterial, x), from_str, from_none], self.material)
1221
+ if self.outerDiameter is not None:
1222
+ result["outerDiameter"] = from_union([lambda x: to_class(DimensionWithTolerance, x), from_none], self.outerDiameter)
1223
+ if self.coating is not None:
1224
+ result["coating"] = from_union([lambda x: to_class(InsulationWireCoating, x), from_str, from_none], self.coating)
1225
+ if self.conductingArea is not None:
1226
+ result["conductingArea"] = from_union([lambda x: to_class(DimensionWithTolerance, x), from_none], self.conductingArea)
1227
+ if self.manufacturerInfo is not None:
1228
+ result["manufacturerInfo"] = from_union([lambda x: to_class(ManufacturerInfo, x), from_none], self.manufacturerInfo)
1229
+ if self.name is not None:
1230
+ result["name"] = from_union([from_str, from_none], self.name)
1231
+ if self.numberConductors is not None:
1232
+ result["numberConductors"] = from_union([from_int, from_none], self.numberConductors)
1233
+ if self.standard is not None:
1234
+ result["standard"] = from_union([lambda x: to_enum(WireStandard, x), from_none], self.standard)
1235
+ if self.standardName is not None:
1236
+ result["standardName"] = from_union([from_str, from_none], self.standardName)
1237
+ if self.conductingHeight is not None:
1238
+ result["conductingHeight"] = from_union([lambda x: to_class(DimensionWithTolerance, x), from_none], self.conductingHeight)
1239
+ if self.conductingWidth is not None:
1240
+ result["conductingWidth"] = from_union([lambda x: to_class(DimensionWithTolerance, x), from_none], self.conductingWidth)
1241
+ if self.outerHeight is not None:
1242
+ result["outerHeight"] = from_union([lambda x: to_class(DimensionWithTolerance, x), from_none], self.outerHeight)
1243
+ if self.outerWidth is not None:
1244
+ result["outerWidth"] = from_union([lambda x: to_class(DimensionWithTolerance, x), from_none], self.outerWidth)
1245
+ if self.edgeRadius is not None:
1246
+ result["edgeRadius"] = from_union([lambda x: to_class(DimensionWithTolerance, x), from_none], self.edgeRadius)
1247
+ if self.strand is not None:
1248
+ result["strand"] = from_union([lambda x: to_class(WireRound, x), from_str, from_none], self.strand)
1249
+ return result
1250
+
1251
+
1252
+ @dataclass
1253
+ class CoilFunctionalDescription:
1254
+ """Data describing one winding associated with a magnetic"""
1255
+
1256
+ isolationSide: IsolationSide
1257
+ name: str
1258
+ """Name given to the winding"""
1259
+
1260
+ numberParallels: int
1261
+ """Number of parallels in winding"""
1262
+
1263
+ numberTurns: int
1264
+ """Number of turns in winding"""
1265
+
1266
+ wire: Union[Wire, str]
1267
+ connections: Optional[List[ConnectionElement]] = None
1268
+ """Array on elements, representing the all the pins this winding is connected to"""
1269
+
1270
+ @staticmethod
1271
+ def from_dict(obj: Any) -> 'CoilFunctionalDescription':
1272
+ assert isinstance(obj, dict)
1273
+ isolationSide = IsolationSide(obj.get("isolationSide"))
1274
+ name = from_str(obj.get("name"))
1275
+ numberParallels = from_int(obj.get("numberParallels"))
1276
+ numberTurns = from_int(obj.get("numberTurns"))
1277
+ wire = from_union([Wire.from_dict, from_str], obj.get("wire"))
1278
+ connections = from_union([lambda x: from_list(ConnectionElement.from_dict, x), from_none], obj.get("connections"))
1279
+ return CoilFunctionalDescription(isolationSide, name, numberParallels, numberTurns, wire, connections)
1280
+
1281
+ def to_dict(self) -> dict:
1282
+ result: dict = {}
1283
+ result["isolationSide"] = to_enum(IsolationSide, self.isolationSide)
1284
+ result["name"] = from_str(self.name)
1285
+ result["numberParallels"] = from_int(self.numberParallels)
1286
+ result["numberTurns"] = from_int(self.numberTurns)
1287
+ result["wire"] = from_union([lambda x: to_class(Wire, x), from_str], self.wire)
1288
+ if self.connections is not None:
1289
+ result["connections"] = from_union([lambda x: from_list(lambda x: to_class(ConnectionElement, x), x), from_none], self.connections)
1290
+ return result
1291
+
1292
+
1293
+ class CoordinateSystem(Enum):
1294
+ """System in which dimension and coordinates are in"""
1295
+
1296
+ cartesian = "cartesian"
1297
+ polar = "polar"
1298
+
1299
+
1300
+ @dataclass
1301
+ class PartialWinding:
1302
+ """Data describing one part of winding, described by a list with the proportion of each
1303
+ parallel in the winding that is contained here
1304
+ """
1305
+ parallelsProportion: List[float]
1306
+ """Number of parallels in winding"""
1307
+
1308
+ winding: str
1309
+ """The name of the winding that this part belongs to"""
1310
+
1311
+ connections: Optional[List[ConnectionElement]] = None
1312
+ """Array on two elements, representing the input and output connection for this partial
1313
+ winding
1314
+ """
1315
+
1316
+ @staticmethod
1317
+ def from_dict(obj: Any) -> 'PartialWinding':
1318
+ assert isinstance(obj, dict)
1319
+ parallelsProportion = from_list(from_float, obj.get("parallelsProportion"))
1320
+ winding = from_str(obj.get("winding"))
1321
+ connections = from_union([lambda x: from_list(ConnectionElement.from_dict, x), from_none], obj.get("connections"))
1322
+ return PartialWinding(parallelsProportion, winding, connections)
1323
+
1324
+ def to_dict(self) -> dict:
1325
+ result: dict = {}
1326
+ result["parallelsProportion"] = from_list(to_float, self.parallelsProportion)
1327
+ result["winding"] = from_str(self.winding)
1328
+ if self.connections is not None:
1329
+ result["connections"] = from_union([lambda x: from_list(lambda x: to_class(ConnectionElement, x), x), from_none], self.connections)
1330
+ return result
1331
+
1332
+
1333
+ class CoilAlignment(Enum):
1334
+ """Way in which the turns are aligned inside the layer
1335
+
1336
+ Way in which the layers are aligned inside the section
1337
+ """
1338
+ centered = "centered"
1339
+ innerortop = "inner or top"
1340
+ outerorbottom = "outer or bottom"
1341
+ spread = "spread"
1342
+
1343
+
1344
+ class ElectricalType(Enum):
1345
+ """Type of the layer"""
1346
+
1347
+ conduction = "conduction"
1348
+ insulation = "insulation"
1349
+ shielding = "shielding"
1350
+
1351
+
1352
+ class WindingStyle(Enum):
1353
+ """Defines if the layer is wound by consecutive turns or parallels
1354
+
1355
+ Defines if the section is wound by consecutive turns or parallels
1356
+ """
1357
+ windByConsecutiveParallels = "windByConsecutiveParallels"
1358
+ windByConsecutiveTurns = "windByConsecutiveTurns"
1359
+
1360
+
1361
+ @dataclass
1362
+ class Layer:
1363
+ """Data describing one layer in a magnetic"""
1364
+
1365
+ coordinates: List[float]
1366
+ """The coordinates of the center of the layer, referred to the center of the main column"""
1367
+
1368
+ dimensions: List[float]
1369
+ """Dimensions of the rectangle defining the layer"""
1370
+
1371
+ name: str
1372
+ """Name given to the layer"""
1373
+
1374
+ orientation: WindingOrientation
1375
+ """Way in which the layer is oriented inside the section"""
1376
+
1377
+ partialWindings: List[PartialWinding]
1378
+ """List of partial windings in this layer"""
1379
+
1380
+ type: ElectricalType
1381
+ """Type of the layer"""
1382
+
1383
+ additionalCoordinates: Optional[List[List[float]]] = None
1384
+ """List of additional coordinates of the center of the layer, referred to the center of the
1385
+ main column, in case the layer is not symmetrical, as in toroids
1386
+ """
1387
+ coordinateSystem: Optional[CoordinateSystem] = None
1388
+ """System in which dimension and coordinates are in"""
1389
+
1390
+ fillingFactor: Optional[float] = None
1391
+ """How much space in this layer is used by wires compared to the total"""
1392
+
1393
+ insulationMaterial: Optional[Union[InsulationMaterial, str]] = None
1394
+ """In case of insulating layer, the material used"""
1395
+
1396
+ section: Optional[str] = None
1397
+ """The name of the section that this layer belongs to"""
1398
+
1399
+ turnsAlignment: Optional[CoilAlignment] = None
1400
+ """Way in which the turns are aligned inside the layer"""
1401
+
1402
+ windingStyle: Optional[WindingStyle] = None
1403
+ """Defines if the layer is wound by consecutive turns or parallels"""
1404
+
1405
+ @staticmethod
1406
+ def from_dict(obj: Any) -> 'Layer':
1407
+ assert isinstance(obj, dict)
1408
+ coordinates = from_list(from_float, obj.get("coordinates"))
1409
+ dimensions = from_list(from_float, obj.get("dimensions"))
1410
+ name = from_str(obj.get("name"))
1411
+ orientation = WindingOrientation(obj.get("orientation"))
1412
+ partialWindings = from_list(PartialWinding.from_dict, obj.get("partialWindings"))
1413
+ type = ElectricalType(obj.get("type"))
1414
+ additionalCoordinates = from_union([lambda x: from_list(lambda x: from_list(from_float, x), x), from_none], obj.get("additionalCoordinates"))
1415
+ coordinateSystem = from_union([CoordinateSystem, from_none], obj.get("coordinateSystem"))
1416
+ fillingFactor = from_union([from_float, from_none], obj.get("fillingFactor"))
1417
+ insulationMaterial = from_union([InsulationMaterial.from_dict, from_str, from_none], obj.get("insulationMaterial"))
1418
+ section = from_union([from_str, from_none], obj.get("section"))
1419
+ turnsAlignment = from_union([CoilAlignment, from_none], obj.get("turnsAlignment"))
1420
+ windingStyle = from_union([WindingStyle, from_none], obj.get("windingStyle"))
1421
+ return Layer(coordinates, dimensions, name, orientation, partialWindings, type, additionalCoordinates, coordinateSystem, fillingFactor, insulationMaterial, section, turnsAlignment, windingStyle)
1422
+
1423
+ def to_dict(self) -> dict:
1424
+ result: dict = {}
1425
+ result["coordinates"] = from_list(to_float, self.coordinates)
1426
+ result["dimensions"] = from_list(to_float, self.dimensions)
1427
+ result["name"] = from_str(self.name)
1428
+ result["orientation"] = to_enum(WindingOrientation, self.orientation)
1429
+ result["partialWindings"] = from_list(lambda x: to_class(PartialWinding, x), self.partialWindings)
1430
+ result["type"] = to_enum(ElectricalType, self.type)
1431
+ if self.additionalCoordinates is not None:
1432
+ result["additionalCoordinates"] = from_union([lambda x: from_list(lambda x: from_list(to_float, x), x), from_none], self.additionalCoordinates)
1433
+ if self.coordinateSystem is not None:
1434
+ result["coordinateSystem"] = from_union([lambda x: to_enum(CoordinateSystem, x), from_none], self.coordinateSystem)
1435
+ if self.fillingFactor is not None:
1436
+ result["fillingFactor"] = from_union([to_float, from_none], self.fillingFactor)
1437
+ if self.insulationMaterial is not None:
1438
+ result["insulationMaterial"] = from_union([lambda x: to_class(InsulationMaterial, x), from_str, from_none], self.insulationMaterial)
1439
+ if self.section is not None:
1440
+ result["section"] = from_union([from_str, from_none], self.section)
1441
+ if self.turnsAlignment is not None:
1442
+ result["turnsAlignment"] = from_union([lambda x: to_enum(CoilAlignment, x), from_none], self.turnsAlignment)
1443
+ if self.windingStyle is not None:
1444
+ result["windingStyle"] = from_union([lambda x: to_enum(WindingStyle, x), from_none], self.windingStyle)
1445
+ return result
1446
+
1447
+
1448
+ @dataclass
1449
+ class Section:
1450
+ """Data describing one section in a magnetic"""
1451
+
1452
+ coordinates: List[float]
1453
+ """The coordinates of the center of the section, referred to the center of the main column"""
1454
+
1455
+ dimensions: List[float]
1456
+ """Dimensions of the rectangle defining the section"""
1457
+
1458
+ layersOrientation: WindingOrientation
1459
+ """Way in which the layers are oriented inside the section"""
1460
+
1461
+ name: str
1462
+ """Name given to the winding"""
1463
+
1464
+ partialWindings: List[PartialWinding]
1465
+ """List of partial windings in this section"""
1466
+
1467
+ type: ElectricalType
1468
+ """Type of the layer"""
1469
+
1470
+ coordinateSystem: Optional[CoordinateSystem] = None
1471
+ """System in which dimension and coordinates are in"""
1472
+
1473
+ fillingFactor: Optional[float] = None
1474
+ """How much space in this section is used by wires compared to the total"""
1475
+
1476
+ layersAlignment: Optional[CoilAlignment] = None
1477
+ """Way in which the layers are aligned inside the section"""
1478
+
1479
+ margin: Optional[List[float]] = None
1480
+ """Defines the distance in extremes of the section that is reserved to be filled with margin
1481
+ tape. It is an array os two elements from inner or top, to outer or bottom
1482
+ """
1483
+ windingStyle: Optional[WindingStyle] = None
1484
+ """Defines if the section is wound by consecutive turns or parallels"""
1485
+
1486
+ @staticmethod
1487
+ def from_dict(obj: Any) -> 'Section':
1488
+ assert isinstance(obj, dict)
1489
+ coordinates = from_list(from_float, obj.get("coordinates"))
1490
+ dimensions = from_list(from_float, obj.get("dimensions"))
1491
+ layersOrientation = WindingOrientation(obj.get("layersOrientation"))
1492
+ name = from_str(obj.get("name"))
1493
+ partialWindings = from_list(PartialWinding.from_dict, obj.get("partialWindings"))
1494
+ type = ElectricalType(obj.get("type"))
1495
+ coordinateSystem = from_union([CoordinateSystem, from_none], obj.get("coordinateSystem"))
1496
+ fillingFactor = from_union([from_float, from_none], obj.get("fillingFactor"))
1497
+ layersAlignment = from_union([CoilAlignment, from_none], obj.get("layersAlignment"))
1498
+ margin = from_union([lambda x: from_list(from_float, x), from_none], obj.get("margin"))
1499
+ windingStyle = from_union([WindingStyle, from_none], obj.get("windingStyle"))
1500
+ return Section(coordinates, dimensions, layersOrientation, name, partialWindings, type, coordinateSystem, fillingFactor, layersAlignment, margin, windingStyle)
1501
+
1502
+ def to_dict(self) -> dict:
1503
+ result: dict = {}
1504
+ result["coordinates"] = from_list(to_float, self.coordinates)
1505
+ result["dimensions"] = from_list(to_float, self.dimensions)
1506
+ result["layersOrientation"] = to_enum(WindingOrientation, self.layersOrientation)
1507
+ result["name"] = from_str(self.name)
1508
+ result["partialWindings"] = from_list(lambda x: to_class(PartialWinding, x), self.partialWindings)
1509
+ result["type"] = to_enum(ElectricalType, self.type)
1510
+ if self.coordinateSystem is not None:
1511
+ result["coordinateSystem"] = from_union([lambda x: to_enum(CoordinateSystem, x), from_none], self.coordinateSystem)
1512
+ if self.fillingFactor is not None:
1513
+ result["fillingFactor"] = from_union([to_float, from_none], self.fillingFactor)
1514
+ if self.layersAlignment is not None:
1515
+ result["layersAlignment"] = from_union([lambda x: to_enum(CoilAlignment, x), from_none], self.layersAlignment)
1516
+ if self.margin is not None:
1517
+ result["margin"] = from_union([lambda x: from_list(to_float, x), from_none], self.margin)
1518
+ if self.windingStyle is not None:
1519
+ result["windingStyle"] = from_union([lambda x: to_enum(WindingStyle, x), from_none], self.windingStyle)
1520
+ return result
1521
+
1522
+
1523
+ class TurnOrientation(Enum):
1524
+ """Way in which the turn is wound"""
1525
+
1526
+ clockwise = "clockwise"
1527
+ counterClockwise = "counterClockwise"
1528
+
1529
+
1530
+ @dataclass
1531
+ class Turn:
1532
+ """Data describing one turn in a magnetic"""
1533
+
1534
+ coordinates: List[float]
1535
+ """The coordinates of the center of the turn, referred to the center of the main column"""
1536
+
1537
+ length: float
1538
+ """The length of the turn, referred from the center of its cross section, in m"""
1539
+
1540
+ name: str
1541
+ """Name given to the turn"""
1542
+
1543
+ parallel: int
1544
+ """The index of the parallel that this turn belongs to"""
1545
+
1546
+ winding: str
1547
+ """The name of the winding that this turn belongs to"""
1548
+
1549
+ additionalCoordinates: Optional[List[List[float]]] = None
1550
+ """List of additional coordinates of the center of the turn, referred to the center of the
1551
+ main column, in case the turn is not symmetrical, as in toroids
1552
+ """
1553
+ angle: Optional[float] = None
1554
+ """The angle that the turn does, useful for partial turns, in degrees"""
1555
+
1556
+ coordinateSystem: Optional[CoordinateSystem] = None
1557
+ """System in which dimension and coordinates are in"""
1558
+
1559
+ dimensions: Optional[List[float]] = None
1560
+ """Dimensions of the rectangle defining the turn"""
1561
+
1562
+ layer: Optional[str] = None
1563
+ """The name of the layer that this turn belongs to"""
1564
+
1565
+ orientation: Optional[TurnOrientation] = None
1566
+ """Way in which the turn is wound"""
1567
+
1568
+ rotation: Optional[float] = None
1569
+ """Rotation of the rectangle defining the turn, in degrees"""
1570
+
1571
+ section: Optional[str] = None
1572
+ """The name of the section that this turn belongs to"""
1573
+
1574
+ @staticmethod
1575
+ def from_dict(obj: Any) -> 'Turn':
1576
+ assert isinstance(obj, dict)
1577
+ coordinates = from_list(from_float, obj.get("coordinates"))
1578
+ length = from_float(obj.get("length"))
1579
+ name = from_str(obj.get("name"))
1580
+ parallel = from_int(obj.get("parallel"))
1581
+ winding = from_str(obj.get("winding"))
1582
+ additionalCoordinates = from_union([lambda x: from_list(lambda x: from_list(from_float, x), x), from_none], obj.get("additionalCoordinates"))
1583
+ angle = from_union([from_float, from_none], obj.get("angle"))
1584
+ coordinateSystem = from_union([CoordinateSystem, from_none], obj.get("coordinateSystem"))
1585
+ dimensions = from_union([lambda x: from_list(from_float, x), from_none], obj.get("dimensions"))
1586
+ layer = from_union([from_str, from_none], obj.get("layer"))
1587
+ orientation = from_union([TurnOrientation, from_none], obj.get("orientation"))
1588
+ rotation = from_union([from_float, from_none], obj.get("rotation"))
1589
+ section = from_union([from_str, from_none], obj.get("section"))
1590
+ return Turn(coordinates, length, name, parallel, winding, additionalCoordinates, angle, coordinateSystem, dimensions, layer, orientation, rotation, section)
1591
+
1592
+ def to_dict(self) -> dict:
1593
+ result: dict = {}
1594
+ result["coordinates"] = from_list(to_float, self.coordinates)
1595
+ result["length"] = to_float(self.length)
1596
+ result["name"] = from_str(self.name)
1597
+ result["parallel"] = from_int(self.parallel)
1598
+ result["winding"] = from_str(self.winding)
1599
+ if self.additionalCoordinates is not None:
1600
+ result["additionalCoordinates"] = from_union([lambda x: from_list(lambda x: from_list(to_float, x), x), from_none], self.additionalCoordinates)
1601
+ if self.angle is not None:
1602
+ result["angle"] = from_union([to_float, from_none], self.angle)
1603
+ if self.coordinateSystem is not None:
1604
+ result["coordinateSystem"] = from_union([lambda x: to_enum(CoordinateSystem, x), from_none], self.coordinateSystem)
1605
+ if self.dimensions is not None:
1606
+ result["dimensions"] = from_union([lambda x: from_list(to_float, x), from_none], self.dimensions)
1607
+ if self.layer is not None:
1608
+ result["layer"] = from_union([from_str, from_none], self.layer)
1609
+ if self.orientation is not None:
1610
+ result["orientation"] = from_union([lambda x: to_enum(TurnOrientation, x), from_none], self.orientation)
1611
+ if self.rotation is not None:
1612
+ result["rotation"] = from_union([to_float, from_none], self.rotation)
1613
+ if self.section is not None:
1614
+ result["section"] = from_union([from_str, from_none], self.section)
1615
+ return result
1616
+
1617
+
1618
+ @dataclass
1619
+ class Coil:
1620
+ """Data describing the coil
1621
+
1622
+ The description of a magnetic coil
1623
+ """
1624
+ bobbin: Union[Bobbin, str]
1625
+ functionalDescription: List[CoilFunctionalDescription]
1626
+ """The data from the coil based on its function, in a way that can be used by analytical
1627
+ models of only Magnetism.
1628
+ """
1629
+ layersDescription: Optional[List[Layer]] = None
1630
+ """The data from the coil at the layer level, in a way that can be used by more advanced
1631
+ analytical and finite element models
1632
+ """
1633
+ sectionsDescription: Optional[List[Section]] = None
1634
+ """The data from the coil at the section level, in a way that can be used by more advanced
1635
+ analytical and finite element models
1636
+ """
1637
+ turnsDescription: Optional[List[Turn]] = None
1638
+ """The data from the coil at the turn level, in a way that can be used by the most advanced
1639
+ analytical and finite element models
1640
+ """
1641
+
1642
+ @staticmethod
1643
+ def from_dict(obj: Any) -> 'Coil':
1644
+ assert isinstance(obj, dict)
1645
+ bobbin = from_union([Bobbin.from_dict, from_str], obj.get("bobbin"))
1646
+ functionalDescription = from_list(CoilFunctionalDescription.from_dict, obj.get("functionalDescription"))
1647
+ layersDescription = from_union([lambda x: from_list(Layer.from_dict, x), from_none], obj.get("layersDescription"))
1648
+ sectionsDescription = from_union([lambda x: from_list(Section.from_dict, x), from_none], obj.get("sectionsDescription"))
1649
+ turnsDescription = from_union([lambda x: from_list(Turn.from_dict, x), from_none], obj.get("turnsDescription"))
1650
+ return Coil(bobbin, functionalDescription, layersDescription, sectionsDescription, turnsDescription)
1651
+
1652
+ def to_dict(self) -> dict:
1653
+ result: dict = {}
1654
+ result["bobbin"] = from_union([lambda x: to_class(Bobbin, x), from_str], self.bobbin)
1655
+ result["functionalDescription"] = from_list(lambda x: to_class(CoilFunctionalDescription, x), self.functionalDescription)
1656
+ if self.layersDescription is not None:
1657
+ result["layersDescription"] = from_union([lambda x: from_list(lambda x: to_class(Layer, x), x), from_none], self.layersDescription)
1658
+ if self.sectionsDescription is not None:
1659
+ result["sectionsDescription"] = from_union([lambda x: from_list(lambda x: to_class(Section, x), x), from_none], self.sectionsDescription)
1660
+ if self.turnsDescription is not None:
1661
+ result["turnsDescription"] = from_union([lambda x: from_list(lambda x: to_class(Turn, x), x), from_none], self.turnsDescription)
1662
+ return result
1663
+
1664
+
1665
+ class Coating(Enum):
1666
+ """The coating of the core"""
1667
+
1668
+ epoxy = "epoxy"
1669
+ parylene = "parylene"
1670
+
1671
+
1672
+ class GapType(Enum):
1673
+ """The type of a gap"""
1674
+
1675
+ additive = "additive"
1676
+ residual = "residual"
1677
+ subtractive = "subtractive"
1678
+
1679
+
1680
+ @dataclass
1681
+ class CoreGap:
1682
+ """A gap for the magnetic cores"""
1683
+
1684
+ length: float
1685
+ """The length of the gap"""
1686
+
1687
+ type: GapType
1688
+ """The type of a gap"""
1689
+
1690
+ area: Optional[float] = None
1691
+ """Geometrical area of the gap"""
1692
+
1693
+ coordinates: Optional[List[float]] = None
1694
+ """The coordinates of the center of the gap, referred to the center of the main column"""
1695
+
1696
+ distanceClosestNormalSurface: Optional[float] = None
1697
+ """The distance where the closest perpendicular surface is. This usually is half the winding
1698
+ height
1699
+ """
1700
+ distanceClosestParallelSurface: Optional[float] = None
1701
+ """The distance where the closest parallel surface is. This usually is the opposite side of
1702
+ the winnding window
1703
+ """
1704
+ sectionDimensions: Optional[List[float]] = None
1705
+ """Dimension of the section normal to the magnetic flux"""
1706
+
1707
+ shape: Optional[ColumnShape] = None
1708
+
1709
+ @staticmethod
1710
+ def from_dict(obj: Any) -> 'CoreGap':
1711
+ assert isinstance(obj, dict)
1712
+ length = from_float(obj.get("length"))
1713
+ type = GapType(obj.get("type"))
1714
+ area = from_union([from_float, from_none], obj.get("area"))
1715
+ coordinates = from_union([lambda x: from_list(from_float, x), from_none], obj.get("coordinates"))
1716
+ distanceClosestNormalSurface = from_union([from_float, from_none], obj.get("distanceClosestNormalSurface"))
1717
+ distanceClosestParallelSurface = from_union([from_float, from_none], obj.get("distanceClosestParallelSurface"))
1718
+ sectionDimensions = from_union([lambda x: from_list(from_float, x), from_none], obj.get("sectionDimensions"))
1719
+ shape = from_union([ColumnShape, from_none], obj.get("shape"))
1720
+ return CoreGap(length, type, area, coordinates, distanceClosestNormalSurface, distanceClosestParallelSurface, sectionDimensions, shape)
1721
+
1722
+ def to_dict(self) -> dict:
1723
+ result: dict = {}
1724
+ result["length"] = to_float(self.length)
1725
+ result["type"] = to_enum(GapType, self.type)
1726
+ if self.area is not None:
1727
+ result["area"] = from_union([to_float, from_none], self.area)
1728
+ if self.coordinates is not None:
1729
+ result["coordinates"] = from_union([lambda x: from_list(to_float, x), from_none], self.coordinates)
1730
+ if self.distanceClosestNormalSurface is not None:
1731
+ result["distanceClosestNormalSurface"] = from_union([to_float, from_none], self.distanceClosestNormalSurface)
1732
+ if self.distanceClosestParallelSurface is not None:
1733
+ result["distanceClosestParallelSurface"] = from_union([to_float, from_none], self.distanceClosestParallelSurface)
1734
+ if self.sectionDimensions is not None:
1735
+ result["sectionDimensions"] = from_union([lambda x: from_list(to_float, x), from_none], self.sectionDimensions)
1736
+ if self.shape is not None:
1737
+ result["shape"] = from_union([lambda x: to_enum(ColumnShape, x), from_none], self.shape)
1738
+ return result
1739
+
1740
+
1741
+ @dataclass
1742
+ class SaturationElement:
1743
+ """data for describing one point of the BH cycle"""
1744
+
1745
+ magneticField: float
1746
+ """magnetic field value, in A/m"""
1747
+
1748
+ magneticFluxDensity: float
1749
+ """magnetic flux density value, in T"""
1750
+
1751
+ temperature: float
1752
+ """temperature for the field value, in Celsius"""
1753
+
1754
+ @staticmethod
1755
+ def from_dict(obj: Any) -> 'SaturationElement':
1756
+ assert isinstance(obj, dict)
1757
+ magneticField = from_float(obj.get("magneticField"))
1758
+ magneticFluxDensity = from_float(obj.get("magneticFluxDensity"))
1759
+ temperature = from_float(obj.get("temperature"))
1760
+ return SaturationElement(magneticField, magneticFluxDensity, temperature)
1761
+
1762
+ def to_dict(self) -> dict:
1763
+ result: dict = {}
1764
+ result["magneticField"] = to_float(self.magneticField)
1765
+ result["magneticFluxDensity"] = to_float(self.magneticFluxDensity)
1766
+ result["temperature"] = to_float(self.temperature)
1767
+ return result
1768
+
1769
+
1770
+ class MaterialEnum(Enum):
1771
+ """The composition of a magnetic material"""
1772
+
1773
+ amorphous = "amorphous"
1774
+ electricalSteel = "electricalSteel"
1775
+ ferrite = "ferrite"
1776
+ nanocrystalline = "nanocrystalline"
1777
+ powder = "powder"
1778
+
1779
+
1780
+ class MaterialCompositionEnum(Enum):
1781
+ """The composition of a magnetic material"""
1782
+
1783
+ MnZn = "MnZn"
1784
+ NiZn = "NiZn"
1785
+
1786
+
1787
+ @dataclass
1788
+ class FrequencyFactor:
1789
+ """Field with the coefficients used to calculate how much the permeability decreases with
1790
+ the frequency, as factor = a + b * f + c * pow(f, 2) + d * pow(f, 3) + e * pow(f, 4)
1791
+
1792
+ Field with the coefficients used to calculate how much the permeability decreases with
1793
+ the frequency, as factor = 1 / (a + b * pow(f, c) ) + d
1794
+ """
1795
+ a: float
1796
+ b: float
1797
+ c: float
1798
+ d: float
1799
+ e: Optional[float] = None
1800
+
1801
+ @staticmethod
1802
+ def from_dict(obj: Any) -> 'FrequencyFactor':
1803
+ assert isinstance(obj, dict)
1804
+ a = from_float(obj.get("a"))
1805
+ b = from_float(obj.get("b"))
1806
+ c = from_float(obj.get("c"))
1807
+ d = from_float(obj.get("d"))
1808
+ e = from_union([from_float, from_none], obj.get("e"))
1809
+ return FrequencyFactor(a, b, c, d, e)
1810
+
1811
+ def to_dict(self) -> dict:
1812
+ result: dict = {}
1813
+ result["a"] = to_float(self.a)
1814
+ result["b"] = to_float(self.b)
1815
+ result["c"] = to_float(self.c)
1816
+ result["d"] = to_float(self.d)
1817
+ if self.e is not None:
1818
+ result["e"] = from_union([to_float, from_none], self.e)
1819
+ return result
1820
+
1821
+
1822
+ @dataclass
1823
+ class MagneticFieldDcBiasFactor:
1824
+ """Field with the coefficients used to calculate how much the permeability decreases with
1825
+ the H DC bias, as factor = a + b * pow(H, c)
1826
+
1827
+ Field with the coefficients used to calculate how much the permeability decreases with
1828
+ the H DC bias, as factor = a + b * pow(H, c) + d
1829
+ """
1830
+ a: float
1831
+ b: float
1832
+ c: float
1833
+ d: Optional[float] = None
1834
+
1835
+ @staticmethod
1836
+ def from_dict(obj: Any) -> 'MagneticFieldDcBiasFactor':
1837
+ assert isinstance(obj, dict)
1838
+ a = from_float(obj.get("a"))
1839
+ b = from_float(obj.get("b"))
1840
+ c = from_float(obj.get("c"))
1841
+ d = from_union([from_float, from_none], obj.get("d"))
1842
+ return MagneticFieldDcBiasFactor(a, b, c, d)
1843
+
1844
+ def to_dict(self) -> dict:
1845
+ result: dict = {}
1846
+ result["a"] = to_float(self.a)
1847
+ result["b"] = to_float(self.b)
1848
+ result["c"] = to_float(self.c)
1849
+ if self.d is not None:
1850
+ result["d"] = from_union([to_float, from_none], self.d)
1851
+ return result
1852
+
1853
+
1854
+ @dataclass
1855
+ class MagneticFluxDensityFactor:
1856
+ """Field with the coefficients used to calculate how much the permeability decreases with
1857
+ the B field, as factor = = 1 / ( 1 / ( a + b * pow(B,c)) + 1 / (d * pow(B, e) ) + 1 / f )
1858
+ """
1859
+ a: float
1860
+ b: float
1861
+ c: float
1862
+ d: float
1863
+ e: float
1864
+ f: float
1865
+
1866
+ @staticmethod
1867
+ def from_dict(obj: Any) -> 'MagneticFluxDensityFactor':
1868
+ assert isinstance(obj, dict)
1869
+ a = from_float(obj.get("a"))
1870
+ b = from_float(obj.get("b"))
1871
+ c = from_float(obj.get("c"))
1872
+ d = from_float(obj.get("d"))
1873
+ e = from_float(obj.get("e"))
1874
+ f = from_float(obj.get("f"))
1875
+ return MagneticFluxDensityFactor(a, b, c, d, e, f)
1876
+
1877
+ def to_dict(self) -> dict:
1878
+ result: dict = {}
1879
+ result["a"] = to_float(self.a)
1880
+ result["b"] = to_float(self.b)
1881
+ result["c"] = to_float(self.c)
1882
+ result["d"] = to_float(self.d)
1883
+ result["e"] = to_float(self.e)
1884
+ result["f"] = to_float(self.f)
1885
+ return result
1886
+
1887
+
1888
+ class InitialPermeabilitModifierMethod(Enum):
1889
+ magnetics = "magnetics"
1890
+ micrometals = "micrometals"
1891
+
1892
+
1893
+ @dataclass
1894
+ class TemperatureFactor:
1895
+ """Field with the coefficients used to calculate how much the permeability decreases with
1896
+ the temperature, as factor = a + b * T + c * pow(T, 2) + d * pow(T, 3) + e * pow(T, 4)
1897
+
1898
+ Field with the coefficients used to calculate how much the permeability decreases with
1899
+ the temperature, as either factor = a * (T -20) * 0.0001 or factor = (a + c * T + e *
1900
+ pow(T, 2)) / (1 + b * T + d * pow(T, 2))
1901
+ """
1902
+ a: float
1903
+ b: Optional[float] = None
1904
+ c: Optional[float] = None
1905
+ d: Optional[float] = None
1906
+ e: Optional[float] = None
1907
+
1908
+ @staticmethod
1909
+ def from_dict(obj: Any) -> 'TemperatureFactor':
1910
+ assert isinstance(obj, dict)
1911
+ a = from_float(obj.get("a"))
1912
+ b = from_union([from_float, from_none], obj.get("b"))
1913
+ c = from_union([from_float, from_none], obj.get("c"))
1914
+ d = from_union([from_float, from_none], obj.get("d"))
1915
+ e = from_union([from_float, from_none], obj.get("e"))
1916
+ return TemperatureFactor(a, b, c, d, e)
1917
+
1918
+ def to_dict(self) -> dict:
1919
+ result: dict = {}
1920
+ result["a"] = to_float(self.a)
1921
+ if self.b is not None:
1922
+ result["b"] = from_union([to_float, from_none], self.b)
1923
+ if self.c is not None:
1924
+ result["c"] = from_union([to_float, from_none], self.c)
1925
+ if self.d is not None:
1926
+ result["d"] = from_union([to_float, from_none], self.d)
1927
+ if self.e is not None:
1928
+ result["e"] = from_union([to_float, from_none], self.e)
1929
+ return result
1930
+
1931
+
1932
+ @dataclass
1933
+ class InitialPermeabilitModifier:
1934
+ """Object where keys are shape families for which this permeability is valid. If missing,
1935
+ the variant is valid for all shapes
1936
+
1937
+ Coefficients given by Magnetics in order to calculate the permeability of their cores
1938
+
1939
+ Coefficients given by Micrometals in order to calculate the permeability of their cores
1940
+ """
1941
+ magneticFieldDcBiasFactor: MagneticFieldDcBiasFactor
1942
+ """Field with the coefficients used to calculate how much the permeability decreases with
1943
+ the H DC bias, as factor = a + b * pow(H, c)
1944
+
1945
+ Field with the coefficients used to calculate how much the permeability decreases with
1946
+ the H DC bias, as factor = a + b * pow(H, c) + d
1947
+ """
1948
+ frequencyFactor: Optional[FrequencyFactor] = None
1949
+ """Field with the coefficients used to calculate how much the permeability decreases with
1950
+ the frequency, as factor = a + b * f + c * pow(f, 2) + d * pow(f, 3) + e * pow(f, 4)
1951
+
1952
+ Field with the coefficients used to calculate how much the permeability decreases with
1953
+ the frequency, as factor = 1 / (a + b * pow(f, c) ) + d
1954
+ """
1955
+ method: Optional[InitialPermeabilitModifierMethod] = None
1956
+ """Name of this method"""
1957
+
1958
+ temperatureFactor: Optional[TemperatureFactor] = None
1959
+ """Field with the coefficients used to calculate how much the permeability decreases with
1960
+ the temperature, as factor = a + b * T + c * pow(T, 2) + d * pow(T, 3) + e * pow(T, 4)
1961
+
1962
+ Field with the coefficients used to calculate how much the permeability decreases with
1963
+ the temperature, as either factor = a * (T -20) * 0.0001 or factor = (a + c * T + e *
1964
+ pow(T, 2)) / (1 + b * T + d * pow(T, 2))
1965
+ """
1966
+ magneticFluxDensityFactor: Optional[MagneticFluxDensityFactor] = None
1967
+ """Field with the coefficients used to calculate how much the permeability decreases with
1968
+ the B field, as factor = = 1 / ( 1 / ( a + b * pow(B,c)) + 1 / (d * pow(B, e) ) + 1 / f )
1969
+ """
1970
+
1971
+ @staticmethod
1972
+ def from_dict(obj: Any) -> 'InitialPermeabilitModifier':
1973
+ assert isinstance(obj, dict)
1974
+ magneticFieldDcBiasFactor = MagneticFieldDcBiasFactor.from_dict(obj.get("magneticFieldDcBiasFactor"))
1975
+ frequencyFactor = from_union([FrequencyFactor.from_dict, from_none], obj.get("frequencyFactor"))
1976
+ method = from_union([InitialPermeabilitModifierMethod, from_none], obj.get("method"))
1977
+ temperatureFactor = from_union([TemperatureFactor.from_dict, from_none], obj.get("temperatureFactor"))
1978
+ magneticFluxDensityFactor = from_union([MagneticFluxDensityFactor.from_dict, from_none], obj.get("magneticFluxDensityFactor"))
1979
+ return InitialPermeabilitModifier(magneticFieldDcBiasFactor, frequencyFactor, method, temperatureFactor, magneticFluxDensityFactor)
1980
+
1981
+ def to_dict(self) -> dict:
1982
+ result: dict = {}
1983
+ result["magneticFieldDcBiasFactor"] = to_class(MagneticFieldDcBiasFactor, self.magneticFieldDcBiasFactor)
1984
+ if self.frequencyFactor is not None:
1985
+ result["frequencyFactor"] = from_union([lambda x: to_class(FrequencyFactor, x), from_none], self.frequencyFactor)
1986
+ if self.method is not None:
1987
+ result["method"] = from_union([lambda x: to_enum(InitialPermeabilitModifierMethod, x), from_none], self.method)
1988
+ if self.temperatureFactor is not None:
1989
+ result["temperatureFactor"] = from_union([lambda x: to_class(TemperatureFactor, x), from_none], self.temperatureFactor)
1990
+ if self.magneticFluxDensityFactor is not None:
1991
+ result["magneticFluxDensityFactor"] = from_union([lambda x: to_class(MagneticFluxDensityFactor, x), from_none], self.magneticFluxDensityFactor)
1992
+ return result
1993
+
1994
+
1995
+ @dataclass
1996
+ class PermeabilityPoint:
1997
+ """data for describing one point of permebility"""
1998
+
1999
+ value: float
2000
+ """Permeability value"""
2001
+
2002
+ frequency: Optional[float] = None
2003
+ """Frequency of the Magnetic field, in Hz"""
2004
+
2005
+ magneticFieldDcBias: Optional[float] = None
2006
+ """DC bias in the magnetic field, in A/m"""
2007
+
2008
+ magneticFluxDensityPeak: Optional[float] = None
2009
+ """magnetic flux density peak for the field value, in T"""
2010
+
2011
+ modifiers: Optional[Dict[str, InitialPermeabilitModifier]] = None
2012
+ """The initial permeability of a magnetic material according to its manufacturer"""
2013
+
2014
+ temperature: Optional[float] = None
2015
+ """temperature for the field value, in Celsius"""
2016
+
2017
+ tolerance: Optional[float] = None
2018
+ """tolerance for the field value"""
2019
+
2020
+ @staticmethod
2021
+ def from_dict(obj: Any) -> 'PermeabilityPoint':
2022
+ assert isinstance(obj, dict)
2023
+ value = from_float(obj.get("value"))
2024
+ frequency = from_union([from_float, from_none], obj.get("frequency"))
2025
+ magneticFieldDcBias = from_union([from_float, from_none], obj.get("magneticFieldDcBias"))
2026
+ magneticFluxDensityPeak = from_union([from_float, from_none], obj.get("magneticFluxDensityPeak"))
2027
+ modifiers = from_union([lambda x: from_dict(InitialPermeabilitModifier.from_dict, x), from_none], obj.get("modifiers"))
2028
+ temperature = from_union([from_float, from_none], obj.get("temperature"))
2029
+ tolerance = from_union([from_float, from_none], obj.get("tolerance"))
2030
+ return PermeabilityPoint(value, frequency, magneticFieldDcBias, magneticFluxDensityPeak, modifiers, temperature, tolerance)
2031
+
2032
+ def to_dict(self) -> dict:
2033
+ result: dict = {}
2034
+ result["value"] = to_float(self.value)
2035
+ if self.frequency is not None:
2036
+ result["frequency"] = from_union([to_float, from_none], self.frequency)
2037
+ if self.magneticFieldDcBias is not None:
2038
+ result["magneticFieldDcBias"] = from_union([to_float, from_none], self.magneticFieldDcBias)
2039
+ if self.magneticFluxDensityPeak is not None:
2040
+ result["magneticFluxDensityPeak"] = from_union([to_float, from_none], self.magneticFluxDensityPeak)
2041
+ if self.modifiers is not None:
2042
+ result["modifiers"] = from_union([lambda x: from_dict(lambda x: to_class(InitialPermeabilitModifier, x), x), from_none], self.modifiers)
2043
+ if self.temperature is not None:
2044
+ result["temperature"] = from_union([to_float, from_none], self.temperature)
2045
+ if self.tolerance is not None:
2046
+ result["tolerance"] = from_union([to_float, from_none], self.tolerance)
2047
+ return result
2048
+
2049
+
2050
+ @dataclass
2051
+ class ComplexClass:
2052
+ """The data regarding the complex permeability of a magnetic material"""
2053
+
2054
+ imaginary: Optional[Union[PermeabilityPoint, List[PermeabilityPoint]]] = None
2055
+ real: Optional[Union[PermeabilityPoint, List[PermeabilityPoint]]] = None
2056
+
2057
+ @staticmethod
2058
+ def from_dict(obj: Any) -> 'ComplexClass':
2059
+ assert isinstance(obj, dict)
2060
+ imaginary = from_union([PermeabilityPoint.from_dict, lambda x: from_list(PermeabilityPoint.from_dict, x), from_none], obj.get("imaginary"))
2061
+ real = from_union([PermeabilityPoint.from_dict, lambda x: from_list(PermeabilityPoint.from_dict, x), from_none], obj.get("real"))
2062
+ return ComplexClass(imaginary, real)
2063
+
2064
+ def to_dict(self) -> dict:
2065
+ result: dict = {}
2066
+ if self.imaginary is not None:
2067
+ result["imaginary"] = from_union([lambda x: to_class(PermeabilityPoint, x), lambda x: from_list(lambda x: to_class(PermeabilityPoint, x), x), from_none], self.imaginary)
2068
+ if self.real is not None:
2069
+ result["real"] = from_union([lambda x: to_class(PermeabilityPoint, x), lambda x: from_list(lambda x: to_class(PermeabilityPoint, x), x), from_none], self.real)
2070
+ return result
2071
+
2072
+
2073
+ @dataclass
2074
+ class Permeabilities:
2075
+ """The data regarding the relative permeability of a magnetic material"""
2076
+
2077
+ initial: Union[PermeabilityPoint, List[PermeabilityPoint]]
2078
+ amplitude: Optional[Union[PermeabilityPoint, List[PermeabilityPoint]]] = None
2079
+ complex: Optional[ComplexClass] = None
2080
+ """The data regarding the complex permeability of a magnetic material"""
2081
+
2082
+ @staticmethod
2083
+ def from_dict(obj: Any) -> 'Permeabilities':
2084
+ assert isinstance(obj, dict)
2085
+ initial = from_union([PermeabilityPoint.from_dict, lambda x: from_list(PermeabilityPoint.from_dict, x)], obj.get("initial"))
2086
+ amplitude = from_union([PermeabilityPoint.from_dict, lambda x: from_list(PermeabilityPoint.from_dict, x), from_none], obj.get("amplitude"))
2087
+ complex = from_union([ComplexClass.from_dict, from_none], obj.get("complex"))
2088
+ return Permeabilities(initial, amplitude, complex)
2089
+
2090
+ def to_dict(self) -> dict:
2091
+ result: dict = {}
2092
+ result["initial"] = from_union([lambda x: to_class(PermeabilityPoint, x), lambda x: from_list(lambda x: to_class(PermeabilityPoint, x), x)], self.initial)
2093
+ if self.amplitude is not None:
2094
+ result["amplitude"] = from_union([lambda x: to_class(PermeabilityPoint, x), lambda x: from_list(lambda x: to_class(PermeabilityPoint, x), x), from_none], self.amplitude)
2095
+ if self.complex is not None:
2096
+ result["complex"] = from_union([lambda x: to_class(ComplexClass, x), from_none], self.complex)
2097
+ return result
2098
+
2099
+
2100
+ class CoreMaterialType(Enum):
2101
+ """The type of a magnetic material"""
2102
+
2103
+ commercial = "commercial"
2104
+ custom = "custom"
2105
+
2106
+
2107
+ @dataclass
2108
+ class Harmonics:
2109
+ """Data containing the harmonics of the waveform, defined by a list of amplitudes and a list
2110
+ of frequencies
2111
+ """
2112
+ amplitudes: List[float]
2113
+ """List of amplitudes of the harmonics that compose the waveform"""
2114
+
2115
+ frequencies: List[float]
2116
+ """List of frequencies of the harmonics that compose the waveform"""
2117
+
2118
+ @staticmethod
2119
+ def from_dict(obj: Any) -> 'Harmonics':
2120
+ assert isinstance(obj, dict)
2121
+ amplitudes = from_list(from_float, obj.get("amplitudes"))
2122
+ frequencies = from_list(from_float, obj.get("frequencies"))
2123
+ return Harmonics(amplitudes, frequencies)
2124
+
2125
+ def to_dict(self) -> dict:
2126
+ result: dict = {}
2127
+ result["amplitudes"] = from_list(to_float, self.amplitudes)
2128
+ result["frequencies"] = from_list(to_float, self.frequencies)
2129
+ return result
2130
+
2131
+
2132
+ class WaveformLabel(Enum):
2133
+ """Label of the waveform, if applicable. Used for common waveforms"""
2134
+
2135
+ BipolarRectangular = "Bipolar Rectangular"
2136
+ BipolarTriangular = "Bipolar Triangular"
2137
+ Custom = "Custom"
2138
+ FlybackPrimary = "Flyback Primary"
2139
+ FlybackSecondary = "Flyback Secondary"
2140
+ FlybackSecondaryDCM = "FlybackSecondaryDCM"
2141
+ FlybackSecondaryWithDeadtime = "Flyback Secondary With Deadtime"
2142
+ Rectangular = "Rectangular"
2143
+ RectangularDCM = "RectangularDCM"
2144
+ RectangularWithDeadtime = "Rectangular With Deadtime"
2145
+ Sinusoidal = "Sinusoidal"
2146
+ Triangular = "Triangular"
2147
+ UnipolarRectangular = "Unipolar Rectangular"
2148
+ UnipolarTriangular = "Unipolar Triangular"
2149
+
2150
+
2151
+ @dataclass
2152
+ class Processed:
2153
+ label: WaveformLabel
2154
+ """Label of the waveform, if applicable. Used for common waveforms"""
2155
+
2156
+ offset: float
2157
+ """The offset value of the waveform, referred to 0"""
2158
+
2159
+ acEffectiveFrequency: Optional[float] = None
2160
+ """The effective frequency value of the AC component of the waveform, according to
2161
+ https://sci-hub.wf/https://ieeexplore.ieee.org/document/750181, Appendix C
2162
+ """
2163
+ average: Optional[float] = None
2164
+ """The average value of the waveform, referred to 0"""
2165
+
2166
+ dutyCycle: Optional[float] = None
2167
+ """The duty cycle of the waveform, if applicable"""
2168
+
2169
+ effectiveFrequency: Optional[float] = None
2170
+ """The effective frequency value of the waveform, according to
2171
+ https://sci-hub.wf/https://ieeexplore.ieee.org/document/750181, Appendix C
2172
+ """
2173
+ peak: Optional[float] = None
2174
+ """The maximum positive value of the waveform"""
2175
+
2176
+ peakToPeak: Optional[float] = None
2177
+ """The peak to peak value of the waveform"""
2178
+
2179
+ phase: Optional[float] = None
2180
+ """The phase of the waveform, in degrees"""
2181
+
2182
+ rms: Optional[float] = None
2183
+ """The RMS value of the waveform"""
2184
+
2185
+ thd: Optional[float] = None
2186
+ """The Total Harmonic Distortion of the waveform, according to
2187
+ https://en.wikipedia.org/wiki/Total_harmonic_distortion
2188
+ """
2189
+
2190
+ @staticmethod
2191
+ def from_dict(obj: Any) -> 'Processed':
2192
+ assert isinstance(obj, dict)
2193
+ label = WaveformLabel(obj.get("label"))
2194
+ offset = from_float(obj.get("offset"))
2195
+ acEffectiveFrequency = from_union([from_float, from_none], obj.get("acEffectiveFrequency"))
2196
+ average = from_union([from_float, from_none], obj.get("average"))
2197
+ dutyCycle = from_union([from_float, from_none], obj.get("dutyCycle"))
2198
+ effectiveFrequency = from_union([from_float, from_none], obj.get("effectiveFrequency"))
2199
+ peak = from_union([from_float, from_none], obj.get("peak"))
2200
+ peakToPeak = from_union([from_float, from_none], obj.get("peakToPeak"))
2201
+ phase = from_union([from_float, from_none], obj.get("phase"))
2202
+ rms = from_union([from_float, from_none], obj.get("rms"))
2203
+ thd = from_union([from_float, from_none], obj.get("thd"))
2204
+ return Processed(label, offset, acEffectiveFrequency, average, dutyCycle, effectiveFrequency, peak, peakToPeak, phase, rms, thd)
2205
+
2206
+ def to_dict(self) -> dict:
2207
+ result: dict = {}
2208
+ result["label"] = to_enum(WaveformLabel, self.label)
2209
+ result["offset"] = to_float(self.offset)
2210
+ if self.acEffectiveFrequency is not None:
2211
+ result["acEffectiveFrequency"] = from_union([to_float, from_none], self.acEffectiveFrequency)
2212
+ if self.average is not None:
2213
+ result["average"] = from_union([to_float, from_none], self.average)
2214
+ if self.dutyCycle is not None:
2215
+ result["dutyCycle"] = from_union([to_float, from_none], self.dutyCycle)
2216
+ if self.effectiveFrequency is not None:
2217
+ result["effectiveFrequency"] = from_union([to_float, from_none], self.effectiveFrequency)
2218
+ if self.peak is not None:
2219
+ result["peak"] = from_union([to_float, from_none], self.peak)
2220
+ if self.peakToPeak is not None:
2221
+ result["peakToPeak"] = from_union([to_float, from_none], self.peakToPeak)
2222
+ if self.phase is not None:
2223
+ result["phase"] = from_union([to_float, from_none], self.phase)
2224
+ if self.rms is not None:
2225
+ result["rms"] = from_union([to_float, from_none], self.rms)
2226
+ if self.thd is not None:
2227
+ result["thd"] = from_union([to_float, from_none], self.thd)
2228
+ return result
2229
+
2230
+
2231
+ @dataclass
2232
+ class Waveform:
2233
+ """Data containing the points that define an arbitrary waveform with equidistant points
2234
+
2235
+ Data containing the points that define an arbitrary waveform with non-equidistant points
2236
+ paired with their time in the period
2237
+ """
2238
+ data: List[float]
2239
+ """List of values that compose the waveform, at equidistant times form each other"""
2240
+
2241
+ numberPeriods: Optional[int] = None
2242
+ """The number of periods covered by the data"""
2243
+
2244
+ ancillaryLabel: Optional[str] = None
2245
+ time: Optional[List[float]] = None
2246
+
2247
+ @staticmethod
2248
+ def from_dict(obj: Any) -> 'Waveform':
2249
+ assert isinstance(obj, dict)
2250
+ data = from_list(from_float, obj.get("data"))
2251
+ numberPeriods = from_union([from_int, from_none], obj.get("numberPeriods"))
2252
+ ancillaryLabel = from_union([from_str, from_none], obj.get("ancillaryLabel"))
2253
+ time = from_union([lambda x: from_list(from_float, x), from_none], obj.get("time"))
2254
+ return Waveform(data, numberPeriods, ancillaryLabel, time)
2255
+
2256
+ def to_dict(self) -> dict:
2257
+ result: dict = {}
2258
+ result["data"] = from_list(to_float, self.data)
2259
+ if self.numberPeriods is not None:
2260
+ result["numberPeriods"] = from_union([from_int, from_none], self.numberPeriods)
2261
+ if self.ancillaryLabel is not None:
2262
+ result["ancillaryLabel"] = from_union([from_str, from_none], self.ancillaryLabel)
2263
+ if self.time is not None:
2264
+ result["time"] = from_union([lambda x: from_list(to_float, x), from_none], self.time)
2265
+ return result
2266
+
2267
+
2268
+ @dataclass
2269
+ class SignalDescriptor:
2270
+ """Excitation of the B field that produced the core losses
2271
+
2272
+ Structure definining one electromagnetic parameters: current, voltage, magnetic flux
2273
+ density
2274
+ """
2275
+ harmonics: Optional[Harmonics] = None
2276
+ """Data containing the harmonics of the waveform, defined by a list of amplitudes and a list
2277
+ of frequencies
2278
+ """
2279
+ processed: Optional[Processed] = None
2280
+ waveform: Optional[Waveform] = None
2281
+
2282
+ @staticmethod
2283
+ def from_dict(obj: Any) -> 'SignalDescriptor':
2284
+ assert isinstance(obj, dict)
2285
+ harmonics = from_union([Harmonics.from_dict, from_none], obj.get("harmonics"))
2286
+ processed = from_union([Processed.from_dict, from_none], obj.get("processed"))
2287
+ waveform = from_union([Waveform.from_dict, from_none], obj.get("waveform"))
2288
+ return SignalDescriptor(harmonics, processed, waveform)
2289
+
2290
+ def to_dict(self) -> dict:
2291
+ result: dict = {}
2292
+ if self.harmonics is not None:
2293
+ result["harmonics"] = from_union([lambda x: to_class(Harmonics, x), from_none], self.harmonics)
2294
+ if self.processed is not None:
2295
+ result["processed"] = from_union([lambda x: to_class(Processed, x), from_none], self.processed)
2296
+ if self.waveform is not None:
2297
+ result["waveform"] = from_union([lambda x: to_class(Waveform, x), from_none], self.waveform)
2298
+ return result
2299
+
2300
+
2301
+ @dataclass
2302
+ class OperatingPointExcitation:
2303
+ """Data describing the excitation of the winding
2304
+
2305
+ The description of a magnetic operating point
2306
+ """
2307
+ frequency: float
2308
+ """Frequency of the waveform, common for all electromagnetic parameters, in Hz"""
2309
+
2310
+ current: Optional[SignalDescriptor] = None
2311
+ magneticFieldStrength: Optional[SignalDescriptor] = None
2312
+ magneticFluxDensity: Optional[SignalDescriptor] = None
2313
+ magnetizingCurrent: Optional[SignalDescriptor] = None
2314
+ name: Optional[str] = None
2315
+ """A label that identifies this Operating Point"""
2316
+
2317
+ voltage: Optional[SignalDescriptor] = None
2318
+
2319
+ @staticmethod
2320
+ def from_dict(obj: Any) -> 'OperatingPointExcitation':
2321
+ assert isinstance(obj, dict)
2322
+ frequency = from_float(obj.get("frequency"))
2323
+ current = from_union([SignalDescriptor.from_dict, from_none], obj.get("current"))
2324
+ magneticFieldStrength = from_union([SignalDescriptor.from_dict, from_none], obj.get("magneticFieldStrength"))
2325
+ magneticFluxDensity = from_union([SignalDescriptor.from_dict, from_none], obj.get("magneticFluxDensity"))
2326
+ magnetizingCurrent = from_union([SignalDescriptor.from_dict, from_none], obj.get("magnetizingCurrent"))
2327
+ name = from_union([from_str, from_none], obj.get("name"))
2328
+ voltage = from_union([SignalDescriptor.from_dict, from_none], obj.get("voltage"))
2329
+ return OperatingPointExcitation(frequency, current, magneticFieldStrength, magneticFluxDensity, magnetizingCurrent, name, voltage)
2330
+
2331
+ def to_dict(self) -> dict:
2332
+ result: dict = {}
2333
+ result["frequency"] = to_float(self.frequency)
2334
+ if self.current is not None:
2335
+ result["current"] = from_union([lambda x: to_class(SignalDescriptor, x), from_none], self.current)
2336
+ if self.magneticFieldStrength is not None:
2337
+ result["magneticFieldStrength"] = from_union([lambda x: to_class(SignalDescriptor, x), from_none], self.magneticFieldStrength)
2338
+ if self.magneticFluxDensity is not None:
2339
+ result["magneticFluxDensity"] = from_union([lambda x: to_class(SignalDescriptor, x), from_none], self.magneticFluxDensity)
2340
+ if self.magnetizingCurrent is not None:
2341
+ result["magnetizingCurrent"] = from_union([lambda x: to_class(SignalDescriptor, x), from_none], self.magnetizingCurrent)
2342
+ if self.name is not None:
2343
+ result["name"] = from_union([from_str, from_none], self.name)
2344
+ if self.voltage is not None:
2345
+ result["voltage"] = from_union([lambda x: to_class(SignalDescriptor, x), from_none], self.voltage)
2346
+ return result
2347
+
2348
+
2349
+ @dataclass
2350
+ class VolumetricLossesPoint:
2351
+ """data for describing the volumetric losses at a given point of magnetic flux density,
2352
+ frequency and temperature
2353
+
2354
+ List of volumetric losses points
2355
+ """
2356
+ magneticFluxDensity: OperatingPointExcitation
2357
+ origin: str
2358
+ """origin of the data"""
2359
+
2360
+ temperature: float
2361
+ """temperature value, in Celsius"""
2362
+
2363
+ value: float
2364
+ """volumetric losses value, in W/m3"""
2365
+
2366
+ @staticmethod
2367
+ def from_dict(obj: Any) -> 'VolumetricLossesPoint':
2368
+ assert isinstance(obj, dict)
2369
+ magneticFluxDensity = OperatingPointExcitation.from_dict(obj.get("magneticFluxDensity"))
2370
+ origin = from_str(obj.get("origin"))
2371
+ temperature = from_float(obj.get("temperature"))
2372
+ value = from_float(obj.get("value"))
2373
+ return VolumetricLossesPoint(magneticFluxDensity, origin, temperature, value)
2374
+
2375
+ def to_dict(self) -> dict:
2376
+ result: dict = {}
2377
+ result["magneticFluxDensity"] = to_class(OperatingPointExcitation, self.magneticFluxDensity)
2378
+ result["origin"] = from_str(self.origin)
2379
+ result["temperature"] = to_float(self.temperature)
2380
+ result["value"] = to_float(self.value)
2381
+ return result
2382
+
2383
+
2384
+ @dataclass
2385
+ class RoshenAdditionalCoefficients:
2386
+ """List of coefficients for taking into account the excess losses and the dependencies of
2387
+ the resistivity
2388
+ """
2389
+ excessLossesCoefficient: float
2390
+ resistivityFrequencyCoefficient: float
2391
+ resistivityMagneticFluxDensityCoefficient: float
2392
+ resistivityOffset: float
2393
+ resistivityTemperatureCoefficient: float
2394
+
2395
+ @staticmethod
2396
+ def from_dict(obj: Any) -> 'RoshenAdditionalCoefficients':
2397
+ assert isinstance(obj, dict)
2398
+ excessLossesCoefficient = from_float(obj.get("excessLossesCoefficient"))
2399
+ resistivityFrequencyCoefficient = from_float(obj.get("resistivityFrequencyCoefficient"))
2400
+ resistivityMagneticFluxDensityCoefficient = from_float(obj.get("resistivityMagneticFluxDensityCoefficient"))
2401
+ resistivityOffset = from_float(obj.get("resistivityOffset"))
2402
+ resistivityTemperatureCoefficient = from_float(obj.get("resistivityTemperatureCoefficient"))
2403
+ return RoshenAdditionalCoefficients(excessLossesCoefficient, resistivityFrequencyCoefficient, resistivityMagneticFluxDensityCoefficient, resistivityOffset, resistivityTemperatureCoefficient)
2404
+
2405
+ def to_dict(self) -> dict:
2406
+ result: dict = {}
2407
+ result["excessLossesCoefficient"] = to_float(self.excessLossesCoefficient)
2408
+ result["resistivityFrequencyCoefficient"] = to_float(self.resistivityFrequencyCoefficient)
2409
+ result["resistivityMagneticFluxDensityCoefficient"] = to_float(self.resistivityMagneticFluxDensityCoefficient)
2410
+ result["resistivityOffset"] = to_float(self.resistivityOffset)
2411
+ result["resistivityTemperatureCoefficient"] = to_float(self.resistivityTemperatureCoefficient)
2412
+ return result
2413
+
2414
+
2415
+ @dataclass
2416
+ class LossFactorPoint:
2417
+ """Data for describing the loss factor at a given frequency and temperature"""
2418
+
2419
+ value: float
2420
+ """Loss Factor value"""
2421
+
2422
+ frequency: Optional[float] = None
2423
+ """Frequency of the field, in Hz"""
2424
+
2425
+ temperature: Optional[float] = None
2426
+ """temperature for the value, in Celsius"""
2427
+
2428
+ @staticmethod
2429
+ def from_dict(obj: Any) -> 'LossFactorPoint':
2430
+ assert isinstance(obj, dict)
2431
+ value = from_float(obj.get("value"))
2432
+ frequency = from_union([from_float, from_none], obj.get("frequency"))
2433
+ temperature = from_union([from_float, from_none], obj.get("temperature"))
2434
+ return LossFactorPoint(value, frequency, temperature)
2435
+
2436
+ def to_dict(self) -> dict:
2437
+ result: dict = {}
2438
+ result["value"] = to_float(self.value)
2439
+ if self.frequency is not None:
2440
+ result["frequency"] = from_union([to_float, from_none], self.frequency)
2441
+ if self.temperature is not None:
2442
+ result["temperature"] = from_union([to_float, from_none], self.temperature)
2443
+ return result
2444
+
2445
+
2446
+ class CoreLossesMethodType(Enum):
2447
+ lossFactor = "lossFactor"
2448
+ magnetics = "magnetics"
2449
+ micrometals = "micrometals"
2450
+ roshen = "roshen"
2451
+ steinmetz = "steinmetz"
2452
+
2453
+
2454
+ @dataclass
2455
+ class SteinmetzCoreLossesMethodRangeDatum:
2456
+ alpha: float
2457
+ """frequency power coefficient alpha"""
2458
+
2459
+ beta: float
2460
+ """magnetic flux density power coefficient beta"""
2461
+
2462
+ k: float
2463
+ """Proportional coefficient k"""
2464
+
2465
+ ct0: Optional[float] = None
2466
+ """Constant temperature coefficient ct0"""
2467
+
2468
+ ct1: Optional[float] = None
2469
+ """Proportional negative temperature coefficient ct1"""
2470
+
2471
+ ct2: Optional[float] = None
2472
+ """Square temperature coefficient ct2"""
2473
+
2474
+ maximumFrequency: Optional[float] = None
2475
+ """maximum frequency for which the coefficients are valid, in Hz"""
2476
+
2477
+ minimumFrequency: Optional[float] = None
2478
+ """minimum frequency for which the coefficients are valid, in Hz"""
2479
+
2480
+ @staticmethod
2481
+ def from_dict(obj: Any) -> 'SteinmetzCoreLossesMethodRangeDatum':
2482
+ assert isinstance(obj, dict)
2483
+ alpha = from_float(obj.get("alpha"))
2484
+ beta = from_float(obj.get("beta"))
2485
+ k = from_float(obj.get("k"))
2486
+ ct0 = from_union([from_float, from_none], obj.get("ct0"))
2487
+ ct1 = from_union([from_float, from_none], obj.get("ct1"))
2488
+ ct2 = from_union([from_float, from_none], obj.get("ct2"))
2489
+ maximumFrequency = from_union([from_float, from_none], obj.get("maximumFrequency"))
2490
+ minimumFrequency = from_union([from_float, from_none], obj.get("minimumFrequency"))
2491
+ return SteinmetzCoreLossesMethodRangeDatum(alpha, beta, k, ct0, ct1, ct2, maximumFrequency, minimumFrequency)
2492
+
2493
+ def to_dict(self) -> dict:
2494
+ result: dict = {}
2495
+ result["alpha"] = to_float(self.alpha)
2496
+ result["beta"] = to_float(self.beta)
2497
+ result["k"] = to_float(self.k)
2498
+ if self.ct0 is not None:
2499
+ result["ct0"] = from_union([to_float, from_none], self.ct0)
2500
+ if self.ct1 is not None:
2501
+ result["ct1"] = from_union([to_float, from_none], self.ct1)
2502
+ if self.ct2 is not None:
2503
+ result["ct2"] = from_union([to_float, from_none], self.ct2)
2504
+ if self.maximumFrequency is not None:
2505
+ result["maximumFrequency"] = from_union([to_float, from_none], self.maximumFrequency)
2506
+ if self.minimumFrequency is not None:
2507
+ result["minimumFrequency"] = from_union([to_float, from_none], self.minimumFrequency)
2508
+ return result
2509
+
2510
+
2511
+ @dataclass
2512
+ class CoreLossesMethodData:
2513
+ """Steinmetz coefficients for estimating volumetric losses in a given frequency range
2514
+
2515
+ Roshen coefficients for estimating volumetric losses
2516
+
2517
+ Micrometals method for estimating volumetric losses
2518
+
2519
+ Magnetics method for estimating volumetric losses
2520
+
2521
+ Loss factor method for estimating volumetric losses
2522
+ """
2523
+ method: CoreLossesMethodType
2524
+ """Name of this method"""
2525
+
2526
+ ranges: Optional[List[SteinmetzCoreLossesMethodRangeDatum]] = None
2527
+ coefficients: Optional[RoshenAdditionalCoefficients] = None
2528
+ """List of coefficients for taking into account the excess losses and the dependencies of
2529
+ the resistivity
2530
+ """
2531
+ referenceVolumetricLosses: Optional[List[VolumetricLossesPoint]] = None
2532
+ """List of reference volumetric losses used to estimate excess eddy current losses"""
2533
+
2534
+ a: Optional[float] = None
2535
+ b: Optional[float] = None
2536
+ c: Optional[float] = None
2537
+ d: Optional[float] = None
2538
+ factors: Optional[List[LossFactorPoint]] = None
2539
+
2540
+ @staticmethod
2541
+ def from_dict(obj: Any) -> 'CoreLossesMethodData':
2542
+ assert isinstance(obj, dict)
2543
+ method = CoreLossesMethodType(obj.get("method"))
2544
+ ranges = from_union([lambda x: from_list(SteinmetzCoreLossesMethodRangeDatum.from_dict, x), from_none], obj.get("ranges"))
2545
+ coefficients = from_union([RoshenAdditionalCoefficients.from_dict, from_none], obj.get("coefficients"))
2546
+ referenceVolumetricLosses = from_union([lambda x: from_list(VolumetricLossesPoint.from_dict, x), from_none], obj.get("referenceVolumetricLosses"))
2547
+ a = from_union([from_float, from_none], obj.get("a"))
2548
+ b = from_union([from_float, from_none], obj.get("b"))
2549
+ c = from_union([from_float, from_none], obj.get("c"))
2550
+ d = from_union([from_float, from_none], obj.get("d"))
2551
+ factors = from_union([lambda x: from_list(LossFactorPoint.from_dict, x), from_none], obj.get("factors"))
2552
+ return CoreLossesMethodData(method, ranges, coefficients, referenceVolumetricLosses, a, b, c, d, factors)
2553
+
2554
+ def to_dict(self) -> dict:
2555
+ result: dict = {}
2556
+ result["method"] = to_enum(CoreLossesMethodType, self.method)
2557
+ if self.ranges is not None:
2558
+ result["ranges"] = from_union([lambda x: from_list(lambda x: to_class(SteinmetzCoreLossesMethodRangeDatum, x), x), from_none], self.ranges)
2559
+ if self.coefficients is not None:
2560
+ result["coefficients"] = from_union([lambda x: to_class(RoshenAdditionalCoefficients, x), from_none], self.coefficients)
2561
+ if self.referenceVolumetricLosses is not None:
2562
+ result["referenceVolumetricLosses"] = from_union([lambda x: from_list(lambda x: to_class(VolumetricLossesPoint, x), x), from_none], self.referenceVolumetricLosses)
2563
+ if self.a is not None:
2564
+ result["a"] = from_union([to_float, from_none], self.a)
2565
+ if self.b is not None:
2566
+ result["b"] = from_union([to_float, from_none], self.b)
2567
+ if self.c is not None:
2568
+ result["c"] = from_union([to_float, from_none], self.c)
2569
+ if self.d is not None:
2570
+ result["d"] = from_union([to_float, from_none], self.d)
2571
+ if self.factors is not None:
2572
+ result["factors"] = from_union([lambda x: from_list(lambda x: to_class(LossFactorPoint, x), x), from_none], self.factors)
2573
+ return result
2574
+
2575
+
2576
+ @dataclass
2577
+ class CoreMaterial:
2578
+ """A material for the magnetic cores"""
2579
+
2580
+ manufacturerInfo: ManufacturerInfo
2581
+ material: MaterialEnum
2582
+ """The composition of a magnetic material"""
2583
+
2584
+ name: str
2585
+ """The name of a magnetic material"""
2586
+
2587
+ permeability: Permeabilities
2588
+ """The data regarding the relative permeability of a magnetic material"""
2589
+
2590
+ resistivity: List[ResistivityPoint]
2591
+ """Resistivity value according to manufacturer"""
2592
+
2593
+ saturation: List[SaturationElement]
2594
+ """BH Cycle points where a non-negligible increase in magnetic field produces a negligible
2595
+ increase of magnetic flux density
2596
+ """
2597
+ type: CoreMaterialType
2598
+ """The type of a magnetic material"""
2599
+
2600
+ volumetricLosses: Dict[str, List[Union[CoreLossesMethodData, List[VolumetricLossesPoint]]]]
2601
+ """The data regarding the volumetric losses of a magnetic material"""
2602
+
2603
+ bhCycle: Optional[List[SaturationElement]] = None
2604
+ coerciveForce: Optional[List[SaturationElement]] = None
2605
+ """BH Cycle points where the magnetic flux density is 0"""
2606
+
2607
+ curieTemperature: Optional[float] = None
2608
+ """The temperature at which this material losses all ferromagnetism"""
2609
+
2610
+ density: Optional[float] = None
2611
+ """Density value according to manufacturer, in kg/m3"""
2612
+
2613
+ family: Optional[str] = None
2614
+ """The family of a magnetic material according to its manufacturer"""
2615
+
2616
+ heatCapacity: Optional[DimensionWithTolerance] = None
2617
+ """Heat capacity value according to manufacturer, in J/Kg/K"""
2618
+
2619
+ heatConductivity: Optional[DimensionWithTolerance] = None
2620
+ """Heat conductivity value according to manufacturer, in W/m/K"""
2621
+
2622
+ materialComposition: Optional[MaterialCompositionEnum] = None
2623
+ """The composition of a magnetic material"""
2624
+
2625
+ remanence: Optional[List[SaturationElement]] = None
2626
+ """BH Cycle points where the magnetic field is 0"""
2627
+
2628
+ @staticmethod
2629
+ def from_dict(obj: Any) -> 'CoreMaterial':
2630
+ assert isinstance(obj, dict)
2631
+ manufacturerInfo = ManufacturerInfo.from_dict(obj.get("manufacturerInfo"))
2632
+ material = MaterialEnum(obj.get("material"))
2633
+ name = from_str(obj.get("name"))
2634
+ permeability = Permeabilities.from_dict(obj.get("permeability"))
2635
+ resistivity = from_list(ResistivityPoint.from_dict, obj.get("resistivity"))
2636
+ saturation = from_list(SaturationElement.from_dict, obj.get("saturation"))
2637
+ type = CoreMaterialType(obj.get("type"))
2638
+ volumetricLosses = from_dict(lambda x: from_list(lambda x: from_union([CoreLossesMethodData.from_dict, lambda x: from_list(VolumetricLossesPoint.from_dict, x)], x), x), obj.get("volumetricLosses"))
2639
+ bhCycle = from_union([lambda x: from_list(SaturationElement.from_dict, x), from_none], obj.get("bhCycle"))
2640
+ coerciveForce = from_union([lambda x: from_list(SaturationElement.from_dict, x), from_none], obj.get("coerciveForce"))
2641
+ curieTemperature = from_union([from_float, from_none], obj.get("curieTemperature"))
2642
+ density = from_union([from_float, from_none], obj.get("density"))
2643
+ family = from_union([from_str, from_none], obj.get("family"))
2644
+ heatCapacity = from_union([DimensionWithTolerance.from_dict, from_none], obj.get("heatCapacity"))
2645
+ heatConductivity = from_union([DimensionWithTolerance.from_dict, from_none], obj.get("heatConductivity"))
2646
+ materialComposition = from_union([MaterialCompositionEnum, from_none], obj.get("materialComposition"))
2647
+ remanence = from_union([lambda x: from_list(SaturationElement.from_dict, x), from_none], obj.get("remanence"))
2648
+ return CoreMaterial(manufacturerInfo, material, name, permeability, resistivity, saturation, type, volumetricLosses, bhCycle, coerciveForce, curieTemperature, density, family, heatCapacity, heatConductivity, materialComposition, remanence)
2649
+
2650
+ def to_dict(self) -> dict:
2651
+ result: dict = {}
2652
+ result["manufacturerInfo"] = to_class(ManufacturerInfo, self.manufacturerInfo)
2653
+ result["material"] = to_enum(MaterialEnum, self.material)
2654
+ result["name"] = from_str(self.name)
2655
+ result["permeability"] = to_class(Permeabilities, self.permeability)
2656
+ result["resistivity"] = from_list(lambda x: to_class(ResistivityPoint, x), self.resistivity)
2657
+ result["saturation"] = from_list(lambda x: to_class(SaturationElement, x), self.saturation)
2658
+ result["type"] = to_enum(CoreMaterialType, self.type)
2659
+ result["volumetricLosses"] = from_dict(lambda x: from_list(lambda x: from_union([lambda x: to_class(CoreLossesMethodData, x), lambda x: from_list(lambda x: to_class(VolumetricLossesPoint, x), x)], x), x), self.volumetricLosses)
2660
+ if self.bhCycle is not None:
2661
+ result["bhCycle"] = from_union([lambda x: from_list(lambda x: to_class(SaturationElement, x), x), from_none], self.bhCycle)
2662
+ if self.coerciveForce is not None:
2663
+ result["coerciveForce"] = from_union([lambda x: from_list(lambda x: to_class(SaturationElement, x), x), from_none], self.coerciveForce)
2664
+ if self.curieTemperature is not None:
2665
+ result["curieTemperature"] = from_union([to_float, from_none], self.curieTemperature)
2666
+ if self.density is not None:
2667
+ result["density"] = from_union([to_float, from_none], self.density)
2668
+ if self.family is not None:
2669
+ result["family"] = from_union([from_str, from_none], self.family)
2670
+ if self.heatCapacity is not None:
2671
+ result["heatCapacity"] = from_union([lambda x: to_class(DimensionWithTolerance, x), from_none], self.heatCapacity)
2672
+ if self.heatConductivity is not None:
2673
+ result["heatConductivity"] = from_union([lambda x: to_class(DimensionWithTolerance, x), from_none], self.heatConductivity)
2674
+ if self.materialComposition is not None:
2675
+ result["materialComposition"] = from_union([lambda x: to_enum(MaterialCompositionEnum, x), from_none], self.materialComposition)
2676
+ if self.remanence is not None:
2677
+ result["remanence"] = from_union([lambda x: from_list(lambda x: to_class(SaturationElement, x), x), from_none], self.remanence)
2678
+ return result
2679
+
2680
+
2681
+ class CoreShapeFamily(Enum):
2682
+ """The family of a magnetic shape"""
2683
+
2684
+ c = "c"
2685
+ drum = "drum"
2686
+ e = "e"
2687
+ ec = "ec"
2688
+ efd = "efd"
2689
+ ei = "ei"
2690
+ el = "el"
2691
+ elp = "elp"
2692
+ ep = "ep"
2693
+ epx = "epx"
2694
+ eq = "eq"
2695
+ er = "er"
2696
+ etd = "etd"
2697
+ h = "h"
2698
+ lp = "lp"
2699
+ p = "p"
2700
+ planare = "planar e"
2701
+ planarel = "planar el"
2702
+ planarer = "planar er"
2703
+ pm = "pm"
2704
+ pq = "pq"
2705
+ pqi = "pqi"
2706
+ rm = "rm"
2707
+ rod = "rod"
2708
+ t = "t"
2709
+ u = "u"
2710
+ ui = "ui"
2711
+ ur = "ur"
2712
+ ut = "ut"
2713
+
2714
+
2715
+ class MagneticCircuit(Enum):
2716
+ """Describes if the magnetic circuit of the shape is open, and can be combined with others;
2717
+ or closed, and has to be used by itself
2718
+ """
2719
+ closed = "closed"
2720
+ open = "open"
2721
+
2722
+
2723
+ @dataclass
2724
+ class CoreShape:
2725
+ """A shape for the magnetic cores"""
2726
+
2727
+ family: CoreShapeFamily
2728
+ """The family of a magnetic shape"""
2729
+
2730
+ type: FunctionalDescriptionType
2731
+ """The type of a magnetic shape"""
2732
+
2733
+ aliases: Optional[List[str]] = None
2734
+ """Alternative names of a magnetic shape"""
2735
+
2736
+ dimensions: Optional[Dict[str, Union[DimensionWithTolerance, float]]] = None
2737
+ """The dimensions of a magnetic shape, keys must be as defined in EN 62317"""
2738
+
2739
+ familySubtype: Optional[str] = None
2740
+ """The subtype of the shape, in case there are more than one"""
2741
+
2742
+ magneticCircuit: Optional[MagneticCircuit] = None
2743
+ """Describes if the magnetic circuit of the shape is open, and can be combined with others;
2744
+ or closed, and has to be used by itself
2745
+ """
2746
+ name: Optional[str] = None
2747
+ """The name of a magnetic shape"""
2748
+
2749
+ @staticmethod
2750
+ def from_dict(obj: Any) -> 'CoreShape':
2751
+ assert isinstance(obj, dict)
2752
+ family = CoreShapeFamily(obj.get("family"))
2753
+ type = FunctionalDescriptionType(obj.get("type"))
2754
+ aliases = from_union([lambda x: from_list(from_str, x), from_none], obj.get("aliases"))
2755
+ dimensions = from_union([lambda x: from_dict(lambda x: from_union([DimensionWithTolerance.from_dict, from_float], x), x), from_none], obj.get("dimensions"))
2756
+ familySubtype = from_union([from_str, from_none], obj.get("familySubtype"))
2757
+ magneticCircuit = from_union([MagneticCircuit, from_none], obj.get("magneticCircuit"))
2758
+ name = from_union([from_str, from_none], obj.get("name"))
2759
+ return CoreShape(family, type, aliases, dimensions, familySubtype, magneticCircuit, name)
2760
+
2761
+ def to_dict(self) -> dict:
2762
+ result: dict = {}
2763
+ result["family"] = to_enum(CoreShapeFamily, self.family)
2764
+ result["type"] = to_enum(FunctionalDescriptionType, self.type)
2765
+ if self.aliases is not None:
2766
+ result["aliases"] = from_union([lambda x: from_list(from_str, x), from_none], self.aliases)
2767
+ if self.dimensions is not None:
2768
+ result["dimensions"] = from_union([lambda x: from_dict(lambda x: from_union([lambda x: to_class(DimensionWithTolerance, x), to_float], x), x), from_none], self.dimensions)
2769
+ if self.familySubtype is not None:
2770
+ result["familySubtype"] = from_union([from_str, from_none], self.familySubtype)
2771
+ if self.magneticCircuit is not None:
2772
+ result["magneticCircuit"] = from_union([lambda x: to_enum(MagneticCircuit, x), from_none], self.magneticCircuit)
2773
+ if self.name is not None:
2774
+ result["name"] = from_union([from_str, from_none], self.name)
2775
+ return result
2776
+
2777
+
2778
+ class CoreType(Enum):
2779
+ """The type of core"""
2780
+
2781
+ closedshape = "closed shape"
2782
+ pieceandplate = "piece and plate"
2783
+ toroidal = "toroidal"
2784
+ twopieceset = "two-piece set"
2785
+
2786
+
2787
+ @dataclass
2788
+ class CoreFunctionalDescription:
2789
+ """The data from the core based on its function, in a way that can be used by analytical
2790
+ models.
2791
+ """
2792
+ gapping: List[CoreGap]
2793
+ """The lists of gaps in the magnetic core"""
2794
+
2795
+ material: Union[CoreMaterial, str]
2796
+ shape: Union[CoreShape, str]
2797
+ type: CoreType
2798
+ """The type of core"""
2799
+
2800
+ coating: Optional[Coating] = None
2801
+ """The coating of the core"""
2802
+
2803
+ numberStacks: Optional[int] = None
2804
+ """The number of stacked cores"""
2805
+
2806
+ @staticmethod
2807
+ def from_dict(obj: Any) -> 'CoreFunctionalDescription':
2808
+ assert isinstance(obj, dict)
2809
+ gapping = from_list(CoreGap.from_dict, obj.get("gapping"))
2810
+ material = from_union([CoreMaterial.from_dict, from_str], obj.get("material"))
2811
+ shape = from_union([CoreShape.from_dict, from_str], obj.get("shape"))
2812
+ type = CoreType(obj.get("type"))
2813
+ coating = from_union([Coating, from_none], obj.get("coating"))
2814
+ numberStacks = from_union([from_int, from_none], obj.get("numberStacks"))
2815
+ return CoreFunctionalDescription(gapping, material, shape, type, coating, numberStacks)
2816
+
2817
+ def to_dict(self) -> dict:
2818
+ result: dict = {}
2819
+ result["gapping"] = from_list(lambda x: to_class(CoreGap, x), self.gapping)
2820
+ result["material"] = from_union([lambda x: to_class(CoreMaterial, x), from_str], self.material)
2821
+ result["shape"] = from_union([lambda x: to_class(CoreShape, x), from_str], self.shape)
2822
+ result["type"] = to_enum(CoreType, self.type)
2823
+ if self.coating is not None:
2824
+ result["coating"] = from_union([lambda x: to_enum(Coating, x), from_none], self.coating)
2825
+ if self.numberStacks is not None:
2826
+ result["numberStacks"] = from_union([from_int, from_none], self.numberStacks)
2827
+ return result
2828
+
2829
+
2830
+ @dataclass
2831
+ class Machining:
2832
+ """Data describing the machining applied to a piece"""
2833
+
2834
+ coordinates: List[float]
2835
+ """The coordinates of the start of the machining, referred to the top of the main column of
2836
+ the piece
2837
+ """
2838
+ length: float
2839
+ """Length of the machining"""
2840
+
2841
+ @staticmethod
2842
+ def from_dict(obj: Any) -> 'Machining':
2843
+ assert isinstance(obj, dict)
2844
+ coordinates = from_list(from_float, obj.get("coordinates"))
2845
+ length = from_float(obj.get("length"))
2846
+ return Machining(coordinates, length)
2847
+
2848
+ def to_dict(self) -> dict:
2849
+ result: dict = {}
2850
+ result["coordinates"] = from_list(to_float, self.coordinates)
2851
+ result["length"] = to_float(self.length)
2852
+ return result
2853
+
2854
+
2855
+ class CoreGeometricalDescriptionElementType(Enum):
2856
+ """The type of piece
2857
+
2858
+ The type of spacer
2859
+ """
2860
+ closed = "closed"
2861
+ halfset = "half set"
2862
+ plate = "plate"
2863
+ sheet = "sheet"
2864
+ spacer = "spacer"
2865
+ toroidal = "toroidal"
2866
+
2867
+
2868
+ @dataclass
2869
+ class CoreGeometricalDescriptionElement:
2870
+ """The data from the core based on its geometrical description, in a way that can be used by
2871
+ CAD models.
2872
+
2873
+ Data describing the a piece of a core
2874
+
2875
+ Data describing the spacer used to separate cores in additive gaps
2876
+ """
2877
+ coordinates: List[float]
2878
+ """The coordinates of the top of the piece, referred to the center of the main column
2879
+
2880
+ The coordinates of the center of the gap, referred to the center of the main column
2881
+ """
2882
+ type: CoreGeometricalDescriptionElementType
2883
+ """The type of piece
2884
+
2885
+ The type of spacer
2886
+ """
2887
+ machining: Optional[List[Machining]] = None
2888
+ material: Optional[Union[CoreMaterial, str]] = None
2889
+ rotation: Optional[List[float]] = None
2890
+ """The rotation of the top of the piece from its original state, referred to the center of
2891
+ the main column
2892
+ """
2893
+ shape: Optional[Union[CoreShape, str]] = None
2894
+ dimensions: Optional[List[float]] = None
2895
+ """Dimensions of the cube defining the spacer"""
2896
+
2897
+ insulationMaterial: Optional[Union[InsulationMaterial, str]] = None
2898
+ """Material of the spacer"""
2899
+
2900
+ @staticmethod
2901
+ def from_dict(obj: Any) -> 'CoreGeometricalDescriptionElement':
2902
+ assert isinstance(obj, dict)
2903
+ coordinates = from_list(from_float, obj.get("coordinates"))
2904
+ type = CoreGeometricalDescriptionElementType(obj.get("type"))
2905
+ machining = from_union([lambda x: from_list(Machining.from_dict, x), from_none], obj.get("machining"))
2906
+ material = from_union([CoreMaterial.from_dict, from_str, from_none], obj.get("material"))
2907
+ rotation = from_union([lambda x: from_list(from_float, x), from_none], obj.get("rotation"))
2908
+ shape = from_union([CoreShape.from_dict, from_str, from_none], obj.get("shape"))
2909
+ dimensions = from_union([lambda x: from_list(from_float, x), from_none], obj.get("dimensions"))
2910
+ insulationMaterial = from_union([InsulationMaterial.from_dict, from_str, from_none], obj.get("insulationMaterial"))
2911
+ return CoreGeometricalDescriptionElement(coordinates, type, machining, material, rotation, shape, dimensions, insulationMaterial)
2912
+
2913
+ def to_dict(self) -> dict:
2914
+ result: dict = {}
2915
+ result["coordinates"] = from_list(to_float, self.coordinates)
2916
+ result["type"] = to_enum(CoreGeometricalDescriptionElementType, self.type)
2917
+ if self.machining is not None:
2918
+ result["machining"] = from_union([lambda x: from_list(lambda x: to_class(Machining, x), x), from_none], self.machining)
2919
+ if self.material is not None:
2920
+ result["material"] = from_union([lambda x: to_class(CoreMaterial, x), from_str, from_none], self.material)
2921
+ if self.rotation is not None:
2922
+ result["rotation"] = from_union([lambda x: from_list(to_float, x), from_none], self.rotation)
2923
+ if self.shape is not None:
2924
+ result["shape"] = from_union([lambda x: to_class(CoreShape, x), from_str, from_none], self.shape)
2925
+ if self.dimensions is not None:
2926
+ result["dimensions"] = from_union([lambda x: from_list(to_float, x), from_none], self.dimensions)
2927
+ if self.insulationMaterial is not None:
2928
+ result["insulationMaterial"] = from_union([lambda x: to_class(InsulationMaterial, x), from_str, from_none], self.insulationMaterial)
2929
+ return result
2930
+
2931
+
2932
+ class ColumnType(Enum):
2933
+ """Name of the column"""
2934
+
2935
+ central = "central"
2936
+ lateral = "lateral"
2937
+
2938
+
2939
+ @dataclass
2940
+ class ColumnElement:
2941
+ """Data describing a column of the core"""
2942
+
2943
+ area: float
2944
+ """Area of the section column, normal to the magnetic flux direction"""
2945
+
2946
+ coordinates: List[float]
2947
+ """The coordinates of the center of the column, referred to the center of the main column.
2948
+ In the case of half-sets, the center will be in the top point, where it would join
2949
+ another half-set
2950
+ """
2951
+ depth: float
2952
+ """Depth of the column"""
2953
+
2954
+ height: float
2955
+ """Height of the column"""
2956
+
2957
+ shape: ColumnShape
2958
+ type: ColumnType
2959
+ """Name of the column"""
2960
+
2961
+ width: float
2962
+ """Width of the column"""
2963
+
2964
+ minimumDepth: Optional[float] = None
2965
+ """Minimum depth of the column, if irregular"""
2966
+
2967
+ minimumWidth: Optional[float] = None
2968
+ """Minimum width of the column, if irregular"""
2969
+
2970
+ @staticmethod
2971
+ def from_dict(obj: Any) -> 'ColumnElement':
2972
+ assert isinstance(obj, dict)
2973
+ area = from_float(obj.get("area"))
2974
+ coordinates = from_list(from_float, obj.get("coordinates"))
2975
+ depth = from_float(obj.get("depth"))
2976
+ height = from_float(obj.get("height"))
2977
+ shape = ColumnShape(obj.get("shape"))
2978
+ type = ColumnType(obj.get("type"))
2979
+ width = from_float(obj.get("width"))
2980
+ minimumDepth = from_union([from_float, from_none], obj.get("minimumDepth"))
2981
+ minimumWidth = from_union([from_float, from_none], obj.get("minimumWidth"))
2982
+ return ColumnElement(area, coordinates, depth, height, shape, type, width, minimumDepth, minimumWidth)
2983
+
2984
+ def to_dict(self) -> dict:
2985
+ result: dict = {}
2986
+ result["area"] = to_float(self.area)
2987
+ result["coordinates"] = from_list(to_float, self.coordinates)
2988
+ result["depth"] = to_float(self.depth)
2989
+ result["height"] = to_float(self.height)
2990
+ result["shape"] = to_enum(ColumnShape, self.shape)
2991
+ result["type"] = to_enum(ColumnType, self.type)
2992
+ result["width"] = to_float(self.width)
2993
+ if self.minimumDepth is not None:
2994
+ result["minimumDepth"] = from_union([to_float, from_none], self.minimumDepth)
2995
+ if self.minimumWidth is not None:
2996
+ result["minimumWidth"] = from_union([to_float, from_none], self.minimumWidth)
2997
+ return result
2998
+
2999
+
3000
+ @dataclass
3001
+ class EffectiveParameters:
3002
+ """Effective data of the magnetic core"""
3003
+
3004
+ effectiveArea: float
3005
+ """This is the equivalent section that the magnetic flux traverses, because the shape of the
3006
+ core is not uniform and its section changes along the path
3007
+ """
3008
+ effectiveLength: float
3009
+ """This is the equivalent length that the magnetic flux travels through the core."""
3010
+
3011
+ effectiveVolume: float
3012
+ """This is the product of the effective length by the effective area, and represents the
3013
+ equivalent volume that is magnetized by the field
3014
+ """
3015
+ minimumArea: float
3016
+ """This is the minimum area seen by the magnetic flux along its path"""
3017
+
3018
+ @staticmethod
3019
+ def from_dict(obj: Any) -> 'EffectiveParameters':
3020
+ assert isinstance(obj, dict)
3021
+ effectiveArea = from_float(obj.get("effectiveArea"))
3022
+ effectiveLength = from_float(obj.get("effectiveLength"))
3023
+ effectiveVolume = from_float(obj.get("effectiveVolume"))
3024
+ minimumArea = from_float(obj.get("minimumArea"))
3025
+ return EffectiveParameters(effectiveArea, effectiveLength, effectiveVolume, minimumArea)
3026
+
3027
+ def to_dict(self) -> dict:
3028
+ result: dict = {}
3029
+ result["effectiveArea"] = to_float(self.effectiveArea)
3030
+ result["effectiveLength"] = to_float(self.effectiveLength)
3031
+ result["effectiveVolume"] = to_float(self.effectiveVolume)
3032
+ result["minimumArea"] = to_float(self.minimumArea)
3033
+ return result
3034
+
3035
+
3036
+ @dataclass
3037
+ class CoreProcessedDescription:
3038
+ """The data from the core after been processed, and ready to use by the analytical models"""
3039
+
3040
+ columns: List[ColumnElement]
3041
+ """List of columns in the core"""
3042
+
3043
+ depth: float
3044
+ """Total depth of the core"""
3045
+
3046
+ effectiveParameters: EffectiveParameters
3047
+ height: float
3048
+ """Total height of the core"""
3049
+
3050
+ width: float
3051
+ """Total width of the core"""
3052
+
3053
+ windingWindows: List[WindingWindowElement]
3054
+ """List of winding windows, all elements in the list must be of the same type"""
3055
+
3056
+ @staticmethod
3057
+ def from_dict(obj: Any) -> 'CoreProcessedDescription':
3058
+ assert isinstance(obj, dict)
3059
+ columns = from_list(ColumnElement.from_dict, obj.get("columns"))
3060
+ depth = from_float(obj.get("depth"))
3061
+ effectiveParameters = EffectiveParameters.from_dict(obj.get("effectiveParameters"))
3062
+ height = from_float(obj.get("height"))
3063
+ width = from_float(obj.get("width"))
3064
+ windingWindows = from_list(WindingWindowElement.from_dict, obj.get("windingWindows"))
3065
+ return CoreProcessedDescription(columns, depth, effectiveParameters, height, width, windingWindows)
3066
+
3067
+ def to_dict(self) -> dict:
3068
+ result: dict = {}
3069
+ result["columns"] = from_list(lambda x: to_class(ColumnElement, x), self.columns)
3070
+ result["depth"] = to_float(self.depth)
3071
+ result["effectiveParameters"] = to_class(EffectiveParameters, self.effectiveParameters)
3072
+ result["height"] = to_float(self.height)
3073
+ result["width"] = to_float(self.width)
3074
+ result["windingWindows"] = from_list(lambda x: to_class(WindingWindowElement, x), self.windingWindows)
3075
+ return result
3076
+
3077
+
3078
+ @dataclass
3079
+ class MagneticCore:
3080
+ """Data describing the magnetic core.
3081
+
3082
+ The description of a magnetic core
3083
+ """
3084
+ functionalDescription: CoreFunctionalDescription
3085
+ """The data from the core based on its function, in a way that can be used by analytical
3086
+ models.
3087
+ """
3088
+ distributorsInfo: Optional[List[DistributorInfo]] = None
3089
+ """The lists of distributors of the magnetic core"""
3090
+
3091
+ geometricalDescription: Optional[List[CoreGeometricalDescriptionElement]] = None
3092
+ """List with data from the core based on its geometrical description, in a way that can be
3093
+ used by CAD models.
3094
+ """
3095
+ manufacturerInfo: Optional[ManufacturerInfo] = None
3096
+ name: Optional[str] = None
3097
+ """The name of core"""
3098
+
3099
+ processedDescription: Optional[CoreProcessedDescription] = None
3100
+ """The data from the core after been processed, and ready to use by the analytical models"""
3101
+
3102
+ @staticmethod
3103
+ def from_dict(obj: Any) -> 'MagneticCore':
3104
+ assert isinstance(obj, dict)
3105
+ functionalDescription = CoreFunctionalDescription.from_dict(obj.get("functionalDescription"))
3106
+ distributorsInfo = from_union([lambda x: from_list(DistributorInfo.from_dict, x), from_none], obj.get("distributorsInfo"))
3107
+ geometricalDescription = from_union([lambda x: from_list(CoreGeometricalDescriptionElement.from_dict, x), from_none], obj.get("geometricalDescription"))
3108
+ manufacturerInfo = from_union([ManufacturerInfo.from_dict, from_none], obj.get("manufacturerInfo"))
3109
+ name = from_union([from_str, from_none], obj.get("name"))
3110
+ processedDescription = from_union([CoreProcessedDescription.from_dict, from_none], obj.get("processedDescription"))
3111
+ return MagneticCore(functionalDescription, distributorsInfo, geometricalDescription, manufacturerInfo, name, processedDescription)
3112
+
3113
+ def to_dict(self) -> dict:
3114
+ result: dict = {}
3115
+ result["functionalDescription"] = to_class(CoreFunctionalDescription, self.functionalDescription)
3116
+ if self.distributorsInfo is not None:
3117
+ result["distributorsInfo"] = from_union([lambda x: from_list(lambda x: to_class(DistributorInfo, x), x), from_none], self.distributorsInfo)
3118
+ if self.geometricalDescription is not None:
3119
+ result["geometricalDescription"] = from_union([lambda x: from_list(lambda x: to_class(CoreGeometricalDescriptionElement, x), x), from_none], self.geometricalDescription)
3120
+ if self.manufacturerInfo is not None:
3121
+ result["manufacturerInfo"] = from_union([lambda x: to_class(ManufacturerInfo, x), from_none], self.manufacturerInfo)
3122
+ if self.name is not None:
3123
+ result["name"] = from_union([from_str, from_none], self.name)
3124
+ if self.processedDescription is not None:
3125
+ result["processedDescription"] = from_union([lambda x: to_class(CoreProcessedDescription, x), from_none], self.processedDescription)
3126
+ return result
3127
+
3128
+
3129
+ @dataclass
3130
+ class MagneticManufacturerRecommendations:
3131
+ ratedCurrent: Optional[float] = None
3132
+ """The manufacturer's rated current for this part"""
3133
+
3134
+ ratedCurrentTemperatureRise: Optional[float] = None
3135
+ """The temperature rise for which the rated current is calculated"""
3136
+
3137
+ ratedMagneticFlux: Optional[float] = None
3138
+ """The manufacturer's rated magnetic flux or volt-seconds for this part"""
3139
+
3140
+ saturationCurrent: Optional[float] = None
3141
+ """The manufacturer's saturation current for this part"""
3142
+
3143
+ saturationCurrentInductanceDrop: Optional[float] = None
3144
+ """Percentage of inductance drop at saturation current"""
3145
+
3146
+ @staticmethod
3147
+ def from_dict(obj: Any) -> 'MagneticManufacturerRecommendations':
3148
+ assert isinstance(obj, dict)
3149
+ ratedCurrent = from_union([from_float, from_none], obj.get("ratedCurrent"))
3150
+ ratedCurrentTemperatureRise = from_union([from_float, from_none], obj.get("ratedCurrentTemperatureRise"))
3151
+ ratedMagneticFlux = from_union([from_float, from_none], obj.get("ratedMagneticFlux"))
3152
+ saturationCurrent = from_union([from_float, from_none], obj.get("saturationCurrent"))
3153
+ saturationCurrentInductanceDrop = from_union([from_float, from_none], obj.get("saturationCurrentInductanceDrop"))
3154
+ return MagneticManufacturerRecommendations(ratedCurrent, ratedCurrentTemperatureRise, ratedMagneticFlux, saturationCurrent, saturationCurrentInductanceDrop)
3155
+
3156
+ def to_dict(self) -> dict:
3157
+ result: dict = {}
3158
+ if self.ratedCurrent is not None:
3159
+ result["ratedCurrent"] = from_union([to_float, from_none], self.ratedCurrent)
3160
+ if self.ratedCurrentTemperatureRise is not None:
3161
+ result["ratedCurrentTemperatureRise"] = from_union([to_float, from_none], self.ratedCurrentTemperatureRise)
3162
+ if self.ratedMagneticFlux is not None:
3163
+ result["ratedMagneticFlux"] = from_union([to_float, from_none], self.ratedMagneticFlux)
3164
+ if self.saturationCurrent is not None:
3165
+ result["saturationCurrent"] = from_union([to_float, from_none], self.saturationCurrent)
3166
+ if self.saturationCurrentInductanceDrop is not None:
3167
+ result["saturationCurrentInductanceDrop"] = from_union([to_float, from_none], self.saturationCurrentInductanceDrop)
3168
+ return result
3169
+
3170
+
3171
+ @dataclass
3172
+ class MagneticManufacturerInfo:
3173
+ name: str
3174
+ """The name of the manufacturer of the part"""
3175
+
3176
+ cost: Optional[str] = None
3177
+ """The manufacturer's price for this part"""
3178
+
3179
+ datasheetUrl: Optional[str] = None
3180
+ """The manufacturer's URL to the datasheet of the product"""
3181
+
3182
+ family: Optional[str] = None
3183
+ """The family of a magnetic, as defined by the manufacturer"""
3184
+
3185
+ recommendations: Optional[MagneticManufacturerRecommendations] = None
3186
+ reference: Optional[str] = None
3187
+ """The manufacturer's reference of this part"""
3188
+
3189
+ status: Optional[Status] = None
3190
+ """The production status of a part according to its manufacturer"""
3191
+
3192
+ @staticmethod
3193
+ def from_dict(obj: Any) -> 'MagneticManufacturerInfo':
3194
+ assert isinstance(obj, dict)
3195
+ name = from_str(obj.get("name"))
3196
+ cost = from_union([from_str, from_none], obj.get("cost"))
3197
+ datasheetUrl = from_union([from_str, from_none], obj.get("datasheetUrl"))
3198
+ family = from_union([from_str, from_none], obj.get("family"))
3199
+ recommendations = from_union([MagneticManufacturerRecommendations.from_dict, from_none], obj.get("recommendations"))
3200
+ reference = from_union([from_str, from_none], obj.get("reference"))
3201
+ status = from_union([Status, from_none], obj.get("status"))
3202
+ return MagneticManufacturerInfo(name, cost, datasheetUrl, family, recommendations, reference, status)
3203
+
3204
+ def to_dict(self) -> dict:
3205
+ result: dict = {}
3206
+ result["name"] = from_str(self.name)
3207
+ if self.cost is not None:
3208
+ result["cost"] = from_union([from_str, from_none], self.cost)
3209
+ if self.datasheetUrl is not None:
3210
+ result["datasheetUrl"] = from_union([from_str, from_none], self.datasheetUrl)
3211
+ if self.family is not None:
3212
+ result["family"] = from_union([from_str, from_none], self.family)
3213
+ if self.recommendations is not None:
3214
+ result["recommendations"] = from_union([lambda x: to_class(MagneticManufacturerRecommendations, x), from_none], self.recommendations)
3215
+ if self.reference is not None:
3216
+ result["reference"] = from_union([from_str, from_none], self.reference)
3217
+ if self.status is not None:
3218
+ result["status"] = from_union([lambda x: to_enum(Status, x), from_none], self.status)
3219
+ return result
3220
+
3221
+
3222
+ @dataclass
3223
+ class MagneticClass:
3224
+ """The description of a magnetic"""
3225
+
3226
+ coil: Coil
3227
+ """Data describing the coil"""
3228
+
3229
+ core: MagneticCore
3230
+ """Data describing the magnetic core."""
3231
+
3232
+ distributorsInfo: Optional[List[DistributorInfo]] = None
3233
+ """The lists of distributors of the magnetic"""
3234
+
3235
+ manufacturerInfo: Optional[MagneticManufacturerInfo] = None
3236
+ rotation: Optional[List[float]] = None
3237
+ """The rotation of the magnetic, by default the winding column goes vertical"""
3238
+
3239
+ @staticmethod
3240
+ def from_dict(obj: Any) -> 'MagneticClass':
3241
+ assert isinstance(obj, dict)
3242
+ coil = Coil.from_dict(obj.get("coil"))
3243
+ core = MagneticCore.from_dict(obj.get("core"))
3244
+ distributorsInfo = from_union([lambda x: from_list(DistributorInfo.from_dict, x), from_none], obj.get("distributorsInfo"))
3245
+ manufacturerInfo = from_union([MagneticManufacturerInfo.from_dict, from_none], obj.get("manufacturerInfo"))
3246
+ rotation = from_union([lambda x: from_list(from_float, x), from_none], obj.get("rotation"))
3247
+ return MagneticClass(coil, core, distributorsInfo, manufacturerInfo, rotation)
3248
+
3249
+ def to_dict(self) -> dict:
3250
+ result: dict = {}
3251
+ result["coil"] = to_class(Coil, self.coil)
3252
+ result["core"] = to_class(MagneticCore, self.core)
3253
+ if self.distributorsInfo is not None:
3254
+ result["distributorsInfo"] = from_union([lambda x: from_list(lambda x: to_class(DistributorInfo, x), x), from_none], self.distributorsInfo)
3255
+ if self.manufacturerInfo is not None:
3256
+ result["manufacturerInfo"] = from_union([lambda x: to_class(MagneticManufacturerInfo, x), from_none], self.manufacturerInfo)
3257
+ if self.rotation is not None:
3258
+ result["rotation"] = from_union([lambda x: from_list(to_float, x), from_none], self.rotation)
3259
+ return result
3260
+
3261
+
3262
+ @dataclass
3263
+ class Metadata:
3264
+ """Data describing metadata about the measurement"""
3265
+
3266
+ date: str
3267
+ """date of testing"""
3268
+
3269
+ where: str
3270
+ """where the test was performmed, company, institution"""
3271
+
3272
+ who: str
3273
+ """name of person who did the test"""
3274
+
3275
+ testname: Optional[str] = None
3276
+ """optional unique identifier to distinguish between multiple tests"""
3277
+
3278
+ @staticmethod
3279
+ def from_dict(obj: Any) -> 'Metadata':
3280
+ assert isinstance(obj, dict)
3281
+ date = from_str(obj.get("date"))
3282
+ where = from_str(obj.get("where"))
3283
+ who = from_str(obj.get("who"))
3284
+ testname = from_union([from_str, from_none], obj.get("testname"))
3285
+ return Metadata(date, where, who, testname)
3286
+
3287
+ def to_dict(self) -> dict:
3288
+ result: dict = {}
3289
+ result["date"] = from_str(self.date)
3290
+ result["where"] = from_str(self.where)
3291
+ result["who"] = from_str(self.who)
3292
+ if self.testname is not None:
3293
+ result["testname"] = from_union([from_str, from_none], self.testname)
3294
+ return result
3295
+
3296
+
3297
+ @dataclass
3298
+ class Cooling:
3299
+ """Relative Humidity of the ambient where the magnetic will operate
3300
+
3301
+ Data describing a natural convection cooling
3302
+
3303
+ Data describing a forced convection cooling
3304
+
3305
+ Data describing a heatsink cooling
3306
+
3307
+ Data describing a cold plate cooling
3308
+ """
3309
+ fluid: Optional[str] = None
3310
+ """Name of the fluid used"""
3311
+
3312
+ temperature: Optional[float] = None
3313
+ """Temperature of the fluid. To be used only if different from ambient temperature"""
3314
+
3315
+ flowDiameter: Optional[float] = None
3316
+ """Diameter of the fluid flow, normally defined as a fan diameter"""
3317
+
3318
+ velocity: Optional[List[float]] = None
3319
+ dimensions: Optional[List[float]] = None
3320
+ """Dimensions of the cube defining the heatsink
3321
+
3322
+ Dimensions of the cube defining the cold plate
3323
+ """
3324
+ interfaceThermalResistance: Optional[float] = None
3325
+ """Bulk thermal resistance of the thermal interface used to connect the device to the
3326
+ heatsink, in W/mK
3327
+
3328
+ Bulk thermal resistance of the thermal interface used to connect the device to the cold
3329
+ plate, in W/mK
3330
+ """
3331
+ interfaceThickness: Optional[float] = None
3332
+ """Thickness of the thermal interface used to connect the device to the heatsink, in m
3333
+
3334
+ Thickness of the thermal interface used to connect the device to the cold plate, in m
3335
+ """
3336
+ thermalResistance: Optional[float] = None
3337
+ """Bulk thermal resistance of the heat sink, in W/K
3338
+
3339
+ Bulk thermal resistance of the cold plate, in W/K
3340
+ """
3341
+ maximumTemperature: Optional[float] = None
3342
+ """Maximum temperature of the cold plate"""
3343
+
3344
+ @staticmethod
3345
+ def from_dict(obj: Any) -> 'Cooling':
3346
+ assert isinstance(obj, dict)
3347
+ fluid = from_union([from_str, from_none], obj.get("fluid"))
3348
+ temperature = from_union([from_float, from_none], obj.get("temperature"))
3349
+ flowDiameter = from_union([from_float, from_none], obj.get("flowDiameter"))
3350
+ velocity = from_union([lambda x: from_list(from_float, x), from_none], obj.get("velocity"))
3351
+ dimensions = from_union([lambda x: from_list(from_float, x), from_none], obj.get("dimensions"))
3352
+ interfaceThermalResistance = from_union([from_float, from_none], obj.get("interfaceThermalResistance"))
3353
+ interfaceThickness = from_union([from_float, from_none], obj.get("interfaceThickness"))
3354
+ thermalResistance = from_union([from_float, from_none], obj.get("thermalResistance"))
3355
+ maximumTemperature = from_union([from_float, from_none], obj.get("maximumTemperature"))
3356
+ return Cooling(fluid, temperature, flowDiameter, velocity, dimensions, interfaceThermalResistance, interfaceThickness, thermalResistance, maximumTemperature)
3357
+
3358
+ def to_dict(self) -> dict:
3359
+ result: dict = {}
3360
+ if self.fluid is not None:
3361
+ result["fluid"] = from_union([from_str, from_none], self.fluid)
3362
+ if self.temperature is not None:
3363
+ result["temperature"] = from_union([to_float, from_none], self.temperature)
3364
+ if self.flowDiameter is not None:
3365
+ result["flowDiameter"] = from_union([to_float, from_none], self.flowDiameter)
3366
+ if self.velocity is not None:
3367
+ result["velocity"] = from_union([lambda x: from_list(to_float, x), from_none], self.velocity)
3368
+ if self.dimensions is not None:
3369
+ result["dimensions"] = from_union([lambda x: from_list(to_float, x), from_none], self.dimensions)
3370
+ if self.interfaceThermalResistance is not None:
3371
+ result["interfaceThermalResistance"] = from_union([to_float, from_none], self.interfaceThermalResistance)
3372
+ if self.interfaceThickness is not None:
3373
+ result["interfaceThickness"] = from_union([to_float, from_none], self.interfaceThickness)
3374
+ if self.thermalResistance is not None:
3375
+ result["thermalResistance"] = from_union([to_float, from_none], self.thermalResistance)
3376
+ if self.maximumTemperature is not None:
3377
+ result["maximumTemperature"] = from_union([to_float, from_none], self.maximumTemperature)
3378
+ return result
3379
+
3380
+
3381
+ @dataclass
3382
+ class OperatingConditions:
3383
+ """The description of a magnetic operating conditions"""
3384
+
3385
+ ambientTemperature: float
3386
+ """Temperature of the ambient where the magnetic will operate"""
3387
+
3388
+ ambientRelativeHumidity: Optional[float] = None
3389
+ """Relative Humidity of the ambient where the magnetic will operate"""
3390
+
3391
+ cooling: Optional[Cooling] = None
3392
+ """Relative Humidity of the ambient where the magnetic will operate"""
3393
+
3394
+ name: Optional[str] = None
3395
+ """A label that identifies this Operating Conditions"""
3396
+
3397
+ @staticmethod
3398
+ def from_dict(obj: Any) -> 'OperatingConditions':
3399
+ assert isinstance(obj, dict)
3400
+ ambientTemperature = from_float(obj.get("ambientTemperature"))
3401
+ ambientRelativeHumidity = from_union([from_float, from_none], obj.get("ambientRelativeHumidity"))
3402
+ cooling = from_union([Cooling.from_dict, from_none], obj.get("cooling"))
3403
+ name = from_union([from_str, from_none], obj.get("name"))
3404
+ return OperatingConditions(ambientTemperature, ambientRelativeHumidity, cooling, name)
3405
+
3406
+ def to_dict(self) -> dict:
3407
+ result: dict = {}
3408
+ result["ambientTemperature"] = to_float(self.ambientTemperature)
3409
+ if self.ambientRelativeHumidity is not None:
3410
+ result["ambientRelativeHumidity"] = from_union([to_float, from_none], self.ambientRelativeHumidity)
3411
+ if self.cooling is not None:
3412
+ result["cooling"] = from_union([lambda x: to_class(Cooling, x), from_none], self.cooling)
3413
+ if self.name is not None:
3414
+ result["name"] = from_union([from_str, from_none], self.name)
3415
+ return result
3416
+
3417
+
3418
+ @dataclass
3419
+ class OperatingPoint:
3420
+ """Data describing one operating point, including the operating conditions and the
3421
+ excitations for all ports
3422
+ """
3423
+ conditions: OperatingConditions
3424
+ excitationsPerWinding: List[OperatingPointExcitation]
3425
+ name: Optional[str] = None
3426
+ """Name describing this operating point"""
3427
+
3428
+ @staticmethod
3429
+ def from_dict(obj: Any) -> 'OperatingPoint':
3430
+ assert isinstance(obj, dict)
3431
+ conditions = OperatingConditions.from_dict(obj.get("conditions"))
3432
+ excitationsPerWinding = from_list(OperatingPointExcitation.from_dict, obj.get("excitationsPerWinding"))
3433
+ name = from_union([from_str, from_none], obj.get("name"))
3434
+ return OperatingPoint(conditions, excitationsPerWinding, name)
3435
+
3436
+ def to_dict(self) -> dict:
3437
+ result: dict = {}
3438
+ result["conditions"] = to_class(OperatingConditions, self.conditions)
3439
+ result["excitationsPerWinding"] = from_list(lambda x: to_class(OperatingPointExcitation, x), self.excitationsPerWinding)
3440
+ if self.name is not None:
3441
+ result["name"] = from_union([from_str, from_none], self.name)
3442
+ return result
3443
+
3444
+
3445
+ class ResultOrigin(Enum):
3446
+ """Origin of the value of the result"""
3447
+
3448
+ manufacturer = "manufacturer"
3449
+ measurement = "measurement"
3450
+ simulation = "simulation"
3451
+
3452
+
3453
+ @dataclass
3454
+ class OutputsCoreLossesOutput:
3455
+ """Data describing the core losses and the intermediate inputs used to calculate them"""
3456
+
3457
+ coreLosses: float
3458
+ """Value of the core losses"""
3459
+
3460
+ methodUsed: str
3461
+ """Model used to calculate the core losses in the case of simulation, or method used to
3462
+ measure it
3463
+ """
3464
+ origin: ResultOrigin
3465
+ eddyCurrentCoreLosses: Optional[float] = None
3466
+ """Part of the core losses due to eddy currents"""
3467
+
3468
+ hysteresisCoreLosses: Optional[float] = None
3469
+ """Part of the core losses due to hysteresis"""
3470
+
3471
+ magneticFluxDensity: Optional[SignalDescriptor] = None
3472
+ """Excitation of the B field that produced the core losses"""
3473
+
3474
+ temperature: Optional[float] = None
3475
+ """temperature in the core that produced the core losses"""
3476
+
3477
+ volumetricLosses: Optional[float] = None
3478
+ """Volumetric value of the core losses"""
3479
+
3480
+ @staticmethod
3481
+ def from_dict(obj: Any) -> 'OutputsCoreLossesOutput':
3482
+ assert isinstance(obj, dict)
3483
+ coreLosses = from_float(obj.get("coreLosses"))
3484
+ methodUsed = from_str(obj.get("methodUsed"))
3485
+ origin = ResultOrigin(obj.get("origin"))
3486
+ eddyCurrentCoreLosses = from_union([from_float, from_none], obj.get("eddyCurrentCoreLosses"))
3487
+ hysteresisCoreLosses = from_union([from_float, from_none], obj.get("hysteresisCoreLosses"))
3488
+ magneticFluxDensity = from_union([SignalDescriptor.from_dict, from_none], obj.get("magneticFluxDensity"))
3489
+ temperature = from_union([from_float, from_none], obj.get("temperature"))
3490
+ volumetricLosses = from_union([from_float, from_none], obj.get("volumetricLosses"))
3491
+ return OutputsCoreLossesOutput(coreLosses, methodUsed, origin, eddyCurrentCoreLosses, hysteresisCoreLosses, magneticFluxDensity, temperature, volumetricLosses)
3492
+
3493
+ def to_dict(self) -> dict:
3494
+ result: dict = {}
3495
+ result["coreLosses"] = to_float(self.coreLosses)
3496
+ result["methodUsed"] = from_str(self.methodUsed)
3497
+ result["origin"] = to_enum(ResultOrigin, self.origin)
3498
+ if self.eddyCurrentCoreLosses is not None:
3499
+ result["eddyCurrentCoreLosses"] = from_union([to_float, from_none], self.eddyCurrentCoreLosses)
3500
+ if self.hysteresisCoreLosses is not None:
3501
+ result["hysteresisCoreLosses"] = from_union([to_float, from_none], self.hysteresisCoreLosses)
3502
+ if self.magneticFluxDensity is not None:
3503
+ result["magneticFluxDensity"] = from_union([lambda x: to_class(SignalDescriptor, x), from_none], self.magneticFluxDensity)
3504
+ if self.temperature is not None:
3505
+ result["temperature"] = from_union([to_float, from_none], self.temperature)
3506
+ if self.volumetricLosses is not None:
3507
+ result["volumetricLosses"] = from_union([to_float, from_none], self.volumetricLosses)
3508
+ return result
3509
+
3510
+
3511
+ @dataclass
3512
+ class FrequencyResponseChart:
3513
+ data: Optional[float] = None
3514
+ frequency: Optional[float] = None
3515
+
3516
+ @staticmethod
3517
+ def from_dict(obj: Any) -> 'FrequencyResponseChart':
3518
+ assert isinstance(obj, dict)
3519
+ data = from_union([from_float, from_none], obj.get("data"))
3520
+ frequency = from_union([from_float, from_none], obj.get("frequency"))
3521
+ return FrequencyResponseChart(data, frequency)
3522
+
3523
+ def to_dict(self) -> dict:
3524
+ result: dict = {}
3525
+ if self.data is not None:
3526
+ result["data"] = from_union([to_float, from_none], self.data)
3527
+ if self.frequency is not None:
3528
+ result["frequency"] = from_union([to_float, from_none], self.frequency)
3529
+ return result
3530
+
3531
+
3532
+ @dataclass
3533
+ class FrequencyResponse:
3534
+ """TODO"""
3535
+
3536
+ chart: Optional[List[FrequencyResponseChart]] = None
3537
+ """TODO"""
3538
+
3539
+ dataPoint: Optional[str] = None
3540
+ """TODO"""
3541
+
3542
+ @staticmethod
3543
+ def from_dict(obj: Any) -> 'FrequencyResponse':
3544
+ assert isinstance(obj, dict)
3545
+ chart = from_union([lambda x: from_list(FrequencyResponseChart.from_dict, x), from_none], obj.get("chart"))
3546
+ dataPoint = from_union([from_str, from_none], obj.get("dataPoint"))
3547
+ return FrequencyResponse(chart, dataPoint)
3548
+
3549
+ def to_dict(self) -> dict:
3550
+ result: dict = {}
3551
+ if self.chart is not None:
3552
+ result["chart"] = from_union([lambda x: from_list(lambda x: to_class(FrequencyResponseChart, x), x), from_none], self.chart)
3553
+ if self.dataPoint is not None:
3554
+ result["dataPoint"] = from_union([from_str, from_none], self.dataPoint)
3555
+ return result
3556
+
3557
+
3558
+ @dataclass
3559
+ class PhaseFrequencyCharacteristicChart:
3560
+ frequency: Optional[float] = None
3561
+ phase: Optional[float] = None
3562
+
3563
+ @staticmethod
3564
+ def from_dict(obj: Any) -> 'PhaseFrequencyCharacteristicChart':
3565
+ assert isinstance(obj, dict)
3566
+ frequency = from_union([from_float, from_none], obj.get("frequency"))
3567
+ phase = from_union([from_float, from_none], obj.get("phase"))
3568
+ return PhaseFrequencyCharacteristicChart(frequency, phase)
3569
+
3570
+ def to_dict(self) -> dict:
3571
+ result: dict = {}
3572
+ if self.frequency is not None:
3573
+ result["frequency"] = from_union([to_float, from_none], self.frequency)
3574
+ if self.phase is not None:
3575
+ result["phase"] = from_union([to_float, from_none], self.phase)
3576
+ return result
3577
+
3578
+
3579
+ @dataclass
3580
+ class PhaseFrequencyCharacteristic:
3581
+ """TODO"""
3582
+
3583
+ chart: Optional[List[PhaseFrequencyCharacteristicChart]] = None
3584
+ """TODO"""
3585
+
3586
+ dataPoint: Optional[str] = None
3587
+ """TODO"""
3588
+
3589
+ @staticmethod
3590
+ def from_dict(obj: Any) -> 'PhaseFrequencyCharacteristic':
3591
+ assert isinstance(obj, dict)
3592
+ chart = from_union([lambda x: from_list(PhaseFrequencyCharacteristicChart.from_dict, x), from_none], obj.get("chart"))
3593
+ dataPoint = from_union([from_str, from_none], obj.get("dataPoint"))
3594
+ return PhaseFrequencyCharacteristic(chart, dataPoint)
3595
+
3596
+ def to_dict(self) -> dict:
3597
+ result: dict = {}
3598
+ if self.chart is not None:
3599
+ result["chart"] = from_union([lambda x: from_list(lambda x: to_class(PhaseFrequencyCharacteristicChart, x), x), from_none], self.chart)
3600
+ if self.dataPoint is not None:
3601
+ result["dataPoint"] = from_union([from_str, from_none], self.dataPoint)
3602
+ return result
3603
+
3604
+
3605
+ class SensorType(Enum):
3606
+ """The type of voltage sensor
3607
+
3608
+ The type of current sensor
3609
+ """
3610
+ coaxialShunt = "coaxialShunt"
3611
+ differential = "differential"
3612
+ other = "other"
3613
+ probe = "probe"
3614
+ resistiveShunt = "resistiveShunt"
3615
+ singleended = "single-ended"
3616
+
3617
+
3618
+ class EquipmentType(Enum):
3619
+ """The type of equipment"""
3620
+
3621
+ amplifier = "amplifier"
3622
+ bhAnalyzer = "bhAnalyzer"
3623
+ currentSensor = "currentSensor"
3624
+ currentSource = "currentSource"
3625
+ halfBridge = "halfBridge"
3626
+ oscilloscope = "oscilloscope"
3627
+ voltageSensor = "voltageSensor"
3628
+ voltageSource = "voltageSource"
3629
+ wattmeter = "wattmeter"
3630
+
3631
+
3632
+ @dataclass
3633
+ class Equipment:
3634
+ """The description of a voltage source
3635
+
3636
+ The description of a current source
3637
+
3638
+ The description of a half bridge
3639
+
3640
+ The description of a wattmeter
3641
+
3642
+ The description of a BH Analyzer
3643
+
3644
+ The description of an Oscilloscope
3645
+ """
3646
+ model: str
3647
+ """The model of the equipment"""
3648
+
3649
+ type: EquipmentType
3650
+ calibrationDate: Optional[str] = None
3651
+ """The calibration date of the equipment"""
3652
+
3653
+ distortion: Optional[float] = None
3654
+ """The distortion of the voltage source
3655
+
3656
+ The distortion of the current source
3657
+ """
3658
+ assetNumber: Optional[str] = None
3659
+ """The asset number of the equipment"""
3660
+
3661
+ description: Optional[str] = None
3662
+ """The description of the equipment"""
3663
+
3664
+ manufacturer: Optional[str] = None
3665
+ """The manufacturer of the equipment"""
3666
+
3667
+ serialNumber: Optional[str] = None
3668
+ """The serial number of the equipment"""
3669
+
3670
+ switchPartNumber: Optional[str] = None
3671
+ """The part number of the switch used in the half bridge"""
3672
+
3673
+ switchRdson: Optional[float] = None
3674
+ """The Rdson of the switch used in the half bridge"""
3675
+
3676
+ switchVdss: Optional[float] = None
3677
+ """The Vdss of the switch used in the half bridge"""
3678
+
3679
+ phaseErrorPerKHz: Optional[str] = None
3680
+ """TODO"""
3681
+
3682
+ rangeErrorCurrent: Optional[str] = None
3683
+ """TODO"""
3684
+
3685
+ rangeErrorVoltage: Optional[str] = None
3686
+ """TODO"""
3687
+
3688
+ readingErrorCurrent: Optional[str] = None
3689
+ """TODO"""
3690
+
3691
+ readingErrorVoltage: Optional[str] = None
3692
+ """TODO"""
3693
+
3694
+ phaseError: Optional[str] = None
3695
+ """TODO"""
3696
+
3697
+ rangeError: Optional[str] = None
3698
+ """TODO"""
3699
+
3700
+ readingError: Optional[str] = None
3701
+ """TODO"""
3702
+
3703
+ chanRangeError: Optional[str] = None
3704
+ """TODO"""
3705
+
3706
+ chanReadingError: Optional[str] = None
3707
+ """TODO"""
3708
+
3709
+ deskew: Optional[str] = None
3710
+ """TODO"""
3711
+
3712
+ frequencyResponse: Optional[FrequencyResponse] = None
3713
+ """TODO"""
3714
+
3715
+ probeError: Optional[str] = None
3716
+ """TODO"""
3717
+
3718
+ ratio: Optional[float] = None
3719
+ """TODO"""
3720
+
3721
+ sensorType: Optional[SensorType] = None
3722
+ currentRatio: Optional[float] = None
3723
+ """TODO"""
3724
+
3725
+ phaseFrequencyCharacteristic: Optional[PhaseFrequencyCharacteristic] = None
3726
+ """TODO"""
3727
+
3728
+ rating: Optional[str] = None
3729
+ """TODO"""
3730
+
3731
+ resistance: Optional[float] = None
3732
+ """TODO"""
3733
+
3734
+ tempCoefficent: Optional[float] = None
3735
+ """TODO"""
3736
+
3737
+ @staticmethod
3738
+ def from_dict(obj: Any) -> 'Equipment':
3739
+ assert isinstance(obj, dict)
3740
+ model = from_str(obj.get("model"))
3741
+ type = EquipmentType(obj.get("type"))
3742
+ calibrationDate = from_union([from_str, from_none], obj.get("calibrationDate"))
3743
+ distortion = from_union([from_float, from_none], obj.get("distortion"))
3744
+ assetNumber = from_union([from_str, from_none], obj.get("assetNumber"))
3745
+ description = from_union([from_str, from_none], obj.get("description"))
3746
+ manufacturer = from_union([from_str, from_none], obj.get("manufacturer"))
3747
+ serialNumber = from_union([from_str, from_none], obj.get("serialNumber"))
3748
+ switchPartNumber = from_union([from_str, from_none], obj.get("switchPartNumber"))
3749
+ switchRdson = from_union([from_float, from_none], obj.get("switchRdson"))
3750
+ switchVdss = from_union([from_float, from_none], obj.get("switchVdss"))
3751
+ phaseErrorPerKHz = from_union([from_str, from_none], obj.get("phaseErrorPerKHz"))
3752
+ rangeErrorCurrent = from_union([from_str, from_none], obj.get("rangeErrorCurrent"))
3753
+ rangeErrorVoltage = from_union([from_str, from_none], obj.get("rangeErrorVoltage"))
3754
+ readingErrorCurrent = from_union([from_str, from_none], obj.get("readingErrorCurrent"))
3755
+ readingErrorVoltage = from_union([from_str, from_none], obj.get("readingErrorVoltage"))
3756
+ phaseError = from_union([from_str, from_none], obj.get("phaseError"))
3757
+ rangeError = from_union([from_str, from_none], obj.get("rangeError"))
3758
+ readingError = from_union([from_str, from_none], obj.get("readingError"))
3759
+ chanRangeError = from_union([from_str, from_none], obj.get("chanRangeError"))
3760
+ chanReadingError = from_union([from_str, from_none], obj.get("chanReadingError"))
3761
+ deskew = from_union([from_str, from_none], obj.get("deskew"))
3762
+ frequencyResponse = from_union([FrequencyResponse.from_dict, from_none], obj.get("frequencyResponse"))
3763
+ probeError = from_union([from_str, from_none], obj.get("probeError"))
3764
+ ratio = from_union([from_float, from_none], obj.get("ratio"))
3765
+ sensorType = from_union([SensorType, from_none], obj.get("sensorType"))
3766
+ currentRatio = from_union([from_float, from_none], obj.get("currentRatio"))
3767
+ phaseFrequencyCharacteristic = from_union([PhaseFrequencyCharacteristic.from_dict, from_none], obj.get("phaseFrequencyCharacteristic"))
3768
+ rating = from_union([from_str, from_none], obj.get("rating"))
3769
+ resistance = from_union([from_float, from_none], obj.get("resistance"))
3770
+ tempCoefficent = from_union([from_float, from_none], obj.get("tempCoefficent"))
3771
+ return Equipment(model, type, calibrationDate, distortion, assetNumber, description, manufacturer, serialNumber, switchPartNumber, switchRdson, switchVdss, phaseErrorPerKHz, rangeErrorCurrent, rangeErrorVoltage, readingErrorCurrent, readingErrorVoltage, phaseError, rangeError, readingError, chanRangeError, chanReadingError, deskew, frequencyResponse, probeError, ratio, sensorType, currentRatio, phaseFrequencyCharacteristic, rating, resistance, tempCoefficent)
3772
+
3773
+ def to_dict(self) -> dict:
3774
+ result: dict = {}
3775
+ result["model"] = from_str(self.model)
3776
+ result["type"] = to_enum(EquipmentType, self.type)
3777
+ if self.calibrationDate is not None:
3778
+ result["calibrationDate"] = from_union([from_str, from_none], self.calibrationDate)
3779
+ if self.distortion is not None:
3780
+ result["distortion"] = from_union([to_float, from_none], self.distortion)
3781
+ if self.assetNumber is not None:
3782
+ result["assetNumber"] = from_union([from_str, from_none], self.assetNumber)
3783
+ if self.description is not None:
3784
+ result["description"] = from_union([from_str, from_none], self.description)
3785
+ if self.manufacturer is not None:
3786
+ result["manufacturer"] = from_union([from_str, from_none], self.manufacturer)
3787
+ if self.serialNumber is not None:
3788
+ result["serialNumber"] = from_union([from_str, from_none], self.serialNumber)
3789
+ if self.switchPartNumber is not None:
3790
+ result["switchPartNumber"] = from_union([from_str, from_none], self.switchPartNumber)
3791
+ if self.switchRdson is not None:
3792
+ result["switchRdson"] = from_union([to_float, from_none], self.switchRdson)
3793
+ if self.switchVdss is not None:
3794
+ result["switchVdss"] = from_union([to_float, from_none], self.switchVdss)
3795
+ if self.phaseErrorPerKHz is not None:
3796
+ result["phaseErrorPerKHz"] = from_union([from_str, from_none], self.phaseErrorPerKHz)
3797
+ if self.rangeErrorCurrent is not None:
3798
+ result["rangeErrorCurrent"] = from_union([from_str, from_none], self.rangeErrorCurrent)
3799
+ if self.rangeErrorVoltage is not None:
3800
+ result["rangeErrorVoltage"] = from_union([from_str, from_none], self.rangeErrorVoltage)
3801
+ if self.readingErrorCurrent is not None:
3802
+ result["readingErrorCurrent"] = from_union([from_str, from_none], self.readingErrorCurrent)
3803
+ if self.readingErrorVoltage is not None:
3804
+ result["readingErrorVoltage"] = from_union([from_str, from_none], self.readingErrorVoltage)
3805
+ if self.phaseError is not None:
3806
+ result["phaseError"] = from_union([from_str, from_none], self.phaseError)
3807
+ if self.rangeError is not None:
3808
+ result["rangeError"] = from_union([from_str, from_none], self.rangeError)
3809
+ if self.readingError is not None:
3810
+ result["readingError"] = from_union([from_str, from_none], self.readingError)
3811
+ if self.chanRangeError is not None:
3812
+ result["chanRangeError"] = from_union([from_str, from_none], self.chanRangeError)
3813
+ if self.chanReadingError is not None:
3814
+ result["chanReadingError"] = from_union([from_str, from_none], self.chanReadingError)
3815
+ if self.deskew is not None:
3816
+ result["deskew"] = from_union([from_str, from_none], self.deskew)
3817
+ if self.frequencyResponse is not None:
3818
+ result["frequencyResponse"] = from_union([lambda x: to_class(FrequencyResponse, x), from_none], self.frequencyResponse)
3819
+ if self.probeError is not None:
3820
+ result["probeError"] = from_union([from_str, from_none], self.probeError)
3821
+ if self.ratio is not None:
3822
+ result["ratio"] = from_union([to_float, from_none], self.ratio)
3823
+ if self.sensorType is not None:
3824
+ result["sensorType"] = from_union([lambda x: to_enum(SensorType, x), from_none], self.sensorType)
3825
+ if self.currentRatio is not None:
3826
+ result["currentRatio"] = from_union([to_float, from_none], self.currentRatio)
3827
+ if self.phaseFrequencyCharacteristic is not None:
3828
+ result["phaseFrequencyCharacteristic"] = from_union([lambda x: to_class(PhaseFrequencyCharacteristic, x), from_none], self.phaseFrequencyCharacteristic)
3829
+ if self.rating is not None:
3830
+ result["rating"] = from_union([from_str, from_none], self.rating)
3831
+ if self.resistance is not None:
3832
+ result["resistance"] = from_union([to_float, from_none], self.resistance)
3833
+ if self.tempCoefficent is not None:
3834
+ result["tempCoefficent"] = from_union([to_float, from_none], self.tempCoefficent)
3835
+ return result
3836
+
3837
+
3838
+ @dataclass
3839
+ class TestCircuit:
3840
+ files: List[str]
3841
+ """List of files associated with this testCircuit, in Base64"""
3842
+
3843
+ image: str
3844
+ """image of the test circuit, in Base64"""
3845
+
3846
+ name: str
3847
+ """name of the test circuit"""
3848
+
3849
+ @staticmethod
3850
+ def from_dict(obj: Any) -> 'TestCircuit':
3851
+ assert isinstance(obj, dict)
3852
+ files = from_list(from_str, obj.get("files"))
3853
+ image = from_str(obj.get("image"))
3854
+ name = from_str(obj.get("name"))
3855
+ return TestCircuit(files, image, name)
3856
+
3857
+ def to_dict(self) -> dict:
3858
+ result: dict = {}
3859
+ result["files"] = from_list(from_str, self.files)
3860
+ result["image"] = from_str(self.image)
3861
+ result["name"] = from_str(self.name)
3862
+ return result
3863
+
3864
+
3865
+ @dataclass
3866
+ class SetupClass:
3867
+ """Setup used to measure the core losses, including test circuit and equipment list"""
3868
+
3869
+ equipmentList: List[Union[Equipment, str]]
3870
+ """Object with the equipment used in the test circuit"""
3871
+
3872
+ name: str
3873
+ """Name of the setup"""
3874
+
3875
+ testCircuit: Union[TestCircuit, str]
3876
+
3877
+ @staticmethod
3878
+ def from_dict(obj: Any) -> 'SetupClass':
3879
+ assert isinstance(obj, dict)
3880
+ equipmentList = from_list(lambda x: from_union([Equipment.from_dict, from_str], x), obj.get("equipmentList"))
3881
+ name = from_str(obj.get("name"))
3882
+ testCircuit = from_union([TestCircuit.from_dict, from_str], obj.get("testCircuit"))
3883
+ return SetupClass(equipmentList, name, testCircuit)
3884
+
3885
+ def to_dict(self) -> dict:
3886
+ result: dict = {}
3887
+ result["equipmentList"] = from_list(lambda x: from_union([lambda x: to_class(Equipment, x), from_str], x), self.equipmentList)
3888
+ result["name"] = from_str(self.name)
3889
+ result["testCircuit"] = from_union([lambda x: to_class(TestCircuit, x), from_str], self.testCircuit)
3890
+ return result
3891
+
3892
+
3893
+ @dataclass
3894
+ class Cdx:
3895
+ """Top file for a Core Data X entry"""
3896
+
3897
+ magnetic: Union[MagneticClass, str]
3898
+ metadata: Metadata
3899
+ operatingPoint: OperatingPoint
3900
+ result: OutputsCoreLossesOutput
3901
+ setup: Union[SetupClass, str]
3902
+
3903
+ @staticmethod
3904
+ def from_dict(obj: Any) -> 'Cdx':
3905
+ assert isinstance(obj, dict)
3906
+ magnetic = from_union([MagneticClass.from_dict, from_str], obj.get("magnetic"))
3907
+ metadata = Metadata.from_dict(obj.get("metadata"))
3908
+ operatingPoint = OperatingPoint.from_dict(obj.get("operatingPoint"))
3909
+ result = OutputsCoreLossesOutput.from_dict(obj.get("result"))
3910
+ setup = from_union([SetupClass.from_dict, from_str], obj.get("setup"))
3911
+ return Cdx(magnetic, metadata, operatingPoint, result, setup)
3912
+
3913
+ def to_dict(self) -> dict:
3914
+ result: dict = {}
3915
+ result["magnetic"] = from_union([lambda x: to_class(MagneticClass, x), from_str], self.magnetic)
3916
+ result["metadata"] = to_class(Metadata, self.metadata)
3917
+ result["operatingPoint"] = to_class(OperatingPoint, self.operatingPoint)
3918
+ result["result"] = to_class(OutputsCoreLossesOutput, self.result)
3919
+ result["setup"] = from_union([lambda x: to_class(SetupClass, x), from_str], self.setup)
3920
+ return result
3921
+
3922
+
3923
+ def Cdxfromdict(s: Any) -> Cdx:
3924
+ return Cdx.from_dict(s)
3925
+
3926
+
3927
+ def Cdxtodict(x: Cdx) -> Any:
3928
+ return to_class(Cdx, x)