Conversation
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1296 +/- ##
==========================================
+ Coverage 82.59% 82.88% +0.29%
==========================================
Files 173 177 +4
Lines 27549 28449 +900
==========================================
+ Hits 22754 23580 +826
- Misses 4795 4869 +74
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
… sync The "Rearrange inverters structure" and "Add plotly resampler to motor plots" commits (merged in from jguarato/ross:feature-motor) broke most of the motors doctest/test suite: - SourceAC.get_operating_state() was left behind when InverterVF/ InverterFOC were renamed to get_current_state(); every run_direct_on_line() call and downstream results.py doctest failed with AttributeError. - InverterVF.get_phase_voltages()/get_current_state() gained a required theta_0 parameter that their own doctests never passed. - line_to_dc_bus()'s docstring documented 310.9 for line_to_dc_bus(219.9) when the function (v_line * 1.35) actually returns 296.865. - run_with_inverter_vf() now requires frequency_s positionally; our InverterVF test fixtures (added when the method still hardcoded 5000 Hz internally) didn't pass it. - plotly-resampler (new hard import in motors/results.py) was never added to requirements.txt, so a clean install can't import ross.motors at all. Also update the three renamed tutorial notebooks (tutorial_motor_part_1/2/3.ipynb): they still called run_open_loop_vf_adjustment(), the name jguarato's branch used before this same rearrange renamed it back to run_with_inverter_vf(). Full suite (pytest ross) is back to 758 passed / 9 skipped / 2 failed, matching the two failures that pre-date this branch (Rotor.run_with_motor and steady_state_index doctests).
Fix breakage introduced by the inverter rearrange + missing plotly-resampler dependency
jguarato
marked this pull request as ready for review
September 24, 2026 12:32
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces a new
MotorElementclass that enables the simulation of three-phase induction motors in ROSS analyses. The motor model is implemented using a fourth-order Runge–Kutta (RK4) numerical integration method, capturing the coupled dynamics of magnetic fluxes and electrical currents.Besides that it adds a
Rotor.run_with_motor(). That method simulates the motor, then applies the net electromagnetic torque and the actual shaft speed to the rotor's time response. It supports three drive modes:DOL: direct-on-line start. Optional grid harmonics and three-phase voltage unbalance.VFD_VF: variable-frequency drive with open-loop V/f adjustment.VFD_FOC: variable-frequency drive with closed-loop field-oriented control.What's new
ross/motors/(new subpackage)motor_element.py:MotorElementmodels the TPIM in a synchronous reference frame. It hasrun_direct_on_line(),run_with_inverter_vf()andrun_with_inverter_foc(). The time loops are compiled with numba. It also providesmotor_example().motor_drive.py: power supplies and drives:SourceAC(with harmonics and unbalance), theInverterbase class,InverterVFandInverterFOC.results.py:MotorResponseResultshasplot_torque(),plot_speed(),plot_phase_currents(),plot_phase_voltages(),plot_line_voltages()andsample_at().PhaseResultshasplot()andplot_dfft().utils.py: Clarke/Park transforms, phase/line/DC-bus conversions, a windowed DFFT and an RK4 step.motor_icon.svg: the icon drawn on the rotor plot.Rotor integration (
rotor_assembly.py)Rotor,CoAxialRotorandMultiRotoraccept onemotor_element. It is carried throughadd_elements,remove_elements,from_section,summaryand the rotor plot.run_with_motor()runs the motor model and samples electric torque, load torque and speed on the rotor time grid. It addsTe − Tlto the torsional DOF at the motor node and the speed-dependent unbalance force. It then integrates with Newmark. By default (steady_state=True) it integrates only the last third of the interval after the load is applied. The motor results are stored inresults.motor_results.K1 + K2·accel + Ktq·torque.Supporting changes
ShaftElement.Ktq(): the torque stiffness matrix, pulled out ofK()so the time integration can reuse it.K()still returns the same matrix.ross.units.format_unit(): compact unit strings for plot axis labels, such asN⋅mandrad/s.ross.utils.downsample_figure(): MinMax-LTTB downsampling (viatsdownsample) for long time-series plots.ross.utils.limit_data_range(): now also used by the DFFT plot inTimeResponseResults.Running direct method....cv(metric horsepower) was added tonew_units.txt.Docs
docs/user_guide/tutorial_motor.ipynb.references.bib: Wu (2016) and Novotny & Lipo (1996).Tests
New
ross/tests/test_motor_element.pycovers:run_with_motor: normal run, invaliddrive_mode, and a rotor with no motor.New dependency
tsdownsample(inrequirements.txt).Example
Notes for reviewers