PyOpenMagnetics 1.7.22__tar.gz → 1.7.23__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.7.22 → pyopenmagnetics-1.7.23}/PKG-INFO +1 -1
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/pyproject.toml +1 -1
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/simulation.cpp +46 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/simulation.h +1 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/tests/test_datasheet_only_catalogue.py +15 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/.github/workflows/ci.yml +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/.github/workflows/publish.yml +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/.gitignore +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/AGENTS.md +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/CMakeLists.txt +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/LICENSE +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/PyOpenMagnetics.pyi +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/README.md +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/_packaging/__init__.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/_packaging/_build_info.py.in +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/api/MAS.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/api/mas_db_reader.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/api/validation.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/clear_cibuildwheel_cache.sh +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/docs/compatibility.md +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/docs/errors.md +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/docs/performance.md +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/examples/README.md +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/examples/buck_inductor.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/examples/complete_simulation_example.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/examples/converter_design_example.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/examples/debug_bobbin.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/examples/debug_coil.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/examples/debug_core.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/examples/debug_plotting.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/examples/flyback_220v_12v_1a.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/examples/flyback_220v_12v_2a_complete.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/examples/flyback_bh_curve.png +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/examples/flyback_core.png +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/examples/flyback_design.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/examples/flyback_summary.png +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/examples/flyback_waveforms.png +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/examples/list_plot_funcs.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/examples/plot_flyback_design.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/examples/plot_flyback_pyom.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/examples/test_field_calc.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/examples/test_field_plot.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/force_fresh_build.sh +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/llms.txt +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/notebooks/01_getting_started.ipynb +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/notebooks/02_buck_inductor.ipynb +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/notebooks/03_core_losses.ipynb +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/notebooks/README.md +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/requirements.txt +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/advisers.cpp +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/advisers.h +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/bobbin.cpp +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/bobbin.h +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/cmc.cpp +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/cmc.h +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/common.h +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/converter.cpp +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/converter.h +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/core.cpp +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/core.h +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/crossref.cpp +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/crossref.h +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/database.cpp +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/database.h +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/logging.cpp +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/logging.h +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/losses.cpp +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/losses.h +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/module.cpp +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/plotting.cpp +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/plotting.h +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/settings.cpp +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/settings.h +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/utils.cpp +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/utils.h +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/winding.cpp +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/winding.h +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/wire.cpp +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/src/wire.h +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/test.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/tests/__init__.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/tests/conftest.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/tests/test_converter_endpoints.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/tests/test_core.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/tests/test_core_adviser.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/tests/test_examples_integration.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/tests/test_inputs.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/tests/test_logging.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/tests/test_magnetic_adviser.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/tests/test_magnetics_catalogue_load.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/tests/test_mas_schema_walk.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/tests/test_plotting.py +0 -0
- {pyopenmagnetics-1.7.22 → pyopenmagnetics-1.7.23}/tests/test_winding.py +0 -0
|
@@ -23,6 +23,31 @@ json simulate(json inputsJson, json magneticJson, json modelsData) {
|
|
|
23
23
|
return result;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
json build_datasheet(json inputsJson, json magneticJson, json modelsData) {
|
|
27
|
+
// Simulate the magnetic at the given operating points (the same models as simulate), then let
|
|
28
|
+
// MagneticSimulator::build_datasheet read the outputs into a manufacturer-style datasheet. Returns
|
|
29
|
+
// the magnetic's manufacturerInfo with datasheetInfo filled in; its other fields are kept.
|
|
30
|
+
OpenMagnetics::Inputs inputs(inputsJson);
|
|
31
|
+
OpenMagnetics::Magnetic magnetic(magneticJson);
|
|
32
|
+
|
|
33
|
+
auto reluctanceModelName = OpenMagnetics::defaults.reluctanceModelDefault;
|
|
34
|
+
find_reluctance_model(modelsData, reluctanceModelName);
|
|
35
|
+
auto coreLossesModelName = OpenMagnetics::defaults.coreLossesModelDefault;
|
|
36
|
+
if (!modelsData.is_null() && modelsData.find("coreLosses") != modelsData.end()) {
|
|
37
|
+
OpenMagnetics::from_json(modelsData["coreLosses"], coreLossesModelName);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
OpenMagnetics::MagneticSimulator magneticSimulator;
|
|
41
|
+
magneticSimulator.set_core_losses_model_name(coreLossesModelName);
|
|
42
|
+
magneticSimulator.set_reluctance_model_name(reluctanceModelName);
|
|
43
|
+
auto mas = magneticSimulator.simulate(inputs, magnetic);
|
|
44
|
+
auto manufacturerInfo = magneticSimulator.build_datasheet(mas);
|
|
45
|
+
|
|
46
|
+
json result;
|
|
47
|
+
to_json(result, manufacturerInfo);
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
|
|
26
51
|
std::string export_magnetic_as_subcircuit(json magneticJson) {
|
|
27
52
|
// Returns the raw SPICE subcircuit netlist as a plain string. We must NOT
|
|
28
53
|
// return nlohmann::ordered_json here: pybind11_json registers a caster for
|
|
@@ -418,6 +443,27 @@ void register_simulation_bindings(py::module& m) {
|
|
|
418
443
|
)pbdoc",
|
|
419
444
|
py::call_guard<py::gil_scoped_release>());
|
|
420
445
|
|
|
446
|
+
m.def("build_datasheet", &build_datasheet,
|
|
447
|
+
R"pbdoc(
|
|
448
|
+
Build a manufacturer-style datasheet for a magnetic from MKF's own simulation.
|
|
449
|
+
|
|
450
|
+
Simulates the magnetic at the given operating points, then reads the results into
|
|
451
|
+
manufacturerInfo.datasheetInfo (MagneticSimulator::build_datasheet): inductance at the
|
|
452
|
+
first operating point, DC resistance, the heat-limited rated current (40 K rise), the
|
|
453
|
+
peak saturation current at the hottest operating point, self-resonant frequency and an
|
|
454
|
+
impedance sweep, thermal and mechanical data.
|
|
455
|
+
|
|
456
|
+
Args:
|
|
457
|
+
inputs_json: MAS Inputs: the conditions the datasheet is stated at.
|
|
458
|
+
magnetic_json: the magnetic (core and coil).
|
|
459
|
+
models_json: models to simulate with, as for simulate().
|
|
460
|
+
|
|
461
|
+
Returns:
|
|
462
|
+
The magnetic's manufacturerInfo with datasheetInfo filled in.
|
|
463
|
+
)pbdoc",
|
|
464
|
+
py::arg("inputs_json"), py::arg("magnetic_json"), py::arg("models_json"),
|
|
465
|
+
py::call_guard<py::gil_scoped_release>());
|
|
466
|
+
|
|
421
467
|
m.def("export_magnetic_as_subcircuit", &export_magnetic_as_subcircuit,
|
|
422
468
|
R"pbdoc(
|
|
423
469
|
Export a magnetic component as a SPICE-compatible subcircuit.
|
|
@@ -142,3 +142,18 @@ def test_results_can_come_back_ranked_but_unsimulated(mixed_catalogue):
|
|
|
142
142
|
built = references_of(simulated).index("BUILT")
|
|
143
143
|
assert simulated["data"][built]["mas"].get("outputs"), "the default still simulates a modelled part"
|
|
144
144
|
assert not ranked["data"][built]["mas"].get("outputs")
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def test_build_datasheet_states_what_mkf_simulates_for_a_modelled_part():
|
|
148
|
+
"""A modelled part with no datasheet gets one from MKF: the values a catalogue datasheet
|
|
149
|
+
states, computed at the given conditions, with the part's own manufacturerInfo kept."""
|
|
150
|
+
part = modelled_part("BUILT")
|
|
151
|
+
del part["manufacturerInfo"]["datasheetInfo"]
|
|
152
|
+
info = PyOpenMagnetics.build_datasheet(buck_inputs(), PyOpenMagnetics.magnetic_autocomplete(part, {}), {})
|
|
153
|
+
|
|
154
|
+
assert info["reference"] == "BUILT"
|
|
155
|
+
electrical = info["datasheetInfo"]["electrical"][0]
|
|
156
|
+
assert electrical["subtype"] == "inductor"
|
|
157
|
+
for key in ("inductance", "dcResistance", "ratedCurrents", "saturationCurrentPeak", "selfResonantFrequency"):
|
|
158
|
+
assert electrical.get(key) is not None, key
|
|
159
|
+
assert electrical["ratedCurrents"][0] > 0 and electrical["saturationCurrentPeak"] > 0
|
|
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
|
|
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
|