完善建模交互、组件图标与系统协议
This commit is contained in:
1 parent
456c29b3b6
commit
6572defaa4
66 files changed
+10067
-4163
No files matched your search
@@ -91,8 +91,10 @@ class SimulationNetwork:
|
||||
) -> Connection:
|
||||
endpoint_a = Endpoint(endpoint_a_component, endpoint_a_port)
|
||||
endpoint_b = Endpoint(endpoint_b_component, endpoint_b_port)
|
||||
if endpoint_a == endpoint_b:
|
||||
raise ValueError(f"Cannot connect endpoint {endpoint_a} to itself.")
|
||||
if endpoint_a.component == endpoint_b.component:
|
||||
raise ValueError(
|
||||
f"Cannot connect component {endpoint_a.component} to itself."
|
||||
)
|
||||
|
||||
first_port = self._port_for(endpoint_a)
|
||||
second_port = self._port_for(endpoint_b)
|
||||
@@ -131,6 +133,16 @@ class SimulationNetwork:
|
||||
+ ", ".join(occupied)
|
||||
+ ". Use a junction component for branching."
|
||||
)
|
||||
else:
|
||||
signal_input = (
|
||||
endpoint_a
|
||||
if first_definition.nominal_role == "input"
|
||||
else endpoint_b
|
||||
)
|
||||
if signal_input in occupied_endpoints:
|
||||
raise ValueError(
|
||||
f"Signal input {signal_input} already has a driver."
|
||||
)
|
||||
|
||||
if first_definition.kind == "physical" and endpoint_b.key < endpoint_a.key:
|
||||
endpoint_a, endpoint_b = endpoint_b, endpoint_a
|
||||
|
||||
Reference in new issue
Block a user