hybrid_system
Hybrid system core types.
FlowFunction
Bases: Protocol
Continuous dynamics callback.
EventSurfaceFunction
Bases: Protocol
Scalar event-surface callback.
ResetFunction
Bases: Protocol
State reset callback.
CrossingDirection
Bases: IntEnum
Direction in which an event surface must cross zero.
ContinuousDynamics(flow, label=None)
dataclass
Reusable continuous dynamics definition.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
flow
|
Callable[..., Derivative]
|
Dynamics function returning the state derivative. Scalar derivative returns are accepted only for single-state systems, both during solver evaluation and when derivatives are captured on the returned trace grid. |
required |
label
|
str | None
|
Optional display label. |
None
|
Location(dynamics, *, label=None, parameters=None)
dataclass
Location(
dynamics: ContinuousDynamics,
*,
label: str | None = None,
parameters: Parameters | None = None,
)
Location(
dynamics: Callable[..., Derivative],
*,
label: str | None = None,
parameters: Parameters | None = None,
)
Discrete hybrid-automaton location.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dynamics
|
ContinuousDynamics | Callable[..., Derivative]
|
Continuous dynamics or bare flow callback active here. |
required |
label
|
str | None
|
Optional display label. |
None
|
parameters
|
Parameters | None
|
Location-local parameter map. |
None
|
Source code in src/flowcean/ode/hybrid_system.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
EventSurface(fn, direction=CrossingDirection.EITHER, label=None)
dataclass
Scalar event surface defining a simulated transition event.
Flowcean transitions fire when fn reaches zero in direction.
This is event-surface semantics, not Boolean guard-region semantics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[..., float]
|
Root function; transitions when it crosses zero. |
required |
direction
|
CrossingDirection
|
Crossing direction. Defaults to either direction. |
EITHER
|
label
|
str | None
|
Optional display label. |
None
|
Reset(fn, label=None)
dataclass
State reset applied on a transition.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[..., State]
|
Reset function applied at the event time. |
required |
label
|
str | None
|
Optional display label. |
None
|
Transition(source, target, event, reset=None)
dataclass
Discrete event-triggered transition between locations.
event is a scalar zero-crossing surface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Location
|
Source location. |
required |
target
|
Location
|
Target location. |
required |
event
|
EventSurface | Callable[..., float]
|
Event surface that triggers the transition. |
required |
reset
|
Reset | Callable[..., State] | None
|
Optional reset applied upon transition. |
None
|
Source code in src/flowcean/ode/hybrid_system.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | |
HybridSystem(locations, transitions, initial_location, initial_state, parameters=dict())
dataclass
Hybrid system with locations and transitions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
locations
|
Sequence[Location]
|
Location objects in this system. |
required |
transitions
|
Sequence[Transition]
|
Transition list defining event surfaces and resets. |
required |
initial_location
|
Location
|
Starting location object. |
required |
initial_state
|
State
|
Initial state vector. |
required |
parameters
|
Parameters
|
Global parameter map passed to callbacks. |
dict()
|
transitions_from(location)
Return transitions leaving the given location.
Source code in src/flowcean/ode/hybrid_system.py
292 293 294 295 296 297 298 | |
Event(time, source_location, target_location, event_surface, reset, state)
dataclass
Transition event information for a trace.
Trace(t, x, location, events, u=None, dx=None)
dataclass
Simulation trace with time, state, and location labels.
as_dict()
Return a dictionary view of the trace.
Source code in src/flowcean/ode/hybrid_system.py
365 366 367 368 369 370 371 372 373 374 | |
display_label(obj)
Return the human-readable label for a hybrid-system object.
Source code in src/flowcean/ode/hybrid_system.py
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | |