组合test_mql 132状态总闭包
This commit is contained in:
1 parent
3d1de6d5d0
commit
716a1c572a
3 files changed
+182
-1
No files matched your search
@@ -188,14 +188,21 @@ class TestMqlMechanicalMassClosure:
|
||||
)
|
||||
return TestMqlMechanicalMassSnapshot(states=states)
|
||||
|
||||
def rhs(self, state_vector: list[float]) -> list[float]:
|
||||
def rhs(
|
||||
self,
|
||||
state_vector: list[float],
|
||||
*,
|
||||
force_by_mass_alias: dict[str, float] | None = None,
|
||||
) -> list[float]:
|
||||
snapshot = self.snapshot(state_vector)
|
||||
force_by_mass_alias = force_by_mass_alias or {}
|
||||
derivatives: list[float] = []
|
||||
for state in snapshot.states:
|
||||
mass = self.assembly.masses[state.alias].endstop()
|
||||
acceleration, velocity = mass.derivatives(
|
||||
velocity_m_s=state.velocity_m_s,
|
||||
displacement_m=state.displacement_m,
|
||||
port_1_force_n=force_by_mass_alias.get(state.alias, 0.0),
|
||||
)
|
||||
derivatives.extend([acceleration, velocity])
|
||||
return derivatives
|
||||
|
||||
Reference in new issue
Block a user