visualdynamics.core.state_space¶
state_space
¶
A shape set at a channel table's channels, as a modal state-space model.
The model answers forces at the table's reference rows with every row of the table, in table order:
ẋ = A x + B u
y = C x + D u
Each mode r of the set gives two states, its modal displacement and
velocity, [q_r, q̇_r], in a 2×2 block of A:
A_r = [[0, 1], [-ω_r², -2 ζ_r ω_r]] B_r = [0; φ_in,r / m_r]
with ω_r the mode's frequency in rad/s, ζ_r its damping and m_r its modal mass. A response row reads the modes at its DOF, φ_out, as its channel type asks:
displacement C = [φ_out, 0] D = 0
velocity C = [0, φ_out] D = 0
acceleration C = [-ω_r² φ_out, -2 ζ_r ω_r φ_out]
D = Σ_r φ_out φ_in / m_r
so C (iωI − A)⁻¹ B + D is the set's own synthesized FRF
(ShapeSet.synthesize_frf) at the same DOFs. A reference row reads its
own input: its C row is zero and its D row is that input's unit vector,
as a force gauge reads the force applied.
Two changes are made to the set as it stands, and the model says how many modes each touched:
- Every mode at or above
maximum_frequencyis dropped, its states and its share of D both. A controller that integrates the model at its sample rate and keeps every n-th sample, as Rattlesnake's state-space hardware does, has no filter before that decimation, so a mode above the Nyquist frequency aliases into the band. - Every mode below
rigid_frequencyis moved up to it, keeping its damping. A rigid-body mode at 0 Hz is a double integrator, and its displacement state drifts without bound through a long random run. At 1 Hz the accelerance above a few hertz is unchanged.
Each output row is written in its channel's unit and each input column in its reference row's force unit, so the model reads the controller's channel table directly: no sensitivity is applied to a state-space channel. A blank unit cell takes the unit system's unit for the channel's type.
Classes:
| Name | Description |
|---|---|
StateSpaceModel |
The matrices of a modal state-space model and what they hold. |
Functions:
| Name | Description |
|---|---|
state_space_model |
The modal state-space model of |
Classes¶
StateSpaceModel
dataclass
¶
StateSpaceModel(A: ndarray, B: ndarray, C: ndarray, D: ndarray, channel_dof: list[str], input_dof: list[str], channel_unit: list[str], mode_frequency: ndarray, lifted: int, dropped: int)
The matrices of a modal state-space model and what they hold.
Attributes:
A: (2n, 2n) for n modes, a 2×2 block per mode.
B: (2n, inputs), a column per reference row.
C: (channels, 2n), a row per channel in table order.
D: (channels, inputs).
channel_dof: Each row's DOF, as the table names it.
input_dof: Each input's DOF, the reference rows in table order.
channel_unit: The unit each row is in, which for a reference row
is also its input's unit.
mode_frequency: Each kept mode's frequency in Hz, after lifting.
lifted: How many modes were moved up to the rigid frequency.
dropped: How many modes were at or above the maximum frequency.
Methods:
| Name | Description |
|---|---|
summary |
One line on what the model holds, for a status line. |
frf |
C (iωI − A)⁻¹ B + D at each frequency, in Hz: `(lines, |
Methods:¶
summary
¶
One line on what the model holds, for a status line.
Source code in src/visualdynamics/core/state_space.py
frf
¶
C (iωI − A)⁻¹ B + D at each frequency, in Hz: (lines,
channels, inputs), in the rows' and inputs' units.
The model's own FRF, evaluated from the matrices rather than the set, so a preview shows what the file holds.
Source code in src/visualdynamics/core/state_space.py
Functions:¶
state_space_model
¶
state_space_model(shapes: ShapeSet, table: ChannelTable, *, maximum_frequency: float | None = None, rigid_frequency: float = 1.0, unit_system: UnitSystem | None = None) -> StateSpaceModel
The modal state-space model of shapes at table's channels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shapes
|
ShapeSet
|
Real, mass-normalized shapes with a declared mass unit, covering every channel's DOF. |
required |
table
|
ChannelTable
|
The channels. Its reference rows are the inputs, each a force, and every row is an output, in table order. |
required |
maximum_frequency
|
float
|
Modes at or above this frequency, in Hz, are left out. Every mode is kept when omitted. For a controller, its Nyquist frequency. |
None
|
rigid_frequency
|
float
|
Modes below this frequency, in Hz, are moved up to it. |
1.0
|
unit_system
|
UnitSystem
|
The units for a channel whose unit cell is blank. SI when omitted. |
None
|
Returns:
| Type | Description |
|---|---|
StateSpaceModel
|
The matrices, with the rows' DOFs and units and the modes kept. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the set is complex, has no mass unit or no drive-point scale; if the table has no reference row, a reference row that is not a force, a channel with no node or direction, or a response whose type is not a displacement, velocity or acceleration; if the set has no coefficient at a channel's DOF; or if the maximum frequency leaves out every mode. |
Source code in src/visualdynamics/core/state_space.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 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 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | |