PyOpenMagnetics 1.3.6__tar.gz → 1.3.8__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.
Files changed (84) hide show
  1. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/CMakeLists.txt +85 -73
  2. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/PKG-INFO +1 -1
  3. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/examples/converter_design_example.py +2 -2
  4. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/pyproject.toml +1 -1
  5. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/src/bobbin.cpp +27 -62
  6. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/src/core.cpp +80 -171
  7. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/src/losses.cpp +2 -4
  8. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/src/settings.cpp +1 -2
  9. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/tests/test_converter_endpoints.py +6 -6
  10. pyopenmagnetics-1.3.8/tests/test_plotting.py +705 -0
  11. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/.github/workflows/ci.yml +0 -0
  12. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/.github/workflows/publish.yml +0 -0
  13. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/.gitignore +0 -0
  14. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/AGENTS.md +0 -0
  15. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/LICENSE +0 -0
  16. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/PyOpenMagnetics.pyi +0 -0
  17. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/README.md +0 -0
  18. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/api/MAS.py +0 -0
  19. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/api/mas_db_reader.py +0 -0
  20. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/api/validation.py +0 -0
  21. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/clear_cibuildwheel_cache.sh +0 -0
  22. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/docs/compatibility.md +0 -0
  23. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/docs/errors.md +0 -0
  24. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/docs/performance.md +0 -0
  25. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/examples/README.md +0 -0
  26. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/examples/buck_inductor.py +0 -0
  27. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/examples/complete_simulation_example.py +0 -0
  28. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/examples/debug_bobbin.py +0 -0
  29. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/examples/debug_coil.py +0 -0
  30. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/examples/debug_core.py +0 -0
  31. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/examples/debug_plotting.py +0 -0
  32. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/examples/flyback_220v_12v_1a.py +0 -0
  33. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/examples/flyback_220v_12v_2a_complete.py +0 -0
  34. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/examples/flyback_bh_curve.png +0 -0
  35. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/examples/flyback_core.png +0 -0
  36. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/examples/flyback_design.py +0 -0
  37. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/examples/flyback_summary.png +0 -0
  38. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/examples/flyback_waveforms.png +0 -0
  39. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/examples/list_plot_funcs.py +0 -0
  40. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/examples/plot_flyback_design.py +0 -0
  41. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/examples/plot_flyback_pyom.py +0 -0
  42. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/examples/test_field_calc.py +0 -0
  43. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/examples/test_field_plot.py +0 -0
  44. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/force_fresh_build.sh +0 -0
  45. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/llms.txt +0 -0
  46. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/notebooks/01_getting_started.ipynb +0 -0
  47. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/notebooks/02_buck_inductor.ipynb +0 -0
  48. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/notebooks/03_core_losses.ipynb +0 -0
  49. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/notebooks/README.md +0 -0
  50. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/requirements.txt +0 -0
  51. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/src/advisers.cpp +0 -0
  52. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/src/advisers.h +0 -0
  53. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/src/bobbin.h +0 -0
  54. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/src/common.h +0 -0
  55. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/src/converter.cpp +0 -0
  56. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/src/converter.h +0 -0
  57. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/src/core.h +0 -0
  58. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/src/database.cpp +0 -0
  59. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/src/database.h +0 -0
  60. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/src/logging.cpp +0 -0
  61. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/src/logging.h +0 -0
  62. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/src/losses.h +0 -0
  63. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/src/module.cpp +0 -0
  64. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/src/plotting.cpp +0 -0
  65. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/src/plotting.h +0 -0
  66. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/src/settings.h +0 -0
  67. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/src/simulation.cpp +0 -0
  68. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/src/simulation.h +0 -0
  69. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/src/utils.cpp +0 -0
  70. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/src/utils.h +0 -0
  71. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/src/winding.cpp +0 -0
  72. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/src/winding.h +0 -0
  73. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/src/wire.cpp +0 -0
  74. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/src/wire.h +0 -0
  75. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/test.py +0 -0
  76. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/tests/__init__.py +0 -0
  77. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/tests/conftest.py +0 -0
  78. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/tests/test_core.py +0 -0
  79. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/tests/test_core_adviser.py +0 -0
  80. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/tests/test_examples_integration.py +0 -0
  81. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/tests/test_inputs.py +0 -0
  82. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/tests/test_logging.py +0 -0
  83. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/tests/test_magnetic_adviser.py +0 -0
  84. {pyopenmagnetics-1.3.6 → pyopenmagnetics-1.3.8}/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 TRUE)
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
- SET(MAS_DIR "${CMAKE_BINARY_DIR}/_deps/mas-src")
41
- SET(MKF_DIR "${CMAKE_BINARY_DIR}/_deps/mkf-src")
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
- message(STATUS "Fetching MKF")
114
- # Force fresh clone by using a unique timestamp - update this when MKF changes
115
- set(MKF_FORCE_REFRESH "2025-02-26-01")
116
- # Tell MKF to disable matplotplusplus and use SVG-based Painter instead
117
- set(INCLUDE_PYMKF ON CACHE BOOL "Build Python interface" FORCE)
118
- FetchContent_Declare(MKF
119
- GIT_REPOSITORY https://github.com/OpenMagnetics/MKF.git
120
- GIT_TAG main
121
- GIT_PROGRESS TRUE
122
- GIT_SHALLOW TRUE)
123
-
124
- message(STATUS "Fetching mas")
125
- # Skip Git LFS to avoid bandwidth quota issues - data files are optional for build
126
- set(ENV{GIT_LFS_SKIP_SMUDGE} "1")
127
- # Force fresh clone by using a unique timestamp - update this when MAS changes
128
- set(MAS_FORCE_REFRESH "2025-02-26-01")
129
- FetchContent_Declare(
130
- mas
131
- GIT_REPOSITORY https://github.com/OpenMagnetics/MAS.git
132
- GIT_TAG main
133
- GIT_SHALLOW TRUE)
134
-
135
- message(STATUS "Fetching Properties mas")
136
- FetchContent_GetProperties(mas)
137
- message(STATUS "Fetching Properties MKF")
138
- FetchContent_GetProperties(MKF)
139
- message(STATUS "MAS_POPULATED: ${MAS_POPULATED}")
140
- message(STATUS "MKF_POPULATED: ${MKF_POPULATED}")
141
-
142
- # Always delete and repopulate MAS to ensure we get the latest
143
- if(EXISTS ${CMAKE_BINARY_DIR}/_deps/mas-src)
144
- message(STATUS "Removing old MAS source to force fresh clone")
145
- file(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/_deps/mas-src)
146
- endif()
147
- message(STATUS "Populating MAS")
148
- FetchContent_Populate(mas)
149
- # Show git log to verify version
150
- execute_process(
151
- COMMAND git -C ${mas_SOURCE_DIR} log --oneline -1
152
- OUTPUT_VARIABLE MAS_GIT_LOG
153
- OUTPUT_STRIP_TRAILING_WHITESPACE
154
- ERROR_VARIABLE MAS_GIT_ERROR
155
- )
156
- message(STATUS "MAS version: ${MAS_GIT_LOG}")
157
- if(MAS_GIT_ERROR)
158
- message(STATUS "MAS git error: ${MAS_GIT_ERROR}")
159
- endif()
160
-
161
- if(NOT MKF_POPULATED)
162
- message(STATUS "Populating MKF")
163
- FetchContent_Populate(MKF)
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 "MKF already populated at: ${MKF_SOURCE_DIR}")
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
- ${CMAKE_BINARY_DIR}/_deps/mkf-src/src/*.cpp
231
- ${CMAKE_BINARY_DIR}/_deps/mkf-src/src/advisers/*.cpp
232
- ${CMAKE_BINARY_DIR}/_deps/mkf-src/src/constructive_models/*.cpp
233
- ${CMAKE_BINARY_DIR}/_deps/mkf-src/src/converter_models/*.cpp
234
- ${CMAKE_BINARY_DIR}/_deps/mkf-src/src/physical_models/*.cpp
235
- ${CMAKE_BINARY_DIR}/_deps/mkf-src/src/processors/*.cpp
236
- ${CMAKE_BINARY_DIR}/_deps/mkf-src/src/support/*.cpp
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("${CMAKE_BINARY_DIR}/_deps/mkf-src/")
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("${CMAKE_BINARY_DIR}/_deps/mkf-src/src/")
280
- include_directories("${CMAKE_BINARY_DIR}/_deps/mkf-src/src/advisers/")
281
- include_directories("${CMAKE_BINARY_DIR}/_deps/mkf-src/src/constructive_models/")
282
- include_directories("${CMAKE_BINARY_DIR}/_deps/mkf-src/src/converter_models/")
283
- include_directories("${CMAKE_BINARY_DIR}/_deps/mkf-src/src/physical_models/")
284
- include_directories("${CMAKE_BINARY_DIR}/_deps/mkf-src/src/processors/")
285
- include_directories("${CMAKE_BINARY_DIR}/_deps/mkf-src/src/support/")
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}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: PyOpenMagnetics
3
- Version: 1.3.6
3
+ Version: 1.3.8
4
4
  Summary: Python wrapper for OpenMagnetics
5
5
  Author-Email: Alfonso Martinez <Alfonso_VII@hotmail.com>
6
6
  Classifier: Development Status :: 4 - Beta
@@ -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
- "outputVoltage": 3.3,
173
- "outputCurrent": 5.0,
172
+ "outputVoltages": [3.3],
173
+ "outputCurrents": [5.0],
174
174
  "switchingFrequency": 500000, # 500 kHz
175
175
  "ambientTemperature": 25
176
176
  }]
@@ -4,7 +4,7 @@ build-backend = "scikit_build_core.build"
4
4
 
5
5
  [project]
6
6
  name = "PyOpenMagnetics"
7
- version = "1.3.6"
7
+ version = "1.3.8"
8
8
  requires-python = ">=3.8"
9
9
  authors = [
10
10
  { name="Alfonso Martinez", email="Alfonso_VII@hotmail.com" },
@@ -3,83 +3,48 @@
3
3
  namespace PyMKF {
4
4
 
5
5
  json get_bobbins() {
6
- try {
7
- auto bobbins = OpenMagnetics::get_bobbins();
8
- json result = json::array();
9
- for (auto elem : bobbins) {
10
- json aux;
11
- to_json(aux, elem);
12
- result.push_back(aux);
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
- try {
25
- auto bobbinNames = OpenMagnetics::get_bobbin_names();
26
- json result = json::array();
27
- for (auto elem : bobbinNames) {
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
- try {
41
- auto bobbinData = OpenMagnetics::find_bobbin_by_name(bobbinName);
42
- json result;
43
- to_json(result, bobbinData);
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
- try {
55
- OpenMagnetics::Core core(coreDataJson, false, false, false);
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
- json result;
59
- to_json(result, bobbin);
60
- return result;
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
- try {
71
- OpenMagnetics::Core core(coreDataJson, false, false, false);
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
- json result;
75
- to_json(result, bobbin);
76
- return result;
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
- try {
8
- auto materials = OpenMagnetics::get_materials(std::nullopt);
9
- json result = json::array();
10
- for (auto elem: materials) {
11
- json aux;
12
- to_json(aux, elem);
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
- try {
48
- auto steinmetzCoreLossesMethodRangeDatum = OpenMagnetics::CoreLossesModel::get_steinmetz_coefficients(materialName, frequency);
49
- json result;
50
- to_json(result, steinmetzCoreLossesMethodRangeDatum);
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
- try {
62
- auto shapes = OpenMagnetics::get_shapes(true);
63
- json result = json::array();
64
- for (auto elem : shapes) {
65
- json aux;
66
- to_json(aux, elem);
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
- try {
80
- auto shapes = OpenMagnetics::get_shapes(false);
81
- std::vector<CoreShapeFamily> families;
82
- json result = json::array();
83
- for (auto elem : shapes) {
84
- auto family = elem.get_family();
85
- if (std::find(families.begin(), families.end(), family) == families.end()) {
86
- families.push_back(family);
87
- json aux;
88
- to_json(aux, family);
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
- try {
103
- auto materialNames = OpenMagnetics::get_core_material_names(std::nullopt);
104
- json result = json::array();
105
- for (auto elem : materialNames) {
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
- try {
119
- auto materialNames = OpenMagnetics::get_core_material_names(manufacturerName);
120
- json result = json::array();
121
- for (auto elem : materialNames) {
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
- try {
135
- OpenMagnetics::settings.set_use_toroidal_cores(includeToroidal);
136
- auto shapeNames = OpenMagnetics::get_core_shape_names();
137
- json result = json::array();
138
- for (auto elem : shapeNames) {
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
- try {
152
- auto materialData = OpenMagnetics::find_core_material_by_name(materialName);
153
- json result;
154
- to_json(result, materialData);
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
- try {
166
- auto shapeData = OpenMagnetics::find_core_shape_by_name(shapeName);
167
- json result;
168
- to_json(result, shapeData);
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
- try {
180
- OpenMagnetics::Core core(coreDataJson, false, false, false);
181
- core.process_data();
182
- json result;
183
- to_json(result, core.get_processed_description().value());
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
- try {
195
- OpenMagnetics::Core core(coreDataJson, false, false, false);
196
- auto geometricalDescription = core.create_geometrical_description().value();
197
- json result = json::array();
198
- for (auto& elem : geometricalDescription) {
199
- json aux;
200
- to_json(aux, elem);
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
- try {
214
- OpenMagnetics::Core core(coreDataJson, false, false, false);
215
- core.process_gap();
216
- json result = json::array();
217
- for (auto& gap : core.get_functional_description().get_gapping()) {
218
- json aux;
219
- to_json(aux, gap);
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
- try {
359
- json result = json::array();
360
- for (auto elem : OpenMagnetics::coreDatabase) {
361
- json aux;
362
- to_json(aux, elem);
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) {