前端进度条性能优化、仿真结束后后处理优化;后端C代码生成流程优化:先识别来源,再按照已知未知量需求排序,最后局部求解

This commit is contained in:
ljz committed 2026-09-11 11:27:54 +08:00
1 parent 0dcb465d84
commit 91bd9fb252
77 files changed
+11223 -551

No files matched your search

+23
View File
@@ -10,6 +10,7 @@ from typing import Literal
from lxml import etree
from app.simulation.core.ports import PortDefinition
from app.simulation.core.port_computation import port_supply_issue, reference_supply_issues
from app.simulation.performance import profile_phase
from app.simulation.registry import COMPONENT_MODEL_REGISTRY, ParameterSpec
from app.simulation.config import SolveIVPConfig
@@ -566,6 +567,8 @@ def _validate_connections(
occupied_physical_ports: dict[tuple[str, str], str] = {}
driven_signal_inputs: dict[tuple[str, str], str] = {}
referenced_ports: set[tuple[str, str]] = set()
supply_ports: dict[tuple[str, str], PortDefinition] = {}
supply_adjacency: dict[tuple[str, str], tuple[str, str]] = {}
for index, connection in enumerate(document.connections, start=1):
path = f"/System/Connections/Connection[{index}]"
@@ -707,6 +710,19 @@ def _validate_connections(
connection.line,
)
)
first_endpoint, second_endpoint = (item[0] for item in resolved_endpoints)
supply_issue = port_supply_issue(
first_port, second_port,
f"{first_endpoint.component}.{first_endpoint.port}",
f"{second_endpoint.component}.{second_endpoint.port}",
)
if supply_issue:
issues.append(_semantic_issue(supply_issue.code, supply_issue.message,
path, connection.line))
if first_port.kind == 'physical':
a, b = first_endpoint.key, second_endpoint.key
supply_ports[a], supply_ports[b] = first_port, second_port
supply_adjacency[a], supply_adjacency[b] = b, a
if first_port.kind == "signal" and {
first_port.nominal_role,
second_port.nominal_role,
@@ -725,6 +741,7 @@ def _validate_connections(
if spec is None:
continue
for port in _active_registered_ports(component):
supply_ports[component.id, port.name] = port
if (component.id, port.name) not in referenced_ports:
issues.append(
_semantic_issue(
@@ -736,6 +753,12 @@ def _validate_connections(
)
)
for issue in reference_supply_issues(supply_ports, supply_adjacency):
component_id = issue.endpoint[0] if issue.endpoint else ''
issues.append(_semantic_issue(issue.code, issue.message,
f"/System/Components/Component[@id='{component_id}']",
None))
def _validate_amesim_medium_references(
document: SystemXmlDocument,