diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 50be80b2..5229839c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,7 +20,7 @@ repos: description: "Ensures that a file is either empty, or ends with one newline" entry: end-of-file-fixer types: [ text ] - stages: [ commit, push, manual ] + stages: [ pre-commit, pre-push, manual ] language: python - id: trailing-whitespace @@ -28,7 +28,7 @@ repos: description: "Trims trailing whitespace" entry: trailing-whitespace-fixer types: [ text ] - stages: [ commit ] + stages: [ pre-commit ] language: python # TOML diff --git a/motulator/common/model/_converter.py b/motulator/common/model/_converter.py index eb6a6f14..c29504fd 100644 --- a/motulator/common/model/_converter.py +++ b/motulator/common/model/_converter.py @@ -1,9 +1,9 @@ """ Continuous-time models for converters. -A three-phase voltage-source inverter with optional DC-bus dynamics is -modelled, along with a six-pulse diode bridge rectifier supplied from a stiff -grid. Complex space vectors are used also for duty ratios and switching states, +A three-phase voltage-source inverter with optional DC-bus dynamics is modeled, +along with a six-pulse diode bridge rectifier supplied from a stiff grid. +Complex space vectors are used also for duty ratios and switching states, wherever applicable. """ @@ -134,7 +134,7 @@ def set_outputs(self, t): super().set_outputs(t) self.out.i_L = self.state.i_L.real - def set_inputs(self, t): + def set_inputs(self, _): """Set output variables.""" self.inp.i_dc = self.out.i_L self.inp.u_dc = self.out.u_dc diff --git a/motulator/drive/model/__init__.py b/motulator/drive/model/__init__.py index 7f1ff7ed..8b0f1859 100644 --- a/motulator/drive/model/__init__.py +++ b/motulator/drive/model/__init__.py @@ -3,8 +3,7 @@ from motulator.common.model._converter import ( FrequencyConverter, VoltageSourceConverter) from motulator.common.model._simulation import CarrierComparison, Simulation -from motulator.drive.model._drive import ( - Drive, DriveWithLCFilter, DriveWithDiodeBridge) +from motulator.drive.model._drive import Drive, DriveWithLCFilter from motulator.drive.model._lc_filter import LCFilter from motulator.drive.model._machine import InductionMachine, SynchronousMachine from motulator.drive.model._mechanics import ( @@ -14,7 +13,6 @@ "CarrierComparison", "Drive", "DriveWithLCFilter", - "DriveWithDiodeBridge", "ExternalRotorSpeed", "FrequencyConverter", "InductionMachine", diff --git a/motulator/drive/model/_drive.py b/motulator/drive/model/_drive.py index 3378871a..8a3cd9e4 100644 --- a/motulator/drive/model/_drive.py +++ b/motulator/drive/model/_drive.py @@ -110,61 +110,3 @@ def post_process(self): self.mechanics.data.tau_M = self.machine.data.tau_M # Post-processing based on the inputs and the states super().post_process_with_inputs() - - -# %% -class DriveWithDiodeBridge(Model): - """ - Machine drive with a diode bridge rectifier. - - Parameters - ---------- - diode_bridge : DiodeBridge - Diode bridge model. - converter : VoltageSourceConverter - Converter model. - machine : InductionMachine | SynchronousMachine - Machine model. - mechanics : ExternalRotorSpeed | StiffMechanicalSystem |\ - TwoMassMechanicalSystem - Mechanical subsystem model. - - """ - - def __init__( - self, - diode_bridge=None, - converter=None, - machine=None, - mechanics=None): - super().__init__() - self.diode_bridge = diode_bridge - self.converter = converter - self.machine = machine - self.mechanics = mechanics - self.subsystems = [ - self.diode_bridge, self.converter, self.machine, self.mechanics - ] - - def interconnect(self, _): - """Interconnect the subsystems.""" - self.diode_bridge.inp.u_dc = self.converter.out.u_dc - self.converter.inp.i_ext = self.diode_bridge.out.i_L - self.converter.inp.i_cs = self.machine.out.i_ss - self.machine.inp.u_ss = self.converter.out.u_cs - self.mechanics.inp.tau_M = self.machine.out.tau_M - self.machine.inp.w_M = self.mechanics.out.w_M - - def post_process(self): - """Post-process the solution.""" - # Post-processing based on the states - super().post_process_states() - # Add the input data to the subsystems for post-processing - self.diode_bridge.data.u_dc = self.converter.data.u_dc - self.converter.data.i_ext = self.diode_bridge.data.i_L - self.converter.data.i_cs = self.machine.data.i_ss - self.machine.data.u_ss = self.converter.data.u_cs - self.machine.data.w_M = self.mechanics.data.w_M - self.mechanics.data.tau_M = self.machine.data.tau_M - # Post-processing based on the inputs and the states - super().post_process_with_inputs()