Skip to content

Power systems

Power systems: generation, transmission, and recovery of electric energy.

BallastInteraction(label, *, target, state='zs', mass='Ms', ks=1500.0, bs=520.0, k2=0.0, alpha=1.75, beta=-1.0)

Bases: Interaction

Ballast under a sleeper, a damped spring with an optional nonlinear term.

The ballast pushes the sleeper with -bs zs' - ks zs - k2 (alpha zs^2 + beta zs^3), which accelerates it divided by its mass. The nonlinear term is off for k2 = 0.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the element that holds the sleeper.

required
state str

The name of the deflection of the sleeper.

'zs'
mass str

The name of the mass of the sleeper.

'Ms'
ks Annotated[float, closed_open(0, oo)]

The stiffness of the ballast.

1500.0
bs Annotated[float, closed_open(0, oo)]

The damping of the ballast.

520.0
k2 Annotated[float, closed_open(0, oo)]

The stiffness of the nonlinear term.

0.0
alpha float

The quadratic coefficient of the nonlinear term.

1.75
beta float

The cubic coefficient of the nonlinear term.

-1.0

Examples:

>>> from skcomplex.systems.engineering.power_systems import BallastInteraction
>>> BallastInteraction('ballast', target='rail', k2=500.0).k2
500.0
Source code in src/skcomplex/systems/engineering/power_systems/_electromechanics.py
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
def __init__(
    self,
    label: str,
    *,
    target: Role,
    state: str = 'zs',
    mass: str = 'Ms',
    ks: Annotated[float, RealSet.closed_open(0, oo)] = 1500.0,
    bs: Annotated[float, RealSet.closed_open(0, oo)] = 520.0,
    k2: Annotated[float, RealSet.closed_open(0, oo)] = 0.0,
    alpha: float = 1.75,
    beta: float = -1.0,
) -> None:
    super().__init__(label)
    self.target = target
    self.state = state
    self.mass = mass
    self.ks = ks
    self.bs = bs
    self.k2 = k2
    self.alpha = alpha
    self.beta = beta

FaradayDiskSystem(I=0.0, U=0.0, omega=0.0, *, B=1.5, M=4.8, N=250.0, R1=2.3, R2=109.0, L=0.2, C=0.75, label='system', solver='auto', backend='auto')

Bases: DynamicalSystem

A battery charger driven by a Faraday disk generator.

The own current of the generator strengthens its field. A motor turns the conducting disk of radii r1 and r2 with a constant torque M in the field B of a magnet plus the field μ N I / l of a coil that the generated current flows through. With a = B (r2^2 - r1^2) / 2 and b = μ N (r2^2 - r1^2) / (2 l), the current, the polarization voltage of the battery, and the angular speed follow L I' = -R1 I - U + (a + b I) ω - E(I), C U' = I - U / R2, and J ω' = M - alpha sign(ω) - β r2 ω - (a + b I) I, where the battery voltage is E(I) = a0 + a1 I + a3 I^3 and the last term is the braking torque of the Lorentz force.

The generator charges the battery only when its voltage a ω exceeds the open-circuit voltage a0 = 8 of the battery, at ω above 35 for the default field. Below that speed the steady current is a small negative current, the battery discharges through the disk and helps the motor, and the steady speed grows linearly with the torque, as (M - alpha) / (β r2) up to the small Lorentz torque: with the defaults the current settles at -0.040 and the speed at 15.7. The coil acts as a negative resistance b ω against R1 + a1, so above ω = (R1 + a1) / b, about 32 or a torque near 9.5 for the defaults, the steady state loses its stability and the current oscillates around zero, swinging between charging and discharging, while the mean braking torque b <I²> bends the speed below the linear trend. A stronger magnet charges at the default torque: B = 4 gives a steady current of 0.013.

The system has the current charger.I, the polarization voltage charger.U, and the angular speed charger.omega.

Parameters:

Name Type Description Default
I float

The initial charging current.

0.0
U float

The initial polarization voltage of the battery.

0.0
omega float

The initial angular speed of the disk.

0.0
B float

The field of the permanent magnet.

1.5
M float

The torque of the drive motor.

4.8
N float

The number of turns of the feedback coil.

250.0
R1 float

The series resistance of the coil, the disk, and the battery.

2.3
R2 float

The polarization resistance of the battery.

109.0
L float

The inductance of the coil.

0.2
C float

The polarization capacitance of the battery.

0.75
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.engineering.power_systems import FaradayDiskSystem
>>> FaradayDiskSystem(M=6.0).prepare().system_.elements[0].values['M']
6.0
Source code in src/skcomplex/systems/engineering/power_systems/_electromechanics.py
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    I: float = 0.0,
    U: float = 0.0,
    omega: float = 0.0,
    *,
    B: float = 1.5,
    M: float = 4.8,
    N: float = 250.0,
    R1: float = 2.3,
    R2: float = 109.0,
    L: float = 0.2,
    C: float = 0.75,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label=label, solver=solver, backend=backend)
    self.I = I
    self.U = U
    self.omega = omega
    self.B = B
    self.M = M
    self.N = N
    self.R1 = R1
    self.R2 = R2
    self.L = L
    self.C = C

PowerGridSystem(n_nodes=8, *, K=2.75, power=1.0, gamma=0.1, added_line=None, doubled_line=None, label='system', solver='auto', backend='auto')

Bases: BaseSystem

A ring power grid in the swing-equation system.

More transmission capacity can break synchrony. The phase of node i relative to the grid frequency follows phi_i'' = P_i - gamma phi_i' + Σ_j K_ij sin(phi_j - phi_i). The first half of the ring are generators with P = power and the second half consumers with P = -power, joined by lines of capacity K. The default grid synchronises, but adding the line (0, 2) or doubling the capacity of the line (0, 1) makes the flows overload a line, and synchrony is lost, which is Braess's paradox. The system has the phases node_<i>.phi and frequency deviations node_<i>.phi'.

Parameters:

Name Type Description Default
n_nodes int

The number of nodes of the ring.

8
K float

The capacity of every line.

2.75
power float

The power of every generator, and its negative the power of every consumer.

1.0
gamma float

The damping.

0.1
added_line tuple[int, int] | None

A pair of nodes to join by an extra line of capacity K, or None.

None
doubled_line tuple[int, int] | None

A pair of neighbouring nodes whose line has capacity 2 K, or None.

None
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.engineering.power_systems import PowerGridSystem
>>> len(PowerGridSystem(added_line=(0, 2)).prepare().system_.interactions)
17
Source code in src/skcomplex/systems/engineering/power_systems/_grids.py
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
def __init__(
    self,
    n_nodes: int = 8,
    *,
    K: float = 2.75,
    power: float = 1.0,
    gamma: float = 0.1,
    added_line: tuple[int, int] | None = None,
    doubled_line: tuple[int, int] | None = None,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.n_nodes = n_nodes
    self.K = K
    self.power = power
    self.gamma = gamma
    self.added_line = added_line
    self.doubled_line = doubled_line

RegenerativeBrakingSystem(v=20.0, *, m=1000.0, A=1.2, L=0.01, R=0.05, C=680.0, alpha=50.0, beta=5.0, label='system', solver='auto', backend='auto')

Bases: DynamicalSystem

A car braked by a Faraday disk generator on its wheel.

The generator charges a supercapacitor.

The disk generates the voltage A v, with the structural constant A = |B| R^2 / (2 r_w) of the disk and the wheel, and drives the current through an inductor and a resistor into a supercapacitor, L I' = A v - R I - V_s and C V_s' = I. The current brakes the car with the force A I, together with dry and viscous friction, m v' = -A I - alpha sign(v) - β v, so the kinetic energy of the car ends up in the capacitor and in the losses. The system has the speed car.v, the current car.I, and the capacitor voltage car.Vs.

Parameters:

Name Type Description Default
v float

The initial speed of the car.

20.0
m float

The mass of the car.

1000.0
A float

The structural constant of the generator, the voltage per unit speed.

1.2
L float

The inductance of the charging circuit.

0.01
R float

The resistance of the charging circuit.

0.05
C float

The capacitance of the supercapacitor.

680.0
alpha float

The dry friction force.

50.0
beta float

The viscous friction coefficient.

5.0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.engineering.power_systems import RegenerativeBrakingSystem
>>> RegenerativeBrakingSystem(C=100.0).prepare().system_.elements[0].values['C']
100.0
Source code in src/skcomplex/systems/engineering/power_systems/_electromechanics.py
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
def __init__(
    self,
    v: float = 20.0,
    *,
    m: float = 1000.0,
    A: float = 1.2,
    L: float = 0.01,
    R: float = 0.05,
    C: float = 680.0,
    alpha: float = 50.0,
    beta: float = 5.0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label=label, solver=solver, backend=backend)
    self.v = v
    self.m = m
    self.A = A
    self.L = L
    self.R = R
    self.C = C
    self.alpha = alpha
    self.beta = beta

SwingInteraction(label, *, target, gamma=0.1)

Bases: Interaction

Swing equation of the phase of a node of a power grid, phi'' = P - gamma phi'.

The node holds its phase phi and its power P, positive for a generator and negative for a consumer.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the node.

required
gamma Annotated[float, closed_open(0, oo)]

The damping.

0.1

Examples:

>>> from skcomplex.systems.engineering.power_systems import SwingInteraction
>>> SwingInteraction('swing', target='node_0', gamma=0.2).gamma
0.2
Source code in src/skcomplex/systems/engineering/power_systems/_grids.py
49
50
51
52
53
54
55
56
57
58
def __init__(
    self,
    label: str,
    *,
    target: Role,
    gamma: Annotated[float, RealSet.closed_open(0, oo)] = 0.1,
) -> None:
    super().__init__(label)
    self.target = target
    self.gamma = gamma

TransmissionLineInteraction(label, *, a, b, K=1.0)

Bases: Interaction

Transmission line of a capacity that couples the phases of two nodes.

Each node gets the power flow K sin(phi_j - phi_i) from the other, so the flows of a line are opposite.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
a Role

The path of the first node the line joins.

required
b Role

The path of the second node the line joins.

required
K Annotated[float, closed_open(0, oo)]

The capacity of the line.

1.0

Examples:

>>> from skcomplex.systems.engineering.power_systems import TransmissionLineInteraction
>>> TransmissionLineInteraction('line', a='node_0', b='node_1', K=2.0).K
2.0
Source code in src/skcomplex/systems/engineering/power_systems/_grids.py
 98
 99
100
101
102
103
104
105
106
107
108
109
def __init__(
    self,
    label: str,
    *,
    a: Role,
    b: Role,
    K: Annotated[float, RealSet.closed_open(0, oo)] = 1.0,
) -> None:
    super().__init__(label)
    self.a = a
    self.b = b
    self.K = K

WheelLoadInteraction(label, *, target, state='z', mass='Mr', F=1000.0, T=10.0, width=1.0, spacing=3.0)

Bases: Interaction

Load of the two wheels of passing bogies on a rail.

Every bogie presses the rail with two rectangular pulses of force F and duration width, spacing apart, once per period T, and the load accelerates the rail divided by its mass.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the element that holds the rail.

required
state str

The name of the deflection of the rail.

'z'
mass str

The name of the mass of the rail.

'Mr'
F Annotated[float, closed_open(0, oo)]

The force of a wheel.

1000.0
T Annotated[float, open(0, oo)]

The period of the passing bogies.

10.0
width Annotated[float, open(0, oo)]

The duration of the load of one wheel.

1.0
spacing Annotated[float, closed_open(0, oo)]

The time between the two wheels of a bogie.

3.0

Examples:

>>> from skcomplex.systems.engineering.power_systems import WheelLoadInteraction
>>> WheelLoadInteraction('wheels', target='rail', F=500.0).F
500.0
Source code in src/skcomplex/systems/engineering/power_systems/_electromechanics.py
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
def __init__(
    self,
    label: str,
    *,
    target: Role,
    state: str = 'z',
    mass: str = 'Mr',
    F: Annotated[float, RealSet.closed_open(0, oo)] = 1000.0,
    T: Annotated[float, RealSet.open(0, oo)] = 10.0,
    width: Annotated[float, RealSet.open(0, oo)] = 1.0,
    spacing: Annotated[float, RealSet.closed_open(0, oo)] = 3.0,
) -> None:
    super().__init__(label)
    self.target = target
    self.state = state
    self.mass = mass
    self.F = F
    self.T = T
    self.width = width
    self.spacing = spacing

WheelRailContactSystem(*, F=1000.0, T=10.0, width=1.0, spacing=3.0, k2=0.0, Mr=60.0, Ms=156.0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

A rail segment on a sleeper, loaded by the wheels of passing bogies.

The rail and the sleeper are lumped masses joined by the pad, a spring and a damper, and the sleeper rests on the ballast, Mr z'' + br (z' - zs') + kr (z - zs) = F(t) and Ms zs'' + br (zs' - z') + bs zs' + kr (zs - z) + ks zs + k2 (alpha zs^2 + β zs^3) = 0. The load is two rectangular pulses of force F per period T, one per wheel of a bogie, spacing apart. The nonlinear ballast term, with alpha = 1.75 and β = -1, is off for k2 = 0. The system has the deflections rail.z of the rail and rail.zs of the sleeper, and their velocities rail.z' and rail.zs'.

Parameters:

Name Type Description Default
F float

The force of a wheel.

1000.0
T float

The period of the passing bogies.

10.0
width float

The duration of the load of one wheel.

1.0
spacing float

The time between the two wheels of a bogie.

3.0
k2 float

The stiffness of the nonlinear ballast term.

0.0
Mr float

The mass of the rail segment.

60.0
Ms float

The mass of the sleeper.

156.0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.engineering.power_systems import WheelRailContactSystem
>>> WheelRailContactSystem(k2=500.0).prepare().system_.interactions[1].k2
500.0
Source code in src/skcomplex/systems/engineering/power_systems/_electromechanics.py
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
def __init__(
    self,
    *,
    F: float = 1000.0,
    T: float = 10.0,
    width: float = 1.0,
    spacing: float = 3.0,
    k2: float = 0.0,
    Mr: float = 60.0,
    Ms: float = 156.0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.F = F
    self.T = T
    self.width = width
    self.spacing = spacing
    self.k2 = k2
    self.Mr = Mr
    self.Ms = Ms