规范化xml内容,并在xml中添加仿真设置,规范化版本号等内容,补充xml规范md文件
This commit is contained in:
1 parent
c52266ba11
commit
104d41d294
6 files changed
+254
-2
No files matched your search
+21
-1
@@ -14,6 +14,8 @@ from pydantic import BaseModel, Field
|
||||
app = FastAPI(title="System Simulation ReactFlow App")
|
||||
FRONTEND_DIST_DIR = Path(__file__).resolve().parent.parent / "frontend" / "dist"
|
||||
PROJECT_STORAGE_DIR = Path(__file__).parent / "data" / "reactflow-projects"
|
||||
SYSTEM_XML_SCHEMA_VERSION = "1"
|
||||
SYSTEM_XML_UNIT_SYSTEM = "SI"
|
||||
|
||||
|
||||
class ReactFlowPosition(BaseModel):
|
||||
@@ -190,7 +192,25 @@ def simulate_reactflow_testmodel(payload: ReactFlowProjectPayload) -> dict[str,
|
||||
|
||||
|
||||
def build_reactflow_system_xml(project: ReactFlowProjectPayload) -> bytes:
|
||||
system = ET.Element("System", {"name": project.name})
|
||||
system = ET.Element(
|
||||
"System",
|
||||
{
|
||||
"name": project.name,
|
||||
"schemaVersion": SYSTEM_XML_SCHEMA_VERSION,
|
||||
"unitSystem": SYSTEM_XML_UNIT_SYSTEM,
|
||||
},
|
||||
)
|
||||
ET.SubElement(
|
||||
system,
|
||||
"Simulation",
|
||||
{
|
||||
"tStart": str(project.simulation.t_start),
|
||||
"tStop": str(project.simulation.t_stop),
|
||||
"step": str(project.simulation.step),
|
||||
"maxStep": str(project.simulation.max_step),
|
||||
"method": project.simulation.method,
|
||||
},
|
||||
)
|
||||
components_node = ET.SubElement(system, "Components")
|
||||
connections_node = ET.SubElement(system, "Connections")
|
||||
|
||||
|
||||
Reference in new issue
Block a user