规范仿真模型库并完善前端交互
归档仿真模型并补充组件目录、建模规范与校验。 完善控制台、默认节点、视图适配及前端自动化测试。
This commit is contained in:
1 parent
f7f1078911
commit
bbc88a6bbb
71 files changed
+4574
-806
No files matched your search
+19
-12
@@ -28,8 +28,8 @@ from app.system_xml import (
|
||||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from PythonModels.core.network import SimulationNetwork
|
||||
from PythonModels.core.ports import PortDefinition
|
||||
from app.simulation.core.ports import PortDefinition
|
||||
from app.simulation.systems.network import SimulationNetwork
|
||||
|
||||
|
||||
app = FastAPI(title="System Simulation ReactFlow App")
|
||||
@@ -231,6 +231,13 @@ def frontend_asset(path: str) -> FileResponse:
|
||||
return FileResponse(asset_path)
|
||||
|
||||
|
||||
@app.get("/api/components/catalog")
|
||||
def get_component_catalog() -> dict[str, object]:
|
||||
from app.simulation.registry import build_component_catalog
|
||||
|
||||
return build_component_catalog()
|
||||
|
||||
|
||||
@app.post("/api/reactflow/system-xml")
|
||||
def export_reactflow_system_xml(payload: ReactFlowProjectPayload) -> Response:
|
||||
try:
|
||||
@@ -572,10 +579,10 @@ def run_system_xml_simulation(
|
||||
progress_callback: SimulationProgressEmitter | None = None,
|
||||
cancel_check: Callable[[], bool] | None = None,
|
||||
) -> dict[str, object]:
|
||||
from PythonModels.core.algebraic import AlgebraicSolveError
|
||||
from PythonModels.core.solver import SolveIVPConfig
|
||||
from PythonModels.core.stream import StreamSolveError
|
||||
from PythonModels.systems.generic import (
|
||||
from app.simulation.solvers.algebraic import AlgebraicSolveError
|
||||
from app.simulation.solvers.solver import SolveIVPConfig
|
||||
from app.simulation.solvers.stream import StreamSolveError
|
||||
from app.simulation.systems.generic import (
|
||||
GenericFluidSystem,
|
||||
SimulationPreparationError,
|
||||
)
|
||||
@@ -1071,9 +1078,9 @@ def validate_compatible_ports(
|
||||
|
||||
|
||||
def compile_reactflow_network(project: ReactFlowProjectPayload) -> "SimulationNetwork":
|
||||
from PythonModels.core.medium import IdealGasMedium
|
||||
from PythonModels.core.network import SimulationNetwork
|
||||
from PythonModels.registry import get_component_model_spec
|
||||
from app.simulation.core.medium import IdealGasMedium
|
||||
from app.simulation.registry import get_component_model_spec
|
||||
from app.simulation.systems.network import SimulationNetwork
|
||||
|
||||
medium = IdealGasMedium()
|
||||
network = SimulationNetwork(name=project.name)
|
||||
@@ -1156,14 +1163,13 @@ def sanitize_project_id(project_id: str) -> str:
|
||||
|
||||
|
||||
def run_reactflow_testmodel(project: ReactFlowProjectPayload) -> dict[str, object]:
|
||||
from PythonModels.core.solver import SolveIVPConfig
|
||||
from PythonModels.scripts.run_testmodel import (
|
||||
from app.simulation.examples.testmodel.run import (
|
||||
TestModelExecutionConfig,
|
||||
TestModelRunConfig,
|
||||
TestModelSamplingConfig,
|
||||
run_testmodel,
|
||||
)
|
||||
from PythonModels.systems.testmodel import (
|
||||
from app.simulation.examples.testmodel.system import (
|
||||
BranchConfig,
|
||||
CylinderConfig,
|
||||
OrificeConfig,
|
||||
@@ -1171,6 +1177,7 @@ def run_reactflow_testmodel(project: ReactFlowProjectPayload) -> dict[str, objec
|
||||
TankConfig,
|
||||
TestModelConfig,
|
||||
)
|
||||
from app.simulation.solvers.solver import SolveIVPConfig
|
||||
|
||||
nodes_by_type: dict[str, list[ReactFlowNodePayload]] = {}
|
||||
for node in project.nodes:
|
||||
|
||||
Reference in new issue
Block a user