MCPcopy Create free account
hub / github.com/Tong89/smartNode / save

Method save

backend/scenario.py:102–125  ·  view source on GitHub ↗

将引擎当前资源配置序列化为场景字典。 Parameters ---------- engine: ``SimulationEngine`` 实例。 name: 场景名称(可选,便于人类识别)。 Returns ------- dict 符合 Scenario Schema 的字典,可直接序列化为 JSON 或 YAML。

(engine: Any, name: str = "")

Source from the content-addressed store, hash-verified

100
101 @staticmethod
102 def save(engine: Any, name: str = "") -> Dict[str, Any]:
103 """将引擎当前资源配置序列化为场景字典。
104
105 Parameters
106 ----------
107 engine:
108 ``SimulationEngine`` 实例。
109 name:
110 场景名称(可选,便于人类识别)。
111
112 Returns
113 -------
114 dict
115 符合 Scenario Schema 的字典,可直接序列化为 JSON 或 YAML。
116 """
117 return {
118 "version": SCENARIO_VERSION,
119 "name": name or "unnamed",
120 "saved_at": datetime.now(tz=timezone.utc).isoformat(),
121 "ground_station_count": len(engine.ground_stations),
122 "leo_satellite_count": len(engine.leo_satellites),
123 "geo_relay_count": len(engine.geo_relays),
124 "data_types": list(engine.DATA_TYPES.keys()) if hasattr(engine, "DATA_TYPES") else [],
125 }
126
127 @staticmethod
128 def load(engine: Any, data: Dict[str, Any]) -> Dict[str, Any]:

Callers 2

scenario_saveFunction · 0.80
save_scenarioMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected