causality inference done

This commit is contained in:
2026-07-22 18:04:07 +02:00
parent 32154386e8
commit c918a6a428
13 changed files with 911 additions and 59 deletions

View File

@@ -216,7 +216,7 @@
"description": "",
"orientation": "indifferent",
"domain": "power",
"causality": "indifferent"
"causality": "single flow in"
}
]
},
@@ -451,11 +451,431 @@
"initialEquations": ""
}
}
},
{
"id": "140ae14b-9dbb-4756-aa25-29101ef2a99e",
"name": "0",
"position": {
"x": -96.0,
"y": -32.0
},
"rotation": 0.0,
"interface": {
"ports": [
{
"id": "port-3e53bf80",
"name": "p",
"position": {
"x": 0.0,
"y": 0.0
},
"properties": {
"iconPosition": {
"x": 64.0,
"y": 64.0
}
},
"type": "power",
"multipleConnections": true,
"valueType": "real",
"quantity": "",
"unit": "",
"dimensions": {
"rows": 1,
"columns": 1
},
"description": "",
"orientation": "indifferent",
"domain": "power",
"causality": "single effort in"
}
]
},
"parameters": [],
"icon": {
"shape": "rectangle",
"fill": "#f4f4f4",
"border": "#303030",
"text": "Text",
"size": {
"width": 128.0,
"height": 128.0
},
"elements": [
{
"type": "text",
"x": 40.0,
"y": 40.0,
"width": 48.0,
"height": 48.0,
"text": "0",
"color": "#303030",
"fontSize": 32.0,
"lineStyle": "solid",
"lineWidth": 1.5,
"stroke": "#303030",
"fill": "#ffffff"
}
]
},
"properties": {
"showName": false
},
"library": {
"showSubtree": true
},
"implementation": {
"kind": "text",
"source": {
"equations": "effort = p[1].e;\nsum(p[i].f for i in 1:$p_N$) = 0;\nfor i in 2:$p_N$ loop\n p[i].e = p[i-1].e;\nend for;",
"declarations": "Real effort;",
"initialEquations": ""
}
}
},
{
"id": "6a6fbadd-28ec-4d10-b854-876752a6b287",
"name": "C0",
"position": {
"x": -96.0,
"y": 96.0
},
"rotation": 0.0,
"interface": {
"ports": [
{
"id": "port-2e1d884f",
"name": "p",
"position": {
"x": 0.0,
"y": 0.0
},
"properties": {
"iconPosition": {
"x": 64.0,
"y": 64.0
}
},
"type": "power",
"multipleConnections": false,
"valueType": "real",
"quantity": "",
"unit": "",
"dimensions": {
"rows": 1,
"columns": 1
},
"description": "",
"orientation": "input",
"domain": "power",
"causality": "preferred effort out"
},
{
"id": "port-ca7716d5",
"name": "state",
"position": {
"x": 0.0,
"y": 0.0
},
"properties": {
"iconPosition": {
"x": 88.0,
"y": 40.0
}
},
"type": "signal",
"multipleConnections": false,
"valueType": "real",
"quantity": "",
"unit": "",
"dimensions": {
"rows": 1,
"columns": 1
},
"description": "",
"orientation": "output",
"domain": "power",
"causality": "indifferent"
}
]
},
"parameters": [
{
"id": "parameter-d056bc27",
"name": "c",
"type": "real",
"value": "1",
"quantity": "",
"unit": "",
"dimensions": {
"rows": 1,
"columns": 1
},
"description": ""
}
],
"icon": {
"shape": "rectangle",
"fill": "#f4f4f4",
"border": "#303030",
"text": "Text",
"size": {
"width": 128.0,
"height": 128.0
},
"elements": [
{
"type": "text",
"x": 40.0,
"y": 40.0,
"width": 48.0,
"height": 48.0,
"text": "C",
"color": "#303030",
"fontSize": 32.0,
"lineStyle": "solid",
"lineWidth": 1.5,
"stroke": "#303030",
"fill": "#ffffff"
}
]
},
"properties": {
"showName": false
},
"library": {
"showSubtree": true
},
"implementation": {
"kind": "text",
"source": {
"equations": "der(state) = p.f;\np.e = state/c;",
"declarations": "",
"initialEquations": ""
}
}
},
{
"id": "9c1aa152-f9fb-459a-9911-e90dd5a9beb3",
"name": "R0",
"position": {
"x": 32.0,
"y": -32.0
},
"rotation": 0.0,
"interface": {
"ports": [
{
"id": "port-2e1d884f",
"name": "p",
"position": {
"x": 0.0,
"y": 0.0
},
"properties": {
"iconPosition": {
"x": 64.0,
"y": 64.0
}
},
"type": "power",
"multipleConnections": false,
"valueType": "real",
"quantity": "",
"unit": "",
"dimensions": {
"rows": 1,
"columns": 1
},
"description": "",
"orientation": "input",
"domain": "power",
"causality": "indifferent"
}
]
},
"parameters": [
{
"id": "parameter-d056bc27",
"name": "r",
"type": "real",
"value": "1",
"quantity": "",
"unit": "",
"dimensions": {
"rows": 1,
"columns": 1
},
"description": ""
}
],
"icon": {
"shape": "rectangle",
"fill": "#f4f4f4",
"border": "#303030",
"text": "Text",
"size": {
"width": 128.0,
"height": 128.0
},
"elements": [
{
"type": "text",
"x": 40.0,
"y": 40.0,
"width": 48.0,
"height": 48.0,
"text": "R",
"color": "#303030",
"fontSize": 32.0,
"lineStyle": "solid",
"lineWidth": 1.5,
"stroke": "#303030",
"fill": "#ffffff"
}
]
},
"properties": {
"showName": false
},
"library": {
"showSubtree": true
},
"implementation": {
"kind": "text",
"source": {
"equations": "p.e = r*p.f;",
"declarations": "",
"initialEquations": ""
}
}
},
{
"id": "f37555f8-8a8b-455a-bd6d-a71343a23002",
"name": "I",
"position": {
"x": -224.0,
"y": -32.0
},
"rotation": 0.0,
"interface": {
"ports": [
{
"id": "port-2e1d884f",
"name": "p",
"position": {
"x": 0.0,
"y": 0.0
},
"properties": {
"iconPosition": {
"x": 64.0,
"y": 64.0
}
},
"type": "power",
"multipleConnections": false,
"valueType": "real",
"quantity": "",
"unit": "",
"dimensions": {
"rows": 1,
"columns": 1
},
"description": "",
"orientation": "input",
"domain": "power",
"causality": "preferred flow out"
},
{
"id": "port-ca7716d5",
"name": "state",
"position": {
"x": 0.0,
"y": 0.0
},
"properties": {
"iconPosition": {
"x": 88.0,
"y": 40.0
}
},
"type": "signal",
"multipleConnections": false,
"valueType": "real",
"quantity": "",
"unit": "",
"dimensions": {
"rows": 1,
"columns": 1
},
"description": "",
"orientation": "output",
"domain": "power",
"causality": "indifferent"
}
]
},
"parameters": [
{
"id": "parameter-d056bc27",
"name": "i",
"type": "real",
"value": "1",
"quantity": "",
"unit": "",
"dimensions": {
"rows": 1,
"columns": 1
},
"description": ""
}
],
"icon": {
"shape": "rectangle",
"fill": "#f4f4f4",
"border": "#303030",
"text": "Text",
"size": {
"width": 128.0,
"height": 128.0
},
"elements": [
{
"type": "text",
"x": 40.0,
"y": 40.0,
"width": 48.0,
"height": 48.0,
"text": "I",
"color": "#303030",
"fontSize": 32.0,
"lineStyle": "solid",
"lineWidth": 1.5,
"stroke": "#303030",
"fill": "#ffffff"
}
]
},
"properties": {
"showName": false
},
"library": {
"showSubtree": true
},
"implementation": {
"kind": "text",
"source": {
"equations": "der(state) = p.e;\np.f = state/i;",
"declarations": "",
"initialEquations": ""
}
}
}
],
"connections": [
{
"id": "4b09ba21-baa0-4db7-9431-4c919478bce4",
"id": "55c04603-2ae5-44d2-b3f3-493a73e88d73",
"source": {
"block": "063a6341-cb18-4bfe-a1e4-00957a88a874",
"port": "port-2e1d884f"
@@ -469,16 +889,16 @@
"waypoints": []
},
"type": "power",
"causality": "none"
"causality": "target"
},
{
"id": "a73a99a1-54e2-461d-a9a7-2d6d11d500f4",
"id": "5e7f801a-eb4a-46d2-9279-b4e81e1e011b",
"source": {
"block": "bfa506d8-ee41-4bab-ae19-a97fd67bfcf6",
"block": "140ae14b-9dbb-4756-aa25-29101ef2a99e",
"port": "port-3e53bf80"
},
"target": {
"block": "ea95e8ee-7f2d-4e14-a65d-d56bec5b4eb2",
"block": "9c1aa152-f9fb-459a-9911-e90dd5a9beb3",
"port": "port-2e1d884f"
},
"name": "",
@@ -486,10 +906,27 @@
"waypoints": []
},
"type": "power",
"causality": "none"
"causality": "target"
},
{
"id": "dd5fb1e2-b125-4b5f-a792-dac89dd89ad3",
"id": "ae95fbfc-c771-47f2-8f9e-1c823daaf6b8",
"source": {
"block": "140ae14b-9dbb-4756-aa25-29101ef2a99e",
"port": "port-3e53bf80"
},
"target": {
"block": "6a6fbadd-28ec-4d10-b854-876752a6b287",
"port": "port-2e1d884f"
},
"name": "",
"properties": {
"waypoints": []
},
"type": "power",
"causality": "source"
},
{
"id": "45886c5b-8dec-4212-b13d-1f2996710a6b",
"source": {
"block": "bfa506d8-ee41-4bab-ae19-a97fd67bfcf6",
"port": "port-3e53bf80"
@@ -503,7 +940,58 @@
"waypoints": []
},
"type": "power",
"causality": "none"
"causality": "source"
},
{
"id": "476a20b4-ff02-4186-ac09-53f91ed06fcd",
"source": {
"block": "bfa506d8-ee41-4bab-ae19-a97fd67bfcf6",
"port": "port-3e53bf80"
},
"target": {
"block": "ea95e8ee-7f2d-4e14-a65d-d56bec5b4eb2",
"port": "port-2e1d884f"
},
"name": "",
"properties": {
"waypoints": []
},
"type": "power",
"causality": "target"
},
{
"id": "48b58a43-4d83-43ec-b502-1ff038445696",
"source": {
"block": "140ae14b-9dbb-4756-aa25-29101ef2a99e",
"port": "port-3e53bf80"
},
"target": {
"block": "f37555f8-8a8b-455a-bd6d-a71343a23002",
"port": "port-2e1d884f"
},
"name": "",
"properties": {
"waypoints": []
},
"type": "power",
"causality": "target"
},
{
"id": "d6940de3-5b4c-42be-a247-639b3803d85e",
"source": {
"block": "bfa506d8-ee41-4bab-ae19-a97fd67bfcf6",
"port": "port-3e53bf80"
},
"target": {
"block": "140ae14b-9dbb-4756-aa25-29101ef2a99e",
"port": "port-3e53bf80"
},
"name": "",
"properties": {
"waypoints": []
},
"type": "power",
"causality": "source"
}
],
"annotations": [],