规范仿真模型库并完善前端交互
归档仿真模型并补充组件目录、建模规范与校验。 完善控制台、默认节点、视图适配及前端自动化测试。
This commit is contained in:
1 parent
f7f1078911
commit
bbc88a6bbb
71 files changed
+4574
-806
No files matched your search
@@ -2,15 +2,15 @@ from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
|
||||
from PythonModels.components.cylinder import Cylinder
|
||||
from PythonModels.components.orifice import Orifice
|
||||
from PythonModels.components.pipe import Pipe
|
||||
from PythonModels.components.resistive_pipe import ResistivePipe
|
||||
from PythonModels.components.tank import Tank
|
||||
from PythonModels.components.tee import Tee
|
||||
from PythonModels.core.medium import IdealGasMedium
|
||||
from PythonModels.core.ports import PortVariableDefinition
|
||||
from PythonModels.registry import COMPONENT_MODEL_REGISTRY
|
||||
from app.simulation.components.experimental.flow.orifice import Orifice
|
||||
from app.simulation.components.experimental.flow.resistive_pipe import ResistivePipe
|
||||
from app.simulation.components.experimental.junctions.tee import Tee
|
||||
from app.simulation.components.experimental.storage.cylinder import Cylinder
|
||||
from app.simulation.components.experimental.storage.tank import Tank
|
||||
from app.simulation.core.medium import IdealGasMedium
|
||||
from app.simulation.core.ports import PortVariableDefinition
|
||||
from app.simulation.examples.testmodel.dynamic_pipe import Pipe
|
||||
from app.simulation.registry import COMPONENT_MODEL_REGISTRY
|
||||
|
||||
|
||||
class ComponentMetadataTests(unittest.TestCase):
|
||||
@@ -32,12 +32,14 @@ class ComponentMetadataTests(unittest.TestCase):
|
||||
with self.subTest(component=component.name):
|
||||
for attribute in (
|
||||
"MODEL_TYPE",
|
||||
"MODEL_VERSION",
|
||||
"PORTS",
|
||||
"PARAMETERS",
|
||||
"RESULT_VARIABLES",
|
||||
):
|
||||
self.assertIn(attribute, type(component).__dict__)
|
||||
self.assertTrue(component.MODEL_TYPE)
|
||||
self.assertTrue(component.MODEL_VERSION)
|
||||
self.assertEqual(component.model_type, component.MODEL_TYPE)
|
||||
self.assertEqual(component.port_definitions, component.PORTS)
|
||||
self.assertEqual(
|
||||
@@ -63,8 +65,15 @@ class ComponentMetadataTests(unittest.TestCase):
|
||||
with self.subTest(model_type=model_type):
|
||||
spec = COMPONENT_MODEL_REGISTRY[model_type]
|
||||
self.assertEqual(spec.model_type, component_class.MODEL_TYPE)
|
||||
self.assertEqual(
|
||||
spec.model_version,
|
||||
component_class.MODEL_VERSION,
|
||||
)
|
||||
self.assertEqual(spec.ports, component_class.PORTS)
|
||||
self.assertEqual(spec.parameters, component_class.PARAMETERS)
|
||||
self.assertIs(spec.display, component_class.DISPLAY)
|
||||
self.assertIs(spec.component_class, component_class)
|
||||
self.assertIn("create", component_class.__dict__)
|
||||
component = spec.create(f"{model_type}_1", self.medium, {})
|
||||
self.assertEqual(
|
||||
component.parameter_values,
|
||||
|
||||
Reference in new issue
Block a user