接入test_mql大质量块约束
This commit is contained in:
1 parent
bb4a71c612
commit
65cdd2284e
3 files changed
+103
-3
No files matched your search
@@ -3921,6 +3921,9 @@ class TestMqlFullStateClosure:
|
||||
)
|
||||
|
||||
def rhs(self, state_vector: list[float]) -> list[float]:
|
||||
return self.rhs_at(0.0, state_vector)
|
||||
|
||||
def rhs_at(self, time_s: float, state_vector: list[float]) -> list[float]:
|
||||
pneumatic_state, mechanical_state = self._split_state(list(state_vector))
|
||||
pneumatic_snapshot = self.pneumatic_closure.snapshot(pneumatic_state)
|
||||
mechanical_snapshot = self.mechanical_closure.snapshot(mechanical_state)
|
||||
@@ -3929,14 +3932,20 @@ class TestMqlFullStateClosure:
|
||||
*self.mechanical_closure.rhs(
|
||||
mechanical_state,
|
||||
force_by_mass_alias=self._force_by_mass_alias(
|
||||
time_s,
|
||||
pneumatic_snapshot,
|
||||
mechanical_snapshot,
|
||||
),
|
||||
constrained_mass_aliases={
|
||||
"mass_friction_endstops_18",
|
||||
"mass_friction_endstops_19",
|
||||
},
|
||||
),
|
||||
]
|
||||
|
||||
def _force_by_mass_alias(
|
||||
self,
|
||||
time_s: float,
|
||||
pneumatic_snapshot: object,
|
||||
mechanical_snapshot: object,
|
||||
) -> dict[str, float]:
|
||||
@@ -3948,6 +3957,13 @@ class TestMqlFullStateClosure:
|
||||
force_by_mass_alias[mass_alias] = (
|
||||
force_by_mass_alias.get(mass_alias, 0.0) - contact_force
|
||||
)
|
||||
force_by_mass_alias.update(
|
||||
self._large_mass_force_by_alias(
|
||||
time_s,
|
||||
pneumatic_snapshot,
|
||||
mechanical_snapshot,
|
||||
)
|
||||
)
|
||||
return force_by_mass_alias
|
||||
|
||||
def _mechanical_node_total_force_by_alias(
|
||||
@@ -3964,6 +3980,30 @@ class TestMqlFullStateClosure:
|
||||
),
|
||||
}
|
||||
|
||||
def _large_mass_force_by_alias(
|
||||
self,
|
||||
time_s: float,
|
||||
pneumatic_snapshot: object,
|
||||
mechanical_snapshot: object,
|
||||
) -> dict[str, float]:
|
||||
node_force = self._mechanical_node_total_force_by_alias(
|
||||
pneumatic_snapshot,
|
||||
mechanical_snapshot,
|
||||
)
|
||||
forcecon_1 = self.mechanical_closure.assembly.force_connectors["forcecon_1"]
|
||||
forcecon_2 = self.mechanical_closure.assembly.force_connectors["forcecon_2"]
|
||||
signals = self.mechanical_closure.assembly.piecewise_signals
|
||||
return {
|
||||
"mass_friction_endstops_18": (
|
||||
node_force["dynamic_mechanical_node_alternative_2"]
|
||||
- forcecon_2.force_at(time_s, signals)
|
||||
),
|
||||
"mass_friction_endstops_19": (
|
||||
forcecon_1.force_at(time_s, signals)
|
||||
- node_force["dynamic_mechanical_node_alternative_3"]
|
||||
),
|
||||
}
|
||||
|
||||
def _piston_force_by_mass_alias(self, pneumatic_snapshot: object) -> dict[str, float]:
|
||||
from PythonModels.systems.test_mql_pneumatic import pressure_to_amesim_gauge_pa
|
||||
|
||||
@@ -4342,7 +4382,7 @@ class TestMqlSystem:
|
||||
resistance_boundary_temperature_k=resistance_boundary_temperature_k,
|
||||
)
|
||||
return integrate_ode(
|
||||
rhs=lambda t, state: closure.rhs(state),
|
||||
rhs=lambda t, state: closure.rhs_at(t, state),
|
||||
initial_state=closure.initial_state_vector(),
|
||||
config=config or SolveIVPConfig(t_stop=1.0e-4, max_step=1.0e-5),
|
||||
t_eval=t_eval,
|
||||
|
||||
Reference in new issue
Block a user