merge/model-development-into-main #2
No files matched your search
@@ -590,6 +590,8 @@ class TestMqlPneumatic96InletLineDiagnostic:
|
||||
amesim_storage_mass_derivative_residual_g_s: float
|
||||
amesim_chamber_pressure_pa: float
|
||||
amesim_chamber_temperature_k: float
|
||||
amesim_node_pressure_pa: float
|
||||
amesim_node_temperature_k: float
|
||||
amesim_line_temperature_derivative_fd_k_s: float
|
||||
amesim_line_pressure_derivative_fd_pa_s: float
|
||||
amesim_port_1_enthalpy_dtemp_component_k_s: float
|
||||
@@ -613,6 +615,20 @@ class TestMqlPneumatic96InletLineDiagnostic:
|
||||
python_orifice_to_line_mass_flow_error_g_s: float
|
||||
python_storage_mass_derivative_g_s: float
|
||||
python_storage_mass_derivative_error_g_s: float
|
||||
python_line_to_node_amesim_node_mass_flow_g_s: float
|
||||
python_line_to_node_amesim_node_mass_flow_error_g_s: float
|
||||
python_line_to_node_amesim_line_mass_flow_g_s: float
|
||||
python_line_to_node_amesim_line_mass_flow_error_g_s: float
|
||||
python_line_to_node_amesim_node_line_mass_flow_g_s: float
|
||||
python_line_to_node_amesim_node_line_mass_flow_error_g_s: float
|
||||
python_orifice_to_line_amesim_line_mass_flow_g_s: float
|
||||
python_orifice_to_line_amesim_line_mass_flow_error_g_s: float
|
||||
python_orifice_to_line_amesim_chamber_mass_flow_g_s: float
|
||||
python_orifice_to_line_amesim_chamber_mass_flow_error_g_s: float
|
||||
python_orifice_to_line_amesim_line_chamber_mass_flow_g_s: float
|
||||
python_orifice_to_line_amesim_line_chamber_mass_flow_error_g_s: float
|
||||
python_storage_amesim_boundary_states_mass_derivative_g_s: float
|
||||
python_storage_amesim_boundary_states_mass_derivative_error_g_s: float
|
||||
python_chamber_pressure_pa: float
|
||||
python_chamber_temperature_k: float
|
||||
python_current_temperature_derivative_k_s: float
|
||||
@@ -2547,6 +2563,10 @@ def _pneumatic_96_inlet_line_diagnostic(
|
||||
amesim_value(f"press@{chamber_alias}") + AMESIM_REFERENCE_PRESSURE_PA
|
||||
)
|
||||
amesim_chamber_temperature = amesim_value(f"temp@{chamber_alias}")
|
||||
amesim_node_pressure = (
|
||||
amesim_value(f"press1@{node_alias}") + AMESIM_REFERENCE_PRESSURE_PA
|
||||
)
|
||||
amesim_node_temperature = amesim_value(f"temp1@{node_alias}")
|
||||
|
||||
python_line_to_node_flow = -snapshot.inlet_node_to_line_flow * 1.0e3
|
||||
python_orifice_to_line_flow = -snapshot.inlet_line_to_chamber_flow * 1.0e3
|
||||
@@ -2554,6 +2574,112 @@ def _pneumatic_96_inlet_line_diagnostic(
|
||||
snapshot.inlet_node_to_line_flow - snapshot.inlet_line_to_chamber_flow
|
||||
) * 1.0e3
|
||||
|
||||
orifice = closure.pneumatic_closure.components.inlet_orifice
|
||||
|
||||
def node_to_line_flow_from_states(
|
||||
*,
|
||||
node_pressure_pa: float,
|
||||
node_temperature_k: float,
|
||||
line_pressure_pa: float,
|
||||
line_temperature_k: float,
|
||||
) -> float:
|
||||
pressure_difference = node_pressure_pa - line_pressure_pa
|
||||
if pressure_difference == 0.0:
|
||||
return 0.0
|
||||
if line.calibrated_linear_conductance is not None:
|
||||
return (
|
||||
line.calibrated_linear_conductance
|
||||
* pressure_difference
|
||||
/ sqrt(line_temperature_k)
|
||||
)
|
||||
upstream_pressure = max(node_pressure_pa, line_pressure_pa)
|
||||
upstream_temperature = (
|
||||
node_temperature_k if pressure_difference > 0.0 else line_temperature_k
|
||||
)
|
||||
density = line.gas.density(upstream_pressure, upstream_temperature)
|
||||
magnitude = line._mass_flow_for_pressure_drop(
|
||||
abs(pressure_difference),
|
||||
density=density,
|
||||
temperature=upstream_temperature,
|
||||
)
|
||||
return magnitude if pressure_difference > 0.0 else -magnitude
|
||||
|
||||
def line_to_node_flow_from_states_g_s(
|
||||
*,
|
||||
node_pressure_pa: float,
|
||||
node_temperature_k: float,
|
||||
line_pressure_pa: float,
|
||||
line_temperature_k: float,
|
||||
) -> float:
|
||||
return -1.0e3 * node_to_line_flow_from_states(
|
||||
node_pressure_pa=node_pressure_pa,
|
||||
node_temperature_k=node_temperature_k,
|
||||
line_pressure_pa=line_pressure_pa,
|
||||
line_temperature_k=line_temperature_k,
|
||||
)
|
||||
|
||||
def orifice_to_line_flow_from_states_g_s(
|
||||
*,
|
||||
line_pressure_pa: float,
|
||||
line_temperature_k: float,
|
||||
chamber_pressure_pa: float,
|
||||
chamber_temperature_k: float,
|
||||
) -> float:
|
||||
upstream_temperature = (
|
||||
line_temperature_k
|
||||
if line_pressure_pa >= chamber_pressure_pa
|
||||
else chamber_temperature_k
|
||||
)
|
||||
line_to_chamber = orifice.mass_flow(
|
||||
line_pressure_pa,
|
||||
chamber_pressure_pa,
|
||||
upstream_temperature,
|
||||
)
|
||||
return -1.0e3 * line_to_chamber
|
||||
|
||||
python_line_to_node_amesim_node_flow = line_to_node_flow_from_states_g_s(
|
||||
node_pressure_pa=amesim_node_pressure,
|
||||
node_temperature_k=amesim_node_temperature,
|
||||
line_pressure_pa=snapshot.inlet_line.p,
|
||||
line_temperature_k=snapshot.inlet_line.T,
|
||||
)
|
||||
python_line_to_node_amesim_line_flow = line_to_node_flow_from_states_g_s(
|
||||
node_pressure_pa=snapshot.inlet_node.p,
|
||||
node_temperature_k=snapshot.inlet_node.T,
|
||||
line_pressure_pa=amesim_line_pressure,
|
||||
line_temperature_k=amesim_line_temperature,
|
||||
)
|
||||
python_line_to_node_amesim_node_line_flow = line_to_node_flow_from_states_g_s(
|
||||
node_pressure_pa=amesim_node_pressure,
|
||||
node_temperature_k=amesim_node_temperature,
|
||||
line_pressure_pa=amesim_line_pressure,
|
||||
line_temperature_k=amesim_line_temperature,
|
||||
)
|
||||
python_orifice_to_line_amesim_line_flow = orifice_to_line_flow_from_states_g_s(
|
||||
line_pressure_pa=amesim_line_pressure,
|
||||
line_temperature_k=amesim_line_temperature,
|
||||
chamber_pressure_pa=snapshot.chamber.p,
|
||||
chamber_temperature_k=snapshot.chamber.T,
|
||||
)
|
||||
python_orifice_to_line_amesim_chamber_flow = orifice_to_line_flow_from_states_g_s(
|
||||
line_pressure_pa=snapshot.inlet_line.p,
|
||||
line_temperature_k=snapshot.inlet_line.T,
|
||||
chamber_pressure_pa=amesim_chamber_pressure,
|
||||
chamber_temperature_k=amesim_chamber_temperature,
|
||||
)
|
||||
python_orifice_to_line_amesim_line_chamber_flow = (
|
||||
orifice_to_line_flow_from_states_g_s(
|
||||
line_pressure_pa=amesim_line_pressure,
|
||||
line_temperature_k=amesim_line_temperature,
|
||||
chamber_pressure_pa=amesim_chamber_pressure,
|
||||
chamber_temperature_k=amesim_chamber_temperature,
|
||||
)
|
||||
)
|
||||
python_storage_amesim_boundary_states = (
|
||||
python_orifice_to_line_amesim_line_chamber_flow
|
||||
- python_line_to_node_amesim_node_line_flow
|
||||
)
|
||||
|
||||
amesim_line_temperature_fd = _series_finite_difference_at(
|
||||
times=amesim_results.times,
|
||||
values=amesim_results.series(f"t2@{line_alias}"),
|
||||
@@ -2750,6 +2876,8 @@ def _pneumatic_96_inlet_line_diagnostic(
|
||||
),
|
||||
amesim_chamber_pressure_pa=amesim_chamber_pressure,
|
||||
amesim_chamber_temperature_k=amesim_chamber_temperature,
|
||||
amesim_node_pressure_pa=amesim_node_pressure,
|
||||
amesim_node_temperature_k=amesim_node_temperature,
|
||||
amesim_line_temperature_derivative_fd_k_s=amesim_line_temperature_fd,
|
||||
amesim_line_pressure_derivative_fd_pa_s=amesim_line_pressure_fd,
|
||||
amesim_port_1_enthalpy_dtemp_component_k_s=amesim_port_1_dtemp,
|
||||
@@ -2791,6 +2919,49 @@ def _pneumatic_96_inlet_line_diagnostic(
|
||||
python_storage_mass_derivative_error_g_s=(
|
||||
python_storage_derivative - amesim_storage_from_ports
|
||||
),
|
||||
python_line_to_node_amesim_node_mass_flow_g_s=(
|
||||
python_line_to_node_amesim_node_flow
|
||||
),
|
||||
python_line_to_node_amesim_node_mass_flow_error_g_s=(
|
||||
python_line_to_node_amesim_node_flow - amesim_line_to_node_flow
|
||||
),
|
||||
python_line_to_node_amesim_line_mass_flow_g_s=(
|
||||
python_line_to_node_amesim_line_flow
|
||||
),
|
||||
python_line_to_node_amesim_line_mass_flow_error_g_s=(
|
||||
python_line_to_node_amesim_line_flow - amesim_line_to_node_flow
|
||||
),
|
||||
python_line_to_node_amesim_node_line_mass_flow_g_s=(
|
||||
python_line_to_node_amesim_node_line_flow
|
||||
),
|
||||
python_line_to_node_amesim_node_line_mass_flow_error_g_s=(
|
||||
python_line_to_node_amesim_node_line_flow - amesim_line_to_node_flow
|
||||
),
|
||||
python_orifice_to_line_amesim_line_mass_flow_g_s=(
|
||||
python_orifice_to_line_amesim_line_flow
|
||||
),
|
||||
python_orifice_to_line_amesim_line_mass_flow_error_g_s=(
|
||||
python_orifice_to_line_amesim_line_flow - amesim_orifice_to_line_flow
|
||||
),
|
||||
python_orifice_to_line_amesim_chamber_mass_flow_g_s=(
|
||||
python_orifice_to_line_amesim_chamber_flow
|
||||
),
|
||||
python_orifice_to_line_amesim_chamber_mass_flow_error_g_s=(
|
||||
python_orifice_to_line_amesim_chamber_flow - amesim_orifice_to_line_flow
|
||||
),
|
||||
python_orifice_to_line_amesim_line_chamber_mass_flow_g_s=(
|
||||
python_orifice_to_line_amesim_line_chamber_flow
|
||||
),
|
||||
python_orifice_to_line_amesim_line_chamber_mass_flow_error_g_s=(
|
||||
python_orifice_to_line_amesim_line_chamber_flow
|
||||
- amesim_orifice_to_line_flow
|
||||
),
|
||||
python_storage_amesim_boundary_states_mass_derivative_g_s=(
|
||||
python_storage_amesim_boundary_states
|
||||
),
|
||||
python_storage_amesim_boundary_states_mass_derivative_error_g_s=(
|
||||
python_storage_amesim_boundary_states - amesim_storage_from_ports
|
||||
),
|
||||
python_chamber_pressure_pa=snapshot.chamber.p,
|
||||
python_chamber_temperature_k=snapshot.chamber.T,
|
||||
python_current_temperature_derivative_k_s=python_current_dtemp,
|
||||
@@ -3523,6 +3694,22 @@ def format_test_mql_pnvo_event_window_summary(
|
||||
f"python_orifice_to_line_dm_error={inlet_line.python_orifice_to_line_mass_flow_error_g_s}, "
|
||||
f"python_storage_dm={inlet_line.python_storage_mass_derivative_g_s}, "
|
||||
f"python_storage_dm_error={inlet_line.python_storage_mass_derivative_error_g_s}, "
|
||||
f"amesim_node_p_abs={inlet_line.amesim_node_pressure_pa}, "
|
||||
f"amesim_node_t={inlet_line.amesim_node_temperature_k}, "
|
||||
f"python_line_to_node_amesim_node_dm={inlet_line.python_line_to_node_amesim_node_mass_flow_g_s}, "
|
||||
f"python_line_to_node_amesim_node_dm_error={inlet_line.python_line_to_node_amesim_node_mass_flow_error_g_s}, "
|
||||
f"python_line_to_node_amesim_line_dm={inlet_line.python_line_to_node_amesim_line_mass_flow_g_s}, "
|
||||
f"python_line_to_node_amesim_line_dm_error={inlet_line.python_line_to_node_amesim_line_mass_flow_error_g_s}, "
|
||||
f"python_line_to_node_amesim_node_line_dm={inlet_line.python_line_to_node_amesim_node_line_mass_flow_g_s}, "
|
||||
f"python_line_to_node_amesim_node_line_dm_error={inlet_line.python_line_to_node_amesim_node_line_mass_flow_error_g_s}, "
|
||||
f"python_orifice_to_line_amesim_line_dm={inlet_line.python_orifice_to_line_amesim_line_mass_flow_g_s}, "
|
||||
f"python_orifice_to_line_amesim_line_dm_error={inlet_line.python_orifice_to_line_amesim_line_mass_flow_error_g_s}, "
|
||||
f"python_orifice_to_line_amesim_chamber_dm={inlet_line.python_orifice_to_line_amesim_chamber_mass_flow_g_s}, "
|
||||
f"python_orifice_to_line_amesim_chamber_dm_error={inlet_line.python_orifice_to_line_amesim_chamber_mass_flow_error_g_s}, "
|
||||
f"python_orifice_to_line_amesim_line_chamber_dm={inlet_line.python_orifice_to_line_amesim_line_chamber_mass_flow_g_s}, "
|
||||
f"python_orifice_to_line_amesim_line_chamber_dm_error={inlet_line.python_orifice_to_line_amesim_line_chamber_mass_flow_error_g_s}, "
|
||||
f"python_storage_amesim_boundary_states_dm={inlet_line.python_storage_amesim_boundary_states_mass_derivative_g_s}, "
|
||||
f"python_storage_amesim_boundary_states_dm_error={inlet_line.python_storage_amesim_boundary_states_mass_derivative_error_g_s}, "
|
||||
f"python_chamber_p_abs={inlet_line.python_chamber_pressure_pa}, "
|
||||
f"python_chamber_t={inlet_line.python_chamber_temperature_k}, "
|
||||
f"amesim_fd_dT={inlet_line.amesim_line_temperature_derivative_fd_k_s}, "
|
||||
|
||||
@@ -511,6 +511,8 @@ class RunTestMqlFullStateComparisonScriptTests(unittest.TestCase):
|
||||
amesim_storage_mass_derivative_residual_g_s=0.0,
|
||||
amesim_chamber_pressure_pa=15131788.1,
|
||||
amesim_chamber_temperature_k=291.9,
|
||||
amesim_node_pressure_pa=13887929.6,
|
||||
amesim_node_temperature_k=288.9,
|
||||
amesim_line_temperature_derivative_fd_k_s=149.5,
|
||||
amesim_line_pressure_derivative_fd_pa_s=-17835932.3,
|
||||
amesim_port_1_enthalpy_dtemp_component_k_s=1234.0,
|
||||
@@ -534,6 +536,20 @@ class RunTestMqlFullStateComparisonScriptTests(unittest.TestCase):
|
||||
python_orifice_to_line_mass_flow_error_g_s=0.8,
|
||||
python_storage_mass_derivative_g_s=-6.0,
|
||||
python_storage_mass_derivative_error_g_s=0.0,
|
||||
python_line_to_node_amesim_node_mass_flow_g_s=451.0,
|
||||
python_line_to_node_amesim_node_mass_flow_error_g_s=-1.2,
|
||||
python_line_to_node_amesim_line_mass_flow_g_s=452.8,
|
||||
python_line_to_node_amesim_line_mass_flow_error_g_s=0.6,
|
||||
python_line_to_node_amesim_node_line_mass_flow_g_s=452.0,
|
||||
python_line_to_node_amesim_node_line_mass_flow_error_g_s=-0.2,
|
||||
python_orifice_to_line_amesim_line_mass_flow_g_s=445.8,
|
||||
python_orifice_to_line_amesim_line_mass_flow_error_g_s=-0.4,
|
||||
python_orifice_to_line_amesim_chamber_mass_flow_g_s=446.6,
|
||||
python_orifice_to_line_amesim_chamber_mass_flow_error_g_s=0.4,
|
||||
python_orifice_to_line_amesim_line_chamber_mass_flow_g_s=446.0,
|
||||
python_orifice_to_line_amesim_line_chamber_mass_flow_error_g_s=-0.2,
|
||||
python_storage_amesim_boundary_states_mass_derivative_g_s=-6.0,
|
||||
python_storage_amesim_boundary_states_mass_derivative_error_g_s=0.0,
|
||||
python_chamber_pressure_pa=15131800.0,
|
||||
python_chamber_temperature_k=292.0,
|
||||
python_current_temperature_derivative_k_s=261.9,
|
||||
@@ -757,6 +773,9 @@ class RunTestMqlFullStateComparisonScriptTests(unittest.TestCase):
|
||||
self.assertIn("python_line_to_node_dm=453.0", summary)
|
||||
self.assertIn("python_line_to_node_dm_error=0.8", summary)
|
||||
self.assertIn("python_storage_dm_error=0.0", summary)
|
||||
self.assertIn("python_line_to_node_amesim_node_line_dm=452.0", summary)
|
||||
self.assertIn("python_orifice_to_line_amesim_line_chamber_dm=446.0", summary)
|
||||
self.assertIn("python_storage_amesim_boundary_states_dm_error=0.0", summary)
|
||||
self.assertIn("amesim_fd_dT=149.5", summary)
|
||||
self.assertIn("amesim_dT_m_offset=-351.0", summary)
|
||||
self.assertIn("python_current_dT=261.9", summary)
|
||||
|
||||
Reference in new issue
Block a user