Skip to content

Commit 115befc

Browse files
authored
Remove the unneeded DriveWithDiodeBridge class. Migrate pre-commit configs. (#172)
1 parent 8734bea commit 115befc

File tree

4 files changed

+7
-67
lines changed

4 files changed

+7
-67
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ repos:
2020
description: "Ensures that a file is either empty, or ends with one newline"
2121
entry: end-of-file-fixer
2222
types: [ text ]
23-
stages: [ commit, push, manual ]
23+
stages: [ pre-commit, pre-push, manual ]
2424
language: python
2525

2626
- id: trailing-whitespace
2727
name: trim trailing whitespace
2828
description: "Trims trailing whitespace"
2929
entry: trailing-whitespace-fixer
3030
types: [ text ]
31-
stages: [ commit ]
31+
stages: [ pre-commit ]
3232
language: python
3333

3434
# TOML

motulator/common/model/_converter.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"""
22
Continuous-time models for converters.
33
4-
A three-phase voltage-source inverter with optional DC-bus dynamics is
5-
modelled, along with a six-pulse diode bridge rectifier supplied from a stiff
6-
grid. Complex space vectors are used also for duty ratios and switching states,
4+
A three-phase voltage-source inverter with optional DC-bus dynamics is modeled,
5+
along with a six-pulse diode bridge rectifier supplied from a stiff grid.
6+
Complex space vectors are used also for duty ratios and switching states,
77
wherever applicable.
88
99
"""
@@ -134,7 +134,7 @@ def set_outputs(self, t):
134134
super().set_outputs(t)
135135
self.out.i_L = self.state.i_L.real
136136

137-
def set_inputs(self, t):
137+
def set_inputs(self, _):
138138
"""Set output variables."""
139139
self.inp.i_dc = self.out.i_L
140140
self.inp.u_dc = self.out.u_dc

motulator/drive/model/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
from motulator.common.model._converter import (
44
FrequencyConverter, VoltageSourceConverter)
55
from motulator.common.model._simulation import CarrierComparison, Simulation
6-
from motulator.drive.model._drive import (
7-
Drive, DriveWithLCFilter, DriveWithDiodeBridge)
6+
from motulator.drive.model._drive import Drive, DriveWithLCFilter
87
from motulator.drive.model._lc_filter import LCFilter
98
from motulator.drive.model._machine import InductionMachine, SynchronousMachine
109
from motulator.drive.model._mechanics import (
@@ -14,7 +13,6 @@
1413
"CarrierComparison",
1514
"Drive",
1615
"DriveWithLCFilter",
17-
"DriveWithDiodeBridge",
1816
"ExternalRotorSpeed",
1917
"FrequencyConverter",
2018
"InductionMachine",

motulator/drive/model/_drive.py

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -110,61 +110,3 @@ def post_process(self):
110110
self.mechanics.data.tau_M = self.machine.data.tau_M
111111
# Post-processing based on the inputs and the states
112112
super().post_process_with_inputs()
113-
114-
115-
# %%
116-
class DriveWithDiodeBridge(Model):
117-
"""
118-
Machine drive with a diode bridge rectifier.
119-
120-
Parameters
121-
----------
122-
diode_bridge : DiodeBridge
123-
Diode bridge model.
124-
converter : VoltageSourceConverter
125-
Converter model.
126-
machine : InductionMachine | SynchronousMachine
127-
Machine model.
128-
mechanics : ExternalRotorSpeed | StiffMechanicalSystem |\
129-
TwoMassMechanicalSystem
130-
Mechanical subsystem model.
131-
132-
"""
133-
134-
def __init__(
135-
self,
136-
diode_bridge=None,
137-
converter=None,
138-
machine=None,
139-
mechanics=None):
140-
super().__init__()
141-
self.diode_bridge = diode_bridge
142-
self.converter = converter
143-
self.machine = machine
144-
self.mechanics = mechanics
145-
self.subsystems = [
146-
self.diode_bridge, self.converter, self.machine, self.mechanics
147-
]
148-
149-
def interconnect(self, _):
150-
"""Interconnect the subsystems."""
151-
self.diode_bridge.inp.u_dc = self.converter.out.u_dc
152-
self.converter.inp.i_ext = self.diode_bridge.out.i_L
153-
self.converter.inp.i_cs = self.machine.out.i_ss
154-
self.machine.inp.u_ss = self.converter.out.u_cs
155-
self.mechanics.inp.tau_M = self.machine.out.tau_M
156-
self.machine.inp.w_M = self.mechanics.out.w_M
157-
158-
def post_process(self):
159-
"""Post-process the solution."""
160-
# Post-processing based on the states
161-
super().post_process_states()
162-
# Add the input data to the subsystems for post-processing
163-
self.diode_bridge.data.u_dc = self.converter.data.u_dc
164-
self.converter.data.i_ext = self.diode_bridge.data.i_L
165-
self.converter.data.i_cs = self.machine.data.i_ss
166-
self.machine.data.u_ss = self.converter.data.u_cs
167-
self.machine.data.w_M = self.mechanics.data.w_M
168-
self.mechanics.data.tau_M = self.machine.data.tau_M
169-
# Post-processing based on the inputs and the states
170-
super().post_process_with_inputs()

0 commit comments

Comments
 (0)