Skip to content

Commit

Permalink
Remove the unneeded DriveWithDiodeBridge class. Migrate pre-commit co…
Browse files Browse the repository at this point in the history
…nfigs.
  • Loading branch information
mhinkkan committed Oct 12, 2024
1 parent 8734bea commit 3a1ed3e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 67 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ 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
name: trim trailing whitespace
description: "Trims trailing whitespace"
entry: trailing-whitespace-fixer
types: [ text ]
stages: [ commit ]
stages: [ pre-commit ]
language: python

# TOML
Expand Down
8 changes: 4 additions & 4 deletions motulator/common/model/_converter.py
Original file line number Diff line number Diff line change
@@ -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.
"""
Expand Down Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions motulator/drive/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -14,7 +13,6 @@
"CarrierComparison",
"Drive",
"DriveWithLCFilter",
"DriveWithDiodeBridge",
"ExternalRotorSpeed",
"FrequencyConverter",
"InductionMachine",
Expand Down
58 changes: 0 additions & 58 deletions motulator/drive/model/_drive.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 3a1ed3e

Please sign in to comment.