接入test_mql真实固定气室拓扑
This commit is contained in:
1 parent
c0f28520b4
commit
2d33a8f4bc
8 files changed
+747
-5
No files matched your search
@@ -3920,8 +3920,23 @@ class TestMqlSystem:
|
||||
TestMqlPneumaticTopologyCandidate,
|
||||
TestMqlPneumaticTopologyDiscovery,
|
||||
)
|
||||
from PythonModels.systems.test_mql_pneumatic_topology import (
|
||||
discover_fixed_chamber_segments,
|
||||
)
|
||||
from PythonModels.systems.test_mql_topology import load_test_mql_cir_topology
|
||||
|
||||
topology = load_test_mql_cir_topology(self.archive_path)
|
||||
chamber_segment_specs = discover_fixed_chamber_segments(
|
||||
topology,
|
||||
COMPONENT_SPECS,
|
||||
CONNECTION_SPECS,
|
||||
)
|
||||
|
||||
typed_aliases = set(self._pneumatic_components_by_alias())
|
||||
component_submodels = {
|
||||
str(component["alias"]): str(component["submodel"])
|
||||
for component in COMPONENT_SPECS
|
||||
}
|
||||
blocked_candidates = []
|
||||
for spec in CONNECTION_SPECS:
|
||||
source_component = str(spec["source_component"])
|
||||
@@ -3932,12 +3947,28 @@ class TestMqlSystem:
|
||||
continue
|
||||
|
||||
line_submodel = str(spec["submodel"])
|
||||
if source_is_typed and target_is_typed:
|
||||
reason = "direct typed pneumatic connection is not a complete volume-orifice-volume branch"
|
||||
elif line_submodel == "DIRECT":
|
||||
reason = "requires AMESim boundary component interpretation before closure construction"
|
||||
endpoint_submodels = {
|
||||
component_submodels.get(source_component, ""),
|
||||
component_submodels.get(target_component, ""),
|
||||
}
|
||||
if "PNRP17" in endpoint_submodels:
|
||||
category = "piston-boundary"
|
||||
reason = "requires pneumatic piston and mechanical coupling interpretation"
|
||||
elif "STEP0" in endpoint_submodels:
|
||||
category = "control-boundary"
|
||||
reason = "requires modulated-orifice control signal evaluation"
|
||||
elif endpoint_submodels & {"PN3NODE2", "P4NODE2"}:
|
||||
category = "node-line-boundary"
|
||||
reason = "requires AMESim node/line equations before full-network closure"
|
||||
elif source_is_typed and target_is_typed:
|
||||
category = "typed-direct"
|
||||
reason = "direct typed connection is not a complete simulated subnetwork"
|
||||
elif line_submodel != "DIRECT":
|
||||
category = "line-boundary"
|
||||
reason = "requires AMESim line equations before full-network closure"
|
||||
else:
|
||||
reason = "requires AMESim node/line submodel interpretation before closure construction"
|
||||
category = "component-boundary"
|
||||
reason = "requires AMESim boundary component interpretation"
|
||||
|
||||
blocked_candidates.append(
|
||||
TestMqlPneumaticTopologyCandidate(
|
||||
@@ -3949,15 +3980,97 @@ class TestMqlSystem:
|
||||
target_port=str(spec["target_port"]),
|
||||
source_is_typed_pneumatic=source_is_typed,
|
||||
target_is_typed_pneumatic=target_is_typed,
|
||||
category=category,
|
||||
reason=reason,
|
||||
)
|
||||
)
|
||||
|
||||
return TestMqlPneumaticTopologyDiscovery(
|
||||
branch_specs=(),
|
||||
chamber_segment_specs=chamber_segment_specs,
|
||||
blocked_candidates=tuple(blocked_candidates),
|
||||
)
|
||||
|
||||
def pneumatic_chamber_segment_closure_from_spec(
|
||||
self,
|
||||
spec,
|
||||
*,
|
||||
inlet_pressure_pa: float,
|
||||
outlet_pressure_pa: float,
|
||||
inlet_temperature_k: float = 293.15,
|
||||
outlet_temperature_k: float = 293.15,
|
||||
):
|
||||
"""Build a reduced segment using absolute-pressure line boundaries.
|
||||
|
||||
Boundary values apply at the PNL0001/orifice interfaces, not at the nodes.
|
||||
"""
|
||||
from PythonModels.components.amesim_pneumatic import (
|
||||
AmesimPneumaticOrifice,
|
||||
AmesimPneumaticVolume,
|
||||
)
|
||||
from PythonModels.systems.test_mql_closure import (
|
||||
TestMqlPneumaticBoundaryCondition,
|
||||
TestMqlPneumaticChamberSegmentClosure,
|
||||
TestMqlPneumaticChamberSegmentComponents,
|
||||
)
|
||||
|
||||
volume = self.network.components[spec.volume_alias]
|
||||
inlet_orifice = self.network.components[spec.inlet_orifice_alias]
|
||||
outlet_orifice = self.network.components[spec.outlet_orifice_alias]
|
||||
if not isinstance(volume, AmesimPneumaticVolume):
|
||||
raise TypeError(f"{spec.volume_alias} is not an AMESim pneumatic volume")
|
||||
if not isinstance(inlet_orifice, AmesimPneumaticOrifice):
|
||||
raise TypeError(
|
||||
f"{spec.inlet_orifice_alias} is not an AMESim pneumatic orifice"
|
||||
)
|
||||
if not isinstance(outlet_orifice, AmesimPneumaticOrifice):
|
||||
raise TypeError(
|
||||
f"{spec.outlet_orifice_alias} is not an AMESim pneumatic orifice"
|
||||
)
|
||||
return TestMqlPneumaticChamberSegmentClosure(
|
||||
components=TestMqlPneumaticChamberSegmentComponents(
|
||||
volume=volume,
|
||||
inlet_orifice=inlet_orifice,
|
||||
outlet_orifice=outlet_orifice,
|
||||
spec=spec,
|
||||
),
|
||||
inlet_boundary=TestMqlPneumaticBoundaryCondition(
|
||||
pressure_pa=inlet_pressure_pa,
|
||||
temperature_k=inlet_temperature_k,
|
||||
),
|
||||
outlet_boundary=TestMqlPneumaticBoundaryCondition(
|
||||
pressure_pa=outlet_pressure_pa,
|
||||
temperature_k=outlet_temperature_k,
|
||||
),
|
||||
)
|
||||
|
||||
def simulate_pneumatic_chamber_segment_from_spec(
|
||||
self,
|
||||
spec,
|
||||
*,
|
||||
inlet_pressure_pa: float,
|
||||
outlet_pressure_pa: float,
|
||||
inlet_temperature_k: float = 293.15,
|
||||
outlet_temperature_k: float = 293.15,
|
||||
config: SolveIVPConfig | None = None,
|
||||
t_eval: list[float] | None = None,
|
||||
):
|
||||
"""Integrate a reduced segment with absolute-pressure line boundaries."""
|
||||
closure = self.pneumatic_chamber_segment_closure_from_spec(
|
||||
spec,
|
||||
inlet_pressure_pa=inlet_pressure_pa,
|
||||
outlet_pressure_pa=outlet_pressure_pa,
|
||||
inlet_temperature_k=inlet_temperature_k,
|
||||
outlet_temperature_k=outlet_temperature_k,
|
||||
)
|
||||
run_config = config or SolveIVPConfig(t_stop=1.0e-4, max_step=1.0e-5)
|
||||
return integrate_ode(
|
||||
rhs=lambda t, state: closure.rhs(state),
|
||||
initial_state=closure.initial_state_vector(),
|
||||
config=run_config,
|
||||
t_eval=t_eval,
|
||||
)
|
||||
|
||||
def pneumatic_branch_closure_from_spec(self, spec):
|
||||
return self.pneumatic_branch_closure(
|
||||
name=spec.name,
|
||||
|
||||
Reference in new issue
Block a user