PyOpenMagnetics 1.4.4__tar.gz → 1.4.6__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.4.4 → pyopenmagnetics-1.4.6}/PKG-INFO +1 -1
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/PyOpenMagnetics.pyi +16 -5
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/llms.txt +4 -2
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/pyproject.toml +1 -1
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/src/core.cpp +48 -4
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/src/core.h +2 -1
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/src/utils.cpp +10 -6
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/src/utils.h +1 -1
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/.github/workflows/ci.yml +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/.github/workflows/publish.yml +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/.gitignore +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/AGENTS.md +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/CMakeLists.txt +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/LICENSE +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/README.md +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/__init__.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/api/MAS.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/api/mas_db_reader.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/api/validation.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/clear_cibuildwheel_cache.sh +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/docs/compatibility.md +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/docs/errors.md +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/docs/performance.md +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/examples/README.md +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/examples/buck_inductor.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/examples/complete_simulation_example.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/examples/converter_design_example.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/examples/debug_bobbin.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/examples/debug_coil.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/examples/debug_core.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/examples/debug_plotting.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/examples/flyback_220v_12v_1a.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/examples/flyback_220v_12v_2a_complete.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/examples/flyback_bh_curve.png +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/examples/flyback_core.png +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/examples/flyback_design.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/examples/flyback_summary.png +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/examples/flyback_waveforms.png +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/examples/list_plot_funcs.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/examples/plot_flyback_design.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/examples/plot_flyback_pyom.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/examples/test_field_calc.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/examples/test_field_plot.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/force_fresh_build.sh +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/notebooks/01_getting_started.ipynb +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/notebooks/02_buck_inductor.ipynb +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/notebooks/03_core_losses.ipynb +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/notebooks/README.md +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/requirements.txt +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/src/advisers.cpp +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/src/advisers.h +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/src/bobbin.cpp +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/src/bobbin.h +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/src/common.h +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/src/converter.cpp +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/src/converter.h +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/src/database.cpp +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/src/database.h +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/src/logging.cpp +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/src/logging.h +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/src/losses.cpp +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/src/losses.h +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/src/module.cpp +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/src/plotting.cpp +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/src/plotting.h +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/src/settings.cpp +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/src/settings.h +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/src/simulation.cpp +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/src/simulation.h +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/src/winding.cpp +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/src/winding.h +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/src/wire.cpp +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/src/wire.h +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/test.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/tests/__init__.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/tests/conftest.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/tests/test_converter_endpoints.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/tests/test_core.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/tests/test_core_adviser.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/tests/test_examples_integration.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/tests/test_inputs.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/tests/test_logging.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/tests/test_magnetic_adviser.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/tests/test_plotting.py +0 -0
- {pyopenmagnetics-1.4.4 → pyopenmagnetics-1.4.6}/tests/test_winding.py +0 -0
|
@@ -84,7 +84,7 @@ by reading AGENTS.md before starting.
|
|
|
84
84
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
85
85
|
"""
|
|
86
86
|
|
|
87
|
-
from typing import Dict, List, Any, Optional, Union, Literal
|
|
87
|
+
from typing import Dict, List, Any, Optional, Union, Literal, overload
|
|
88
88
|
|
|
89
89
|
# Type aliases for JSON-like structures
|
|
90
90
|
JsonDict = Dict[str, Any]
|
|
@@ -373,12 +373,23 @@ def calculate_inductance_from_number_turns_and_gapping(
|
|
|
373
373
|
"""
|
|
374
374
|
...
|
|
375
375
|
|
|
376
|
+
@overload
|
|
376
377
|
def calculate_number_turns_from_gapping_and_inductance(
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
378
|
+
core_data: Core,
|
|
379
|
+
coil_data: Coil,
|
|
380
|
+
inputs_data: Inputs,
|
|
381
|
+
models_data: ModelsDict
|
|
382
|
+
) -> int:
|
|
383
|
+
"""Calculate required turns for target inductance with given gap (coil-aware, preferred)."""
|
|
384
|
+
...
|
|
385
|
+
|
|
386
|
+
@overload
|
|
387
|
+
def calculate_number_turns_from_gapping_and_inductance(
|
|
388
|
+
core_data: Core,
|
|
389
|
+
inputs_data: Inputs,
|
|
390
|
+
models_data: ModelsDict
|
|
380
391
|
) -> int:
|
|
381
|
-
"""
|
|
392
|
+
"""Legacy 3-argument form (no coil_data); synthesizes a single-primary-winding coil. Prefer the coil-aware overload."""
|
|
382
393
|
...
|
|
383
394
|
|
|
384
395
|
def calculate_gapping_from_number_turns_and_inductance(
|
|
@@ -230,10 +230,12 @@ L = PyOpenMagnetics.calculate_inductance_from_number_turns_and_gapping(
|
|
|
230
230
|
core, coil, operating_point, models
|
|
231
231
|
)
|
|
232
232
|
|
|
233
|
-
# Calculate turns from inductance and gap
|
|
233
|
+
# Calculate turns from inductance and gap (coil-aware, preferred)
|
|
234
234
|
N = PyOpenMagnetics.calculate_number_turns_from_gapping_and_inductance(
|
|
235
|
-
core, inputs, models
|
|
235
|
+
core, coil, inputs, models
|
|
236
236
|
)
|
|
237
|
+
# Legacy 3-argument form (no coil) is still accepted for backward compatibility:
|
|
238
|
+
# N = PyOpenMagnetics.calculate_number_turns_from_gapping_and_inductance(core, inputs, models)
|
|
237
239
|
|
|
238
240
|
# Calculate gap from turns and inductance
|
|
239
241
|
core_with_gap = PyOpenMagnetics.calculate_gapping_from_number_turns_and_inductance(
|
|
@@ -322,12 +322,34 @@ double calculate_inductance_from_number_turns_and_gapping(json coreData, json co
|
|
|
322
322
|
return magnetizingInductance;
|
|
323
323
|
}
|
|
324
324
|
|
|
325
|
-
double calculate_number_turns_from_gapping_and_inductance(json coreData, json inputsData, json modelsData) {
|
|
325
|
+
double calculate_number_turns_from_gapping_and_inductance(json coreData, json coilData, json inputsData, json modelsData) {
|
|
326
326
|
OpenMagnetics::Core core(coreData);
|
|
327
|
+
OpenMagnetics::Coil coil(coilData);
|
|
327
328
|
OpenMagnetics::Inputs inputs(inputsData);
|
|
328
329
|
|
|
329
330
|
std::map<std::string, std::string> models = modelsData.get<std::map<std::string, std::string>>();
|
|
330
|
-
|
|
331
|
+
|
|
332
|
+
auto reluctanceModelName = OpenMagnetics::defaults.reluctanceModelDefault;
|
|
333
|
+
if (models.find("reluctance") != models.end()) {
|
|
334
|
+
OpenMagnetics::from_json(models["reluctance"], reluctanceModelName);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
OpenMagnetics::MagnetizingInductance magnetizingInductanceObj(reluctanceModelName);
|
|
338
|
+
double numberTurns = magnetizingInductanceObj.calculate_number_turns_from_gapping_and_inductance(core, coil, &inputs);
|
|
339
|
+
|
|
340
|
+
return numberTurns;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// Legacy 3-argument variant (no coil_data). Backward-compat shim for callers
|
|
344
|
+
// written before the coil parameter was added; forwards to MKF's 3-argument
|
|
345
|
+
// overload, which synthesizes a single-primary-winding coil internally. New
|
|
346
|
+
// code should pass coil_data and use the 4-argument form above.
|
|
347
|
+
double calculate_number_turns_from_gapping_and_inductance_legacy(json coreData, json inputsData, json modelsData) {
|
|
348
|
+
OpenMagnetics::Core core(coreData);
|
|
349
|
+
OpenMagnetics::Inputs inputs(inputsData);
|
|
350
|
+
|
|
351
|
+
std::map<std::string, std::string> models = modelsData.get<std::map<std::string, std::string>>();
|
|
352
|
+
|
|
331
353
|
auto reluctanceModelName = OpenMagnetics::defaults.reluctanceModelDefault;
|
|
332
354
|
if (models.find("reluctance") != models.end()) {
|
|
333
355
|
OpenMagnetics::from_json(models["reluctance"], reluctanceModelName);
|
|
@@ -960,14 +982,36 @@ void register_core_bindings(py::module& m) {
|
|
|
960
982
|
|
|
961
983
|
Args:
|
|
962
984
|
core_data: JSON object with core specification.
|
|
985
|
+
coil_data: JSON object with coil/winding specification.
|
|
963
986
|
inputs_data: JSON Inputs with magnetizingInductance requirement.
|
|
964
987
|
models_data: JSON dict with "reluctance" model selection.
|
|
965
|
-
|
|
988
|
+
|
|
989
|
+
Returns:
|
|
990
|
+
Required number of turns (may be non-integer).
|
|
991
|
+
)pbdoc",
|
|
992
|
+
py::arg("core_data"), py::arg("coil_data"), py::arg("inputs_data"), py::arg("models_data"));
|
|
993
|
+
|
|
994
|
+
// Legacy 3-argument overload (no coil_data) registered under the SAME name:
|
|
995
|
+
// pybind dispatches by arity, so existing 3-arg callers keep working while
|
|
996
|
+
// new code uses the coil-aware 4-arg form above (the canonical default).
|
|
997
|
+
m.def("calculate_number_turns_from_gapping_and_inductance", &calculate_number_turns_from_gapping_and_inductance_legacy,
|
|
998
|
+
R"pbdoc(
|
|
999
|
+
Legacy variant of calculate_number_turns_from_gapping_and_inductance
|
|
1000
|
+
without coil_data (kept for backward compatibility).
|
|
1001
|
+
|
|
1002
|
+
Synthesizes a single-primary-winding coil internally. Prefer the
|
|
1003
|
+
coil-aware 4-argument form for multi-winding designs.
|
|
1004
|
+
|
|
1005
|
+
Args:
|
|
1006
|
+
core_data: JSON object with core specification.
|
|
1007
|
+
inputs_data: JSON Inputs with magnetizingInductance requirement.
|
|
1008
|
+
models_data: JSON dict with "reluctance" model selection.
|
|
1009
|
+
|
|
966
1010
|
Returns:
|
|
967
1011
|
Required number of turns (may be non-integer).
|
|
968
1012
|
)pbdoc",
|
|
969
1013
|
py::arg("core_data"), py::arg("inputs_data"), py::arg("models_data"));
|
|
970
|
-
|
|
1014
|
+
|
|
971
1015
|
m.def("calculate_gapping_from_number_turns_and_inductance", &calculate_gapping_from_number_turns_and_inductance,
|
|
972
1016
|
R"pbdoc(
|
|
973
1017
|
Calculate required gap from turns count and target inductance.
|
|
@@ -43,7 +43,8 @@ double calculate_temperature_from_core_thermal_resistance(json coreJson, double
|
|
|
43
43
|
json calculate_gap_reluctance(json coreGapData, std::string modelNameString);
|
|
44
44
|
json get_gap_reluctance_model_information();
|
|
45
45
|
double calculate_inductance_from_number_turns_and_gapping(json coreData, json coilData, json operatingPointData, json modelsData);
|
|
46
|
-
double calculate_number_turns_from_gapping_and_inductance(json coreData, json inputsData, json modelsData);
|
|
46
|
+
double calculate_number_turns_from_gapping_and_inductance(json coreData, json coilData, json inputsData, json modelsData);
|
|
47
|
+
double calculate_number_turns_from_gapping_and_inductance_legacy(json coreData, json inputsData, json modelsData);
|
|
47
48
|
json calculate_gapping_from_number_turns_and_inductance(json coreData, json coilData, json inputsData, std::string gappingTypeJson, int decimals, json modelsData);
|
|
48
49
|
|
|
49
50
|
// Shape queries by family/manufacturer
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
namespace PyMKF {
|
|
4
4
|
|
|
5
|
-
double resolve_dimension_with_tolerance(json dimensionWithToleranceJson) {
|
|
5
|
+
double resolve_dimension_with_tolerance(json dimensionWithToleranceJson, std::string preferredValue) {
|
|
6
6
|
DimensionWithTolerance dimensionWithTolerance(dimensionWithToleranceJson);
|
|
7
|
-
|
|
7
|
+
OpenMagnetics::DimensionalValues preferred = json(preferredValue).get<OpenMagnetics::DimensionalValues>();
|
|
8
|
+
return OpenMagnetics::resolve_dimensional_values(dimensionWithTolerance, preferred);
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
json calculate_basic_processed_data(json waveformJson) {
|
|
@@ -347,16 +348,19 @@ void register_utils_bindings(py::module& m) {
|
|
|
347
348
|
m.def("resolve_dimension_with_tolerance", &resolve_dimension_with_tolerance,
|
|
348
349
|
R"pbdoc(
|
|
349
350
|
Resolve a dimension specification that may include tolerances.
|
|
350
|
-
|
|
351
|
+
|
|
351
352
|
Extracts a single value from dimension data that may contain
|
|
352
353
|
nominal, minimum, and maximum values.
|
|
353
|
-
|
|
354
|
+
|
|
354
355
|
Args:
|
|
355
356
|
dimension_json: JSON object with dimension specification.
|
|
356
|
-
|
|
357
|
+
preferred: Which value to prefer when present — "Nominal" (default),
|
|
358
|
+
"Maximum", or "Minimum".
|
|
359
|
+
|
|
357
360
|
Returns:
|
|
358
361
|
Resolved dimension value as float.
|
|
359
|
-
)pbdoc"
|
|
362
|
+
)pbdoc",
|
|
363
|
+
py::arg("dimensionWithToleranceJson"), py::arg("preferredValue") = "Nominal");
|
|
360
364
|
|
|
361
365
|
m.def("calculate_basic_processed_data", &calculate_basic_processed_data,
|
|
362
366
|
R"pbdoc(
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
namespace PyMKF {
|
|
5
5
|
|
|
6
6
|
// Utility functions for processing and calculations
|
|
7
|
-
double resolve_dimension_with_tolerance(json dimensionWithToleranceJson);
|
|
7
|
+
double resolve_dimension_with_tolerance(json dimensionWithToleranceJson, std::string preferredValue = "Nominal");
|
|
8
8
|
json calculate_basic_processed_data(json waveformJson);
|
|
9
9
|
json calculate_harmonics(json waveformJson, double frequency);
|
|
10
10
|
json calculate_sampled_waveform(json waveformJson, double frequency);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|