PyOpenMagnetics 1.3.6__tar.gz → 1.3.7__tar.gz
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.
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/CMakeLists.txt +85 -73
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/PKG-INFO +1 -1
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/examples/converter_design_example.py +2 -2
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/pyproject.toml +1 -1
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/src/bobbin.cpp +27 -62
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/src/core.cpp +80 -171
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/src/losses.cpp +2 -4
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/src/settings.cpp +1 -2
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/tests/test_converter_endpoints.py +6 -6
- pyopenmagnetics-1.3.7/tests/test_plotting.py +705 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/.github/workflows/ci.yml +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/.github/workflows/publish.yml +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/.gitignore +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/AGENTS.md +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/LICENSE +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/PyOpenMagnetics.pyi +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/README.md +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/api/MAS.py +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/api/mas_db_reader.py +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/api/validation.py +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/clear_cibuildwheel_cache.sh +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/docs/compatibility.md +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/docs/errors.md +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/docs/performance.md +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/examples/README.md +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/examples/buck_inductor.py +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/examples/complete_simulation_example.py +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/examples/debug_bobbin.py +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/examples/debug_coil.py +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/examples/debug_core.py +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/examples/debug_plotting.py +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/examples/flyback_220v_12v_1a.py +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/examples/flyback_220v_12v_2a_complete.py +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/examples/flyback_bh_curve.png +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/examples/flyback_core.png +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/examples/flyback_design.py +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/examples/flyback_summary.png +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/examples/flyback_waveforms.png +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/examples/list_plot_funcs.py +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/examples/plot_flyback_design.py +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/examples/plot_flyback_pyom.py +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/examples/test_field_calc.py +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/examples/test_field_plot.py +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/force_fresh_build.sh +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/llms.txt +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/notebooks/01_getting_started.ipynb +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/notebooks/02_buck_inductor.ipynb +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/notebooks/03_core_losses.ipynb +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/notebooks/README.md +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/requirements.txt +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/src/advisers.cpp +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/src/advisers.h +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/src/bobbin.h +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/src/common.h +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/src/converter.cpp +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/src/converter.h +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/src/core.h +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/src/database.cpp +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/src/database.h +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/src/logging.cpp +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/src/logging.h +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/src/losses.h +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/src/module.cpp +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/src/plotting.cpp +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/src/plotting.h +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/src/settings.h +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/src/simulation.cpp +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/src/simulation.h +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/src/utils.cpp +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/src/utils.h +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/src/winding.cpp +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/src/winding.h +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/src/wire.cpp +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/src/wire.h +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/test.py +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/tests/__init__.py +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/tests/conftest.py +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/tests/test_core.py +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/tests/test_core_adviser.py +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/tests/test_examples_integration.py +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/tests/test_inputs.py +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/tests/test_logging.py +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/tests/test_magnetic_adviser.py +0 -0
- {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.7}/tests/test_winding.py +0 -0
|
@@ -29,7 +29,7 @@ else ()
|
|
|
29
29
|
set(CMAKE_BUILD_TYPE Release)
|
|
30
30
|
|
|
31
31
|
# Enable Link Time Optimization to reduce binary size
|
|
32
|
-
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION
|
|
32
|
+
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION FALSE) # TEMP: disable LTO (OOM)
|
|
33
33
|
|
|
34
34
|
# Strip symbols and use size optimization
|
|
35
35
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s -Os")
|
|
@@ -37,8 +37,15 @@ else ()
|
|
|
37
37
|
endif()
|
|
38
38
|
|
|
39
39
|
SET(MAS_DIRECTORY "${CMAKE_BINARY_DIR}/MAS/")
|
|
40
|
-
|
|
41
|
-
SET(
|
|
40
|
+
if(DEFINED ENV{LOCAL_MKF_DIR})
|
|
41
|
+
SET(LOCAL_MKF_MAS TRUE)
|
|
42
|
+
SET(MAS_DIR "${PROJECT_SOURCE_DIR}/_mas_local")
|
|
43
|
+
SET(MKF_DIR "${PROJECT_SOURCE_DIR}/_mkf_local")
|
|
44
|
+
else()
|
|
45
|
+
SET(LOCAL_MKF_MAS FALSE)
|
|
46
|
+
SET(MAS_DIR "${CMAKE_BINARY_DIR}/_deps/mas-src")
|
|
47
|
+
SET(MKF_DIR "${CMAKE_BINARY_DIR}/_deps/mkf-src")
|
|
48
|
+
endif()
|
|
42
49
|
SET(FETCHCONTENT_QUIET FALSE)
|
|
43
50
|
|
|
44
51
|
message(STATUS MAS_DIRECTORY)
|
|
@@ -110,63 +117,68 @@ FetchContent_Declare(eigen
|
|
|
110
117
|
FetchContent_MakeAvailable(eigen)
|
|
111
118
|
include_directories("${CMAKE_BINARY_DIR}/_deps/eigen-src")
|
|
112
119
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
message(STATUS "
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
120
|
+
if(NOT LOCAL_MKF_MAS)
|
|
121
|
+
message(STATUS "Fetching MKF")
|
|
122
|
+
# Force fresh clone by using a unique timestamp - update this when MKF changes
|
|
123
|
+
set(MKF_FORCE_REFRESH "2025-02-26-01")
|
|
124
|
+
# Tell MKF to disable matplotplusplus and use SVG-based Painter instead
|
|
125
|
+
set(INCLUDE_PYMKF ON CACHE BOOL "Build Python interface" FORCE)
|
|
126
|
+
FetchContent_Declare(MKF
|
|
127
|
+
GIT_REPOSITORY https://github.com/OpenMagnetics/MKF.git
|
|
128
|
+
GIT_TAG main
|
|
129
|
+
GIT_PROGRESS TRUE
|
|
130
|
+
GIT_SHALLOW TRUE)
|
|
131
|
+
|
|
132
|
+
message(STATUS "Fetching mas")
|
|
133
|
+
# Skip Git LFS to avoid bandwidth quota issues - data files are optional for build
|
|
134
|
+
set(ENV{GIT_LFS_SKIP_SMUDGE} "1")
|
|
135
|
+
# Force fresh clone by using a unique timestamp - update this when MAS changes
|
|
136
|
+
set(MAS_FORCE_REFRESH "2025-02-26-01")
|
|
137
|
+
FetchContent_Declare(
|
|
138
|
+
mas
|
|
139
|
+
GIT_REPOSITORY https://github.com/OpenMagnetics/MAS.git
|
|
140
|
+
GIT_TAG main
|
|
141
|
+
GIT_SHALLOW TRUE)
|
|
142
|
+
|
|
143
|
+
message(STATUS "Fetching Properties mas")
|
|
144
|
+
FetchContent_GetProperties(mas)
|
|
145
|
+
message(STATUS "Fetching Properties MKF")
|
|
146
|
+
FetchContent_GetProperties(MKF)
|
|
147
|
+
message(STATUS "MAS_POPULATED: ${MAS_POPULATED}")
|
|
148
|
+
message(STATUS "MKF_POPULATED: ${MKF_POPULATED}")
|
|
149
|
+
|
|
150
|
+
# Always delete and repopulate MAS to ensure we get the latest
|
|
151
|
+
if(EXISTS ${CMAKE_BINARY_DIR}/_deps/mas-src)
|
|
152
|
+
message(STATUS "Removing old MAS source to force fresh clone")
|
|
153
|
+
file(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/_deps/mas-src)
|
|
154
|
+
endif()
|
|
155
|
+
message(STATUS "Populating MAS")
|
|
156
|
+
FetchContent_Populate(mas)
|
|
157
|
+
# Show git log to verify version
|
|
158
|
+
execute_process(
|
|
159
|
+
COMMAND git -C ${mas_SOURCE_DIR} log --oneline -1
|
|
160
|
+
OUTPUT_VARIABLE MAS_GIT_LOG
|
|
161
|
+
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
162
|
+
ERROR_VARIABLE MAS_GIT_ERROR
|
|
163
|
+
)
|
|
164
|
+
message(STATUS "MAS version: ${MAS_GIT_LOG}")
|
|
165
|
+
if(MAS_GIT_ERROR)
|
|
166
|
+
message(STATUS "MAS git error: ${MAS_GIT_ERROR}")
|
|
167
|
+
endif()
|
|
168
|
+
|
|
169
|
+
if(NOT MKF_POPULATED)
|
|
170
|
+
message(STATUS "Populating MKF")
|
|
171
|
+
FetchContent_Populate(MKF)
|
|
172
|
+
else()
|
|
173
|
+
message(STATUS "MKF already populated at: ${MKF_SOURCE_DIR}")
|
|
174
|
+
endif()
|
|
175
|
+
|
|
176
|
+
message(STATUS ${MAS_SOURCE_DIR})
|
|
164
177
|
else()
|
|
165
|
-
message(STATUS "
|
|
178
|
+
message(STATUS "Using local MKF at ${MKF_DIR}")
|
|
179
|
+
message(STATUS "Using local MAS at ${MAS_DIR}")
|
|
166
180
|
endif()
|
|
167
181
|
|
|
168
|
-
message(STATUS ${MAS_SOURCE_DIR})
|
|
169
|
-
|
|
170
182
|
message(STATUS "Compiling MAS")
|
|
171
183
|
|
|
172
184
|
|
|
@@ -226,14 +238,14 @@ add_custom_target(PyMASGeneration
|
|
|
226
238
|
DEPENDS "${MAS_DIRECTORY}/MAS.hpp")
|
|
227
239
|
|
|
228
240
|
message(STATUS "Compiling PyOpenMagnetics with modular structure")
|
|
229
|
-
file(GLOB SOURCES src/*.cpp
|
|
230
|
-
${
|
|
231
|
-
${
|
|
232
|
-
${
|
|
233
|
-
${
|
|
234
|
-
${
|
|
235
|
-
${
|
|
236
|
-
${
|
|
241
|
+
file(GLOB SOURCES src/*.cpp
|
|
242
|
+
${MKF_DIR}/src/*.cpp
|
|
243
|
+
${MKF_DIR}/src/advisers/*.cpp
|
|
244
|
+
${MKF_DIR}/src/constructive_models/*.cpp
|
|
245
|
+
${MKF_DIR}/src/converter_models/*.cpp
|
|
246
|
+
${MKF_DIR}/src/physical_models/*.cpp
|
|
247
|
+
${MKF_DIR}/src/processors/*.cpp
|
|
248
|
+
${MKF_DIR}/src/support/*.cpp
|
|
237
249
|
)
|
|
238
250
|
message(STATUS SOURCES)
|
|
239
251
|
message(STATUS ${SOURCES})
|
|
@@ -247,7 +259,7 @@ file(DOWNLOAD "https://raw.githubusercontent.com/vector-of-bool/cmrc/master/CMak
|
|
|
247
259
|
"${CMAKE_BINARY_DIR}/CMakeRC.cmake")
|
|
248
260
|
include("${CMAKE_BINARY_DIR}/CMakeRC.cmake")
|
|
249
261
|
|
|
250
|
-
include_directories("${
|
|
262
|
+
include_directories("${MKF_DIR}/")
|
|
251
263
|
|
|
252
264
|
cmrc_add_resource_library(insulation_standards ALIAS data::insulation_standards NAMESPACE insulationData WHENCE ${MKF_DIR}/ ${MKF_DIR}/src/data/insulation_standards/IEC_60664-1.json ${MKF_DIR}/src/data/insulation_standards/IEC_60664-4.json ${MKF_DIR}/src/data/insulation_standards/IEC_60664-5.json ${MKF_DIR}/src/data/insulation_standards/IEC_62368-1.json ${MKF_DIR}/src/data/insulation_standards/IEC_61558-1.json ${MKF_DIR}/src/data/insulation_standards/IEC_61558-2-16.json ${MKF_DIR}/src/data/insulation_standards/IEC_60335-1.json)
|
|
253
265
|
target_link_libraries(PyOpenMagnetics PUBLIC data::insulation_standards)
|
|
@@ -276,13 +288,13 @@ include_directories("${CMAKE_BINARY_DIR}/_deps/magic-enum-src/include")
|
|
|
276
288
|
include_directories("${CMAKE_BINARY_DIR}/_deps/svg-src/src")
|
|
277
289
|
include_directories("${CMAKE_BINARY_DIR}/_deps/spline-src/src")
|
|
278
290
|
include_directories("${CMAKE_BINARY_DIR}/_deps/json-src/include/")
|
|
279
|
-
include_directories("${
|
|
280
|
-
include_directories("${
|
|
281
|
-
include_directories("${
|
|
282
|
-
include_directories("${
|
|
283
|
-
include_directories("${
|
|
284
|
-
include_directories("${
|
|
285
|
-
include_directories("${
|
|
291
|
+
include_directories("${MKF_DIR}/src/")
|
|
292
|
+
include_directories("${MKF_DIR}/src/advisers/")
|
|
293
|
+
include_directories("${MKF_DIR}/src/constructive_models/")
|
|
294
|
+
include_directories("${MKF_DIR}/src/converter_models/")
|
|
295
|
+
include_directories("${MKF_DIR}/src/physical_models/")
|
|
296
|
+
include_directories("${MKF_DIR}/src/processors/")
|
|
297
|
+
include_directories("${MKF_DIR}/src/support/")
|
|
286
298
|
include_directories("${CMAKE_BINARY_DIR}/_deps/eigen-src")
|
|
287
299
|
include_directories("${CMAKE_BINARY_DIR}/_cmrc/include")
|
|
288
300
|
include_directories("${MAS_DIRECTORY}")
|
|
@@ -169,8 +169,8 @@ def design_buck_with_converter_method():
|
|
|
169
169
|
"desiredInductance": 4.7e-6, # 4.7 µH
|
|
170
170
|
"currentRippleRatio": 0.3,
|
|
171
171
|
"operatingPoints": [{
|
|
172
|
-
"
|
|
173
|
-
"
|
|
172
|
+
"outputVoltages": [3.3],
|
|
173
|
+
"outputCurrents": [5.0],
|
|
174
174
|
"switchingFrequency": 500000, # 500 kHz
|
|
175
175
|
"ambientTemperature": 25
|
|
176
176
|
}]
|
|
@@ -3,83 +3,48 @@
|
|
|
3
3
|
namespace PyMKF {
|
|
4
4
|
|
|
5
5
|
json get_bobbins() {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return result;
|
|
15
|
-
}
|
|
16
|
-
catch (const std::exception &exc) {
|
|
17
|
-
json exception;
|
|
18
|
-
exception["data"] = "Exception: " + std::string{exc.what()};
|
|
19
|
-
return exception;
|
|
20
|
-
}
|
|
6
|
+
auto bobbins = OpenMagnetics::get_bobbins();
|
|
7
|
+
json result = json::array();
|
|
8
|
+
for (auto elem : bobbins) {
|
|
9
|
+
json aux;
|
|
10
|
+
to_json(aux, elem);
|
|
11
|
+
result.push_back(aux);
|
|
12
|
+
}
|
|
13
|
+
return result;
|
|
21
14
|
}
|
|
22
15
|
|
|
23
16
|
json get_bobbin_names() {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
result.push_back(elem);
|
|
29
|
-
}
|
|
30
|
-
return result;
|
|
31
|
-
}
|
|
32
|
-
catch (const std::exception &exc) {
|
|
33
|
-
json exception;
|
|
34
|
-
exception["data"] = "Exception: " + std::string{exc.what()};
|
|
35
|
-
return exception;
|
|
17
|
+
auto bobbinNames = OpenMagnetics::get_bobbin_names();
|
|
18
|
+
json result = json::array();
|
|
19
|
+
for (auto elem : bobbinNames) {
|
|
20
|
+
result.push_back(elem);
|
|
36
21
|
}
|
|
22
|
+
return result;
|
|
37
23
|
}
|
|
38
24
|
|
|
39
25
|
json find_bobbin_by_name(json bobbinName) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return result;
|
|
45
|
-
}
|
|
46
|
-
catch (const std::exception &exc) {
|
|
47
|
-
json exception;
|
|
48
|
-
exception["data"] = "Exception: " + std::string{exc.what()};
|
|
49
|
-
return exception;
|
|
50
|
-
}
|
|
26
|
+
auto bobbinData = OpenMagnetics::find_bobbin_by_name(bobbinName);
|
|
27
|
+
json result;
|
|
28
|
+
to_json(result, bobbinData);
|
|
29
|
+
return result;
|
|
51
30
|
}
|
|
52
31
|
|
|
53
32
|
json create_basic_bobbin(json coreDataJson, bool nullDimensions) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
auto bobbin = OpenMagnetics::Bobbin::create_quick_bobbin(core, nullDimensions);
|
|
33
|
+
OpenMagnetics::Core core(coreDataJson, false, false, false);
|
|
34
|
+
auto bobbin = OpenMagnetics::Bobbin::create_quick_bobbin(core, nullDimensions);
|
|
57
35
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
catch (const std::exception &exc) {
|
|
63
|
-
json exception;
|
|
64
|
-
exception["data"] = "Exception: " + std::string{exc.what()};
|
|
65
|
-
return exception;
|
|
66
|
-
}
|
|
36
|
+
json result;
|
|
37
|
+
to_json(result, bobbin);
|
|
38
|
+
return result;
|
|
67
39
|
}
|
|
68
40
|
|
|
69
41
|
json create_basic_bobbin_by_thickness(json coreDataJson, double thickness) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
auto bobbin = OpenMagnetics::Bobbin::create_quick_bobbin(core, thickness);
|
|
42
|
+
OpenMagnetics::Core core(coreDataJson, false, false, false);
|
|
43
|
+
auto bobbin = OpenMagnetics::Bobbin::create_quick_bobbin(core, thickness);
|
|
73
44
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
catch (const std::exception &exc) {
|
|
79
|
-
json exception;
|
|
80
|
-
exception["data"] = "Exception: " + std::string{exc.what()};
|
|
81
|
-
return exception;
|
|
82
|
-
}
|
|
45
|
+
json result;
|
|
46
|
+
to_json(result, bobbin);
|
|
47
|
+
return result;
|
|
83
48
|
}
|
|
84
49
|
|
|
85
50
|
json calculate_bobbin_data(json magneticJson) {
|
|
@@ -4,21 +4,14 @@
|
|
|
4
4
|
namespace PyMKF {
|
|
5
5
|
|
|
6
6
|
json get_core_materials() {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
result.push_back(aux);
|
|
14
|
-
}
|
|
15
|
-
return result;
|
|
16
|
-
}
|
|
17
|
-
catch (const std::exception &exc) {
|
|
18
|
-
json exception;
|
|
19
|
-
exception["data"] = "Exception: " + std::string{exc.what()};
|
|
20
|
-
return exception;
|
|
7
|
+
auto materials = OpenMagnetics::get_materials(std::nullopt);
|
|
8
|
+
json result = json::array();
|
|
9
|
+
for (auto elem: materials) {
|
|
10
|
+
json aux;
|
|
11
|
+
to_json(aux, elem);
|
|
12
|
+
result.push_back(aux);
|
|
21
13
|
}
|
|
14
|
+
return result;
|
|
22
15
|
}
|
|
23
16
|
|
|
24
17
|
double get_material_permeability(json materialName, double temperature, double magneticFieldDcBias, double frequency) {
|
|
@@ -44,188 +37,111 @@ double get_material_resistivity(json materialName, double temperature) {
|
|
|
44
37
|
}
|
|
45
38
|
|
|
46
39
|
json get_core_material_steinmetz_coefficients(json materialName, double frequency) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return result;
|
|
52
|
-
}
|
|
53
|
-
catch (const std::exception &exc) {
|
|
54
|
-
json exception;
|
|
55
|
-
exception["data"] = "Exception: " + std::string{exc.what()};
|
|
56
|
-
return exception;
|
|
57
|
-
}
|
|
40
|
+
auto steinmetzCoreLossesMethodRangeDatum = OpenMagnetics::CoreLossesModel::get_steinmetz_coefficients(materialName, frequency);
|
|
41
|
+
json result;
|
|
42
|
+
to_json(result, steinmetzCoreLossesMethodRangeDatum);
|
|
43
|
+
return result;
|
|
58
44
|
}
|
|
59
45
|
|
|
60
46
|
json get_core_shapes() {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
result.push_back(aux);
|
|
68
|
-
}
|
|
69
|
-
return result;
|
|
70
|
-
}
|
|
71
|
-
catch (const std::exception &exc) {
|
|
72
|
-
json exception;
|
|
73
|
-
exception["data"] = "Exception: " + std::string{exc.what()};
|
|
74
|
-
return exception;
|
|
47
|
+
auto shapes = OpenMagnetics::get_shapes(true);
|
|
48
|
+
json result = json::array();
|
|
49
|
+
for (auto elem : shapes) {
|
|
50
|
+
json aux;
|
|
51
|
+
to_json(aux, elem);
|
|
52
|
+
result.push_back(aux);
|
|
75
53
|
}
|
|
54
|
+
return result;
|
|
76
55
|
}
|
|
77
56
|
|
|
78
57
|
json get_core_shape_families() {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
result.push_back(aux);
|
|
90
|
-
}
|
|
58
|
+
auto shapes = OpenMagnetics::get_shapes(false);
|
|
59
|
+
std::vector<CoreShapeFamily> families;
|
|
60
|
+
json result = json::array();
|
|
61
|
+
for (auto elem : shapes) {
|
|
62
|
+
auto family = elem.get_family();
|
|
63
|
+
if (std::find(families.begin(), families.end(), family) == families.end()) {
|
|
64
|
+
families.push_back(family);
|
|
65
|
+
json aux;
|
|
66
|
+
to_json(aux, family);
|
|
67
|
+
result.push_back(aux);
|
|
91
68
|
}
|
|
92
|
-
return result;
|
|
93
|
-
}
|
|
94
|
-
catch (const std::exception &exc) {
|
|
95
|
-
json exception;
|
|
96
|
-
exception["data"] = "Exception: " + std::string{exc.what()};
|
|
97
|
-
return exception;
|
|
98
69
|
}
|
|
70
|
+
return result;
|
|
99
71
|
}
|
|
100
72
|
|
|
101
73
|
json get_core_material_names() {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
result.push_back(elem);
|
|
107
|
-
}
|
|
108
|
-
return result;
|
|
109
|
-
}
|
|
110
|
-
catch (const std::exception &exc) {
|
|
111
|
-
json exception;
|
|
112
|
-
exception["data"] = "Exception: " + std::string{exc.what()};
|
|
113
|
-
return exception;
|
|
74
|
+
auto materialNames = OpenMagnetics::get_core_material_names(std::nullopt);
|
|
75
|
+
json result = json::array();
|
|
76
|
+
for (auto elem : materialNames) {
|
|
77
|
+
result.push_back(elem);
|
|
114
78
|
}
|
|
79
|
+
return result;
|
|
115
80
|
}
|
|
116
81
|
|
|
117
82
|
json get_core_material_names_by_manufacturer(std::string manufacturerName) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
result.push_back(elem);
|
|
123
|
-
}
|
|
124
|
-
return result;
|
|
125
|
-
}
|
|
126
|
-
catch (const std::exception &exc) {
|
|
127
|
-
json exception;
|
|
128
|
-
exception["data"] = "Exception: " + std::string{exc.what()};
|
|
129
|
-
return exception;
|
|
83
|
+
auto materialNames = OpenMagnetics::get_core_material_names(manufacturerName);
|
|
84
|
+
json result = json::array();
|
|
85
|
+
for (auto elem : materialNames) {
|
|
86
|
+
result.push_back(elem);
|
|
130
87
|
}
|
|
88
|
+
return result;
|
|
131
89
|
}
|
|
132
90
|
|
|
133
91
|
json get_core_shape_names(bool includeToroidal) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
result.push_back(elem);
|
|
140
|
-
}
|
|
141
|
-
return result;
|
|
142
|
-
}
|
|
143
|
-
catch (const std::exception &exc) {
|
|
144
|
-
json exception;
|
|
145
|
-
exception["data"] = "Exception: " + std::string{exc.what()};
|
|
146
|
-
return exception;
|
|
92
|
+
OpenMagnetics::settings.set_use_toroidal_cores(includeToroidal);
|
|
93
|
+
auto shapeNames = OpenMagnetics::get_core_shape_names();
|
|
94
|
+
json result = json::array();
|
|
95
|
+
for (auto elem : shapeNames) {
|
|
96
|
+
result.push_back(elem);
|
|
147
97
|
}
|
|
98
|
+
return result;
|
|
148
99
|
}
|
|
149
100
|
|
|
150
101
|
json find_core_material_by_name(json materialName) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
return result;
|
|
156
|
-
}
|
|
157
|
-
catch (const std::exception &exc) {
|
|
158
|
-
json exception;
|
|
159
|
-
exception["data"] = "Exception: " + std::string{exc.what()};
|
|
160
|
-
return exception;
|
|
161
|
-
}
|
|
102
|
+
auto materialData = OpenMagnetics::find_core_material_by_name(materialName);
|
|
103
|
+
json result;
|
|
104
|
+
to_json(result, materialData);
|
|
105
|
+
return result;
|
|
162
106
|
}
|
|
163
107
|
|
|
164
108
|
json find_core_shape_by_name(json shapeName) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
return result;
|
|
170
|
-
}
|
|
171
|
-
catch (const std::exception &exc) {
|
|
172
|
-
json exception;
|
|
173
|
-
exception["data"] = "Exception: " + std::string{exc.what()};
|
|
174
|
-
return exception;
|
|
175
|
-
}
|
|
109
|
+
auto shapeData = OpenMagnetics::find_core_shape_by_name(shapeName);
|
|
110
|
+
json result;
|
|
111
|
+
to_json(result, shapeData);
|
|
112
|
+
return result;
|
|
176
113
|
}
|
|
177
114
|
|
|
178
115
|
json calculate_core_processed_description(json coreDataJson) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
return result;
|
|
185
|
-
}
|
|
186
|
-
catch (const std::exception &exc) {
|
|
187
|
-
json exception;
|
|
188
|
-
exception["data"] = "Exception: " + std::string{exc.what()};
|
|
189
|
-
return exception;
|
|
190
|
-
}
|
|
116
|
+
OpenMagnetics::Core core(coreDataJson, false, false, false);
|
|
117
|
+
core.process_data();
|
|
118
|
+
json result;
|
|
119
|
+
to_json(result, core.get_processed_description().value());
|
|
120
|
+
return result;
|
|
191
121
|
}
|
|
192
122
|
|
|
193
123
|
json calculate_core_geometrical_description(json coreDataJson) {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
result.push_back(aux);
|
|
202
|
-
}
|
|
203
|
-
return result;
|
|
204
|
-
}
|
|
205
|
-
catch (const std::exception &exc) {
|
|
206
|
-
json exception;
|
|
207
|
-
exception["data"] = "Exception: " + std::string{exc.what()};
|
|
208
|
-
return exception;
|
|
124
|
+
OpenMagnetics::Core core(coreDataJson, false, false, false);
|
|
125
|
+
auto geometricalDescription = core.create_geometrical_description().value();
|
|
126
|
+
json result = json::array();
|
|
127
|
+
for (auto& elem : geometricalDescription) {
|
|
128
|
+
json aux;
|
|
129
|
+
to_json(aux, elem);
|
|
130
|
+
result.push_back(aux);
|
|
209
131
|
}
|
|
132
|
+
return result;
|
|
210
133
|
}
|
|
211
134
|
|
|
212
135
|
json calculate_core_gapping(json coreDataJson) {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
result.push_back(aux);
|
|
221
|
-
}
|
|
222
|
-
return result;
|
|
223
|
-
}
|
|
224
|
-
catch (const std::exception &exc) {
|
|
225
|
-
json exception;
|
|
226
|
-
exception["data"] = "Exception: " + std::string{exc.what()};
|
|
227
|
-
return exception;
|
|
136
|
+
OpenMagnetics::Core core(coreDataJson, false, false, false);
|
|
137
|
+
core.process_gap();
|
|
138
|
+
json result = json::array();
|
|
139
|
+
for (auto& gap : core.get_functional_description().get_gapping()) {
|
|
140
|
+
json aux;
|
|
141
|
+
to_json(aux, gap);
|
|
142
|
+
result.push_back(aux);
|
|
228
143
|
}
|
|
144
|
+
return result;
|
|
229
145
|
}
|
|
230
146
|
|
|
231
147
|
json calculate_shape_data(json shapeJson) {
|
|
@@ -355,20 +271,13 @@ json get_available_cores() {
|
|
|
355
271
|
OpenMagnetics::load_cores();
|
|
356
272
|
}
|
|
357
273
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
result.push_back(aux);
|
|
364
|
-
}
|
|
365
|
-
return result;
|
|
366
|
-
}
|
|
367
|
-
catch (const std::exception &exc) {
|
|
368
|
-
json exception;
|
|
369
|
-
exception["data"] = "Exception: " + std::string{exc.what()};
|
|
370
|
-
return exception;
|
|
274
|
+
json result = json::array();
|
|
275
|
+
for (auto elem : OpenMagnetics::coreDatabase) {
|
|
276
|
+
json aux;
|
|
277
|
+
to_json(aux, elem);
|
|
278
|
+
result.push_back(aux);
|
|
371
279
|
}
|
|
280
|
+
return result;
|
|
372
281
|
}
|
|
373
282
|
|
|
374
283
|
json calculate_gap_reluctance(json coreGapData, std::string modelNameString) {
|