补充test_mql机械原语
This commit is contained in:
1 parent
8f14a3840f
commit
6f34ac16bf
4 files changed
+201
-21
No files matched your search
@@ -1,8 +1,12 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from math import pi
|
||||
|
||||
from PythonModels.components.amesim_mechanical import (
|
||||
AmesimPistonGeometry,
|
||||
circular_area,
|
||||
mm_to_m,
|
||||
)
|
||||
from PythonModels.reporting.amesim_results import AmesimResults
|
||||
from PythonModels.reporting.test_mql_variables import (
|
||||
TestMqlVariableCatalog,
|
||||
@@ -138,18 +142,19 @@ def _build_piston(
|
||||
component: TestMqlResolvedComponent,
|
||||
variable_catalog: TestMqlVariableCatalog | None,
|
||||
) -> TestMqlPistonSpec:
|
||||
piston_diameter_m = mm_to_m(component.parameter_value("dp"))
|
||||
rod_diameter_m = mm_to_m(component.parameter_value("dr"))
|
||||
piston_area_m2 = circular_area(piston_diameter_m)
|
||||
rod_area_m2 = circular_area(rod_diameter_m)
|
||||
geometry = AmesimPistonGeometry(
|
||||
piston_diameter_m=mm_to_m(component.parameter_value("dp")),
|
||||
rod_diameter_m=mm_to_m(component.parameter_value("dr")),
|
||||
zero_length_m=mm_to_m(component.parameter_value("x0")),
|
||||
)
|
||||
return TestMqlPistonSpec(
|
||||
alias=component.alias,
|
||||
piston_diameter_m=piston_diameter_m,
|
||||
rod_diameter_m=rod_diameter_m,
|
||||
zero_displacement_m=mm_to_m(component.parameter_value("x0")),
|
||||
piston_area_m2=piston_area_m2,
|
||||
rod_area_m2=rod_area_m2,
|
||||
annulus_area_m2=piston_area_m2 - rod_area_m2,
|
||||
piston_diameter_m=geometry.piston_diameter_m,
|
||||
rod_diameter_m=geometry.rod_diameter_m,
|
||||
zero_displacement_m=geometry.zero_length_m,
|
||||
piston_area_m2=geometry.piston_area_m2,
|
||||
rod_area_m2=geometry.rod_area_m2,
|
||||
annulus_area_m2=geometry.annulus_area_m2,
|
||||
data_paths=_data_paths(variable_catalog, component.alias),
|
||||
)
|
||||
|
||||
@@ -201,14 +206,6 @@ def _build_mechanical_node(
|
||||
)
|
||||
|
||||
|
||||
def circular_area(diameter_m: float) -> float:
|
||||
return pi * diameter_m * diameter_m / 4.0
|
||||
|
||||
|
||||
def mm_to_m(value: float) -> float:
|
||||
return value * MM_TO_M
|
||||
|
||||
|
||||
def n_per_mm_to_n_per_m(value: float) -> float:
|
||||
return value * N_PER_MM_TO_N_PER_M
|
||||
|
||||
|
||||
Reference in new issue
Block a user