proper modelica text model editing

This commit is contained in:
2026-07-21 17:16:06 +02:00
parent 2f6487e510
commit 48ac9e2f59
13 changed files with 557 additions and 58 deletions

View File

@@ -165,7 +165,9 @@
"implementation": {
"kind": "text",
"source": {
"equations": "y = v;"
"equations": "y = v;",
"declarations": "",
"initialEquations": ""
}
}
},
@@ -270,7 +272,9 @@
"implementation": {
"kind": "text",
"source": {
"equations": "y = k*u;"
"equations": "y = k*u;",
"declarations": "",
"initialEquations": ""
}
}
},
@@ -377,7 +381,9 @@
"implementation": {
"kind": "text",
"source": {
"equations": "y = v+sin(10*time);"
"equations": "y = v+sin(10*time);",
"declarations": "",
"initialEquations": ""
}
}
},
@@ -482,7 +488,9 @@
"implementation": {
"kind": "text",
"source": {
"equations": "y = k*u;"
"equations": "y = k*u;",
"declarations": "",
"initialEquations": ""
}
}
},
@@ -579,7 +587,255 @@
"implementation": {
"kind": "text",
"source": {
"equations": "y = sum(u[i] for i in 1:$u_N$ );"
"equations": "y = sum(u[i] for i in 1:$u_N$ );",
"declarations": "",
"initialEquations": ""
}
}
},
{
"id": "78c8fcb6-bd46-4b85-aa91-3276a8d1e8cb",
"name": "Integrate0",
"position": {
"x": 224.0,
"y": -96.0
},
"rotation": 0.0,
"interface": {
"inputs": [
{
"id": "port-df34ce84",
"name": "u",
"position": {
"x": 0.0,
"y": 0.0
},
"properties": {
"iconPosition": {
"x": 64.0,
"y": 64.0
}
},
"type": "signal",
"multipleConnections": false
}
],
"outputs": [
{
"id": "port-fe9e6486",
"name": "y",
"position": {
"x": 0.0,
"y": 0.0
},
"properties": {
"iconPosition": {
"x": 88.0,
"y": 40.0
}
},
"type": "signal",
"multipleConnections": false
}
]
},
"parameters": [
{
"id": "parameter-61a43a86",
"name": "y_start",
"type": "real",
"value": "0"
}
],
"icon": {
"shape": "rectangle",
"fill": "#f4f4f4",
"border": "#303030",
"text": "Text",
"size": {
"width": 128.0,
"height": 128.0
},
"elements": [
{
"cornerRadius": 5.0,
"fill": "#f4f4f4",
"height": 64.0,
"lineStyle": "solid",
"lineWidth": 1.5,
"stroke": "#303030",
"type": "rectangle",
"width": 64.0,
"x": 32.0,
"y": 32.0
},
{
"color": "#00007f",
"fill": "#ffffff",
"fontSize": 24.0,
"height": 48.0,
"lineStyle": "solid",
"lineWidth": 1.5,
"stroke": "#00007f",
"text": "dt",
"type": "text",
"width": 48.0,
"x": 48.0,
"y": 40.0
},
{
"type": "text",
"x": 32.0,
"y": 32.0,
"width": 32.0,
"height": 56.0,
"fill": "none",
"stroke": "#00007f",
"lineWidth": 1.5,
"lineStyle": "none",
"text": "\u222b",
"fontSize": 35.0,
"color": "#00007f"
}
]
},
"properties": {
"showName": true
},
"library": {
"showSubtree": true
},
"implementation": {
"kind": "text",
"source": {
"equations": "der(y) = u;",
"declarations": "",
"initialEquations": "y = y_start;"
}
}
},
{
"id": "f2caf59f-5688-46b4-b17d-bdc911580d7b",
"name": "Differentiate0",
"position": {
"x": 224.0,
"y": 32.0
},
"rotation": 0.0,
"interface": {
"inputs": [
{
"id": "port-df34ce84",
"name": "u",
"position": {
"x": 0.0,
"y": 0.0
},
"properties": {
"iconPosition": {
"x": 64.0,
"y": 64.0
}
},
"type": "signal",
"multipleConnections": false
}
],
"outputs": [
{
"id": "port-fe9e6486",
"name": "y",
"position": {
"x": 0.0,
"y": 0.0
},
"properties": {
"iconPosition": {
"x": 88.0,
"y": 40.0
}
},
"type": "signal",
"multipleConnections": false
}
]
},
"parameters": [
{
"id": "parameter-61a43a86",
"name": "x_start",
"type": "real",
"value": "0"
},
{
"id": "parameter-d110667b",
"name": "y_start",
"type": "real",
"value": "0"
},
{
"id": "parameter-873b503d",
"name": "k",
"type": "real",
"value": "1"
},
{
"id": "parameter-a55752c7",
"name": "T",
"type": "real",
"value": "0.01"
}
],
"icon": {
"shape": "rectangle",
"fill": "#f4f4f4",
"border": "#303030",
"text": "Text",
"size": {
"width": 128.0,
"height": 128.0
},
"elements": [
{
"cornerRadius": 5.0,
"fill": "#f4f4f4",
"height": 64.0,
"lineStyle": "solid",
"lineWidth": 1.5,
"stroke": "#303030",
"type": "rectangle",
"width": 64.0,
"x": 32.0,
"y": 32.0
},
{
"color": "#00007f",
"fill": "#ffffff",
"fontSize": 22.0,
"height": 48.0,
"lineStyle": "solid",
"lineWidth": 1.5,
"stroke": "#00007f",
"text": "d/dt",
"type": "text",
"width": 64.0,
"x": 32.0,
"y": 40.0
}
]
},
"properties": {
"showName": true
},
"library": {
"showSubtree": true
},
"implementation": {
"kind": "text",
"source": {
"equations": "assert(T > 0, \"Differentiate time constant T must be positive\");\n\nder(x) = (u - x)/T;\ny = (k/T)*(u - x);",
"declarations": "Real x(start=x_start);",
"initialEquations": "y = y_start;"
}
}
}
@@ -644,6 +900,41 @@
"properties": {
"waypoints": []
}
},
{
"id": "33e15cc2-7f33-469e-91a8-921c04f6b823",
"source": {
"block": "59bb51be-8185-4b0b-a894-e38db61aff18",
"port": "port-a2f0dea6"
},
"target": {
"block": "78c8fcb6-bd46-4b85-aa91-3276a8d1e8cb",
"port": "port-df34ce84"
},
"name": "",
"properties": {
"waypoints": []
}
},
{
"id": "26e10b34-f168-4492-b4f2-fb46d8a4aafa",
"source": {
"block": "59bb51be-8185-4b0b-a894-e38db61aff18",
"port": "port-a2f0dea6"
},
"target": {
"block": "f2caf59f-5688-46b4-b17d-bdc911580d7b",
"port": "port-df34ce84"
},
"name": "",
"properties": {
"waypoints": [
{
"x": 160.0,
"y": 96.0
}
]
}
}
],
"annotations": [],