Modified Chua with mixed-mode oscillations
A modified Chua circuit on three time scales.
- Class:
MixedModeChuaSystem - Import:
from skcomplex.systems.engineering.circuits import MixedModeChuaSystem - Field:
engineering/circuits - Topics:
circuit,mixed-mode oscillations,canards,slow-fast,ode - References:
- Krupa, Popović, and Kopell 2008
- Trzaska 2023
Use this system
The block imports the class and simulates the system with its default parameters and its tuned run settings.
from skcomplex.systems.engineering.circuits import MixedModeChuaSystem
trajectory = MixedModeChuaSystem().prepare().simulate()
Parameters
The model parameters take these defaults, and set_params changes them.
| Parameter | Default |
|---|---|
x |
0.01 |
y |
0.0 |
z |
0.0 |
epsilon |
0.01 |
a |
1.5 |
b |
-1.0 |
alpha |
1.0 |
R |
0.0 |
beta |
0.005 |
c |
0.00053 |
solver |
'auto' |
backend |
'auto' |
Tags
The system with its default parameters has these capability tags, which solvers and analyses check.
| Tag | Values |
|---|---|
| Time | continuous |
| Space | none |
| Laws | rate |
| Randomness | deterministic |
| Domains | real |
| Structure | fixed |
Class
The source of the class shows how it builds its components from its model parameters.
class MixedModeChuaSystem(BaseSystem):
"""A modified Chua circuit on three time scales.
Its oscillations mix small and large amplitudes. The circuit follows `ε x' = -y + (a + b x) x^2`,
`y' = alpha (x - R y - z)`, and `z' = c - β y`. For `ε = 0.01`, `a = 1.5`, `b = -1`, and `β = 0.005`, the circuit
has small oscillations only for `c = 0`, large ones only for `c = 0.00105`, and mixed-mode oscillations for
`c = 0.00053`. The system has the states `circuit.x`, `circuit.y`, and `circuit.z`.
Args:
x:
The initial voltage of the first capacitor.
y:
The initial current of the inductor.
z:
The initial voltage of the second capacitor.
epsilon:
The first capacitance, which sets the fast time scale.
a:
The quadratic coefficient of the diode.
b:
The cubic coefficient of the diode.
alpha:
The inverse inductance.
R:
The resistance.
beta:
The gain of the controlled source over the second capacitance.
c:
The offset of the controlled source.
label:
The label of the system, which names it when it is nested in another one.
solver:
The solver of the problem, or `'auto'` for the one the system chooses.
backend:
The backend that evaluates the compiled functions, or `'auto'` for the one the system chooses.
Examples:
>>> from skcomplex.systems.engineering.circuits import MixedModeChuaSystem
>>> MixedModeChuaSystem(c=0.0).prepare().system_.interactions[0].c
0.0
"""
field = 'engineering/circuits'
topics = ('circuit', 'mixed-mode oscillations', 'canards', 'slow-fast', 'ode')
references = ('Krupa, Popović, and Kopell 2008', 'Trzaska 2023')
until = 200.0
dt = 0.5
def __init__(
self,
x: float = 0.01,
y: float = 0.0,
z: float = 0.0,
*,
epsilon: float = 0.01,
a: float = 1.5,
b: float = -1.0,
alpha: float = 1.0,
R: float = 0.0,
beta: float = 0.005,
c: float = 0.00053,
label: str = 'system',
solver: BaseSolver | str = 'auto',
backend: BaseBackend | str = 'auto',
) -> None:
super().__init__(label, solver=solver, backend=backend)
self.x = x
self.y = y
self.z = z
self.epsilon = epsilon
self.a = a
self.b = b
self.alpha = alpha
self.R = R
self.beta = beta
self.c = c
def _prepare(self, context: Sequence[Observable] | None = None) -> None:
"""Set `system_` to the components of the system built from its model parameters."""
super()._prepare(context)
circuit = ChuaCircuitElement('circuit', x=self.x, y=self.y, z=self.z)
chua = MixedModeChuaInteraction(
'chua',
target='circuit',
epsilon=self.epsilon,
a=self.a,
b=self.b,
alpha=self.alpha,
R=self.R,
beta=self.beta,
c=self.c,
)
self.system_ = System(
self.label,
elements=[circuit],
interactions=[chua],
solver=ScipyODESolver(method='Radau'),
)
Components
The system uses these element and interaction classes, each with its nearest class of the core.
Elements:
ChuaCircuitElement, fromElement
Interactions:
MixedModeChuaInteraction, fromInteraction
class ChuaCircuitElement(Element):
"""Chua circuit, with the voltages `x` and `y` of its capacitors and the current `z` of its inductor.
The interactions of `ChuaSystem` and `MixedModeChuaSystem` change the three states.
Args:
label:
The label of the circuit.
x:
The initial voltage of the first capacitor.
y:
The initial voltage of the second capacitor.
z:
The initial current of the inductor.
Examples:
>>> from skcomplex.systems.engineering.circuits._circuits import ChuaCircuitElement
>>> ChuaCircuitElement('circuit', x=1.0).x
1.0
"""
def __init__(self, label: str, *, x: float = 0.1, y: float = 0.0, z: float = 0.0) -> None:
super().__init__(label)
self.x = x
self.y = y
self.z = z
class MixedModeChuaInteraction(Interaction):
"""Slow-fast Chua circuit whose oscillations mix small and large amplitudes.
The states follow `epsilon x' = -y + (a + b x) x^2`, `y' = alpha (x - R y - z)`, and `z' = c - beta y`.
Args:
label:
The label of the interaction.
target:
The path of the circuit.
epsilon:
The first capacitance, which sets the fast time scale.
a:
The quadratic coefficient of the diode.
b:
The cubic coefficient of the diode.
alpha:
The inverse inductance.
R:
The resistance.
beta:
The gain of the controlled source over the second capacitance.
c:
The offset of the controlled source.
Examples:
>>> from skcomplex.systems.engineering.circuits._circuits import MixedModeChuaInteraction
>>> MixedModeChuaInteraction('chua', target='circuit').c
0.00053
"""
law_classes: ClassVar[tuple[type[BaseLaw], ...]] = (RateLaw,)
def __init__(
self,
label: str,
*,
target: Role,
epsilon: Annotated[float, RealSet.open(0, oo)] = 0.01,
a: float = 1.5,
b: float = -1.0,
alpha: Annotated[float, RealSet.open(0, oo)] = 1.0,
R: Annotated[float, RealSet.closed_open(0, oo)] = 0.0,
beta: Annotated[float, RealSet.open(0, oo)] = 0.005,
c: float = 0.00053,
) -> None:
super().__init__(label)
self.target = target
self.epsilon = epsilon
self.a = a
self.b = b
self.alpha = alpha
self.R = R
self.beta = beta
self.c = c
def _prepare(self, context: SimpleNamespace) -> None:
"""Set the rates of the states of the circuit.
Args:
context:
The namespace of the circuit.
"""
super()._prepare(context)
s, x, y, z = context, context.target.x, context.target.y, context.target.z
self.laws_: list[BaseLaw] = [
RateLaw(x.diff(s.t), (-y + (s.a + s.b * x) * x**2) / s.epsilon),
RateLaw(y.diff(s.t), s.alpha * (x - s.R * y - z)),
RateLaw(z.diff(s.t), s.c - s.beta * y),
]
Equations
The equations are those that symbolic returns for the system with its default parameters.
circuit.x: diff(x_circuit(t), t) == ((b_chua*x_circuit(t) + a_chua)*x_circuit(t)^2 - y_circuit(t))/epsilon_chua
circuit.y: diff(y_circuit(t), t) == -(R_chua*y_circuit(t) - x_circuit(t) + z_circuit(t))*alpha_chua
circuit.z: diff(z_circuit(t), t) == -beta_chua*y_circuit(t) + c_chua