From d42ce6d35b7bff6c93eecf60d2f0d8d8c8031e23 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Aug 2025 14:27:37 -0400 Subject: [PATCH 1/3] chaned golder name + removed from gitignore --- .gitignore | 4 - .../arc_cycle.json | 0 {saved_graphs => example_graphs}/baby.json | 0 .../demo_pid_fixed.json | 352 +++++++++--------- .../harmonic_oscillator.json | 0 .../linear_feedback.json | 0 saved_graphs/.gitkeep | 0 saved_graphs/default cycle.json | 134 ------- saved_graphs/example_scope.json | 156 -------- saved_graphs/example_source.json | 293 --------------- saved_graphs/festim_example.json | 208 ----------- saved_graphs/function_demo.json | 195 ---------- saved_graphs/sample 1.json | 177 --------- saved_graphs/test.json | 98 ----- saved_graphs/test3.json | 135 ------- 15 files changed, 180 insertions(+), 1572 deletions(-) rename {saved_graphs => example_graphs}/arc_cycle.json (100%) rename {saved_graphs => example_graphs}/baby.json (100%) rename saved_graphs/demo_pid.json => example_graphs/demo_pid_fixed.json (51%) rename {saved_graphs => example_graphs}/harmonic_oscillator.json (100%) rename {saved_graphs => example_graphs}/linear_feedback.json (100%) delete mode 100644 saved_graphs/.gitkeep delete mode 100644 saved_graphs/default cycle.json delete mode 100644 saved_graphs/example_scope.json delete mode 100644 saved_graphs/example_source.json delete mode 100644 saved_graphs/festim_example.json delete mode 100644 saved_graphs/function_demo.json delete mode 100644 saved_graphs/sample 1.json delete mode 100644 saved_graphs/test.json delete mode 100644 saved_graphs/test3.json diff --git a/.gitignore b/.gitignore index 67bb55a1..62619fe6 100644 --- a/.gitignore +++ b/.gitignore @@ -27,7 +27,3 @@ venv/ docs/_build -# Ignore contents of saved_graphs folder -saved_graphs/* -!saved_graphs/.gitkeep - diff --git a/saved_graphs/arc_cycle.json b/example_graphs/arc_cycle.json similarity index 100% rename from saved_graphs/arc_cycle.json rename to example_graphs/arc_cycle.json diff --git a/saved_graphs/baby.json b/example_graphs/baby.json similarity index 100% rename from saved_graphs/baby.json rename to example_graphs/baby.json diff --git a/saved_graphs/demo_pid.json b/example_graphs/demo_pid_fixed.json similarity index 51% rename from saved_graphs/demo_pid.json rename to example_graphs/demo_pid_fixed.json index 76e96c4a..629aa248 100644 --- a/saved_graphs/demo_pid.json +++ b/example_graphs/demo_pid_fixed.json @@ -9,8 +9,8 @@ "dragging": false, "id": "reference", "measured": { - "height": 54, - "width": 206 + "height": 120, + "width": 120 }, "position": { "x": 50, @@ -30,252 +30,229 @@ "width": 64 }, "position": { - "x": 237, - "y": 238 + "x": 225, + "y": 223 }, "selected": false, "type": "adder" }, { "data": { - "Kp": "1.5", - "Ki": "0.5", - "Kd": "0.1", - "f_max": "10", - "label": "PID Controller" + "gain": "0.4", + "label": "Feedback Gain" }, "dragging": false, - "id": "pid_controller", + "id": "feedback_gain", "measured": { - "height": 48, - "width": 200 + "height": 80, + "width": 90 }, "position": { - "x": 384, - "y": 89 + "x": 416, + "y": 445 }, - "selected": true, - "type": "pid" + "selected": false, + "type": "amplifier" }, { "data": { - "initial_value": "0", - "label": "Plant (Process)" + "gain": "-1", + "label": "x -1" }, "dragging": false, - "id": "plant", + "id": "minus_one", "measured": { - "height": 48, - "width": 200 + "height": 80, + "width": 90 }, "position": { - "x": 662, - "y": 90 + "x": 598, + "y": 382 }, "selected": false, - "type": "integrator" + "type": "amplifier" }, { + "id": "1", + "type": "integrator", + "position": { + "x": 657, + "y": 101 + }, "data": { - "label": "Output Scope", - "timespan": "20" + "label": "integrator 1", + "initial_value": "", + "reset_times": "" }, - "dragging": false, - "id": "output_scope", "measured": { - "height": 120, - "width": 200 - }, - "position": { - "x": 1038, - "y": 131 + "width": 200, + "height": 48 }, "selected": false, - "type": "scope" + "dragging": false }, { + "id": "2", + "type": "scope", + "position": { + "x": 1084, + "y": 158 + }, "data": { - "gain": "0.4", - "label": "Feedback Gain" + "label": "scope 2" }, - "dragging": false, - "id": "feedback_gain", "measured": { - "height": 86, - "width": 136 - }, - "position": { - "x": 375, - "y": 432 + "width": 120, + "height": 140 }, "selected": false, - "type": "amplifier" + "dragging": false }, { + "id": "3", + "type": "pid", + "position": { + "x": 392, + "y": 116 + }, "data": { - "gain": "-1", - "label": "x -1" + "label": "pid 3", + "Kp": "1.5", + "Ki": "0.5", + "Kd": "0.1", + "f_max": "10" }, - "dragging": false, - "id": "minus_one", "measured": { - "height": 86, - "width": 136 - }, - "position": { - "x": 606, - "y": 390 + "width": 200, + "height": 48 }, "selected": false, - "type": "amplifier" + "dragging": false } ], "edges": [ { - "data": { - "weight": 0.5 - }, - "id": "e-reference-error_summer", - "markerEnd": { - "color": "#ECDFCC", - "height": 20, - "type": "arrowclosed", - "width": 20 - }, - "selected": false, + "id": "ereference-error_summer", "source": "reference", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, "target": "error_summer", - "type": "smoothstep" - }, - { - "data": { - "weight": 0.5 + "sourceHandle": null, + "targetHandle": null, + "type": "smoothstep", + "data": {}, + "style": { + "strokeWidth": 2, + "stroke": "#ECDFCC" }, - "id": "e-error_summer-pid_controller", "markerEnd": { - "color": "#ECDFCC", - "height": 20, "type": "arrowclosed", - "width": 20 - }, - "selected": false, - "source": "error_summer", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, - "target": "pid_controller", - "type": "smoothstep" + "width": 20, + "height": 20, + "color": "#ECDFCC" + } }, { - "data": { - "weight": 1 + "id": "eerror_summer-3", + "source": "error_summer", + "target": "3", + "sourceHandle": null, + "targetHandle": null, + "type": "smoothstep", + "data": {}, + "style": { + "strokeWidth": 2, + "stroke": "#ECDFCC" }, - "id": "e-plant-feedback_gain", "markerEnd": { - "color": "#ECDFCC", - "height": 20, "type": "arrowclosed", - "width": 20 - }, - "selected": false, - "source": "plant", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, - "target": "feedback_gain", - "type": "smoothstep" + "width": 20, + "height": 20, + "color": "#ECDFCC" + } }, { - "data": { - "weight": 0.5 + "id": "e3-1", + "source": "3", + "target": "1", + "sourceHandle": null, + "targetHandle": null, + "type": "smoothstep", + "data": {}, + "style": { + "strokeWidth": 2, + "stroke": "#ECDFCC" }, - "id": "ereference-output_scope", "markerEnd": { - "color": "#ECDFCC", - "height": 20, "type": "arrowclosed", - "width": 20 - }, - "source": "reference", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, - "target": "output_scope", - "type": "smoothstep", - "selected": false + "width": 20, + "height": 20, + "color": "#ECDFCC" + } }, { - "data": { - "weight": 1 + "id": "e1-2", + "source": "1", + "target": "2", + "sourceHandle": null, + "targetHandle": null, + "type": "smoothstep", + "data": {}, + "style": { + "strokeWidth": 2, + "stroke": "#ECDFCC" }, - "id": "epid_controller-plant", "markerEnd": { - "color": "#ECDFCC", - "height": 20, "type": "arrowclosed", - "width": 20 - }, - "source": "pid_controller", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, - "target": "plant", - "type": "smoothstep" + "width": 20, + "height": 20, + "color": "#ECDFCC" + } }, { - "data": { - "weight": 0.5 - }, "id": "efeedback_gain-minus_one", - "markerEnd": { - "color": "#ECDFCC", - "height": 20, - "type": "arrowclosed", - "width": 20 - }, "source": "feedback_gain", + "target": "minus_one", + "sourceHandle": null, + "targetHandle": null, + "type": "smoothstep", + "data": {}, "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 + "strokeWidth": 2, + "stroke": "#ECDFCC" }, - "target": "minus_one", - "type": "smoothstep" + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20, + "color": "#ECDFCC" + } }, { - "data": { - "weight": 0.5 - }, "id": "eminus_one-error_summer", - "markerEnd": { - "color": "#ECDFCC", - "height": 20, - "type": "arrowclosed", - "width": 20 - }, "source": "minus_one", + "target": "error_summer", + "sourceHandle": null, + "targetHandle": null, + "type": "smoothstep", + "data": {}, "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 + "strokeWidth": 2, + "stroke": "#ECDFCC" }, - "target": "error_summer", - "type": "smoothstep" + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20, + "color": "#ECDFCC" + } }, { - "id": "eerror_summer-output_scope", - "source": "error_summer", - "target": "output_scope", + "id": "e1-feedback_gain", + "source": "1", + "target": "feedback_gain", + "sourceHandle": null, + "targetHandle": null, "type": "smoothstep", - "data": { - "weight": 0.5 - }, + "data": {}, "style": { "strokeWidth": 2, "stroke": "#ECDFCC" @@ -289,13 +266,32 @@ "selected": false }, { - "id": "efeedback_gain-output_scope", - "source": "feedback_gain", - "target": "output_scope", + "id": "ereference-2", + "source": "reference", + "target": "2", + "sourceHandle": null, + "targetHandle": null, "type": "smoothstep", - "data": { - "weight": 0.5 + "data": {}, + "style": { + "strokeWidth": 2, + "stroke": "#ECDFCC" }, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20, + "color": "#ECDFCC" + } + }, + { + "id": "eerror_summer-2", + "source": "error_summer", + "target": "2", + "sourceHandle": null, + "targetHandle": null, + "type": "smoothstep", + "data": {}, "style": { "strokeWidth": 2, "stroke": "#ECDFCC" @@ -308,5 +304,17 @@ } } ], - "nodeCounter": 1 + "nodeCounter": 4, + "solverParams": { + "dt": "0.01", + "dt_min": "1e-6", + "dt_max": "1.0", + "Solver": "SSPRK22", + "tolerance_fpi": "1e-6", + "iterations_max": "100", + "log": "true", + "simulation_duration": "50.0", + "extra_params": "{}" + }, + "globalVariables": [] } \ No newline at end of file diff --git a/saved_graphs/harmonic_oscillator.json b/example_graphs/harmonic_oscillator.json similarity index 100% rename from saved_graphs/harmonic_oscillator.json rename to example_graphs/harmonic_oscillator.json diff --git a/saved_graphs/linear_feedback.json b/example_graphs/linear_feedback.json similarity index 100% rename from saved_graphs/linear_feedback.json rename to example_graphs/linear_feedback.json diff --git a/saved_graphs/.gitkeep b/saved_graphs/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/saved_graphs/default cycle.json b/saved_graphs/default cycle.json deleted file mode 100644 index e8d4fad2..00000000 --- a/saved_graphs/default cycle.json +++ /dev/null @@ -1,134 +0,0 @@ -{ - "nodes": [ - { - "id": "1", - "type": "process", - "position": { - "x": 300, - "y": 100 - }, - "data": { - "label": "Storage" - }, - "measured": { - "width": 200, - "height": 48 - } - }, - { - "id": "2", - "type": "process", - "position": { - "x": 750, - "y": 104 - }, - "data": { - "label": "Plasma" - }, - "measured": { - "width": 200, - "height": 48 - }, - "selected": false, - "dragging": false - }, - { - "id": "3", - "type": "process", - "position": { - "x": 300, - "y": 250 - }, - "data": { - "label": "Tritium Extraction System" - }, - "measured": { - "width": 200, - "height": 72 - } - }, - { - "id": "4", - "type": "process", - "position": { - "x": 757, - "y": 250 - }, - "data": { - "label": "Breeding Blanket" - }, - "measured": { - "width": 200, - "height": 48 - }, - "selected": true, - "dragging": false - } - ], - "edges": [ - { - "id": "e1-2", - "source": "1", - "target": "2", - "type": "smoothstep", - "style": { - "strokeWidth": 2, - "stroke": "#ECDFCC" - }, - "markerEnd": { - "type": "arrowclosed", - "width": 20, - "height": 20, - "color": "#ECDFCC" - } - }, - { - "id": "e3-1", - "source": "3", - "target": "1", - "type": "smoothstep", - "style": { - "strokeWidth": 2, - "stroke": "#ECDFCC" - }, - "markerEnd": { - "type": "arrowclosed", - "width": 20, - "height": 20, - "color": "#ECDFCC" - } - }, - { - "id": "e4-3", - "source": "4", - "target": "3", - "type": "smoothstep", - "style": { - "strokeWidth": 2, - "stroke": "#ECDFCC" - }, - "markerEnd": { - "type": "arrowclosed", - "width": 20, - "height": 20, - "color": "#ECDFCC" - } - }, - { - "id": "e2-4", - "source": "2", - "target": "4", - "type": "smoothstep", - "style": { - "strokeWidth": 2, - "stroke": "#ECDFCC" - }, - "markerEnd": { - "type": "arrowclosed", - "width": 20, - "height": 20, - "color": "#ECDFCC" - } - } - ] -} \ No newline at end of file diff --git a/saved_graphs/example_scope.json b/saved_graphs/example_scope.json deleted file mode 100644 index 488bf47b..00000000 --- a/saved_graphs/example_scope.json +++ /dev/null @@ -1,156 +0,0 @@ -{ - "nodes": [ - { - "data": { - "initial_value": "10", - "label": "Node 0", - "residence_time": "2", - "source_term": "" - }, - "id": "0", - "measured": { - "height": 48, - "width": 200 - }, - "position": { - "x": 200, - "y": 200 - }, - "type": "process" - }, - { - "data": { - "initial_value": "", - "label": "Node 1", - "residence_time": "", - "source_term": "" - }, - "dragging": false, - "id": "1", - "measured": { - "height": 48, - "width": 200 - }, - "position": { - "x": 359, - "y": 429 - }, - "selected": true, - "type": "process" - }, - { - "data": { - "label": "Scope" - }, - "dragging": false, - "id": "2", - "measured": { - "height": 120, - "width": 200 - }, - "position": { - "x": 673, - "y": 226 - }, - "selected": false, - "type": "scope" - }, - { - "data": { - "label": "Scope2" - }, - "dragging": false, - "id": "3", - "measured": { - "height": 120, - "width": 200 - }, - "position": { - "x": 671, - "y": 570 - }, - "selected": false, - "type": "scope" - } - ], - "edges": [ - { - "data": { - "weight": 0.3333333333333333 - }, - "id": "e0-1", - "markerEnd": { - "color": "#ECDFCC", - "height": 20, - "type": "arrowclosed", - "width": 20 - }, - "source": "0", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, - "target": "1", - "type": "smoothstep" - }, - { - "id": "e0-2", - "source": "0", - "target": "2", - "type": "smoothstep", - "data": { - "weight": 0.3333333333333333 - }, - "style": { - "strokeWidth": 2, - "stroke": "#ECDFCC" - }, - "markerEnd": { - "type": "arrowclosed", - "width": 20, - "height": 20, - "color": "#ECDFCC" - } - }, - { - "id": "e0-3", - "source": "0", - "target": "3", - "type": "smoothstep", - "data": { - "weight": 0.3333333333333333 - }, - "style": { - "strokeWidth": 2, - "stroke": "#ECDFCC" - }, - "markerEnd": { - "type": "arrowclosed", - "width": 20, - "height": 20, - "color": "#ECDFCC" - }, - "selected": false - }, - { - "id": "e1-2", - "source": "1", - "target": "2", - "type": "smoothstep", - "data": { - "weight": 1 - }, - "style": { - "strokeWidth": 2, - "stroke": "#ECDFCC" - }, - "markerEnd": { - "type": "arrowclosed", - "width": 20, - "height": 20, - "color": "#ECDFCC" - } - } - ], - "nodeCounter": 3 -} \ No newline at end of file diff --git a/saved_graphs/example_source.json b/saved_graphs/example_source.json deleted file mode 100644 index df1c7c13..00000000 --- a/saved_graphs/example_source.json +++ /dev/null @@ -1,293 +0,0 @@ -{ - "nodes": [ - { - "data": { - "initial_value": "1.5", - "label": "Storage", - "residence_time": "", - "source_term": "" - }, - "dragging": false, - "id": "1", - "measured": { - "height": 48, - "width": 200 - }, - "position": { - "x": 302, - "y": 651 - }, - "selected": true, - "type": "process" - }, - { - "data": { - "label": "Source", - "value": "1" - }, - "dragging": false, - "id": "4", - "measured": { - "height": 53, - "width": 205 - }, - "position": { - "x": 454.40000000000003, - "y": 76.19999999999999 - }, - "selected": false, - "type": "source" - }, - { - "data": { - "initial_value": "", - "label": "Breeding blanket", - "residence_time": "2", - "source_term": "" - }, - "dragging": false, - "id": "3", - "measured": { - "height": 48, - "width": 200 - }, - "position": { - "x": 876, - "y": 395 - }, - "selected": false, - "type": "process" - }, - { - "data": { - "gain": "1.05", - "label": "TBR" - }, - "dragging": false, - "id": "5", - "measured": { - "height": 85, - "width": 135 - }, - "position": { - "x": 721, - "y": 178 - }, - "selected": false, - "type": "amplifier" - }, - { - "data": { - "gain": "-1", - "label": "Injection rate" - }, - "dragging": false, - "id": "6", - "measured": { - "height": 85, - "width": 135 - }, - "position": { - "x": 363, - "y": 195 - }, - "selected": false, - "type": "amplifier" - }, - { - "data": { - "gain": "0.9", - "label": "Pump rate" - }, - "dragging": false, - "id": "7", - "measured": { - "height": 85, - "width": 135 - }, - "position": { - "x": 575, - "y": 284 - }, - "selected": false, - "type": "amplifier" - }, - { - "data": { - "initial_value": "", - "label": "Pump", - "residence_time": "1", - "source_term": "" - }, - "dragging": false, - "id": "2", - "measured": { - "height": 48, - "width": 200 - }, - "position": { - "x": 553, - "y": 449 - }, - "selected": false, - "type": "process" - } - ], - "edges": [ - { - "data": { - "weight": 0.3333333333333333 - }, - "id": "e4-5", - "markerEnd": { - "color": "#ECDFCC", - "height": 20, - "type": "arrowclosed", - "width": 20 - }, - "selected": false, - "source": "4", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, - "target": "5", - "type": "smoothstep" - }, - { - "data": { - "weight": 1 - }, - "id": "e5-3", - "markerEnd": { - "color": "#ECDFCC", - "height": 20, - "type": "arrowclosed", - "width": 20 - }, - "source": "5", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, - "target": "3", - "type": "smoothstep" - }, - { - "data": { - "weight": 0.3333333333333333 - }, - "id": "e4-7", - "markerEnd": { - "color": "#ECDFCC", - "height": 20, - "type": "arrowclosed", - "width": 20 - }, - "source": "4", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, - "target": "7", - "type": "smoothstep" - }, - { - "data": { - "weight": 1 - }, - "id": "e7-2", - "markerEnd": { - "color": "#ECDFCC", - "height": 20, - "type": "arrowclosed", - "width": 20 - }, - "source": "7", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, - "target": "2", - "type": "smoothstep" - }, - { - "data": { - "weight": 0.3333333333333333 - }, - "id": "e4-6", - "markerEnd": { - "color": "#ECDFCC", - "height": 20, - "type": "arrowclosed", - "width": 20 - }, - "source": "4", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, - "target": "6", - "type": "smoothstep" - }, - { - "data": { - "weight": 1 - }, - "id": "e6-1", - "markerEnd": { - "color": "#ECDFCC", - "height": 20, - "type": "arrowclosed", - "width": 20 - }, - "source": "6", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, - "target": "1", - "type": "smoothstep" - }, - { - "id": "e3-1", - "source": "3", - "target": "1", - "type": "smoothstep", - "data": { - "weight": 1 - }, - "style": { - "strokeWidth": 2, - "stroke": "#ECDFCC" - }, - "markerEnd": { - "type": "arrowclosed", - "width": 20, - "height": 20, - "color": "#ECDFCC" - }, - "selected": false - }, - { - "id": "e2-1", - "source": "2", - "target": "1", - "type": "smoothstep", - "data": { - "weight": 1 - }, - "style": { - "strokeWidth": 2, - "stroke": "#ECDFCC" - }, - "markerEnd": { - "type": "arrowclosed", - "width": 20, - "height": 20, - "color": "#ECDFCC" - } - } - ], - "nodeCounter": 1 -} \ No newline at end of file diff --git a/saved_graphs/festim_example.json b/saved_graphs/festim_example.json deleted file mode 100644 index b6b0abde..00000000 --- a/saved_graphs/festim_example.json +++ /dev/null @@ -1,208 +0,0 @@ -{ - "nodes": [ - { - "id": "4", - "type": "constant", - "position": { - "x": 1093.1885987981248, - "y": 271.20138523630243 - }, - "data": { - "label": "cL", - "value": "0" - }, - "measured": { - "width": 205, - "height": 53 - }, - "selected": false, - "dragging": false - }, - { - "id": "5", - "type": "scope", - "position": { - "x": 1271, - "y": 457 - }, - "data": { - "label": "scope 5" - }, - "measured": { - "width": 120, - "height": 140 - }, - "selected": false, - "dragging": false - }, - { - "id": "9", - "type": "scope", - "position": { - "x": 967.9637725351604, - "y": 81.60628755860085 - }, - "data": { - "label": "scope 9" - }, - "measured": { - "width": 120, - "height": 140 - }, - "selected": false, - "dragging": false - }, - { - "id": "10", - "type": "stepsource", - "position": { - "x": 589, - "y": 224 - }, - "data": { - "label": "stepsource 10", - "amplitude": "1", - "delay": "0.2" - }, - "measured": { - "width": 120, - "height": 120 - }, - "selected": false, - "dragging": false - }, - { - "id": "12", - "type": "wall", - "position": { - "x": 952, - "y": 417 - }, - "data": { - "label": "wall", - "thickness": "1", - "surface_area": "1", - "temperature": "300", - "D_0": "0.05", - "E_D": "0", - "n_vertices": "100" - }, - "measured": { - "width": 70, - "height": 200 - }, - "selected": true, - "dragging": false - } - ], - "edges": [ - { - "id": "e4-9", - "source": "4", - "target": "9", - "sourceHandle": null, - "targetHandle": null, - "type": "smoothstep", - "data": {}, - "style": { - "strokeWidth": 2, - "stroke": "#ECDFCC" - }, - "markerEnd": { - "type": "arrowclosed", - "width": 20, - "height": 20, - "color": "#ECDFCC" - } - }, - { - "id": "e10-9", - "source": "10", - "target": "9", - "sourceHandle": null, - "targetHandle": null, - "type": "smoothstep", - "data": {}, - "style": { - "strokeWidth": 2, - "stroke": "#ECDFCC" - }, - "markerEnd": { - "type": "arrowclosed", - "width": 20, - "height": 20, - "color": "#ECDFCC" - } - }, - { - "id": "e10-12-to_c_0", - "source": "10", - "target": "12", - "sourceHandle": null, - "targetHandle": "c_0", - "type": "smoothstep", - "data": {}, - "style": { - "strokeWidth": 2, - "stroke": "#ECDFCC" - }, - "markerEnd": { - "type": "arrowclosed", - "width": 20, - "height": 20, - "color": "#ECDFCC" - } - }, - { - "id": "e4-12-to_c_L", - "source": "4", - "target": "12", - "sourceHandle": null, - "targetHandle": "c_L", - "type": "smoothstep", - "data": {}, - "style": { - "strokeWidth": 2, - "stroke": "#ECDFCC" - }, - "markerEnd": { - "type": "arrowclosed", - "width": 20, - "height": 20, - "color": "#ECDFCC" - } - }, - { - "id": "e12-5-from_flux_L", - "source": "12", - "target": "5", - "sourceHandle": "flux_L", - "targetHandle": null, - "type": "smoothstep", - "data": {}, - "style": { - "strokeWidth": 2, - "stroke": "#ECDFCC" - }, - "markerEnd": { - "type": "arrowclosed", - "width": 20, - "height": 20, - "color": "#ECDFCC" - } - } - ], - "nodeCounter": 13, - "solverParams": { - "dt": "0.02", - "dt_min": "1e-6", - "dt_max": "1.0", - "Solver": "SSPRK22", - "tolerance_fpi": "1e-6", - "iterations_max": "100", - "log": "true", - "simulation_duration": "2", - "extra_params": "{}" - }, - "globalVariables": [] -} \ No newline at end of file diff --git a/saved_graphs/function_demo.json b/saved_graphs/function_demo.json deleted file mode 100644 index 915f8c96..00000000 --- a/saved_graphs/function_demo.json +++ /dev/null @@ -1,195 +0,0 @@ -{ - "nodes": [ - { - "data": { - "amplitude": "1", - "delay": "2", - "label": "Step Input" - }, - "dragging": false, - "id": "stepsource1", - "measured": { - "height": 54, - "width": 206 - }, - "position": { - "x": -58, - "y": 282 - }, - "selected": false, - "type": "stepsource" - }, - { - "data": { - "initial_value": "0", - "label": "Integrator" - }, - "dragging": false, - "id": "integrator1", - "measured": { - "height": 48, - "width": 200 - }, - "position": { - "x": 65, - "y": 362 - }, - "selected": false, - "type": "integrator" - }, - { - "data": { - "expression": "cos(x) + 1", - "label": "Function Block : y = cos(x) + 1" - }, - "dragging": false, - "id": "function1", - "measured": { - "height": 72, - "width": 200 - }, - "position": { - "x": 321, - "y": 352 - }, - "selected": false, - "type": "function" - }, - { - "data": { - "initial_value": "", - "label": "Function can only have one input and one output!", - "residence_time": "", - "source_term": "" - }, - "dragging": false, - "id": "2", - "measured": { - "height": 96, - "width": 200 - }, - "position": { - "x": 320, - "y": 488 - }, - "selected": false, - "type": "process" - }, - { - "data": { - "initial_value": "", - "label": "Process", - "residence_time": "", - "source_term": "" - }, - "dragging": false, - "id": "3", - "measured": { - "height": 48, - "width": 200 - }, - "position": { - "x": 558, - "y": 325 - }, - "selected": false, - "type": "process" - }, - { - "data": { - "label": "Scope" - }, - "dragging": false, - "id": "4", - "measured": { - "height": 120, - "width": 200 - }, - "position": { - "x": 804, - "y": 285 - }, - "selected": false, - "type": "scope" - } - ], - "edges": [ - { - "data": { - "weight": 1 - }, - "id": "efunction1-3", - "markerEnd": { - "color": "#ECDFCC", - "height": 20, - "type": "arrowclosed", - "width": 20 - }, - "source": "function1", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, - "target": "3", - "type": "smoothstep" - }, - { - "data": { - "weight": 1 - }, - "id": "estepsource1-integrator1", - "markerEnd": { - "color": "#ECDFCC", - "height": 20, - "type": "arrowclosed", - "width": 20 - }, - "source": "stepsource1", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, - "target": "integrator1", - "type": "smoothstep" - }, - { - "data": { - "weight": 1 - }, - "id": "eintegrator1-function1", - "markerEnd": { - "color": "#ECDFCC", - "height": 20, - "type": "arrowclosed", - "width": 20 - }, - "source": "integrator1", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, - "target": "function1", - "type": "smoothstep" - }, - { - "id": "e3-4", - "source": "3", - "target": "4", - "type": "smoothstep", - "data": { - "weight": 1 - }, - "style": { - "strokeWidth": 2, - "stroke": "#ECDFCC" - }, - "markerEnd": { - "type": "arrowclosed", - "width": 20, - "height": 20, - "color": "#ECDFCC" - } - } - ], - "nodeCounter": 4 -} \ No newline at end of file diff --git a/saved_graphs/sample 1.json b/saved_graphs/sample 1.json deleted file mode 100644 index 123b48a4..00000000 --- a/saved_graphs/sample 1.json +++ /dev/null @@ -1,177 +0,0 @@ -{ - "nodes": [ - { - "data": { - "a": "2", - "b": "3", - "label": "Storage" - }, - "id": "1", - "measured": { - "height": 68, - "width": 200 - }, - "position": { - "x": 300, - "y": 100 - }, - "selected": false, - "type": "process" - }, - { - "data": { - "c": "4", - "label": "Plasma" - }, - "dragging": false, - "id": "2", - "measured": { - "height": 68, - "width": 200 - }, - "position": { - "x": 646, - "y": 86 - }, - "selected": false, - "type": "process" - }, - { - "data": { - "a": "3", - "b": "4", - "label": "Tritium Extraction System" - }, - "id": "3", - "measured": { - "height": 92, - "width": 200 - }, - "position": { - "x": 300, - "y": 250 - }, - "type": "process" - }, - { - "data": { - "a": "3", - "b": "2", - "label": "Breeding Blanket" - }, - "dragging": false, - "id": "4", - "measured": { - "height": 68, - "width": 200 - }, - "position": { - "x": 636, - "y": 305 - }, - "selected": false, - "type": "process" - }, - { - "data": { - "a": "4", - "b": "5", - "label": "new node" - }, - "dragging": false, - "id": "5", - "measured": { - "height": 68, - "width": 200 - }, - "position": { - "x": 814, - "y": 191 - }, - "selected": false, - "type": "process" - } - ], - "edges": [ - { - "id": "e1-2", - "markerEnd": { - "color": "#FF0072", - "height": 20, - "type": "arrowclosed", - "width": 20 - }, - "source": "1", - "style": { - "stroke": "#FF0072", - "strokeWidth": 2 - }, - "target": "2", - "type": "smoothstep" - }, - { - "id": "e3-1", - "markerEnd": { - "color": "#FF0072", - "height": 20, - "type": "arrowclosed", - "width": 20 - }, - "source": "3", - "style": { - "stroke": "#FF0072", - "strokeWidth": 2 - }, - "target": "1", - "type": "smoothstep" - }, - { - "id": "e4-3", - "markerEnd": { - "color": "#FF0072", - "height": 20, - "type": "arrowclosed", - "width": 20 - }, - "source": "4", - "style": { - "stroke": "#FF0072", - "strokeWidth": 2 - }, - "target": "3", - "type": "smoothstep" - }, - { - "id": "e2-4", - "markerEnd": { - "color": "#FF0072", - "height": 20, - "type": "arrowclosed", - "width": 20 - }, - "source": "2", - "style": { - "stroke": "#FF0072", - "strokeWidth": 2 - }, - "target": "4", - "type": "smoothstep" - }, - { - "id": "e2-5", - "markerEnd": { - "color": "#FF0072", - "height": 20, - "type": "arrowclosed", - "width": 20 - }, - "source": "2", - "style": { - "stroke": "#FF0072", - "strokeWidth": 2 - }, - "target": "5", - "type": "smoothstep" - } - ] -} \ No newline at end of file diff --git a/saved_graphs/test.json b/saved_graphs/test.json deleted file mode 100644 index d8865f17..00000000 --- a/saved_graphs/test.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "nodes": [ - { - "id": "1", - "type": "process", - "position": { - "x": 292.4587105571342, - "y": 363.69738918312294 - }, - "data": { - "label": "Blanket", - "residence_time": 5, - "initial_value": 0, - "source_term": 2.2 - }, - "measured": { - "width": 200, - "height": 68 - }, - "selected": false, - "dragging": false - }, - { - "id": "2", - "type": "process", - "position": { - "x": 669.0956306401249, - "y": 508.44832128486587 - }, - "data": { - "label": "TES", - "residence_time": 3, - "initial_value": 0, - "source_term": 0 - }, - "measured": { - "width": 200, - "height": 68 - }, - "selected": false, - "dragging": false - }, - { - "id": "3", - "type": "process", - "position": { - "x": 716.8220557903593, - "y": 744.1422473772328 - }, - "data": { - "label": "Storage", - "residence_time": "", - "initial_value": 20, - "source_term": -2 - }, - "measured": { - "width": 200, - "height": 68 - }, - "selected": false, - "dragging": false - } - ], - "edges": [ - { - "id": "e1-2", - "source": "1", - "target": "2", - "type": "smoothstep", - "style": { - "strokeWidth": 2, - "stroke": "#ECDFCC" - }, - "markerEnd": { - "type": "arrowclosed", - "width": 20, - "height": 20, - "color": "#ECDFCC" - } - }, - { - "id": "e2-3", - "source": "2", - "target": "3", - "type": "smoothstep", - "style": { - "strokeWidth": 2, - "stroke": "#ECDFCC" - }, - "markerEnd": { - "type": "arrowclosed", - "width": 20, - "height": 20, - "color": "#ECDFCC" - } - } - ] -} \ No newline at end of file diff --git a/saved_graphs/test3.json b/saved_graphs/test3.json deleted file mode 100644 index ad6eddd0..00000000 --- a/saved_graphs/test3.json +++ /dev/null @@ -1,135 +0,0 @@ -{ - "nodes": [ - { - "data": { - "initial_value": 0, - "label": "Blanket", - "residence_time": 5, - "source_term": 2.2 - }, - "dragging": false, - "id": "1", - "measured": { - "height": 68, - "width": 200 - }, - "position": { - "x": 292.4587105571342, - "y": 363.69738918312294 - }, - "selected": false, - "type": "process" - }, - { - "data": { - "initial_value": 0, - "label": "TES", - "residence_time": 3, - "source_term": 0 - }, - "dragging": false, - "id": "2", - "measured": { - "height": 68, - "width": 200 - }, - "position": { - "x": 505.76229730679165, - "y": 507.6149879515325 - }, - "selected": false, - "type": "process" - }, - { - "data": { - "initial_value": 20, - "label": "Storage", - "residence_time": "", - "source_term": -2 - }, - "dragging": false, - "id": "3", - "measured": { - "height": 68, - "width": 200 - }, - "position": { - "x": 645.988722457026, - "y": 724.1422473772329 - }, - "selected": false, - "type": "process" - }, - { - "id": "4", - "type": "process", - "position": { - "x": -37.499999999999545, - "y": 286.6666666666665 - }, - "data": { - "label": "External T bottle", - "residence_time": "1", - "source_term": "", - "initial_value": "5" - }, - "measured": { - "width": 200, - "height": 68 - }, - "selected": false, - "dragging": false - } - ], - "edges": [ - { - "id": "e1-2", - "markerEnd": { - "color": "#ECDFCC", - "height": 20, - "type": "arrowclosed", - "width": 20 - }, - "source": "1", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, - "target": "2", - "type": "smoothstep", - "selected": false - }, - { - "id": "e2-3", - "markerEnd": { - "color": "#ECDFCC", - "height": 20, - "type": "arrowclosed", - "width": 20 - }, - "source": "2", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, - "target": "3", - "type": "smoothstep" - }, - { - "id": "e4-1", - "source": "4", - "target": "1", - "type": "smoothstep", - "style": { - "strokeWidth": 2, - "stroke": "#ECDFCC" - }, - "markerEnd": { - "type": "arrowclosed", - "width": 20, - "height": 20, - "color": "#ECDFCC" - } - } - ] -} \ No newline at end of file From f263a32638b37ba65ec33cec29176f72fb2b0467 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Aug 2025 15:08:13 -0400 Subject: [PATCH 2/3] fixed examples + added to test --- example_graphs/arc_cycle.json | 313 ------------ example_graphs/baby.json | 223 +++++---- example_graphs/demo_pid_fixed.json | 137 +++--- example_graphs/harmonic_oscillator.json | 276 +++++++---- example_graphs/isotopic_exchange.json | 602 ++++++++++++++++++++++++ example_graphs/linear_feedback.json | 285 ++++++----- test/test_examples.py | 27 ++ 7 files changed, 1147 insertions(+), 716 deletions(-) delete mode 100644 example_graphs/arc_cycle.json create mode 100644 example_graphs/isotopic_exchange.json create mode 100644 test/test_examples.py diff --git a/example_graphs/arc_cycle.json b/example_graphs/arc_cycle.json deleted file mode 100644 index 94d4dbd5..00000000 --- a/example_graphs/arc_cycle.json +++ /dev/null @@ -1,313 +0,0 @@ -{ - "nodes": [ - { - "data": { - "description": "Tritium breeding blanket with TBR=1.1", - "initial_value": "0", - "label": "Blanket", - "residence_time": "4500", - "source_term": "1.023e-06" - }, - "id": "blanket", - "measured": { - "height": 48, - "width": 200 - }, - "position": { - "x": 200, - "y": 250 - }, - "selected": false, - "type": "process" - }, - { - "data": { - "description": "Central tritium storage tank", - "initial_value": "1.5", - "label": "Storage", - "residence_time": "", - "source_term": "-4.65e-05" - }, - "dragging": false, - "id": "storage", - "measured": { - "height": 48, - "width": 200 - }, - "position": { - "x": 547, - "y": 380 - }, - "selected": false, - "type": "process" - }, - { - "data": { - "description": "Tritium Extraction System", - "initial_value": "0", - "label": "TES", - "residence_time": "86400", - "source_term": "" - }, - "id": "tes", - "measured": { - "height": 48, - "width": 200 - }, - "position": { - "x": 50, - "y": 400 - }, - "selected": false, - "type": "process" - }, - { - "data": { - "description": "Heat exchanger system", - "initial_value": "0", - "label": "Heat Exchanger", - "residence_time": "1000", - "source_term": "" - }, - "id": "hx", - "measured": { - "height": 48, - "width": 200 - }, - "position": { - "x": 350, - "y": 550 - }, - "selected": false, - "type": "process" - }, - { - "data": { - "description": "Vacuum pumping system", - "initial_value": "0", - "label": "Vacuum Pump", - "residence_time": "600", - "source_term": "4.557e-05" - }, - "dragging": false, - "id": "pump", - "measured": { - "height": 48, - "width": 200 - }, - "position": { - "x": 769, - "y": 243 - }, - "selected": false, - "type": "process" - }, - { - "data": { - "description": "Fuel cleanup system", - "initial_value": "0", - "label": "Fuel Cleanup", - "residence_time": "1080", - "source_term": "" - }, - "id": "fuel_cleanup", - "measured": { - "height": 48, - "width": 200 - }, - "position": { - "x": 1000, - "y": 400 - }, - "selected": false, - "type": "process" - }, - { - "data": { - "description": "Isotope separation system", - "initial_value": "0", - "label": "Isotope Separation", - "residence_time": "13320", - "source_term": "" - }, - "dragging": false, - "id": "iss", - "measured": { - "height": 48, - "width": 200 - }, - "position": { - "x": 776, - "y": 593 - }, - "selected": false, - "type": "process" - } - ], - "edges": [ - { - "data": { - "weight": 1 - }, - "id": "e_blanket_tes", - "label": "Tritium production", - "markerEnd": { - "color": "#ECDFCC", - "height": 20, - "type": "arrowclosed", - "width": 20 - }, - "source": "blanket", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, - "target": "tes", - "type": "smoothstep" - }, - { - "data": { - "weight": 0.8 - }, - "id": "e_tes_storage", - "label": "Extracted tritium", - "markerEnd": { - "color": "#ECDFCC", - "height": 20, - "type": "arrowclosed", - "width": 20 - }, - "selected": false, - "source": "tes", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, - "target": "storage", - "type": "smoothstep" - }, - { - "data": { - "weight": 0.2 - }, - "id": "e_tes_hx", - "label": "Waste heat", - "markerEnd": { - "color": "#ECDFCC", - "height": 20, - "type": "arrowclosed", - "width": 20 - }, - "source": "tes", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, - "target": "hx", - "type": "smoothstep" - }, - { - "data": { - "weight": 1 - }, - "id": "e_hx_blanket", - "label": "Coolant return", - "markerEnd": { - "color": "#ECDFCC", - "height": 20, - "type": "arrowclosed", - "width": 20 - }, - "source": "hx", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, - "target": "blanket", - "type": "smoothstep", - "selected": false - }, - { - "data": { - "weight": 0.3 - }, - "id": "e_pump_storage", - "label": "Direct recycling", - "markerEnd": { - "color": "#ECDFCC", - "height": 20, - "type": "arrowclosed", - "width": 20 - }, - "source": "pump", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, - "target": "storage", - "type": "smoothstep" - }, - { - "data": { - "weight": 0.7 - }, - "id": "e_pump_cleanup", - "label": "Impurities", - "markerEnd": { - "color": "#ECDFCC", - "height": 20, - "type": "arrowclosed", - "width": 20 - }, - "source": "pump", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, - "target": "fuel_cleanup", - "type": "smoothstep" - }, - { - "data": { - "weight": 1 - }, - "id": "e_cleanup_iss", - "label": "Cleaned fuel", - "markerEnd": { - "color": "#ECDFCC", - "height": 20, - "type": "arrowclosed", - "width": 20 - }, - "selected": false, - "source": "fuel_cleanup", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, - "target": "iss", - "type": "smoothstep" - }, - { - "data": { - "weight": 1 - }, - "id": "e_iss_storage", - "label": "Pure tritium", - "markerEnd": { - "color": "#ECDFCC", - "height": 20, - "type": "arrowclosed", - "width": 20 - }, - "source": "iss", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, - "target": "storage", - "type": "smoothstep" - } - ], - "nodeCounter": 1 -} \ No newline at end of file diff --git a/example_graphs/baby.json b/example_graphs/baby.json index f76ae5c6..4287de6d 100644 --- a/example_graphs/baby.json +++ b/example_graphs/baby.json @@ -1,43 +1,5 @@ { "nodes": [ - { - "data": { - "amplitude": "1", - "delay": "2", - "label": "stepsource 2" - }, - "dragging": false, - "id": "2", - "measured": { - "height": 120, - "width": 120 - }, - "position": { - "x": 398.37785598478024, - "y": 489.09982434168865 - }, - "selected": true, - "type": "stepsource" - }, - { - "data": { - "amplitude": "1", - "delay": "4", - "label": "stepsource 3" - }, - "dragging": false, - "id": "3", - "measured": { - "height": 120, - "width": 120 - }, - "position": { - "x": 411, - "y": 216 - }, - "selected": false, - "type": "stepsource" - }, { "data": { "gain": "-1", @@ -56,26 +18,6 @@ "selected": false, "type": "amplifier" }, - { - "data": { - "label": "Neutron source", - "labels": "", - "sampling_rate": "", - "t_wait": "" - }, - "dragging": false, - "id": "5", - "measured": { - "height": 140, - "width": 120 - }, - "position": { - "x": 859.1659050707252, - "y": 126 - }, - "selected": false, - "type": "scope" - }, { "data": { "label": "Neutron rate", @@ -309,83 +251,83 @@ }, "selected": false, "dragging": false - } - ], - "edges": [ + }, { - "data": {}, - "id": "e3-4", - "markerEnd": { - "color": "#ECDFCC", - "height": 20, - "type": "arrowclosed", - "width": 20 + "id": "31", + "type": "stepsource", + "position": { + "x": 435.96282260684967, + "y": 213.2008701092014 }, - "source": "3", - "sourceHandle": null, - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 + "data": { + "label": "Stepsource", + "amplitude": "1", + "tau": "4" }, - "target": "4", - "targetHandle": null, - "type": "smoothstep" + "measured": { + "width": 120, + "height": 120 + }, + "selected": false, + "dragging": false }, { - "data": {}, - "id": "e4-6", - "markerEnd": { - "color": "#ECDFCC", - "height": 20, - "type": "arrowclosed", - "width": 20 + "id": "32", + "type": "stepsource", + "position": { + "x": 324.7489008596274, + "y": 356.4037177393149 }, - "source": "4", - "sourceHandle": null, - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 + "data": { + "label": "Stepsource", + "amplitude": "1", + "tau": "2" }, - "target": "6", - "targetHandle": null, - "type": "smoothstep" + "measured": { + "width": 120, + "height": 120 + }, + "selected": false, + "dragging": false }, { - "data": {}, - "id": "e2-6", - "markerEnd": { - "color": "#ECDFCC", - "height": 20, - "type": "arrowclosed", - "width": 20 + "id": "33", + "type": "scope", + "position": { + "x": 889.5927227230428, + "y": 175.9984179832702 }, - "source": "2", - "sourceHandle": null, - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 + "data": { + "label": "Neutron source", + "labels": "", + "sampling_rate": "", + "t_wait": "" }, - "target": "6", - "targetHandle": null, - "type": "smoothstep" - }, + "measured": { + "width": 120, + "height": 140 + }, + "selected": true, + "dragging": false + } + ], + "edges": [ { "data": {}, - "id": "e6-5", + "id": "e4-6", "markerEnd": { "color": "#ECDFCC", "height": 20, "type": "arrowclosed", "width": 20 }, - "selected": false, - "source": "6", + "source": "4", "sourceHandle": null, "style": { "stroke": "#ECDFCC", "strokeWidth": 2 }, - "target": "5", + "target": "6", "targetHandle": null, "type": "smoothstep" }, @@ -768,9 +710,66 @@ "height": 20, "color": "#ECDFCC" } + }, + { + "id": "e31-4", + "source": "31", + "target": "4", + "sourceHandle": null, + "targetHandle": null, + "type": "smoothstep", + "data": {}, + "style": { + "strokeWidth": 2, + "stroke": "#ECDFCC" + }, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20, + "color": "#ECDFCC" + } + }, + { + "id": "e32-6", + "source": "32", + "target": "6", + "sourceHandle": null, + "targetHandle": null, + "type": "smoothstep", + "data": {}, + "style": { + "strokeWidth": 2, + "stroke": "#ECDFCC" + }, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20, + "color": "#ECDFCC" + } + }, + { + "id": "e6-33", + "source": "6", + "target": "33", + "sourceHandle": null, + "targetHandle": null, + "type": "smoothstep", + "data": {}, + "style": { + "strokeWidth": 2, + "stroke": "#ECDFCC" + }, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20, + "color": "#ECDFCC" + } } ], - "nodeCounter": 31, + "nodeCounter": 34, "solverParams": { "dt": "0.01", "dt_min": "1e-6", diff --git a/example_graphs/demo_pid_fixed.json b/example_graphs/demo_pid_fixed.json index 629aa248..7ebce98a 100644 --- a/example_graphs/demo_pid_fixed.json +++ b/example_graphs/demo_pid_fixed.json @@ -1,24 +1,5 @@ { "nodes": [ - { - "data": { - "amplitude": "1", - "delay": "1", - "label": "Reference Input" - }, - "dragging": false, - "id": "reference", - "measured": { - "height": 120, - "width": 120 - }, - "position": { - "x": 50, - "y": 150 - }, - "selected": false, - "type": "stepsource" - }, { "data": { "label": "Error" @@ -91,23 +72,6 @@ "selected": false, "dragging": false }, - { - "id": "2", - "type": "scope", - "position": { - "x": 1084, - "y": 158 - }, - "data": { - "label": "scope 2" - }, - "measured": { - "width": 120, - "height": 140 - }, - "selected": false, - "dragging": false - }, { "id": "3", "type": "pid", @@ -128,13 +92,52 @@ }, "selected": false, "dragging": false + }, + { + "id": "4", + "type": "stepsource", + "position": { + "x": 90.83795441551936, + "y": 44.05817319772359 + }, + "data": { + "label": "Reference Input", + "amplitude": "1", + "tau": "1" + }, + "measured": { + "width": 120, + "height": 120 + }, + "selected": false, + "dragging": false + }, + { + "id": "5", + "type": "scope", + "position": { + "x": 1020.7686932100712, + "y": 141.28116398185887 + }, + "data": { + "label": "scope 5", + "labels": "", + "sampling_rate": "", + "t_wait": "" + }, + "measured": { + "width": 120, + "height": 140 + }, + "selected": false, + "dragging": false } ], "edges": [ { - "id": "ereference-error_summer", - "source": "reference", - "target": "error_summer", + "id": "eerror_summer-3", + "source": "error_summer", + "target": "3", "sourceHandle": null, "targetHandle": null, "type": "smoothstep", @@ -151,9 +154,9 @@ } }, { - "id": "eerror_summer-3", - "source": "error_summer", - "target": "3", + "id": "e3-1", + "source": "3", + "target": "1", "sourceHandle": null, "targetHandle": null, "type": "smoothstep", @@ -170,9 +173,9 @@ } }, { - "id": "e3-1", - "source": "3", - "target": "1", + "id": "efeedback_gain-minus_one", + "source": "feedback_gain", + "target": "minus_one", "sourceHandle": null, "targetHandle": null, "type": "smoothstep", @@ -189,9 +192,9 @@ } }, { - "id": "e1-2", - "source": "1", - "target": "2", + "id": "eminus_one-error_summer", + "source": "minus_one", + "target": "error_summer", "sourceHandle": null, "targetHandle": null, "type": "smoothstep", @@ -208,9 +211,9 @@ } }, { - "id": "efeedback_gain-minus_one", - "source": "feedback_gain", - "target": "minus_one", + "id": "e1-feedback_gain", + "source": "1", + "target": "feedback_gain", "sourceHandle": null, "targetHandle": null, "type": "smoothstep", @@ -224,11 +227,12 @@ "width": 20, "height": 20, "color": "#ECDFCC" - } + }, + "selected": false }, { - "id": "eminus_one-error_summer", - "source": "minus_one", + "id": "e4-error_summer", + "source": "4", "target": "error_summer", "sourceHandle": null, "targetHandle": null, @@ -246,9 +250,9 @@ } }, { - "id": "e1-feedback_gain", - "source": "1", - "target": "feedback_gain", + "id": "e4-5", + "source": "4", + "target": "5", "sourceHandle": null, "targetHandle": null, "type": "smoothstep", @@ -262,13 +266,12 @@ "width": 20, "height": 20, "color": "#ECDFCC" - }, - "selected": false + } }, { - "id": "ereference-2", - "source": "reference", - "target": "2", + "id": "eerror_summer-5", + "source": "error_summer", + "target": "5", "sourceHandle": null, "targetHandle": null, "type": "smoothstep", @@ -285,9 +288,9 @@ } }, { - "id": "eerror_summer-2", - "source": "error_summer", - "target": "2", + "id": "efeedback_gain-5", + "source": "feedback_gain", + "target": "5", "sourceHandle": null, "targetHandle": null, "type": "smoothstep", @@ -304,7 +307,7 @@ } } ], - "nodeCounter": 4, + "nodeCounter": 6, "solverParams": { "dt": "0.01", "dt_min": "1e-6", @@ -313,7 +316,7 @@ "tolerance_fpi": "1e-6", "iterations_max": "100", "log": "true", - "simulation_duration": "50.0", + "simulation_duration": "35", "extra_params": "{}" }, "globalVariables": [] diff --git a/example_graphs/harmonic_oscillator.json b/example_graphs/harmonic_oscillator.json index 74149db7..d8210ecd 100644 --- a/example_graphs/harmonic_oscillator.json +++ b/example_graphs/harmonic_oscillator.json @@ -1,232 +1,314 @@ { "nodes": [ { + "id": "1", + "type": "integrator", + "position": { + "x": 501.13753581661877, + "y": 120.37249283667622 + }, "data": { - "label": "\u03a3" + "label": "integrator x(t)", + "initial_value": "x0", + "reset_times": "" }, - "dragging": false, - "id": "adder1", "measured": { - "height": 64, - "width": 64 - }, - "position": { - "x": 131.01485558491993, - "y": 198.85130164500296 + "width": 200, + "height": 48 }, "selected": false, - "type": "adder" + "dragging": false }, { + "id": "2", + "type": "scope", + "position": { + "x": 725.3982808022922, + "y": -45.558739255014345 + }, "data": { - "initial_value": "5", - "label": "Integrator (v)" + "label": "scope 2", + "labels": "", + "sampling_rate": "", + "t_wait": "" }, - "dragging": false, - "id": "integrator1", "measured": { - "height": 48, - "width": 200 - }, - "position": { - "x": 202.19517549754596, - "y": 136.51860510759934 + "width": 120, + "height": 140 }, "selected": false, - "type": "integrator" + "dragging": false }, { + "id": "3", + "type": "adder", + "position": { + "x": 113.96275071633238, + "y": 109.59598853868192 + }, "data": { - "initial_value": "2", - "label": "Integrator (x)" + "label": "adder 3", + "operations": "" }, - "dragging": false, - "id": "integrator2", "measured": { - "height": 48, - "width": 200 - }, - "position": { - "x": 504.2248866673858, - "y": 108.37549541017196 + "width": 64, + "height": 64 }, "selected": false, - "type": "integrator" + "dragging": false }, { + "id": "4", + "type": "integrator", + "position": { + "x": 239, + "y": 122 + }, "data": { - "label": "Scope", - "signals": [ - "v(t)", - "x(t)" - ] - }, - "dragging": false, - "id": "scope1", - "measured": { - "height": 120, - "width": 200 + "label": "integrator v(t)", + "initial_value": "v0", + "reset_times": "" }, - "position": { - "x": 818.3159305646946, - "y": 280.3772632921635 + "measured": { + "width": 200, + "height": 48 }, "selected": false, - "type": "scope" + "dragging": false }, { + "id": "7", + "type": "amplifier_reverse", + "position": { + "x": 272.4928366762178, + "y": 292.1404011461318 + }, "data": { - "gain": "-0.25", - "label": "Amp 1" + "label": "Amp 1", + "gain": "-c/m" }, - "dragging": false, - "id": "amp1", "measured": { - "height": 85, - "width": 135 - }, - "position": { - "x": 79.92204380561972, - "y": 373.4144735073621 + "width": 90, + "height": 80 }, "selected": false, - "type": "amplifier" + "dragging": false }, { + "id": "8", + "type": "amplifier_reverse", + "position": { + "x": 457.80802292263616, + "y": 373.9398280802293 + }, "data": { - "gain": "-1.875", - "label": "Amp 2" + "label": "Amp 2", + "gain": "-k/m" }, - "dragging": false, - "id": "amp2", "measured": { - "height": 85, - "width": 135 - }, - "position": { - "x": 531.2825411250742, - "y": 389.0557440698992 + "width": 90, + "height": 80 }, "selected": false, - "type": "amplifier" + "dragging": false } ], "edges": [ { - "id": "e1", - "source": "adder1", + "id": "e1-2", + "source": "1", + "target": "2", "sourceHandle": null, - "target": "integrator1", "targetHandle": null, + "type": "smoothstep", + "data": {}, "style": { "strokeWidth": 2, "stroke": "#ECDFCC" }, "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20, "color": "#ECDFCC" } }, { - "id": "e2", - "source": "integrator1", + "id": "e4-1", + "source": "4", + "target": "1", "sourceHandle": null, - "target": "integrator2", "targetHandle": null, + "type": "smoothstep", + "data": {}, "style": { "strokeWidth": 2, "stroke": "#ECDFCC" }, "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20, "color": "#ECDFCC" } }, { - "id": "e3", - "label": "x(t)", - "source": "integrator2", + "id": "e1-8", + "source": "1", + "target": "8", "sourceHandle": null, - "target": "scope1", "targetHandle": null, + "type": "smoothstep", + "data": {}, "style": { "strokeWidth": 2, "stroke": "#ECDFCC" }, "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20, "color": "#ECDFCC" } }, { - "id": "e4", - "label": "v(t)", - "source": "integrator1", + "id": "e8-3", + "source": "8", + "target": "3", "sourceHandle": null, - "target": "scope1", "targetHandle": null, + "type": "smoothstep", + "data": {}, "style": { "strokeWidth": 2, "stroke": "#ECDFCC" }, "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20, "color": "#ECDFCC" } }, { - "id": "e5", - "source": "integrator1", + "id": "e7-3", + "source": "7", + "target": "3", "sourceHandle": null, - "target": "amp1", "targetHandle": null, + "type": "smoothstep", + "data": {}, "style": { "strokeWidth": 2, "stroke": "#ECDFCC" }, "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20, "color": "#ECDFCC" } }, { - "id": "e6", - "source": "amp1", + "id": "e3-4", + "source": "3", + "target": "4", "sourceHandle": null, - "target": "adder1", "targetHandle": null, - "selected": false, + "type": "smoothstep", + "data": {}, "style": { "strokeWidth": 2, "stroke": "#ECDFCC" }, "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20, "color": "#ECDFCC" } }, { - "id": "e7", - "source": "integrator2", + "id": "e4-2", + "source": "4", + "target": "2", "sourceHandle": null, - "target": "amp2", "targetHandle": null, + "type": "smoothstep", + "data": {}, "style": { "strokeWidth": 2, "stroke": "#ECDFCC" }, "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20, "color": "#ECDFCC" } }, { - "id": "e8", - "source": "amp2", + "id": "e4-7", + "source": "4", + "target": "7", "sourceHandle": null, - "target": "adder1", "targetHandle": null, + "type": "smoothstep", + "data": {}, "style": { "strokeWidth": 2, "stroke": "#ECDFCC" }, "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20, "color": "#ECDFCC" } } ], - "nodeCounter": 1 + "nodeCounter": 9, + "solverParams": { + "dt": "0.01", + "dt_min": "1e-6", + "dt_max": "1.0", + "Solver": "SSPRK22", + "tolerance_fpi": "1e-6", + "iterations_max": "100", + "log": "true", + "simulation_duration": "25", + "extra_params": "{}" + }, + "globalVariables": [ + { + "id": "1754159829210", + "name": "x0", + "value": "2", + "nameError": false + }, + { + "id": "1754159834189", + "name": "v0", + "value": "5", + "nameError": false + }, + { + "id": "1754159838558", + "name": "m", + "value": "0.8", + "nameError": false + }, + { + "id": "1754159842904", + "name": "c", + "value": "0.2", + "nameError": false + }, + { + "id": "1754159846822", + "name": "k", + "value": "1.5", + "nameError": false + } + ] } \ No newline at end of file diff --git a/example_graphs/isotopic_exchange.json b/example_graphs/isotopic_exchange.json new file mode 100644 index 00000000..e42a4581 --- /dev/null +++ b/example_graphs/isotopic_exchange.json @@ -0,0 +1,602 @@ +{ + "nodes": [ + { + "data": { + "initial_value": "", + "label": "piping", + "reset_times": "" + }, + "dragging": false, + "id": "1", + "measured": { + "height": 48, + "width": 200 + }, + "position": { + "x": 635, + "y": 349 + }, + "selected": false, + "type": "integrator" + }, + { + "data": { + "label": "adder 6" + }, + "dragging": false, + "id": "6", + "measured": { + "height": 64, + "width": 64 + }, + "position": { + "x": 1589.1016907897247, + "y": 503.9483894383452 + }, + "selected": false, + "type": "adder" + }, + { + "data": { + "label": "multiplier 7" + }, + "dragging": false, + "id": "7", + "measured": { + "height": 64, + "width": 64 + }, + "position": { + "x": 1234.6909058659276, + "y": 474.8992703080042 + }, + "selected": false, + "type": "multiplier" + }, + { + "data": { + "label": "adder 16" + }, + "dragging": false, + "id": "16", + "measured": { + "height": 64, + "width": 64 + }, + "position": { + "x": 525, + "y": 359 + }, + "selected": false, + "type": "adder" + }, + { + "data": { + "gain": "kr", + "label": "kr c_h2 c_T" + }, + "dragging": false, + "id": "21", + "measured": { + "height": 80, + "width": 90 + }, + "position": { + "x": 1365, + "y": 455 + }, + "selected": false, + "type": "amplifier" + }, + { + "id": "22", + "type": "function", + "position": { + "x": 267.19109456561245, + "y": 288.1459390106112 + }, + "data": { + "label": "f(x) = source_T-x", + "func": "lambda x: source_T-x" + }, + "measured": { + "width": 200, + "height": 80 + }, + "selected": false, + "dragging": false + }, + { + "id": "23", + "type": "stepsource", + "position": { + "x": 127.73632538464565, + "y": 164.47850218975373 + }, + "data": { + "label": "Stepsource", + "amplitude": "source_T", + "tau": "3" + }, + "measured": { + "width": 120, + "height": 120 + }, + "selected": false, + "dragging": false + }, + { + "id": "24", + "type": "stepsource", + "position": { + "x": 1107.8801044607478, + "y": 69.76806974840379 + }, + "data": { + "label": "c_H2", + "amplitude": "1", + "tau": "10" + }, + "measured": { + "width": 120, + "height": 120 + }, + "selected": false, + "dragging": false + }, + { + "id": "25", + "type": "scope", + "position": { + "x": 625.0372947280937, + "y": 10.552011678686554 + }, + "data": { + "label": "isotopes sources", + "labels": "", + "sampling_rate": "", + "t_wait": "" + }, + "measured": { + "width": 120, + "height": 140 + }, + "selected": false, + "dragging": false + }, + { + "id": "26", + "type": "scope", + "position": { + "x": 911.8540609893888, + "y": 9.90776788298875 + }, + "data": { + "label": "Piping inventory", + "labels": "", + "sampling_rate": "", + "t_wait": "" + }, + "measured": { + "width": 120, + "height": 140 + }, + "selected": false, + "dragging": false + }, + { + "id": "27", + "type": "function", + "position": { + "x": 913.1696720193979, + "y": 367.0961625304652 + }, + "data": { + "label": "f(I) = I/S = c", + "func": "lambda I: I/S" + }, + "measured": { + "width": 200, + "height": 80 + }, + "selected": false, + "dragging": false + }, + { + "id": "28", + "type": "function", + "position": { + "x": 1290.0328243310123, + "y": 192.22961978902407 + }, + "data": { + "label": "f(c_T) = kr c_T^2", + "func": "lambda x: kr* x**2" + }, + "measured": { + "width": 200, + "height": 80 + }, + "selected": false, + "dragging": false + }, + { + "id": "29", + "type": "scope", + "position": { + "x": 1685.446908354059, + "y": 221.73470543376408 + }, + "data": { + "label": "Fluxes out", + "labels": "", + "sampling_rate": "", + "t_wait": "" + }, + "measured": { + "width": 120, + "height": 140 + }, + "selected": false, + "dragging": false + }, + { + "id": "31", + "type": "amplifier_reverse", + "position": { + "x": 625.4713468779164, + "y": 539.6484141642767 + }, + "data": { + "label": "x (-1)", + "gain": "-1" + }, + "measured": { + "width": 90, + "height": 80 + }, + "selected": false, + "dragging": false + } + ], + "edges": [ + { + "data": {}, + "id": "e16-1", + "markerEnd": { + "color": "#ECDFCC", + "height": 20, + "type": "arrowclosed", + "width": 20 + }, + "source": "16", + "sourceHandle": null, + "style": { + "stroke": "#ECDFCC", + "strokeWidth": 2 + }, + "target": "1", + "targetHandle": null, + "type": "smoothstep" + }, + { + "data": {}, + "id": "e21-6", + "markerEnd": { + "color": "#ECDFCC", + "height": 20, + "type": "arrowclosed", + "width": 20 + }, + "source": "21", + "sourceHandle": null, + "style": { + "stroke": "#ECDFCC", + "strokeWidth": 2 + }, + "target": "6", + "targetHandle": null, + "type": "smoothstep", + "selected": false + }, + { + "data": {}, + "id": "e7-21", + "markerEnd": { + "color": "#ECDFCC", + "height": 20, + "type": "arrowclosed", + "width": 20 + }, + "source": "7", + "sourceHandle": null, + "style": { + "stroke": "#ECDFCC", + "strokeWidth": 2 + }, + "target": "21", + "targetHandle": null, + "type": "smoothstep" + }, + { + "id": "e22-16-from_source-0", + "source": "22", + "target": "16", + "sourceHandle": "source-0", + "targetHandle": null, + "type": "smoothstep", + "data": {}, + "style": { + "strokeWidth": 2, + "stroke": "#ECDFCC" + }, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20, + "color": "#ECDFCC" + } + }, + { + "id": "e23-22-to_target-0", + "source": "23", + "target": "22", + "sourceHandle": null, + "targetHandle": "target-0", + "type": "smoothstep", + "data": {}, + "style": { + "strokeWidth": 2, + "stroke": "#ECDFCC" + }, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20, + "color": "#ECDFCC" + } + }, + { + "id": "e24-7", + "source": "24", + "target": "7", + "sourceHandle": null, + "targetHandle": null, + "type": "smoothstep", + "data": {}, + "style": { + "strokeWidth": 2, + "stroke": "#ECDFCC" + }, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20, + "color": "#ECDFCC" + } + }, + { + "id": "e22-25-from_source-0", + "source": "22", + "target": "25", + "sourceHandle": "source-0", + "targetHandle": null, + "type": "smoothstep", + "data": {}, + "style": { + "strokeWidth": 2, + "stroke": "#ECDFCC" + }, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20, + "color": "#ECDFCC" + } + }, + { + "id": "e24-25", + "source": "24", + "target": "25", + "sourceHandle": null, + "targetHandle": null, + "type": "smoothstep", + "data": {}, + "style": { + "strokeWidth": 2, + "stroke": "#ECDFCC" + }, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20, + "color": "#ECDFCC" + } + }, + { + "id": "e1-26", + "source": "1", + "target": "26", + "sourceHandle": null, + "targetHandle": null, + "type": "smoothstep", + "data": {}, + "style": { + "strokeWidth": 2, + "stroke": "#ECDFCC" + }, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20, + "color": "#ECDFCC" + } + }, + { + "id": "e1-27-to_target-0", + "source": "1", + "target": "27", + "sourceHandle": null, + "targetHandle": "target-0", + "type": "smoothstep", + "data": {}, + "style": { + "strokeWidth": 2, + "stroke": "#ECDFCC" + }, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20, + "color": "#ECDFCC" + } + }, + { + "id": "e28-29-from_source-0", + "source": "28", + "target": "29", + "sourceHandle": "source-0", + "targetHandle": null, + "type": "smoothstep", + "data": {}, + "style": { + "strokeWidth": 2, + "stroke": "#ECDFCC" + }, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20, + "color": "#ECDFCC" + }, + "selected": false + }, + { + "id": "e21-29", + "source": "21", + "target": "29", + "sourceHandle": null, + "targetHandle": null, + "type": "smoothstep", + "data": {}, + "style": { + "strokeWidth": 2, + "stroke": "#ECDFCC" + }, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20, + "color": "#ECDFCC" + } + }, + { + "id": "e31-16", + "source": "31", + "target": "16", + "sourceHandle": null, + "targetHandle": null, + "type": "smoothstep", + "data": {}, + "style": { + "strokeWidth": 2, + "stroke": "#ECDFCC" + }, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20, + "color": "#ECDFCC" + } + }, + { + "id": "e6-31", + "source": "6", + "target": "31", + "sourceHandle": null, + "targetHandle": null, + "type": "smoothstep", + "data": {}, + "style": { + "strokeWidth": 2, + "stroke": "#ECDFCC" + }, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20, + "color": "#ECDFCC" + } + }, + { + "id": "e27-28-from_source-0-to_target-0", + "source": "27", + "target": "28", + "sourceHandle": "source-0", + "targetHandle": "target-0", + "type": "smoothstep", + "data": {}, + "style": { + "strokeWidth": 2, + "stroke": "#ECDFCC" + }, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20, + "color": "#ECDFCC" + } + }, + { + "id": "e27-7-from_source-0", + "source": "27", + "target": "7", + "sourceHandle": "source-0", + "targetHandle": null, + "type": "smoothstep", + "data": {}, + "style": { + "strokeWidth": 2, + "stroke": "#ECDFCC" + }, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20, + "color": "#ECDFCC" + } + } + ], + "nodeCounter": 32, + "solverParams": { + "Solver": "SSPRK22", + "dt": "0.01", + "dt_max": "1.0", + "dt_min": "1e-6", + "extra_params": "{}", + "iterations_max": "100", + "log": "true", + "simulation_duration": "60", + "tolerance_fpi": "1e-6" + }, + "globalVariables": [ + { + "id": "1753822667212", + "name": "S", + "nameError": false, + "value": "20" + }, + { + "id": "1753824144003", + "name": "source_T", + "nameError": false, + "value": "0.1" + }, + { + "id": "1753824419338", + "name": "kr", + "nameError": false, + "value": "2" + } + ] +} \ No newline at end of file diff --git a/example_graphs/linear_feedback.json b/example_graphs/linear_feedback.json index fb51da27..5c3c24b3 100644 --- a/example_graphs/linear_feedback.json +++ b/example_graphs/linear_feedback.json @@ -1,181 +1,183 @@ { "nodes": [ { + "id": "1", + "type": "stepsource", + "position": { + "x": 283.4511234320089, + "y": -14.228948131394702 + }, "data": { - "label": "Input Signal", + "label": "Source s(t)", "amplitude": "1", - "delay": "3" + "tau": "tau" }, - "id": "source1", "measured": { - "height": 53, - "width": 205 + "width": 120, + "height": 120 }, - "position": { - "x": 5, - "y": 185 - }, - "type": "stepsource", - "selected": false, + "selected": true, "dragging": false }, { + "id": "2", + "type": "scope", + "position": { + "x": 884.901286500961, + "y": 70.57000250921425 + }, "data": { - "label": "Summer" + "label": "Scope", + "labels": "", + "sampling_rate": "", + "t_wait": "" }, - "id": "adder1", "measured": { - "height": 64, - "width": 64 - }, - "position": { - "x": 422, - "y": 176 + "width": 120, + "height": 140 }, "selected": false, - "type": "adder", "dragging": false }, { + "id": "4", + "type": "amplifier_reverse", + "position": { + "x": 539.9858345687064, + "y": 394.2551349419692 + }, "data": { - "initial_value": "2", - "label": "Integrator" + "label": "Amp a", + "gain": "a" }, - "dragging": false, - "id": "integrator1", "measured": { - "height": 48, - "width": 200 - }, - "position": { - "x": 501, - "y": 91 + "width": 90, + "height": 80 }, "selected": false, - "type": "integrator" + "dragging": false }, { + "id": "5", + "type": "integrator", + "position": { + "x": 522.9520384414344, + "y": 208.06441872308315 + }, "data": { - "label": "Output Display" + "label": "Integrator x(t)", + "initial_value": "x0", + "reset_times": "" }, - "id": "scope1", "measured": { - "height": 120, - "width": 200 + "width": 200, + "height": 48 }, - "position": { - "x": 1015, - "y": 133 - }, - "type": "scope", "selected": false, "dragging": false }, { + "id": "6", + "type": "adder", + "position": { + "x": 400, + "y": 200 + }, "data": { - "gain": "-1", - "label": "Feedback Gain" + "label": "adder 6", + "operations": "" }, - "id": "amplifier2", "measured": { - "height": 85, - "width": 135 - }, - "position": { - "x": 650, - "y": 350 - }, - "type": "amplifier", - "selected": false + "width": 64, + "height": 64 + } } ], "edges": [ { - "data": { - "weight": 0.5 + "id": "e5-4", + "source": "5", + "target": "4", + "sourceHandle": null, + "targetHandle": null, + "type": "smoothstep", + "data": {}, + "style": { + "strokeWidth": 2, + "stroke": "#ECDFCC" }, - "id": "eamplifier2-adder1", "markerEnd": { - "color": "#ECDFCC", - "height": 20, "type": "arrowclosed", - "width": 20 - }, - "source": "amplifier2", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, - "target": "adder1", - "type": "smoothstep", - "selected": false + "width": 20, + "height": 20, + "color": "#ECDFCC" + } }, { - "data": { - "weight": 0.5 + "id": "e5-2", + "source": "5", + "target": "2", + "sourceHandle": null, + "targetHandle": null, + "type": "smoothstep", + "data": {}, + "style": { + "strokeWidth": 2, + "stroke": "#ECDFCC" }, - "id": "eadder1-integrator1", "markerEnd": { - "color": "#ECDFCC", - "height": 20, "type": "arrowclosed", - "width": 20 - }, - "source": "adder1", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, - "target": "integrator1", - "type": "smoothstep" + "width": 20, + "height": 20, + "color": "#ECDFCC" + } }, { - "data": { - "weight": 0.5 + "id": "e1-6", + "source": "1", + "target": "6", + "sourceHandle": null, + "targetHandle": null, + "type": "smoothstep", + "data": {}, + "style": { + "strokeWidth": 2, + "stroke": "#ECDFCC" }, - "id": "eintegrator1-amplifier2", "markerEnd": { - "color": "#ECDFCC", - "height": 20, "type": "arrowclosed", - "width": 20 - }, - "source": "integrator1", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, - "target": "amplifier2", - "type": "smoothstep", - "selected": false + "width": 20, + "height": 20, + "color": "#ECDFCC" + } }, { - "data": { - "weight": 0.5 + "id": "e4-6", + "source": "4", + "target": "6", + "sourceHandle": null, + "targetHandle": null, + "type": "smoothstep", + "data": {}, + "style": { + "strokeWidth": 2, + "stroke": "#ECDFCC" }, - "id": "eintegrator1-scope1", "markerEnd": { - "color": "#ECDFCC", - "height": 20, "type": "arrowclosed", - "width": 20 - }, - "source": "integrator1", - "style": { - "stroke": "#ECDFCC", - "strokeWidth": 2 - }, - "target": "scope1", - "type": "smoothstep" + "width": 20, + "height": 20, + "color": "#ECDFCC" + } }, { - "id": "esource1-scope1", - "source": "source1", - "target": "scope1", + "id": "e1-2", + "source": "1", + "target": "2", + "sourceHandle": null, + "targetHandle": null, "type": "smoothstep", - "data": { - "weight": 0.5 - }, + "data": {}, "style": { "strokeWidth": 2, "stroke": "#ECDFCC" @@ -185,17 +187,16 @@ "width": 20, "height": 20, "color": "#ECDFCC" - }, - "selected": false + } }, { - "id": "esource1-adder1", - "source": "source1", - "target": "adder1", + "id": "e6-5", + "source": "6", + "target": "5", + "sourceHandle": null, + "targetHandle": null, "type": "smoothstep", - "data": { - "weight": 0.5 - }, + "data": {}, "style": { "strokeWidth": 2, "stroke": "#ECDFCC" @@ -205,9 +206,39 @@ "width": 20, "height": 20, "color": "#ECDFCC" - }, - "selected": false + } } ], - "nodeCounter": 1 + "nodeCounter": 7, + "solverParams": { + "dt": "0.01", + "dt_min": "1e-6", + "dt_max": "1.0", + "Solver": "SSPRK22", + "tolerance_fpi": "1e-6", + "iterations_max": "100", + "log": "true", + "simulation_duration": "4*tau", + "extra_params": "{}" + }, + "globalVariables": [ + { + "id": "1754160227284", + "name": "a", + "value": "-1", + "nameError": false + }, + { + "id": "1754160231388", + "name": "x0", + "value": "2", + "nameError": false + }, + { + "id": "1754160248756", + "name": "tau", + "value": "3", + "nameError": false + } + ] } \ No newline at end of file diff --git a/test/test_examples.py b/test/test_examples.py new file mode 100644 index 00000000..af085d39 --- /dev/null +++ b/test/test_examples.py @@ -0,0 +1,27 @@ +from src.pathsim_utils import make_pathsim_model +import json + +import pytest + +# find all json files in root example_graphs directory +from pathlib import Path + +example_graphs_dir = Path("example_graphs") +all_examples_files = list(example_graphs_dir.glob("*.json")) + + +@pytest.mark.parametrize( + "filename", all_examples_files, ids=[f.stem for f in all_examples_files] +) +def test_example(filename): + """ + Test the example simulation defined in the given filename. + """ + with open(filename, "r") as f: + graph_data = json.load(f) + + # Load the example simulation from the specified file + my_simulation, duration = make_pathsim_model(graph_data) + + # Run the simulation + my_simulation.run(duration) From 8ac125e4b5bb5c13c7717fe418f2034c0c9fe835 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Sat, 2 Aug 2025 15:08:27 -0400 Subject: [PATCH 3/3] renamed pid --- example_graphs/{demo_pid_fixed.json => pid.json} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename example_graphs/{demo_pid_fixed.json => pid.json} (100%) diff --git a/example_graphs/demo_pid_fixed.json b/example_graphs/pid.json similarity index 100% rename from example_graphs/demo_pid_fixed.json rename to example_graphs/pid.json