-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtest.py
More file actions
23 lines (17 loc) · 828 Bytes
/
test.py
File metadata and controls
23 lines (17 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import PyOpenMagnetics
def get_area_product(core):
return core["processedDescription"]["columns"][0]["area"] * core["processedDescription"]["windingWindows"][0]["area"]
cores = PyOpenMagnetics.get_available_cores()
print(len(cores))
target_area_product_cm4 = 70
tolerance = 0.05
shape_names = []
for core in cores:
area_product = get_area_product(core)
area_product_cm4 = area_product * 100000000
if target_area_product_cm4 * (1 - tolerance) < area_product_cm4 < target_area_product_cm4 * (1 + tolerance):
# print(core["manufacturerInfo"]["reference"])
if core["manufacturerInfo"]["reference"] not in shape_names:
shape_names.append(core["manufacturerInfo"]["reference"])
# print(core["functionalDescription"]["shape"]["name"])
print(shape_names)