接入test_mql真实固定气室拓扑

This commit is contained in:
huojiarong committed 2026-07-17 02:49:06 +00:00
1 parent c0f28520b4
commit 2d33a8f4bc
8 files changed
+747 -5

No files matched your search

@@ -93,6 +93,7 @@ class AmesimPneumaticVolume(DynamicComponent):
U0 = m0 * gas.specific_internal_energy(T0)
self.state = VolumeState(m=m0, U=U0)
self.port_a = PortState()
self.port_b = PortState()
@classmethod
def from_liters(
@@ -130,11 +131,37 @@ class AmesimPneumaticVolume(DynamicComponent):
h = self.gas.specific_enthalpy(T)
self.port_a.p = p
self.port_a.h_outflow = h
self.port_b.p = p
self.port_b.h_outflow = h
return ThermodynamicProperties(p=p, T=T, rho=rho, u=u, h=h)
def derivatives(self, inlet_h: float, m_flow: float) -> VolumeState:
return VolumeState(m=m_flow, U=m_flow * inlet_h)
def derivatives_from_two_connections(
self,
*,
port_a_m_flow: float,
connected_h_a: float,
port_b_m_flow: float,
connected_h_b: float,
internal_h: float,
) -> VolumeState:
inlet_h_a = self.connection_inlet_enthalpy(
port_m_flow=port_a_m_flow,
connected_h=connected_h_a,
internal_h=internal_h,
)
inlet_h_b = self.connection_inlet_enthalpy(
port_m_flow=port_b_m_flow,
connected_h=connected_h_b,
internal_h=internal_h,
)
return VolumeState(
m=port_a_m_flow + port_b_m_flow,
U=port_a_m_flow * inlet_h_a + port_b_m_flow * inlet_h_b,
)
class AmesimVariablePneumaticVolume(AmesimPneumaticVolume):
"""PNCH012-style volume with a dead volume plus an external moving volume."""