Compare commits
8 Commits
dc770a0886
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 48ac9e2f59 | |||
| 2f6487e510 | |||
| eb8f77ce64 | |||
| 35d933ccbb | |||
| edd7bb98f2 | |||
| ddc004dee5 | |||
| cdfc891980 | |||
| 6fb2478589 |
12
BEdit/.vscode/tasks.json
vendored
12
BEdit/.vscode/tasks.json
vendored
@@ -6,7 +6,6 @@
|
||||
"type": "shell",
|
||||
"command": "pyside6-designer",
|
||||
"args": [
|
||||
"${workspaceFolder}/ui/*.ui"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}",
|
||||
@@ -116,6 +115,14 @@
|
||||
"options": {"cwd": "${workspaceFolder}"},
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "Qt: Compile Simulation Window UI to Python",
|
||||
"type": "shell",
|
||||
"command": "pyside6-uic",
|
||||
"args": ["--from-imports", "${workspaceFolder}/ui/simulation_window.ui", "-o", "${workspaceFolder}/src/bedit/gui/generated/ui_simulation_window.py"],
|
||||
"options": {"cwd": "${workspaceFolder}"},
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "Qt: Build Designer Files",
|
||||
"dependsOrder": "sequence",
|
||||
@@ -126,7 +133,8 @@
|
||||
"Qt: Compile Component Options UI to Python",
|
||||
"Qt: Compile Port Options UI to Python",
|
||||
"Qt: Compile Shape Options UI to Python",
|
||||
"Qt: Compile Icon Editor UI to Python"
|
||||
"Qt: Compile Icon Editor UI to Python",
|
||||
"Qt: Compile Simulation Window UI to Python"
|
||||
],
|
||||
"problemMatcher": [],
|
||||
"group": {
|
||||
|
||||
@@ -25,7 +25,7 @@ src/bedit/
|
||||
│ ├── port_types.py # Port type definitions and compatibility
|
||||
│ ├── serializer.py # JSON persistence
|
||||
│ ├── libraries.py # Library file discovery and parsing
|
||||
│ └── simulation/ # Qt-free simulation service and compiler/runtime code
|
||||
│ └── simulation/ # Qt-free composition and OpenModelica interface code
|
||||
└── gui/ # All Qt-dependent code
|
||||
├── app.py # QApplication startup and palette
|
||||
├── main_window.py # Top-level UI orchestration
|
||||
@@ -94,27 +94,76 @@ Keep the root of `src/bedit` minimal. New UI modules should go into the relevant
|
||||
- Avoid the QSettings group name `general`; Qt treats `General` specially in INI
|
||||
files. Autosave keys live under `autosave/`.
|
||||
- User-visible document edits should participate in undo/redo.
|
||||
- Component clipboard data is shared by the graph, document tree, and library
|
||||
tree. Pasting into the document node creates roots; pasting into a graph node
|
||||
creates children at an origin-normalized position. Always clone pasted trees
|
||||
with fresh IDs, preserve connections between jointly copied graph blocks, and
|
||||
assign unique sibling names.
|
||||
- The text-definition editor uses OpenModelica highlighting and completion from
|
||||
`src/bedit/data/syntax/openmodelica.json`. Keep keywords, types, built-ins, and
|
||||
named BEdit `$name$` macro completions editable there; arbitrary `$name$`
|
||||
expressions are highlighted as BEvalues. Highlight colors and bold/italic
|
||||
styles are persisted under `syntax/<category>/` in application settings.
|
||||
- Text component sources may contain private Modelica declarations in
|
||||
`source.declarations`. The text-definition editor exposes declarations above
|
||||
`source.initialEquations` and `source.equations`, with the same highlighting
|
||||
and completion in all three fields. The composer emits each in its matching
|
||||
Modelica section.
|
||||
- Application-wide messages use `core.application_log.get_logger()`. The main
|
||||
window installs the Qt log-panel handler; core code must only use standard
|
||||
Python logging and must not import the GUI handler.
|
||||
- File → Reload Simulation Code (`Ctrl+F5`) reloads modules under
|
||||
`bedit.core.simulation`, replaces the shared application/controller service,
|
||||
and preserves the previous instance attributes where possible.
|
||||
- Simulation compilation lives in `core/simulation/compiler.py`; the simulation
|
||||
service only owns application state and delegates compilation. Ports with
|
||||
- Modelica composition lives in `core/simulation/composer.py`; the simulation
|
||||
service only owns application state and delegates composition. Ports with
|
||||
`multipleConnections` are emitted as Modelica arrays. Their size is inferred
|
||||
per component instance from graph connections and exposed while compiling as
|
||||
`$portname_N$`; array connection endpoints receive stable one-based indices in
|
||||
graph connection order.
|
||||
- Blocking simulator integration belongs in `core/simulation/runner.py` and runs
|
||||
on its daemon worker thread. Never perform OMPython startup or simulation work
|
||||
directly on the Qt GUI thread; background failures must go to the application
|
||||
log.
|
||||
- Simulation → Export Model composes through `Simulation.compose_source()` without
|
||||
building the model, then writes the generated source as a `.mo` file.
|
||||
- OpenModelica integration belongs in `core/simulation/openmodelica.py`. Its
|
||||
persistent worker and OMC session start lazily on the first queued request.
|
||||
Never perform OMPython work directly on the Qt GUI thread. Result and error
|
||||
callbacks run on background threads and must use a Qt signal before touching UI.
|
||||
One lazy temporary working directory is shared by all requests in the session.
|
||||
Explicit application shutdown closes OMC and removes that directory plus the
|
||||
current session's OMPython log and port files; `__del__` is only a fallback.
|
||||
- Simulation runs start an ephemeral localhost TCP listener before launching the
|
||||
generated model through OMC's `system()` function. OpenModelica's newline-delimited
|
||||
`xmltcp` status and message records are parsed in the core and forwarded through
|
||||
callbacks; the simulation service retains the latest progress for polling.
|
||||
- The application owns one reusable `SimulationWindow`. Starting a run clears its
|
||||
progress, log, and future result views. Extend graph presentation through its
|
||||
Designer-owned `resultsLayout` and the
|
||||
`clear_result_views()`/`load_result_views()` hooks.
|
||||
- Simulation-window geometry, dock/toolbar state, and central-results visibility
|
||||
persist under `simulationWindow/` through `application_settings()`.
|
||||
- Standalone simulation results are modeled in `core/simulation/results.py`.
|
||||
Its versioned schema retains model status, messages, metadata, and plottable
|
||||
traces so the simulation window can open results without an active document.
|
||||
Human-readable `.json` uses JSON, while the default `.ber` format uses the same
|
||||
compressed MessagePack approach as `.beb` documents.
|
||||
- After a successful OpenModelica run, `<model>_res.csv` is parsed on the worker
|
||||
before temporary-directory cleanup. `SimulationResults.data` stores every CSV
|
||||
column as a numeric array, including `time`, for later plotting and persistence.
|
||||
- The simulation window's dockable Signals tree derives hierarchy from dot-separated
|
||||
result-column names and bracketed array indices (`a[1]` becomes `a → 1`). Leaf
|
||||
items retain the exact full column name in `UserRole`; plotting code should
|
||||
consume `SimulationWindow.selected_signal_names()`.
|
||||
- Simulation graph tabs persist as `SimulationResults.graphs`; every graph has a
|
||||
stable ID, editable title, and its own `traces` list. Runtime graph widgets belong
|
||||
in `GraphWorkspacePage.plot_layout`, not in the serialized core model. The
|
||||
Signals tree checkboxes edit the active graph's traces, and each page embeds a
|
||||
Matplotlib QtAgg canvas. Each graph persists its own `x_axis` signal (default
|
||||
`time`), selectable from the Signals tree context menu.
|
||||
- Embedded Matplotlib canvases provide cursor-centered wheel zoom and direct
|
||||
left-button drag panning without activating navigation-toolbar modes. Their
|
||||
custom navigation toolbar restores an explicit data-derived home view.
|
||||
- Rerunning the same composed model retains graph tabs, ordering, titles, X axes,
|
||||
and surviving trace settings while replacing numeric data. Missing signals are
|
||||
pruned from traces/X-axis selection and newly returned columns appear in the tree.
|
||||
- The optional OpenModelica executable is persisted as
|
||||
`simulation/openModelicaPath`. The GUI passes it into `Simulation`; core must
|
||||
not read `QSettings`. An empty path uses OMPython/PATH discovery, while an
|
||||
@@ -159,6 +208,9 @@ pyside6-uic --from-imports ui/text_definition_editor.ui \
|
||||
pyside6-uic --from-imports ui/simulation_settings_dialog.ui \
|
||||
-o src/bedit/gui/generated/ui_simulation_settings_dialog.py
|
||||
|
||||
pyside6-uic --from-imports ui/simulation_window.ui \
|
||||
-o src/bedit/gui/generated/ui_simulation_window.py
|
||||
|
||||
pyside6-uic --from-imports ui/graph_parameters_dialog.ui \
|
||||
-o src/bedit/gui/generated/ui_graph_parameters_dialog.py
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ description = "A starter Qt desktop application"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.10"
|
||||
dependencies = [
|
||||
"matplotlib>=3.8,<4",
|
||||
"msgpack>=1.0,<2",
|
||||
"PySide6>=6.7,<7",
|
||||
"OMPython>4.0",
|
||||
|
||||
BIN
BEdit/resources/icons/list-add.png
Normal file
BIN
BEdit/resources/icons/list-add.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
BIN
BEdit/resources/icons/list-remove.png
Normal file
BIN
BEdit/resources/icons/list-remove.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
BIN
BEdit/resources/icons/office-chart-line.png
Normal file
BIN
BEdit/resources/icons/office-chart-line.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 877 B |
BIN
BEdit/resources/icons/view-form-table.png
Normal file
BIN
BEdit/resources/icons/view-form-table.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 429 B |
@@ -1,5 +1,9 @@
|
||||
<RCC>
|
||||
<qresource prefix="icons">
|
||||
<file>icons/list-remove.png</file>
|
||||
<file>icons/list-add.png</file>
|
||||
<file>icons/view-form-table.png</file>
|
||||
<file>icons/office-chart-line.png</file>
|
||||
<file>icons/run-build.png</file>
|
||||
<file>icons/preferences-system.png</file>
|
||||
<file>icons/draw-triangle.png</file>
|
||||
|
||||
@@ -862,6 +862,75 @@ N\xa7\xd3>==\xfd\xa1\xc3\xe1\x98\x92$\xe9I\x00\
|
||||
\xbf\xc9\xd3\x01\x9f\xa3\x0f\x17Z/\xe3\x7f\xe1/\x17\x85\
|
||||
\xd6\x06q(\x0e\x10\x00\x00\x00\x00IEND\xaeB\
|
||||
`\x82\
|
||||
\x00\x00\x04)\
|
||||
\x89\
|
||||
PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\
|
||||
\x00\x00 \x00\x00\x00 \x08\x06\x00\x00\x00szz\xf4\
|
||||
\x00\x00\x00\x06bKGD\x00\xff\x00\xff\x00\xff\xa0\xbd\
|
||||
\xa7\x93\x00\x00\x00\x09pHYs\x00\x007\x5c\x00\x00\
|
||||
7\x5c\x01\xcb\xc7\xa4\xb9\x00\x00\x03\x9bIDATx\
|
||||
\xda\xedT=o\x1bG\x10}\xbb\xb7w$\xf5A\x9e\
|
||||
lJEB\x18\xb1\x0a\x1bv\x13\xdb\x85\xaa\x18P$\
|
||||
\xa4\x89\x81\x94\xd6_\x08`\xb8r\x93 \x85\x02\x01\xa9\
|
||||
\x9c\x1f\xe0>\x85\x81\x94F\x00\xa7\x11\xd88\x85\x1bK\
|
||||
6@)\x94-\xc8\x96\x10\x18\x81\x22\xf3C\x22i\xf2\
|
||||
\xf6v\xf3B.s\xd1\xb1H\x80\xb83\x07x\x98\xbd\
|
||||
\xdd\x99y3\xb3\xb7\x83\xb1\x8ce,\xef\xbd\x88\x1f\x97\
|
||||
\x97\xe1\x05\x01\x820D~~\x1e\xdb\xf7\xee\xa1st\
|
||||
\x94\x188H\x07/\x05\xe5\xe0\x0f\xb5C\xf0\xb7N\xd6\
|
||||
\xb9\xb3g\x11\xde\xba\x85\xf8\xd5+\xc4\xb5\x1a`\x0c\xc4\
|
||||
\x83B\x01\x82\xe4\xe1\xcd\x9b\xf2\x8f'Ol.\x9f\xb7\
|
||||
\x96\x07\xd1\xc9\x09\xbeX_\xc7\xbb\x90\xd7\xd7\xafCN\
|
||||
M\x01RB7\x9bbraA4\xee\xdf7q\xa3\
|
||||
\x01\xf1\xc3\xf9\xf3\xf0\xc3P\xac\x90\xfc\xd1\xda\x9a|v\
|
||||
\xf7\xee4\xc9\xbdw\xda\x01\x87\xec\xf4t<\xb7\xba\xda\
|
||||
\xcc\xdc\xb9c\xebW\xae\x88\xb8^\xb7\xa2|\xfb\xb6\xf8\
|
||||
\xe0\xeaU\xdbl4>?\xda\xd8\xf8\xf6\xa0\x5c\xfe\xa8\
|
||||
yp \xff=\x01G\x9eN\x22!\x1fM\xa0T2\
|
||||
S\x8b\x8b{\xb9\x85\x85U\xe4r?G\x9b\x9bB\xd5\
|
||||
\xaaU[\x7f\xfe|)\xbcp\xe1Avv\xd6\x93a\
|
||||
h\xdb\x07\x07B\xfc\xe7\x04\x122\xe3`\x07p~\x09\
|
||||
\x04c\xa3X\x9c\xd5;;?\x89\xdd\xdd\xcf\xa41e\
|
||||
e\x94B\xb3Z\xfd\xca\xfa\xbeWZZ\x8a>^Y\
|
||||
Q\xf3\xec\x88\xa7\x94#'\xac\x85L\x05\x1c\x09\x9e\xe8\
|
||||
S~\x88cxR\x22\xc8\xe7\xa1\xe7\xe6`\x84\x88\xf4\
|
||||
\xe3\xc7\xbe\xa8V\xbf6\x17/\x96\xd5\xeb\x87\x0f\x0bZ\
|
||||
\xa9K\xad(\xc2\x87\xd7\xaey\xc1\x8b\x17b\xe6\xf8\x18\
|
||||
\xca\xf3\xe0Y\x9bT<B\x98\x00B\x0c\xaa\xa6\xbd!\
|
||||
bc\xfa\xdad2\x00\x89\xdbL`\xfb\xe9S\xfc\xba\
|
||||
\xb5\x85Oo\xdc\xf0J\x95\x0a\xec\xfe\xfe\xa5\xdc\xcb\x97\
|
||||
\x05\x15[\xabzQ\xe4\xd7\xf6\xf7qD\x833$\xb7\
|
||||
LF1\xa8JZ\x9dJ\xc2\x81$\x18VJX\x12\
|
||||
\x81\xa4rr\x12&\x9bE\xa7\xd3\xc1\xef\x9b\x9b\xf8m\
|
||||
{\x1b\xf5\xb7o\xd1e\xcc\xe3j\x15zo\x0f\xf4\xf1\
|
||||
\xd9\x0d\xa5\x0c\x00\x87~\xe6\xacf\x00\x0a\x83\x9e\xd6\xff\
|
||||
l=\xc9$\xbb$\x95\x02\x82\x00\xa0\x8e\xe9\xd7k\xb7\
|
||||
\xd1\x22A\x83o\xbd~x\x88\xb6\xf3\xcb\xf2\xacEm\
|
||||
\xc8A\xe2~\xd2\xc6\x15\xa7\xb9\x88b\x00o8\x1c\xba\
|
||||
t\x0a\xba]L\xb1\x82\xac\xef#\xabT\x9f\xcc#\x04\
|
||||
\x1d\xe5\x10\x0c \xb4\x86\xe9\xf5`834\xdft\xaf\
|
||||
^G\xf7\xafJ\x1di\x86v\x9a~]\xdaj\x12c\
|
||||
b\x02\xbe\xbb\x22IN^\x99V\x87B4&\xac\xad\
|
||||
\x00(\xedll\xe8\xe2\xb9s\xbeGbEC\x9fW\
|
||||
\xe1\xc71|!\x86W\xd2\xdfW\x0c\xe0q_\x11\xc3\
|
||||
\xffD\xce\xcc@\x16\x8b\x10\x1e\xbf\x5c\x85Y\x22\x00P\
|
||||
\xa0\xd6\xd4>\x8b9\xb3\xbb\xab\xa3A\xcf*5r\x8b\
|
||||
5\xf4\xe5\x93\x0e\xb0~\xc2\x03\x1eZ#%\xfd\x93\xb6\
|
||||
\xb3\xda\xd3O\x8f\x04\xbe\xd3\xa7\xde<\xed2\xc0\x08\xb2\
|
||||
\x0e\x19\x06\xa5\xbf\xe0\xbaG\xbfe\x00\x8f\xd4174\
|
||||
\x17\x0c\xb0\x04\xe0;\x03\x5cf\x8b\xa4M?\xad\xd4\xcf\
|
||||
G\x0dV\x9f\x9e\x0f\xce~ v\xf8o\x11zpn\
|
||||
\x14\xb0\xc5\xbdo\xda\xc0/\x92\xa6j\xd2\xcd\x8c<7\
|
||||
\x9e\x01\x8b4\xca\xd3X%\x09$\xc3%\x91\xd1\xa4b\
|
||||
\x87\xd40J\xdbk\xee5\xc9\x09=\xd8\xb2\xea\x8dK\
|
||||
\xb6\x05\xc8\x90Z\xd0\x00\xceY\x11\xdf\xe3\xffI%\xf5\
|
||||
mI\xdc\x224`\xfaE~\xe9\x0e\xa4\xd3=B\xa7\
|
||||
F\xe9\xe8\xe8\x1dE\x90B&\xd1)\x0c\xc4`,c\
|
||||
\x19\xcbX\x06\xf2'\xe3\xdf\x9d\x06\x06\xf6\x92\x0e\x00\x00\
|
||||
\x00\x22zTXtSoftware\x00\x00\
|
||||
x\xda+//\xd7\xcb\xcc\xcb.NN,H\xd5\xcb\
|
||||
/J\x07\x006\xd8\x06X\x10S\xca\x5c\x00\x00\x00\x00\
|
||||
IEND\xaeB`\x82\
|
||||
\x00\x00\x02V\
|
||||
\x89\
|
||||
PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\
|
||||
@@ -2326,6 +2395,158 @@ K\x80@\x89\x15\x8d\xc04\xd5\xb5^\xaf\x1bx\xfa\x19\
|
||||
\x84\xe7\x04\xcf\x88\xfd\xfd\xfd\xe4\xe8\xe8\xc8\x9dL&\x14\
|
||||
\xc7\xcc\x7f5p\xf2g\x94\xf7\x1f\xdf\x9a\xd2\x93\xfbC\
|
||||
\xb7\xa7\x00\x00\x00\x00IEND\xaeB`\x82\
|
||||
\x00\x00\x03m\
|
||||
\x89\
|
||||
PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\
|
||||
\x00\x00 \x00\x00\x00 \x08\x06\x00\x00\x00szz\xf4\
|
||||
\x00\x00\x00\x01sRGB\x00\xae\xce\x1c\xe9\x00\x00\x00\
|
||||
\x06bKGD\x00\xff\x00\xff\x00\xff\xa0\xbd\xa7\x93\x00\
|
||||
\x00\x00\x09pHYs\x00\x00\x1b\xaf\x00\x00\x1b\xaf\x01\
|
||||
^\x1a\x91\x1c\x00\x00\x00\x07tIME\x07\xd9\x02\x10\
|
||||
\x17\x22\x16\x993\xa5<\x00\x00\x02\xedIDATx\
|
||||
\xda\xed\x97_H\xd3Q\x14\xc7\xcf\xd9\xef7\xcb\xca\x89\
|
||||
B \x91\x0f\xc9\xcczha\xf6\xa8\xb4\x06M\x90f\
|
||||
aiV$\x96V\x12\xf9P-S\x90d%Lh\
|
||||
V/B.\x8d\xc2\xb2\xc0\x1erS\xc1\x84\x1cdo\
|
||||
a\xa0\x0f>h\x0f\xfdy\xf0-\x9b\xa6\x0f\xb1{\xfb\
|
||||
n\xf4\x8b\x91\xe2\x5cn\xae\x07\x0f\xdc\x9dq/\xfc>\
|
||||
\xe7{\xce\xe1\xdc\xdf\x8f\xd6M\xb3\x86\x86\x86\xe2Dp\
|
||||
u\xbf\xe19pG\x82>!\x01\x04\xe1\x9aOd\x09\
|
||||
:\x13V\x02\xcd\xd6\x03H\x84\xa9\x04\xab\xaf\xaf\xef\x84\
|
||||
\xcb\x8f\x07\xe0z\xcf\x82AU\xc8\xa6\xeax\xfc\xf6\xd1\
|
||||
\x8dcKf\xa0\xa5\xa5\xa5\x0an$V\xd0\xea\xc7\xf3\
|
||||
\x86\x9a\xae\xf9\xd3\xb5\xdd\xf3\xaf\x84\xa4\xcfRR\xa9\x5c\
|
||||
&\x031\xb3\xf2\xf6\x1f\xb9P\xdb\x14\x90\xd2\xacH\xf6\
|
||||
\x01\xda\x13\x10T\xd1Z\x96\xec\xa7x\x07P\xd26\xc7\
|
||||
P\xdb!\x04\xbd\x10L\x15\xedg7-\x82\xc65\x00\
|
||||
\xc0m\x02?\x82\xd9\xf5\xa4j\xb3\x5c\xd3&,\xba\x1f\
|
||||
R\x8f\xd4\x93\xe3\xe5\xc5\x08\xf0X7\xa1\xa6> B\
|
||||
\xde\xbb&s\xc0\xb3\xf3x\x81'\xbbt\x1f\xc1,w\
|
||||
f\x19M\xd7$\xa0\xbe\xf7\xf2\x16\x19\xf5\x1c\x88\x0e|\
|
||||
L!\xc9\x8d$u\x97X\xa8\x0b\xde\xac\x0aS\xab$\
|
||||
3\x07\xd5\xb3\xd4\xd4\xc7'\x00\xa8\xce\x00\xfc)\xe0\xcc\
|
||||
\xa4\xdbK2\xe9\x96\x94\xaa\x0bu\xcfc\xa8\x1f\xbc\x92\
|
||||
\x22\xffq\x14GnB\xa4\xdbBRy\xcfRy\xcb\
|
||||
\xa4XmS\xcf\xa7I\xe8\xed,\xf4\x85\xbb&\xc7\xb4\
|
||||
\xda\xc7\xfe:\x06X\xf1d\x975y\x8c\xe5_\xbd\xc6\
|
||||
\x93\x96\xf0\xb3\x5c\x87\x9f++\xdf\x8d\xf6m\xbf\xfa\xa9\
|
||||
o[\x9d!\xe6\x97\x11\xc0\x198\x1e\x84\xea\x02\xa4|\
|
||||
?T\xbf\x09?\x97\x92\x8a\xc7\xb3\xf6H)\x92^#\
|
||||
\x1b\xae\xe5 \x03\x06\xb7e \xa5\xc3\xb4\xd2\x00\x00?\
|
||||
\x91\x87Z\x87R\x0e_h\x9b\xea\x9e\x0e?\xdf\xdd\xf8\
|
||||
\x9d\x03B\xde\x0cv>\x9a\xf1\x1aK\xbd\xb5\x7fk\xb3\
|
||||
u1\xb8\xdd0`x\xe8F\xf9\x1e\xe19\xea\x8a\x03\
|
||||
`\xa9\xfb\x09\xf8)\x80\x1d\xb6\x8f\xcf\x02\xda~\xa6}\
|
||||
\x86v\xdc\x981\x06\x045\x02NB\x90\xf7\xf0t\xb3\
|
||||
\x1f\x19\xb8\x80\xe5\xeeOo5\x84\xa9>\x040\x1aD\
|
||||
!\xc0MEs\xe7F\x97diM\xc8\xcc\xf9N\xa7\
|
||||
3'\xfc0\xb9\xe6\x1b\xe9\x98\x8c\xaaB\x07\x92\x142\
|
||||
\xebU6\xeb\xf1\xbc$\x85}\xd8\xbb;\xd1\x9c\xfa\xe1\
|
||||
\x0f0\xfd\x9e;\x04\x13\x1b\xecD\xec\x02\xdcJ\x92\xcf\
|
||||
\x03<\x14\xf5$\x04\xd8\x84\xd5\x85\xbf_P\xeba,\
|
||||
3\x96\x0f\x8a\x0fB}\xe6\xa43\xf5L\x08\x1enB\
|
||||
\xb5\x13J\x01\xb5\x13a\xaa\x87V3\x07|X\x0eI\
|
||||
4\xe5oK\x8b|\x1f\xcc\xd4\xfa\xd1h%\x00\xa7\x02\
|
||||
<\xbc\xaaA\xb4\xf0 m\x0c\x0e+:+\x9a\xad\x1e\
|
||||
\xfd\xaf\xdf\x091k\xea\xfe\xfe\xf8\xe1H\xdf\x05R\xca\
|
||||
|f\x1e\x89\xd1\x9ef\xbdhx\x0fE4mL\xaf\
|
||||
b/B\x06\x12o\xbf\x00\xa3\x17WYZq\xd9W\
|
||||
\x00\x00\x00\x00IEND\xaeB`\x82\
|
||||
\x00\x00\x05\xcf\
|
||||
\x89\
|
||||
PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\
|
||||
\x00\x00 \x00\x00\x00 \x08\x06\x00\x00\x00szz\xf4\
|
||||
\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\
|
||||
\x00\x00\x00\x09pHYs\x00\x00\x03v\x00\x00\x03v\
|
||||
\x01}\xd5\x82\xcc\x00\x00\x00\x19tEXtSof\
|
||||
tware\x00www.inksca\
|
||||
pe.org\x9b\xee<\x1a\x00\x00\x05LID\
|
||||
ATx\xda\xc5\x97\xdboTE\x1c\xc7\xbf3s\xce\
|
||||
\x9e\xeeni\x0b\xbd@\x01C1\x05B\x10\x0d\xf4\x22\
|
||||
\x18\x95D0i\xc4\x17|21\xc6\x17\xc3\x93\x89\xd1\
|
||||
\xc8\x8b\xfaP#oj\x8c\x89O\xfc\x03\xc6K\x0c\xf1\
|
||||
\x01!B\xa8\xc1j\x88D\x90@)\x14\xac\xb5\x86K\
|
||||
K\xaf\xdb\xdd={\xce\xcc\xef\xe7\xec\x9cficb\
|
||||
\xd2\x98\x13f\xf3\xdd93\xbf\x93\x9d\xcf\xfengW\
|
||||
03\x1e\xe6\xf0\xb0\xc2\xf1\xca\xe9\x17wok\xda~\
|
||||
lh\xe6\xe2\xd6\xbf\x0a#\xab\x94\x92h\xcb\xad\x9d{\
|
||||
z\xdd\xfe\x9b\xf9 \xf7\xce\xe1\xad\xef\x0d`\x05Cb\
|
||||
\x05\xa3\xe7\xcb\xce\xc7\x0emz\xf9\xfc\xab\x9d\x87\xbb\xf6\
|
||||
\xb4\xec[\x15k\x82\x8e\x09\x9d\xf9\xed\x8d\x07\xda\x0fu\
|
||||
=\xd5\xd2w\xe6\x83K\x87{S\xf3@N\xe4>\x9d\
|
||||
)M{>\xd5\xa1\xab\xad\x17\x1b\x1a\xda\xdd~V\xe6\
|
||||
\xb1)\xb7\x05\xe7\xee\x9e\x94\xf3\xa5\xe2'\x00\x9eI\x05\
|
||||
\xe0^a\xa2\xe7\xdc\xdf\x03\xe8\x5c\xb3\x05\xf3\xb9k\x10\
|
||||
A\xc5\xed\x87\x98\xc4\x99\xdb\xdf\xe1\xd4\xd8\xb7\x18-\x0e\
|
||||
\xefL\xcd\x03aTi\x1c\x1c\xff\x11\xdd\x1bw\xa3I\
|
||||
\x99\xe5F3\x87+\xf7/\xc2W\xb215\x00\x133\
|
||||
\x08\x11E(\xc7\xcb\x01<\xa3\x9d]2#5\x00\
|
||||
\xd2\x04!$\x8c!\x94u\xb4\xccVG1\x8c6\x10\
|
||||
@\x9a\x00\x0c\x08\x86!B\x18G\x80X\xea\x01\x03c\
|
||||
\xed\x02\x94\x1e\x80Y\x04\xd0d`,\x80\x00j\x10\x01\
|
||||
i\x18\xc3\x10\xd6\x9ej\x0e\x08\xc5 bD:^\xe6\
|
||||
\x01M\xfa\xffy\xe0\xe8\xe0\xd1\x17\xaeN\x5c\xed\x1f\x18\
|
||||
\x1d\xd869w\xafA\x92\x84d\xc0\xbeC\xb1\x80\x94\
|
||||
\x02JHw81!2\x0e\xa0\xc6\xa0\x8dv9b\
|
||||
\xd0ul\x03{\xbe\x84\xaf\x14<_\xc1\xf7\xecu\
|
||||
F\xa15\xd76\xff\xc4\xda\x9e\xeb\x1d\xab\xb6\xf7\xbf\xb4\
|
||||
\xf9\xf5\x13\xb5N\xd8\xf7E_\xefTi\xea\xf8\xc6\xfa\
|
||||
\x8d=mA[\x03\x99$\xdel\xd8\xcd\xb48\x1bw\
|
||||
M\xd0\xdaX\x00\x8d\xd8\x98%\x8a@D\xee^c\xc8\
|
||||
\xddk(\xb9\xdfp\xb2W\xef564\xaa\xd6\x9e\xf9\
|
||||
h\xea\xf8G\xc3o\xb8\x8e\xe9\x1eF\x1d\x9fw\xfc\xb0\
|
||||
\xabm\xd7\x81\xbd\xeb\xf7\x02\xc2`.\x9aAu\x9f\x85\
|
||||
\x15\x5c\xdc\x935\x0c\x84\x00r\xb9,\xee\x9a?!\x93\
|
||||
$p{\x1b\xbcGQ\xa9\x84P\xd2\x83'\xfd\x9a\x94\
|
||||
\xf2\x90\xb1{\x81\xca\xc2g\xcf\xda\x0d\xc6\xc2!\xdc\x89\
|
||||
n\x9e\xf9\xec\xc9\xef\x0f\xb8\x10\x8c\xcf\x8dw#\x06z\
|
||||
\xda\xbb0T\xb8\x00-4 Q\x93\x84\x80\x14\x02J\
|
||||
J7\xcb(Y\x0b'\xc7\x87\xb1\xe8\x06X\x00L\x9c\
|
||||
x\x81\xaa\x22\x042\x8b\xbcX\x8d\x91\x89Q\x9c\x1a:\
|
||||
\x8d\xf7\xf7\xbd\x85\xdb4\x8cyLv\xd5r\x80\x88\x9a\
|
||||
\xc6\xa6\xc602u\x1dEQN\x0eVp\xb3\x10H\
|
||||
\x0e\x96\x02\xcc\xb2\x06\xc2\xe2\x01Dm0\x83\x00x\xc2\
|
||||
\xc3\xba\xecz\xcc\x95\x8b\xb81}\x0bgG\xbfF\x1c\
|
||||
\x11\x00\xd8\xf50\x8a\xc1md|\xd9T\x03\x00[\x91\
|
||||
k\xb5\xa8\xa88\x01 \x07\x91$\x1fK+\x07\x90\x1c\
|
||||
\x0e\x86\xaa\x02A8\xefdT\x1d\x9a\x83V\x17\x8e0\
|
||||
\x0a1\xb10\x81o\xfe\xf8\x0a\x85J\x11\xa5(\xb6\xa0\
|
||||
\x12\x90\xe42V\xb3v\xf9@\x9e\xc0R\x80Y\x10\x9a\
|
||||
f\x0a\xb3\xb8^\xbc\x09?\xf0\x9c\x82L\x80l\x10\xc0\
|
||||
>\xe7\x91\xf7\xb2\x8eI2\x01,]G\x0cD\x00\x22\
|
||||
\x8d\xf9h\x1a\xc3\x93\xbf!\xd4\x15h\x22D\xc6\x00\xd2\
|
||||
\xc0S\xca\xca@\x19W.N\x19\xcf\xc3\x02\xbb\xf0\xcc\
|
||||
.-\xc3A\x10\x0e\x0e\x0e\xff\x82\x1d\xebw .\xc5\
|
||||
@9\x09A$\x04H\x85(\x8b\x18\x9e'\xdc\x87\xd6\
|
||||
5H\xdc\xc1-\x04\x9erkea\x1e\xf1;Q\xd1\
|
||||
\x06\xbc\x987\xe43L\x96\xa09)[cU\xefe\
|
||||
1e\x93\x97du\x8f\x7f~\x00\xa0q\x04\xc0\xfe\x85\
|
||||
\xf2B\xdd\xf9k\xe7\x81x1\x04\x9cP\x0b+)\x92\
|
||||
^ \x94\xc0\xb3{z\xe1\xafV\xc8T3\xbc\x0a!\
|
||||
%\xc2B\x8c\x9f.\xffj!%\xaa=@YyK\
|
||||
\xe4\xfb\x0a\x85\x8cB&c\xd7\x19\xaf\xacY\x1f\xa9\xf5\
|
||||
\x01\xfe\x90\xaf\x81\xd0\x03\xe0,\x08\x0b0@M\x1a`\
|
||||
;SU\x94\x5ck\x13\xbbC}%\x1d@\xe0{\xae\
|
||||
D\x99\x01\x02\xbb\xba\xa7\x7f\x89\xacx\xce\xdaN\xda\xb9\
|
||||
\xfbD\xdf\xc8\xd0\xb2N\xc8\x1f\xf3\x15\x00\xcf\xfdg\xdb\
|
||||
|M2\x0b\xd7\xf5\x9cG\xbc*\x80\xb2\x00\x9e\x87J\
|
||||
r\x00$\x0b\x8c\xbd;#R\xf9MH&\xa9\xf3\x98\
|
||||
b\xf0b|\x94L\xbc\x00h\x07@)\xfe\x1ep\x87\
|
||||
3\x0bT\xe2\x18\xc2\x18\x18J\xbe\xb5X\xecF\xc9+\
|
||||
E\x80\x04\x02(\xeb\x0a8\xd2P2\xb2J\x1aR1\
|
||||
\xa2\xa4\x9d\xa4\x0e \x18\xa5(D\x14F\xae\xe6+\xb1\
|
||||
F!\xac ,\xf9 k\xb3<)\x02\x88D\x0bq\
|
||||
\x08*VP\xac\xc4\xae\x17\xb8\xf2,f\xc0\x92\xacd\
|
||||
z\x00^F\x15\x1b\xb2A\xbeE\x05\xb8Q\x9aK\xda\
|
||||
\xb4U\xf5\xb5)\xee@=1B.\x15R\xfbg\x94\
|
||||
\xad\xf7\x7f\xdf\xd9\xde\x82\x83\xcdk\xb03n\x86\x9cR\
|
||||
\xc0\xb4D\xb7\xea\xc5V\xde\x82<\xea!H^H\x0d\
|
||||
\xdf\x1c\xbc\xb9ym\xa0W7*\xb4\xe6\xf3 c\
|
||||
\xc0Dx\xa2\xf9q\xc8@Add$`\xdeN\x0d\
|
||||
\xe0N\xff\xec\x05\xd9\x1c=?\xee\xf3\xe5\xfb\x22Z\xa0\
|
||||
,\x83\xeb\x18*\xab\xc2 \x9b\xb9\x12\xa0n\xffD\x7f\
|
||||
\xf1\x12V0\x1e\xfa\xdf\xf3\x7f\x00j\xf0\xda\xe8\xbc\xba\
|
||||
\xd0\x0a\x00\x00\x00\x00IEND\xaeB`\x82\
|
||||
\x00\x00\x04<\
|
||||
\x89\
|
||||
PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\
|
||||
@@ -2396,6 +2617,35 @@ f\xa2\xd1\xa5\x5c\x22\xb4\x91SZ\xd5u\xd7\x0a\xd2]\
|
||||
|\x01\x85\x09\x800\x7fss\xd3{\xf6\x7fABG\
|
||||
Y\x01\x05l*\xfc\x00!\x00\x12\xf1%U\xb6\x0e\x00\
|
||||
\x00\x00\x00IEND\xaeB`\x82\
|
||||
\x00\x00\x01\xad\
|
||||
\x89\
|
||||
PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\
|
||||
\x00\x00 \x00\x00\x00 \x08\x03\x00\x00\x00D\xa4\x8a\xc6\
|
||||
\x00\x00\x00\x01sRGB\x00\xae\xce\x1c\xe9\x00\x00\x00\
|
||||
\x09pHYs\x00\x00\x0d\xd7\x00\x00\x0d\xd7\x01B(\
|
||||
\x9bx\x00\x00\x00\x07tIME\x07\xd9\x0c\x1c\x03\x1c\
|
||||
\x0e%S,b\x00\x00\x00uPLTE\x00\x00\x00\
|
||||
\x13\x13\x13\x0a\x0a\x0a\x0b\x0b\x0b\x00\x00\x00\x00\x00\x00\x00\
|
||||
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc6\xc6\xc8\xc7\xc7\
|
||||
\xc9\xc9\xc9\xcb\xcc\xcc\xce\xce\xce\xd0\xd0\xd0\xd2\xd4\xd4\xd6\
|
||||
\xd7\xd7\xd8\xd7\xd7\xd9\xd8\xd8\xda\xd9\xd9\xdb\xda\xda\xdb\xda\
|
||||
\xda\xdc\xdb\xdb\xdc\xdb\xdb\xdd\xdd\xdd\xdf\xde\xde\xdf\xe2\xe2\
|
||||
\xe3\xe3\xe3\xe5\xe3\xe3\xe6\xe4\xe4\xe6\xe6\xe6\xe7\xe7\xe7\xe9\
|
||||
\xe9\xe9\xea\xeb\xeb\xec\xed\xed\xee\xf0\xf0\xf1\xf3\xf3\xf4\xff\
|
||||
\xff\xff\xd3\x9b\xcc\x0e\x00\x00\x00\x0atRNS\x00\x09\
|
||||
\x15\x15\x1825678\xb5\xcc\xc0\x1e\x00\x00\x00\x01\
|
||||
bKGD&Z\x08\x98\xb5\x00\x00\x00\x9bIDA\
|
||||
Tx\xda\xd5\x93\xcb\x0e\x820\x10\x00\x8b\x0aEP|\
|
||||
u\xc1G)\x94\x02\xff\xff\x89.]\x0e\x18\xccr1\
|
||||
F\xe72\xd9d\xd26\x9bT\xfc\x02\xc1\x86%\x10a\
|
||||
\xcf\x12\x0a\xd9)\x86N\x0a\xd9^\x18Z\x0c\xdc\x91\xc1\
|
||||
a\xd0\x1c\x18\x1a\x0c\xec\x9e\xc1bP'\x9et\x97\xce\
|
||||
\x95\xd4\x18\x94=q#\xddIWR\x89\x81\x1e\x03E\
|
||||
\x82\x97IO\x02\x98\x8b\x82G\x01\x9e\xec\x8d\x8aj\xf1\
|
||||
\x84\xcf\xbc!W\x03\x90\x8d\x02oR^-^\xf1?\
|
||||
{\xe0\x83\xc8\x1a=`\xce\xc6\xebd\xa6\x93\x8b\xc4*\
|
||||
\xde2\xc4\xeb/|\xcd'\xec\xbfO\xbf\x90M\x1a\x0a\
|
||||
\x00\x00\x00\x00IEND\xaeB`\x82\
|
||||
\x00\x00\x02\x92\
|
||||
\x89\
|
||||
PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\
|
||||
@@ -2563,6 +2813,10 @@ qt_resource_name = b"\
|
||||
\x0f\xba\x1e'\
|
||||
\x00d\
|
||||
\x00r\x00a\x00w\x00-\x00p\x00a\x00t\x00h\x00.\x00p\x00n\x00g\
|
||||
\x00\x0f\
|
||||
\x020\x8b\xe7\
|
||||
\x00l\
|
||||
\x00i\x00s\x00t\x00-\x00r\x00e\x00m\x00o\x00v\x00e\x00.\x00p\x00n\x00g\
|
||||
\x00\x0d\
|
||||
\x0b\xe6\x1f\xa7\
|
||||
\x00d\
|
||||
@@ -2632,10 +2886,24 @@ qt_resource_name = b"\
|
||||
\x00d\
|
||||
\x00o\x00c\x00u\x00m\x00e\x00n\x00t\x00-\x00s\x00a\x00v\x00e\x00.\x00p\x00n\x00g\
|
||||
\
|
||||
\x00\x15\
|
||||
\x02\xb4\x1f\x07\
|
||||
\x00o\
|
||||
\x00f\x00f\x00i\x00c\x00e\x00-\x00c\x00h\x00a\x00r\x00t\x00-\x00l\x00i\x00n\x00e\
|
||||
\x00.\x00p\x00n\x00g\
|
||||
\x00\x0c\
|
||||
\x09\xc6\x19'\
|
||||
\x00l\
|
||||
\x00i\x00s\x00t\x00-\x00a\x00d\x00d\x00.\x00p\x00n\x00g\
|
||||
\x00\x10\
|
||||
\x03\xe6\xd3g\
|
||||
\x00d\
|
||||
\x00r\x00a\x00w\x00-\x00e\x00l\x00l\x00i\x00p\x00s\x00e\x00.\x00p\x00n\x00g\
|
||||
\x00\x13\
|
||||
\x07\xd6O\x07\
|
||||
\x00v\
|
||||
\x00i\x00e\x00w\x00-\x00f\x00o\x00r\x00m\x00-\x00t\x00a\x00b\x00l\x00e\x00.\x00p\
|
||||
\x00n\x00g\
|
||||
\x00\x12\
|
||||
\x09\xb3>\xc7\
|
||||
\x00d\
|
||||
@@ -2653,63 +2921,71 @@ qt_resource_struct = b"\
|
||||
\x00\x00\x00\x00\x00\x00\x00\x00\
|
||||
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\
|
||||
\x00\x00\x00\x00\x00\x00\x00\x00\
|
||||
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x1c\x00\x00\x00\x03\
|
||||
\x00\x00\x00\x00\x00\x02\x00\x00\x00 \x00\x00\x00\x03\
|
||||
\x00\x00\x00\x00\x00\x00\x00\x00\
|
||||
\x00\x00\x01\xfe\x00\x00\x00\x00\x00\x01\x00\x00N\xe8\
|
||||
\x00\x00\x02\x22\x00\x00\x00\x00\x00\x01\x00\x00S\x15\
|
||||
\x00\x00\x01\x9f{C\xf1'\
|
||||
\x00\x00\x02>\x00\x00\x00\x00\x00\x01\x00\x00Z\x1a\
|
||||
\x00\x00\x02b\x00\x00\x00\x00\x00\x01\x00\x00^G\
|
||||
\x00\x00\x01\x9f\x7f\xa8\xa8)\
|
||||
\x00\x00\x02\xec\x00\x00\x00\x00\x00\x01\x00\x00tV\
|
||||
\x00\x00\x03\x10\x00\x00\x00\x00\x00\x01\x00\x00x\x83\
|
||||
\x00\x00\x01\x9f{0\xc99\
|
||||
\x00\x00\x01\xc4\x00\x00\x00\x00\x00\x01\x00\x00D2\
|
||||
\x00\x00\x01d\x00\x00\x00\x00\x00\x01\x00\x004B\
|
||||
\x00\x00\x01\x9f\x84\xbd\x03\xb8\
|
||||
\x00\x00\x03\xc8\x00\x00\x00\x00\x00\x01\x00\x00\x91\xd7\
|
||||
\x00\x00\x01\x9f\x84\x8f\x00\xb9\
|
||||
\x00\x00\x01\xe8\x00\x00\x00\x00\x00\x01\x00\x00H_\
|
||||
\x00\x00\x01\x9f\x7f&\x83\xcd\
|
||||
\x00\x00\x01\xa4\x00\x00\x00\x00\x00\x01\x00\x00<J\
|
||||
\x00\x00\x01\xc8\x00\x00\x00\x00\x00\x01\x00\x00@w\
|
||||
\x00\x00\x01\x9f{C\xf1\x18\
|
||||
\x00\x00\x03\xa4\x00\x00\x00\x00\x00\x01\x00\x00\x8d\xaa\
|
||||
\x00\x00\x04\x16\x00\x00\x00\x00\x00\x01\x00\x00\x9b\x1b\
|
||||
\x00\x00\x01\x9f\x7fY\xceg\
|
||||
\x00\x00\x02\xa2\x00\x00\x00\x00\x00\x01\x00\x00f\xc8\
|
||||
\x00\x00\x02\xc6\x00\x00\x00\x00\x00\x01\x00\x00j\xf5\
|
||||
\x00\x00\x01\x9f\x7fV\xd5\xc0\
|
||||
\x00\x00\x03Z\x00\x00\x00\x00\x00\x01\x00\x00\x84\xc5\
|
||||
\x00\x00\x03~\x00\x00\x00\x00\x00\x01\x00\x00\x88\xf2\
|
||||
\x00\x00\x01\x9f\x7f&\x83r\
|
||||
\x00\x00\x02\xce\x00\x00\x00\x00\x00\x01\x00\x00m[\
|
||||
\x00\x00\x02\xf2\x00\x00\x00\x00\x00\x01\x00\x00q\x88\
|
||||
\x00\x00\x01\x9f\x7f&\x83\xb1\
|
||||
\x00\x00\x01\x1c\x00\x00\x00\x00\x00\x01\x00\x00,\x08\
|
||||
\x00\x00\x01\x9f\x7fY\xce\x82\
|
||||
\x00\x00\x01\xe0\x00\x00\x00\x00\x00\x01\x00\x00Kh\
|
||||
\x00\x00\x02\x04\x00\x00\x00\x00\x00\x01\x00\x00O\x95\
|
||||
\x00\x00\x01\x9f{C\xf1.\
|
||||
\x00\x00\x01\x84\x00\x00\x00\x00\x00\x01\x00\x006\x9c\
|
||||
\x00\x00\x04<\x00\x00\x00\x00\x00\x01\x00\x00\x9f[\
|
||||
\x00\x00\x01\x9f\x84\x8f\xa6\x10\
|
||||
\x00\x00\x01\xa8\x00\x00\x00\x00\x00\x01\x00\x00:\xc9\
|
||||
\x00\x00\x01\x9f{{\xa5\xd5\
|
||||
\x00\x00\x03\xca\x00\x00\x00\x00\x00\x01\x00\x00\x91\xea\
|
||||
\x00\x00\x04h\x00\x00\x00\x00\x00\x01\x00\x00\xa1\x0c\
|
||||
\x00\x00\x01\x9f\x7f&\x83\x10\
|
||||
\x00\x00\x03\xf8\x00\x00\x00\x00\x00\x01\x00\x00\x95H\
|
||||
\x00\x00\x01\x9f\x84\xbd\x03\xde\
|
||||
\x00\x00\x00\xfe\x00\x00\x00\x00\x00\x01\x00\x00(e\
|
||||
\x00\x00\x01\x9f\x7f&\x83~\
|
||||
\x00\x00\x036\x00\x00\x00\x00\x00\x01\x00\x00\x80\xe2\
|
||||
\x00\x00\x03Z\x00\x00\x00\x00\x00\x01\x00\x00\x85\x0f\
|
||||
\x00\x00\x01\x9f\x7f&\x83T\
|
||||
\x00\x00\x00~\x00\x00\x00\x00\x00\x01\x00\x00\x14M\
|
||||
\x00\x00\x01\x9f\x7fY\xce^\
|
||||
\x00\x00\x00\xa2\x00\x00\x00\x00\x00\x01\x00\x00\x19Y\
|
||||
\x00\x00\x01\x9f{0\xc9B\
|
||||
\x00\x00\x01d\x00\x00\x00\x00\x00\x01\x00\x004B\
|
||||
\x00\x00\x01\x88\x00\x00\x00\x00\x00\x01\x00\x008o\
|
||||
\x00\x00\x01\x9f\x7f&\x83)\
|
||||
\x00\x00\x03\x14\x00\x00\x00\x00\x00\x01\x00\x00{`\
|
||||
\x00\x00\x038\x00\x00\x00\x00\x00\x01\x00\x00\x7f\x8d\
|
||||
\x00\x00\x01\x9f{C\xf1N\
|
||||
\x00\x00\x02p\x00\x00\x00\x00\x00\x01\x00\x00b\x99\
|
||||
\x00\x00\x02\x94\x00\x00\x00\x00\x00\x01\x00\x00f\xc6\
|
||||
\x00\x00\x01\x9f\x7f&\x82\xf2\
|
||||
\x00\x00\x00\xd0\x00\x00\x00\x00\x00\x01\x00\x00!\xc5\
|
||||
\x00\x00\x01\x9f{\x8d\xf34\
|
||||
\x00\x00\x00\x10\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
|
||||
\x00\x00\x01\x9f{0\xc9+\
|
||||
\x00\x00\x02\x1e\x00\x00\x00\x00\x00\x01\x00\x00RH\
|
||||
\x00\x00\x02B\x00\x00\x00\x00\x00\x01\x00\x00Vu\
|
||||
\x00\x00\x01\x9f{C\xf1=\
|
||||
\x00\x00\x006\x00\x00\x00\x00\x00\x01\x00\x00\x05\x86\
|
||||
\x00\x00\x01\x9f\x7f&\x83\x99\
|
||||
\x00\x00\x03\xf4\x00\x00\x00\x00\x00\x01\x00\x00\x94\x80\
|
||||
\x00\x00\x04\x92\x00\x00\x00\x00\x00\x01\x00\x00\xa3\xa2\
|
||||
\x00\x00\x01\x9f{{\xa5\xe3\
|
||||
\x00\x00\x00^\x00\x00\x00\x00\x00\x01\x00\x00\x0c\xc1\
|
||||
\x00\x00\x01\x9f\x7f\xac\xf2\xc6\
|
||||
\x00\x00\x01D\x00\x00\x00\x00\x00\x01\x00\x00/{\
|
||||
\x00\x00\x01\x9f\x7fV\xd5\xe5\
|
||||
\x00\x00\x03|\x00\x00\x00\x00\x00\x01\x00\x00\x88\xb7\
|
||||
\x00\x00\x03\xa0\x00\x00\x00\x00\x00\x01\x00\x00\x8c\xe4\
|
||||
\x00\x00\x01\x9f{0\xc9R\
|
||||
"
|
||||
|
||||
|
||||
@@ -344,11 +344,19 @@ class Component:
|
||||
if kind == "text":
|
||||
raw_source = implementation.get("source", {})
|
||||
equations = raw_source.get("equations", "")
|
||||
declarations = raw_source.get("declarations", "")
|
||||
initial_equations = raw_source.get("initialEquations", "")
|
||||
parameters = data.get("parameters", raw_source.get("parameters", []))
|
||||
if not isinstance(equations, str):
|
||||
raise ValueError("Text component equations must be a string")
|
||||
if not isinstance(declarations, str):
|
||||
raise ValueError("Text component declarations must be a string")
|
||||
if not isinstance(initial_equations, str):
|
||||
raise ValueError("Text component initial equations must be a string")
|
||||
source = {
|
||||
"equations": equations,
|
||||
"declarations": declarations,
|
||||
"initialEquations": initial_equations,
|
||||
}
|
||||
if not isinstance(parameters, list):
|
||||
raise ValueError("Component parameters must be a list")
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
from bedit.core.simulation.service import Simulation
|
||||
from bedit.core.simulation.openmodelica import OpenModelicaInterface
|
||||
from bedit.core.simulation.results import (
|
||||
BerSimulationResultsSerializer,
|
||||
JsonSimulationResultsSerializer,
|
||||
SimulationExecutionResult,
|
||||
SimulationGraph,
|
||||
SimulationResults,
|
||||
SimulationResultsSerializer,
|
||||
SimulationTrace,
|
||||
)
|
||||
|
||||
__all__ = ["Simulation"]
|
||||
__all__ = [
|
||||
"OpenModelicaInterface",
|
||||
"Simulation",
|
||||
"SimulationResults",
|
||||
"SimulationExecutionResult",
|
||||
"SimulationGraph",
|
||||
"SimulationResultsSerializer",
|
||||
"SimulationTrace",
|
||||
"BerSimulationResultsSerializer",
|
||||
"JsonSimulationResultsSerializer",
|
||||
]
|
||||
|
||||
@@ -14,8 +14,8 @@ _BEVALUE_PATTERN = re.compile(r"\$([A-Za-z_][A-Za-z0-9_]*)\$")
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class CompilationResult:
|
||||
"""The intermediate data and generated source produced by compilation."""
|
||||
class CompositionResult:
|
||||
"""The intermediate data and generated source produced by composition."""
|
||||
|
||||
graph: dict[str, Any]
|
||||
objects_by_id: dict[str, Any]
|
||||
@@ -23,16 +23,16 @@ class CompilationResult:
|
||||
model_name: str
|
||||
|
||||
|
||||
def compile_graph(graph: dict[str, Any]) -> CompilationResult:
|
||||
"""Clean, index, and emit a serialized component tree."""
|
||||
def compose_graph(graph: dict[str, Any]) -> CompositionResult:
|
||||
"""Clean, index, and compose a serialized component tree."""
|
||||
|
||||
cleaned_graph = cleanup_graph(deepcopy(graph))
|
||||
objects_by_id = build_id_list(cleaned_graph)
|
||||
return CompilationResult(
|
||||
return CompositionResult(
|
||||
graph=cleaned_graph,
|
||||
objects_by_id=objects_by_id,
|
||||
modelica=emit_model(cleaned_graph, objects_by_id),
|
||||
model_name=model_name_for(cleaned_graph)
|
||||
model_name=model_name_for(cleaned_graph),
|
||||
)
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ def emit_model(
|
||||
) -> str:
|
||||
"""Emit a component and its nested definitions as Modelica source."""
|
||||
|
||||
del id_list # Kept in the public API for compiler extensions and inspection.
|
||||
del id_list # Kept in the public API for composer extensions and inspection.
|
||||
indentation = "\t" * indent
|
||||
body_indent = "\t" * (indent + 1)
|
||||
model_name = model_name_for(graph)
|
||||
@@ -123,6 +123,14 @@ def emit_model(
|
||||
f"{body_indent}parameter {parameter_type} {parameter_name} = {value};"
|
||||
)
|
||||
|
||||
if implementation_kind == "text":
|
||||
declarations = str(implementation.get("source", {}).get("declarations", ""))
|
||||
declarations = expand_bevalues(declarations, macros)
|
||||
lines.extend(
|
||||
f"{body_indent}{line}" if line.strip() else ""
|
||||
for line in declarations.splitlines()
|
||||
)
|
||||
|
||||
if implementation_kind == "graph":
|
||||
for block in nested_graph.get("blocks", []):
|
||||
block_type = model_name_for(block)
|
||||
@@ -134,8 +142,9 @@ def emit_model(
|
||||
f"{body_indent}{junction_type} {_junction_name(junction['id'])};"
|
||||
)
|
||||
|
||||
lines.append(f"{indentation}equation")
|
||||
if implementation_kind == "graph":
|
||||
lines.append(f"{indentation}equation")
|
||||
|
||||
blocks = {block["id"]: block for block in nested_graph.get("blocks", [])}
|
||||
junctions = {
|
||||
junction["id"]: junction for junction in nested_graph.get("junctions", [])
|
||||
@@ -151,8 +160,21 @@ def emit_model(
|
||||
# Connector types may require different equations in future.
|
||||
lines.append(f"{body_indent}{target} = {source};")
|
||||
else:
|
||||
initial_equations = str(
|
||||
implementation.get("source", {}).get("initialEquations", "")
|
||||
)
|
||||
initial_equations = expand_bevalues(initial_equations, macros)
|
||||
equations = str(implementation.get("source", {}).get("equations", ""))
|
||||
equations = expand_bevalues(equations, macros)
|
||||
|
||||
if initial_equations.strip():
|
||||
lines.append(f"{indentation}initial equation")
|
||||
lines.extend(
|
||||
f"{body_indent}{line}" if line.strip() else ""
|
||||
for line in initial_equations.splitlines()
|
||||
)
|
||||
|
||||
lines.append(f"{indentation}equation")
|
||||
lines.extend(
|
||||
f"{body_indent}{line}" if line.strip() else ""
|
||||
for line in equations.splitlines()
|
||||
@@ -161,7 +183,6 @@ def emit_model(
|
||||
lines.append(f"{indentation}end {model_name};")
|
||||
return "\n".join(lines) + "\n"
|
||||
|
||||
|
||||
def cleanup_graph(graph: dict[str, Any]) -> dict[str, Any]:
|
||||
"""Remove annotations and UI-only data from a serialized component tree."""
|
||||
|
||||
@@ -283,7 +304,7 @@ def _port_count_macros(
|
||||
|
||||
|
||||
def expand_bevalues(text: str, values: dict[str, str]) -> str:
|
||||
"""Replace BEdit ``$name$`` macros and reject unresolved compiler values."""
|
||||
"""Replace BEdit ``$name$`` macros and reject unresolved composer values."""
|
||||
|
||||
def replace(match: re.Match[str]) -> str:
|
||||
name = match.group(1)
|
||||
427
BEdit/src/bedit/core/simulation/openmodelica.py
Normal file
427
BEdit/src/bedit/core/simulation/openmodelica.py
Normal file
@@ -0,0 +1,427 @@
|
||||
import json
|
||||
import os
|
||||
import shlex
|
||||
import shutil
|
||||
import socket
|
||||
import tempfile
|
||||
import time
|
||||
import xml.etree.ElementTree as ET
|
||||
from collections.abc import Callable
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
from queue import Queue
|
||||
from threading import Event, Lock, Thread, current_thread
|
||||
from typing import Any
|
||||
|
||||
from bedit.core.application_log import get_logger
|
||||
from bedit.core.simulation.results import (
|
||||
SimulationExecutionResult,
|
||||
load_openmodelica_csv,
|
||||
)
|
||||
|
||||
|
||||
log = get_logger(__name__)
|
||||
ResultCallback = Callable[[Any], None]
|
||||
ErrorCallback = Callable[[Exception], None]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class _Request:
|
||||
description: str
|
||||
operation: Callable[[Any, Path], Any]
|
||||
callback: ResultCallback | None
|
||||
error_callback: ErrorCallback | None
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class SimulationProgress:
|
||||
phase: str
|
||||
current_step_size: float
|
||||
time: float
|
||||
progress: int
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class SimulationMessage:
|
||||
stream: str
|
||||
type: str
|
||||
text: str
|
||||
|
||||
|
||||
class OpenModelicaInterface:
|
||||
"""Asynchronous, persistent interface to one OpenModelica session.
|
||||
|
||||
The worker and OMC session are created lazily for the first request. Callbacks
|
||||
execute on background threads and must not manipulate Qt widgets directly.
|
||||
"""
|
||||
|
||||
def __init__(self, executable_path: str = "") -> None:
|
||||
self._executable_path = executable_path
|
||||
self._lifecycle_lock = Lock()
|
||||
self._queue: Queue[_Request | None] | None = None
|
||||
self._worker: Thread | None = None
|
||||
self._temp_dir: Path | None = None
|
||||
|
||||
@property
|
||||
def executable_path(self) -> str:
|
||||
return self._executable_path
|
||||
|
||||
def configure(self, executable_path: str) -> None:
|
||||
"""Use a new executable path for subsequent requests."""
|
||||
|
||||
if executable_path == self._executable_path:
|
||||
return
|
||||
self.shutdown(wait=True)
|
||||
self._executable_path = executable_path
|
||||
|
||||
def get_version(
|
||||
self,
|
||||
callback: ResultCallback | None = None,
|
||||
error_callback: ErrorCallback | None = None,
|
||||
) -> None:
|
||||
"""Request the OpenModelica version without blocking the caller."""
|
||||
self.send_expression("getVersion()", callback, error_callback)
|
||||
|
||||
def build_model(
|
||||
self,
|
||||
model: str,
|
||||
model_name: str,
|
||||
callback: ResultCallback | None = None,
|
||||
error_callback: ErrorCallback | None = None,
|
||||
) -> None:
|
||||
"""Load and build one composed model as an ordered worker operation."""
|
||||
|
||||
def operation(omc, _temp_dir: Path):
|
||||
loaded = omc.sendExpression(f"loadString({json.dumps(model)})")
|
||||
if loaded is not True:
|
||||
raise RuntimeError("OpenModelica could not load the composed model")
|
||||
return omc.sendExpression(f"buildModel({model_name})")
|
||||
|
||||
self._submit("build model", operation, callback, error_callback)
|
||||
|
||||
def run_model(
|
||||
self,
|
||||
executable: str,
|
||||
arguments: list[str],
|
||||
progress_callback: Callable[[SimulationProgress], None] | None = None,
|
||||
message_callback: Callable[[SimulationMessage], None] | None = None,
|
||||
callback: ResultCallback | None = None,
|
||||
error_callback: ErrorCallback | None = None,
|
||||
) -> None:
|
||||
"""Run a built model and consume its XML/TCP status stream."""
|
||||
|
||||
def operation(omc, temp_dir: Path):
|
||||
return _run_model_with_tcp(
|
||||
omc,
|
||||
executable,
|
||||
arguments,
|
||||
temp_dir,
|
||||
progress_callback,
|
||||
message_callback,
|
||||
)
|
||||
|
||||
self._submit("run simulation", operation, callback, error_callback)
|
||||
|
||||
def send_expression(
|
||||
self,
|
||||
expression: str,
|
||||
callback: ResultCallback | None = None,
|
||||
error_callback: ErrorCallback | None = None,
|
||||
*,
|
||||
parsed: bool = True,
|
||||
) -> None:
|
||||
"""Queue an OMC expression for ordered execution on the worker thread."""
|
||||
|
||||
def operation(omc, _temp_dir: Path):
|
||||
return omc.sendExpression(expression, parsed=parsed)
|
||||
|
||||
self._submit(expression, operation, callback, error_callback)
|
||||
|
||||
def _submit(
|
||||
self,
|
||||
description: str,
|
||||
operation: Callable[[Any, Path], Any],
|
||||
callback: ResultCallback | None,
|
||||
error_callback: ErrorCallback | None,
|
||||
) -> None:
|
||||
request = _Request(description, operation, callback, error_callback)
|
||||
self._ensure_worker().put(request)
|
||||
|
||||
def shutdown(self, *, wait: bool = True) -> None:
|
||||
"""Ask the worker to close its OMC session after queued requests."""
|
||||
|
||||
with self._lifecycle_lock:
|
||||
worker = self._worker
|
||||
queue = self._queue
|
||||
self._worker = None
|
||||
self._queue = None
|
||||
if queue is not None:
|
||||
queue.put(None)
|
||||
if wait and worker is not None and worker is not current_thread():
|
||||
worker.join()
|
||||
if worker is None:
|
||||
self._cleanup_temp_dir()
|
||||
|
||||
def __del__(self) -> None:
|
||||
"""Best-effort fallback; normal application shutdown is explicit."""
|
||||
|
||||
try:
|
||||
self.shutdown(wait=False)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def _ensure_worker(self) -> Queue[_Request | None]:
|
||||
with self._lifecycle_lock:
|
||||
if self._worker is not None and self._worker.is_alive():
|
||||
return self._queue
|
||||
temp_dir = self._ensure_temp_dir_locked()
|
||||
queue: Queue[_Request | None] = Queue()
|
||||
worker = Thread(
|
||||
target=self._worker_main,
|
||||
args=(queue, self._executable_path, temp_dir),
|
||||
name="bedit-openmodelica",
|
||||
daemon=True,
|
||||
)
|
||||
self._queue = queue
|
||||
self._worker = worker
|
||||
worker.start()
|
||||
return queue
|
||||
|
||||
def _worker_main(
|
||||
self,
|
||||
queue: Queue[_Request | None],
|
||||
executable_path: str,
|
||||
temp_dir: Path,
|
||||
) -> None:
|
||||
omc = None
|
||||
try:
|
||||
while (request := queue.get()) is not None:
|
||||
try:
|
||||
if omc is None:
|
||||
omc = _create_session(executable_path)
|
||||
changed_directory = omc.sendExpression(
|
||||
f"cd({json.dumps(str(temp_dir))})"
|
||||
)
|
||||
if not changed_directory:
|
||||
raise RuntimeError(
|
||||
f"OpenModelica could not use {str(temp_dir)!r}"
|
||||
)
|
||||
result = request.operation(omc, temp_dir)
|
||||
except Exception as error:
|
||||
if request.error_callback is None:
|
||||
log.exception(
|
||||
"OpenModelica request failed: %s", request.description
|
||||
)
|
||||
else:
|
||||
_deliver_callback(request.error_callback, error)
|
||||
else:
|
||||
if request.callback is not None:
|
||||
_deliver_callback(request.callback, result)
|
||||
finally:
|
||||
transport_files = _ompython_transport_files(omc)
|
||||
if omc is not None:
|
||||
try:
|
||||
omc.sendExpression("quit()")
|
||||
except Exception:
|
||||
log.debug("Could not close OpenModelica session", exc_info=True)
|
||||
for path in transport_files:
|
||||
try:
|
||||
path.unlink(missing_ok=True)
|
||||
except OSError:
|
||||
log.debug("Could not remove OMPython file %s", path, exc_info=True)
|
||||
self._cleanup_temp_dir(temp_dir)
|
||||
|
||||
def _ensure_temp_dir_locked(self) -> Path:
|
||||
if self._temp_dir is None:
|
||||
self._temp_dir = Path(tempfile.mkdtemp(prefix="bedit-openmodelica-"))
|
||||
return self._temp_dir
|
||||
|
||||
def _cleanup_temp_dir(self, expected: Path | None = None) -> None:
|
||||
with self._lifecycle_lock:
|
||||
if expected is not None and self._temp_dir != expected:
|
||||
temp_dir = expected
|
||||
else:
|
||||
temp_dir = self._temp_dir
|
||||
self._temp_dir = None
|
||||
if temp_dir is not None:
|
||||
shutil.rmtree(temp_dir, ignore_errors=True)
|
||||
|
||||
|
||||
def _deliver_callback(callback: Callable[[Any], None], value: Any) -> None:
|
||||
try:
|
||||
callback(value)
|
||||
except Exception:
|
||||
log.exception("OpenModelica callback failed")
|
||||
|
||||
|
||||
def _create_session(executable_path: str):
|
||||
from OMPython import OMCSessionZMQ
|
||||
|
||||
return OMCSessionZMQ(omhome=_openmodelica_home(executable_path))
|
||||
|
||||
|
||||
def _run_model_with_tcp(
|
||||
omc,
|
||||
executable: str,
|
||||
arguments: list[str],
|
||||
temp_dir: Path,
|
||||
progress_callback: Callable[[SimulationProgress], None] | None,
|
||||
message_callback: Callable[[SimulationMessage], None] | None,
|
||||
) -> SimulationExecutionResult:
|
||||
executable_path = Path(executable)
|
||||
executable_command = executable
|
||||
if not executable_path.is_absolute() and executable_path.parent == Path("."):
|
||||
executable_command = f"./{executable}"
|
||||
|
||||
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as server:
|
||||
server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||
server.bind(("127.0.0.1", 0))
|
||||
server.listen(1)
|
||||
server.settimeout(0.25)
|
||||
port = server.getsockname()[1]
|
||||
command = shlex.join([
|
||||
executable_command,
|
||||
*arguments,
|
||||
f"-port={port}",
|
||||
"-logFormat=xmltcp",
|
||||
])
|
||||
output_path = temp_dir / "simulation-output.txt"
|
||||
command_finished = Event()
|
||||
reader_finished = Event()
|
||||
reader_errors: list[Exception] = []
|
||||
|
||||
def read_progress() -> None:
|
||||
try:
|
||||
connection = _accept_simulation_connection(server, command_finished)
|
||||
with connection, connection.makefile(
|
||||
"r", encoding="utf-8"
|
||||
) as stream:
|
||||
for line in stream:
|
||||
_handle_simulation_xml(
|
||||
line, progress_callback, message_callback
|
||||
)
|
||||
except Exception as error:
|
||||
reader_errors.append(error)
|
||||
finally:
|
||||
reader_finished.set()
|
||||
|
||||
reader = Thread(
|
||||
target=read_progress,
|
||||
name="bedit-simulation-progress",
|
||||
daemon=True,
|
||||
)
|
||||
reader.start()
|
||||
log.info("Starting simulation through OpenModelica: %s", command)
|
||||
try:
|
||||
return_code = omc.sendExpression(
|
||||
f"system({json.dumps(command)}, {json.dumps(str(output_path))})"
|
||||
)
|
||||
finally:
|
||||
command_finished.set()
|
||||
if not reader_finished.wait(20.0):
|
||||
raise TimeoutError("Simulation progress connection did not close")
|
||||
if reader_errors:
|
||||
raise reader_errors[0]
|
||||
if return_code != 0:
|
||||
output = output_path.read_text(errors="replace") if output_path.exists() else ""
|
||||
detail = f": {output.strip()}" if output.strip() else ""
|
||||
raise RuntimeError(
|
||||
f"Simulation process exited with status {return_code}{detail}"
|
||||
)
|
||||
result_path = temp_dir / f"{Path(executable).stem}_res.csv"
|
||||
if not result_path.is_file():
|
||||
raise RuntimeError(
|
||||
f"OpenModelica did not create the expected result file {result_path.name!r}"
|
||||
)
|
||||
data = load_openmodelica_csv(result_path)
|
||||
log.info(
|
||||
"Loaded %d result columns from %s", len(data), result_path.name
|
||||
)
|
||||
return SimulationExecutionResult(
|
||||
return_code=int(return_code),
|
||||
result_file=str(result_path),
|
||||
data=data,
|
||||
)
|
||||
|
||||
|
||||
def _accept_simulation_connection(
|
||||
server: socket.socket, command_finished: Event
|
||||
) -> socket.socket:
|
||||
deadline = time.monotonic() + 15.0
|
||||
while time.monotonic() < deadline:
|
||||
try:
|
||||
connection, _address = server.accept()
|
||||
return connection
|
||||
except socket.timeout:
|
||||
if command_finished.is_set():
|
||||
raise RuntimeError(
|
||||
"Simulation command finished before opening its progress connection"
|
||||
)
|
||||
raise TimeoutError("Simulation did not connect to the progress server")
|
||||
|
||||
|
||||
def _handle_simulation_xml(
|
||||
line: str,
|
||||
progress_callback: Callable[[SimulationProgress], None] | None,
|
||||
message_callback: Callable[[SimulationMessage], None] | None,
|
||||
) -> None:
|
||||
text = line.strip()
|
||||
if not text:
|
||||
return
|
||||
try:
|
||||
element = ET.fromstring(text)
|
||||
except ET.ParseError:
|
||||
log.warning("Invalid simulation status XML: %s", text)
|
||||
return
|
||||
if element.tag == "status" and progress_callback is not None:
|
||||
_deliver_callback(
|
||||
progress_callback,
|
||||
SimulationProgress(
|
||||
phase=element.get("phase", ""),
|
||||
current_step_size=float(element.get("currentStepSize", 0)),
|
||||
time=float(element.get("time", 0)),
|
||||
progress=int(float(element.get("progress", 0))),
|
||||
),
|
||||
)
|
||||
elif element.tag == "message":
|
||||
message = SimulationMessage(
|
||||
stream=element.get("stream", ""),
|
||||
type=element.get("type", ""),
|
||||
text=element.get("text", ""),
|
||||
)
|
||||
log.info("OpenModelica %s: %s", message.stream, message.text)
|
||||
if message_callback is not None:
|
||||
_deliver_callback(message_callback, message)
|
||||
|
||||
|
||||
def _ompython_transport_files(omc) -> set[Path]:
|
||||
"""Return only the log and port files owned by this OMPython session."""
|
||||
|
||||
if omc is None:
|
||||
return set()
|
||||
process = getattr(omc, "omc_process", None)
|
||||
if process is None:
|
||||
return set()
|
||||
files: set[Path] = set()
|
||||
temp_dir = getattr(process, "_temp_dir", None)
|
||||
file_base = getattr(process, "_omc_filebase", None)
|
||||
if temp_dir is not None and file_base:
|
||||
files.add(Path(temp_dir) / f"{file_base}.log")
|
||||
try:
|
||||
port_file = process._get_portfile_path()
|
||||
except Exception:
|
||||
port_file = None
|
||||
if port_file is not None:
|
||||
files.add(Path(port_file))
|
||||
return files
|
||||
|
||||
|
||||
def _openmodelica_home(executable_path: str) -> str | None:
|
||||
"""Convert an optional omc executable path to the home expected by OMPython."""
|
||||
|
||||
if not executable_path.strip():
|
||||
return None
|
||||
path = Path(os.path.expandvars(executable_path)).expanduser()
|
||||
if path.name.lower() in {"omc", "omc.exe"}:
|
||||
return str(path.parent.parent)
|
||||
return str(path)
|
||||
222
BEdit/src/bedit/core/simulation/results.py
Normal file
222
BEdit/src/bedit/core/simulation/results.py
Normal file
@@ -0,0 +1,222 @@
|
||||
import csv
|
||||
import json
|
||||
import zlib
|
||||
from dataclasses import asdict, dataclass, field
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
from uuid import uuid4
|
||||
|
||||
import msgpack
|
||||
|
||||
|
||||
RESULTS_FORMAT = "bedit-simulation-results"
|
||||
RESULTS_VERSION = 1
|
||||
|
||||
|
||||
@dataclass
|
||||
class SimulationTrace:
|
||||
"""One plottable series; samples can be filled by a future result importer."""
|
||||
|
||||
name: str
|
||||
x_values: list[float] = field(default_factory=list)
|
||||
y_values: list[float] = field(default_factory=list)
|
||||
x_label: str = "time"
|
||||
y_label: str = ""
|
||||
unit: str = ""
|
||||
properties: dict[str, Any] = field(default_factory=dict)
|
||||
|
||||
|
||||
@dataclass
|
||||
class SimulationGraph:
|
||||
"""One graph workspace tab and its configured traces."""
|
||||
|
||||
id: str = field(default_factory=lambda: str(uuid4()))
|
||||
title: str = "Graph 1"
|
||||
x_axis: str = "time"
|
||||
traces: list[SimulationTrace] = field(default_factory=list)
|
||||
|
||||
|
||||
@dataclass
|
||||
class SimulationResults:
|
||||
"""Serializable state displayed by the standalone simulation window."""
|
||||
|
||||
model_name: str = ""
|
||||
status: dict[str, Any] = field(default_factory=dict)
|
||||
messages: list[dict[str, str]] = field(default_factory=list)
|
||||
data: dict[str, list[float]] = field(default_factory=dict)
|
||||
graphs: list[SimulationGraph] = field(
|
||||
default_factory=lambda: [SimulationGraph()]
|
||||
)
|
||||
metadata: dict[str, Any] = field(default_factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
return {
|
||||
"format": RESULTS_FORMAT,
|
||||
"version": RESULTS_VERSION,
|
||||
"modelName": self.model_name,
|
||||
"status": dict(self.status),
|
||||
"messages": [dict(message) for message in self.messages],
|
||||
"data": {name: list(values) for name, values in self.data.items()},
|
||||
"graphs": [asdict(graph) for graph in self.graphs],
|
||||
"metadata": dict(self.metadata),
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, data: dict[str, Any]) -> "SimulationResults":
|
||||
if data.get("format") != RESULTS_FORMAT:
|
||||
raise ValueError("Not a BEdit simulation-results file")
|
||||
if data.get("version") != RESULTS_VERSION:
|
||||
raise ValueError(f"Unsupported simulation-results version: {data.get('version')!r}")
|
||||
try:
|
||||
graphs = [
|
||||
SimulationGraph(
|
||||
id=str(graph["id"]),
|
||||
title=str(graph["title"]),
|
||||
x_axis=str(graph.get("x_axis", "time")),
|
||||
traces=[
|
||||
SimulationTrace(**trace) for trace in graph.get("traces", [])
|
||||
],
|
||||
)
|
||||
for graph in data.get("graphs", [])
|
||||
]
|
||||
return cls(
|
||||
model_name=str(data.get("modelName", "")),
|
||||
status=dict(data.get("status", {})),
|
||||
messages=[dict(message) for message in data.get("messages", [])],
|
||||
data={
|
||||
str(name): [float(value) for value in values]
|
||||
for name, values in dict(data.get("data", {})).items()
|
||||
},
|
||||
graphs=graphs,
|
||||
metadata=dict(data.get("metadata", {})),
|
||||
)
|
||||
except (KeyError, TypeError, ValueError) as error:
|
||||
raise ValueError("Malformed simulation-results data") from error
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class SimulationExecutionResult:
|
||||
"""Completed process information delivered before its temp files disappear."""
|
||||
|
||||
return_code: int
|
||||
result_file: str
|
||||
data: dict[str, list[float]]
|
||||
|
||||
|
||||
def load_openmodelica_csv(path: str | Path) -> dict[str, list[float]]:
|
||||
"""Read an OpenModelica CSV result as one numeric array per column."""
|
||||
|
||||
source = Path(path)
|
||||
try:
|
||||
with source.open(newline="", encoding="utf-8") as file:
|
||||
reader = csv.reader(file)
|
||||
headers = next(reader)
|
||||
if not headers or any(not header for header in headers):
|
||||
raise ValueError("The result CSV has an invalid header")
|
||||
if len(set(headers)) != len(headers):
|
||||
raise ValueError("The result CSV contains duplicate column names")
|
||||
columns = {header: [] for header in headers}
|
||||
for row_number, row in enumerate(reader, start=2):
|
||||
if len(row) != len(headers):
|
||||
raise ValueError(
|
||||
f"Result CSV row {row_number} has {len(row)} values; "
|
||||
f"expected {len(headers)}"
|
||||
)
|
||||
for header, value in zip(headers, row, strict=True):
|
||||
columns[header].append(float(value))
|
||||
except OSError as error:
|
||||
raise ValueError(f"Could not read OpenModelica results: {error}") from error
|
||||
except StopIteration as error:
|
||||
raise ValueError("The OpenModelica result CSV is empty") from error
|
||||
except ValueError as error:
|
||||
if str(error).startswith(("The result CSV", "Result CSV")):
|
||||
raise
|
||||
raise ValueError(f"The OpenModelica result CSV is not numeric: {error}") from error
|
||||
return columns
|
||||
|
||||
|
||||
class JsonSimulationResultsSerializer:
|
||||
@staticmethod
|
||||
def load(path: Path) -> SimulationResults:
|
||||
try:
|
||||
data = json.loads(path.read_text(encoding="utf-8"))
|
||||
except (OSError, json.JSONDecodeError) as error:
|
||||
raise ValueError(f"Could not read simulation results: {error}") from error
|
||||
if not isinstance(data, dict):
|
||||
raise ValueError("Simulation-results root must be an object")
|
||||
return SimulationResults.from_dict(data)
|
||||
|
||||
@staticmethod
|
||||
def save(results: SimulationResults, path: Path) -> None:
|
||||
temporary_path = path.with_suffix(path.suffix + ".tmp")
|
||||
temporary_path.write_text(
|
||||
json.dumps(results.to_dict(), indent=2, ensure_ascii=False) + "\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
temporary_path.replace(path)
|
||||
|
||||
|
||||
class BerSimulationResultsSerializer:
|
||||
"""Compressed MessagePack serializer for binary simulation results."""
|
||||
|
||||
MAGIC = b"BER\x00"
|
||||
VERSION = 1
|
||||
|
||||
@classmethod
|
||||
def load(cls, path: Path) -> SimulationResults:
|
||||
try:
|
||||
payload = path.read_bytes()
|
||||
except OSError as error:
|
||||
raise ValueError(f"Could not read simulation results: {error}") from error
|
||||
header = cls.MAGIC + bytes([cls.VERSION])
|
||||
if not payload.startswith(header):
|
||||
raise ValueError("This is not a supported BEdit binary results file")
|
||||
try:
|
||||
data = msgpack.unpackb(
|
||||
zlib.decompress(payload[len(header) :]), raw=False
|
||||
)
|
||||
except (ValueError, zlib.error, msgpack.exceptions.MsgpackException) as error:
|
||||
raise ValueError("The BEdit binary results file is damaged") from error
|
||||
if not isinstance(data, dict):
|
||||
raise ValueError("The BEdit binary results file has an invalid root value")
|
||||
return SimulationResults.from_dict(data)
|
||||
|
||||
@classmethod
|
||||
def save(cls, results: SimulationResults, path: Path) -> None:
|
||||
packed = msgpack.packb(results.to_dict(), use_bin_type=True)
|
||||
payload = cls.MAGIC + bytes([cls.VERSION]) + zlib.compress(packed, level=9)
|
||||
temporary_path = path.with_suffix(path.suffix + ".tmp")
|
||||
temporary_path.write_bytes(payload)
|
||||
temporary_path.replace(path)
|
||||
|
||||
|
||||
class SimulationResultsSerializer:
|
||||
"""Select JSON or compressed MessagePack based on the file extension."""
|
||||
|
||||
@staticmethod
|
||||
def load(path: str | Path) -> SimulationResults:
|
||||
target = Path(path)
|
||||
serializer = (
|
||||
BerSimulationResultsSerializer
|
||||
if target.suffix.lower() == ".ber"
|
||||
else JsonSimulationResultsSerializer
|
||||
)
|
||||
return serializer.load(target)
|
||||
|
||||
@staticmethod
|
||||
def save(results: SimulationResults, path: str | Path) -> None:
|
||||
target = Path(path)
|
||||
serializer = (
|
||||
BerSimulationResultsSerializer
|
||||
if target.suffix.lower() == ".ber"
|
||||
else JsonSimulationResultsSerializer
|
||||
)
|
||||
serializer.save(results, target)
|
||||
|
||||
|
||||
def save_simulation_results(path: str | Path, results: SimulationResults) -> None:
|
||||
SimulationResultsSerializer.save(results, path)
|
||||
|
||||
|
||||
def load_simulation_results(path: str | Path) -> SimulationResults:
|
||||
return SimulationResultsSerializer.load(path)
|
||||
@@ -1,162 +0,0 @@
|
||||
import json
|
||||
import os
|
||||
from collections.abc import Callable
|
||||
from pathlib import Path
|
||||
from threading import Lock, Thread
|
||||
|
||||
from bedit.core.application_log import get_logger
|
||||
|
||||
|
||||
log = get_logger(__name__)
|
||||
_worker_lock = Lock()
|
||||
_worker: Thread | None = None
|
||||
|
||||
|
||||
def run_validation_async(
|
||||
openmodelica_path: str = "",
|
||||
model: str = "",
|
||||
model_name: str = "",
|
||||
task: Callable[[], None] | None = None,
|
||||
) -> None:
|
||||
"""Start one validation task in a background thread and return immediately."""
|
||||
|
||||
global _worker
|
||||
with _worker_lock:
|
||||
if _worker is not None and _worker.is_alive():
|
||||
raise RuntimeError("An OpenModelica task is already running")
|
||||
_worker = Thread(
|
||||
target=_run_safely,
|
||||
args=(
|
||||
task
|
||||
or (lambda: _run_validation(openmodelica_path, model, model_name)),
|
||||
),
|
||||
name="bedit-simulation",
|
||||
daemon=True,
|
||||
)
|
||||
_worker.start()
|
||||
|
||||
|
||||
def run_simulation_async(
|
||||
openmodelica_path: str = "",
|
||||
model: str = "",
|
||||
model_name: str = "",
|
||||
task: Callable[[], None] | None = None,
|
||||
) -> None:
|
||||
"""Start one validation-and-simulation task and return immediately."""
|
||||
|
||||
global _worker
|
||||
with _worker_lock:
|
||||
if _worker is not None and _worker.is_alive():
|
||||
raise RuntimeError("An OpenModelica task is already running")
|
||||
_worker = Thread(
|
||||
target=_run_safely,
|
||||
args=(
|
||||
task
|
||||
or (lambda: _run_openmodelica(openmodelica_path, model, model_name)),
|
||||
),
|
||||
name="bedit-simulation",
|
||||
daemon=True,
|
||||
)
|
||||
_worker.start()
|
||||
|
||||
|
||||
def simulation_is_running() -> bool:
|
||||
"""Return whether the background simulation worker is active."""
|
||||
|
||||
with _worker_lock:
|
||||
return _worker is not None and _worker.is_alive()
|
||||
|
||||
|
||||
def _run_safely(task: Callable[[], None]) -> None:
|
||||
global _worker
|
||||
try:
|
||||
task()
|
||||
except Exception:
|
||||
log.exception("Simulation run failed")
|
||||
finally:
|
||||
with _worker_lock:
|
||||
_worker = None
|
||||
|
||||
|
||||
def _run_validation(
|
||||
openmodelica_path: str = "", model: str = "", model_name: str = ""
|
||||
) -> None:
|
||||
"""Create the OpenModelica session and perform a validation"""
|
||||
|
||||
from OMPython import OMCSessionZMQ
|
||||
|
||||
omhome = _openmodelica_home(openmodelica_path)
|
||||
omc = OMCSessionZMQ(omhome=omhome)
|
||||
_validate_model(omc, model, model_name)
|
||||
|
||||
|
||||
def _run_openmodelica(
|
||||
openmodelica_path: str = "", model: str = "", model_name: str = ""
|
||||
) -> None:
|
||||
"""Validate and run the current simulation stub in one OMC session."""
|
||||
|
||||
from OMPython import OMCSessionZMQ
|
||||
|
||||
omhome = _openmodelica_home(openmodelica_path)
|
||||
omc = OMCSessionZMQ(omhome=omhome)
|
||||
_validate_model(omc, model, model_name)
|
||||
|
||||
log.info("OpenModelica Version: %s", omc.sendExpression("getVersion()"))
|
||||
|
||||
loaded = omc.sendExpression(f"loadString({json.dumps(model)})")
|
||||
if loaded is not True:
|
||||
details = _get_error_string(omc)
|
||||
raise RuntimeError(f"OpenModelica could not load the model: {details}")
|
||||
|
||||
result = omc.sendExpression(f"checkModel({model_name})")
|
||||
details = _get_error_string(omc)
|
||||
if not isinstance(result, str) or "completed successfully" not in result:
|
||||
message = details or result or "Unknown OpenModelica validation error"
|
||||
raise RuntimeError(f"OpenModelica model validation failed: {message}")
|
||||
|
||||
def _validate_model(omc, model: str, model_name: str) -> None:
|
||||
if not model:
|
||||
raise ValueError("There is no compiled Modelica source to validate")
|
||||
if not model_name:
|
||||
raise ValueError("The compiled model has no Modelica name")
|
||||
|
||||
loaded = omc.sendExpression(f"loadString({json.dumps(model)})")
|
||||
if loaded is not True:
|
||||
details = _get_error_string(omc)
|
||||
raise RuntimeError(f"OpenModelica could not load the model: {details}")
|
||||
|
||||
result = omc.sendExpression(f"checkModel({model_name})")
|
||||
details = _get_error_string(omc)
|
||||
if not isinstance(result, str) or "completed successfully" not in result:
|
||||
message = details or result or "Unknown OpenModelica validation error"
|
||||
raise RuntimeError(f"OpenModelica model validation failed: {message}")
|
||||
log.info("%s", result)
|
||||
if details:
|
||||
log.warning("OpenModelica validation messages: %s", details)
|
||||
|
||||
|
||||
def _get_error_string(omc) -> str:
|
||||
"""Read OMC's deliberately unparsed error response as plain text."""
|
||||
|
||||
raw = omc.sendExpression("getErrorString()", parsed=False)
|
||||
if not isinstance(raw, str):
|
||||
return str(raw or "")
|
||||
raw = raw.strip()
|
||||
if not raw:
|
||||
return ""
|
||||
try:
|
||||
decoded = json.loads(raw)
|
||||
except (TypeError, json.JSONDecodeError):
|
||||
return raw
|
||||
return decoded if isinstance(decoded, str) else str(decoded)
|
||||
|
||||
|
||||
def _openmodelica_home(openmodelica_path: str) -> str | None:
|
||||
"""Convert an optional omc executable path to the home expected by OMPython."""
|
||||
|
||||
if not openmodelica_path.strip():
|
||||
return None
|
||||
path = Path(os.path.expandvars(openmodelica_path)).expanduser()
|
||||
if path.name.lower() in {"omc", "omc.exe"}:
|
||||
return str(path.parent.parent)
|
||||
return str(path)
|
||||
@@ -1,50 +1,156 @@
|
||||
from collections.abc import Callable
|
||||
from typing import Any
|
||||
|
||||
from bedit.core.application_log import get_logger
|
||||
from bedit.core.simulation.compiler import compile_graph
|
||||
from bedit.core.simulation.runner import run_simulation_async, run_validation_async
|
||||
from bedit.core.simulation.composer import compose_graph
|
||||
from bedit.core.simulation.openmodelica import (
|
||||
ErrorCallback,
|
||||
OpenModelicaInterface,
|
||||
ResultCallback,
|
||||
SimulationMessage,
|
||||
SimulationProgress,
|
||||
)
|
||||
|
||||
|
||||
log = get_logger(__name__)
|
||||
|
||||
|
||||
class Simulation:
|
||||
"""Application-owned simulation state and compiler facade."""
|
||||
"""Application-owned composition state and OpenModelica interface."""
|
||||
|
||||
def __init__(self, *, openmodelica_path: str = "") -> None:
|
||||
self.state: dict[str, Any] = {}
|
||||
self.last_compilation_input: dict[str, Any] | None = None
|
||||
self.last_compilation_output: str | None = None
|
||||
self.last_composition_input: dict[str, Any] | None = None
|
||||
self.last_composition_output: str | None = None
|
||||
self.id_list: dict[str, Any] = {}
|
||||
self.openmodelica_path = openmodelica_path
|
||||
self.model_name: str | None = None
|
||||
self._openmodelica_path = openmodelica_path
|
||||
self.openmodelica = OpenModelicaInterface(openmodelica_path)
|
||||
self.model_path: str | None = None
|
||||
self.simulation_progress: SimulationProgress | None = None
|
||||
|
||||
def compile(self, graph: dict[str, Any]) -> None:
|
||||
"""Compile a serialized component tree and retain the result."""
|
||||
@property
|
||||
def openmodelica_path(self) -> str:
|
||||
return self._openmodelica_path
|
||||
|
||||
self._prepare_compilation(graph)
|
||||
run_validation_async(
|
||||
self.openmodelica_path,
|
||||
self.last_compilation_output,
|
||||
@openmodelica_path.setter
|
||||
def openmodelica_path(self, value: str) -> None:
|
||||
self._openmodelica_path = value
|
||||
self.openmodelica.configure(value)
|
||||
|
||||
def compose(
|
||||
self,
|
||||
graph: dict[str, Any],
|
||||
callback: Callable[[str], None] | None = None,
|
||||
error_callback: ErrorCallback | None = None,
|
||||
) -> None:
|
||||
"""Compose and retain the active graph's Modelica representation."""
|
||||
|
||||
self.model_path = None
|
||||
self.compose_source(graph)
|
||||
|
||||
def _model_compiled(result):
|
||||
log.info("Compiling OK: %s", result)
|
||||
try:
|
||||
self.model_path = str(result[0])
|
||||
except (IndexError, TypeError) as error:
|
||||
failure = RuntimeError(
|
||||
f"OpenModelica returned an invalid build result: {result!r}"
|
||||
)
|
||||
failure.__cause__ = error
|
||||
if error_callback is not None:
|
||||
error_callback(failure)
|
||||
else:
|
||||
log.error("%s", failure)
|
||||
return
|
||||
if callback is not None:
|
||||
callback(self.model_path)
|
||||
|
||||
self.openmodelica.build_model(
|
||||
self.last_composition_output,
|
||||
self.model_name,
|
||||
_model_compiled,
|
||||
error_callback,
|
||||
)
|
||||
|
||||
def _prepare_compilation(self, graph: dict[str, Any]) -> None:
|
||||
"""Generate and retain Modelica without starting a background operation."""
|
||||
def compose_source(self, graph: dict[str, Any]) -> tuple[str, str]:
|
||||
"""Compose Modelica source without asking OpenModelica to build it."""
|
||||
|
||||
result = compile_graph(graph)
|
||||
self.last_compilation_input = result.graph
|
||||
result = compose_graph(graph)
|
||||
self.last_composition_input = result.graph
|
||||
self.id_list = result.objects_by_id
|
||||
self.last_compilation_output = result.modelica
|
||||
self.last_composition_output = result.modelica
|
||||
self.model_name = result.model_name
|
||||
# log.info("Composed OpenModelica model:\n%s", result.modelica)
|
||||
return result.model_name, result.modelica
|
||||
|
||||
def run_simulation(self, graph: dict[str, Any]) -> None:
|
||||
"""Start the simulation without blocking the calling UI thread."""
|
||||
def run_simulation(
|
||||
self,
|
||||
graph: dict[str, Any],
|
||||
progress_callback: Callable[[SimulationProgress], None] | None = None,
|
||||
message_callback: Callable[[SimulationMessage], None] | None = None,
|
||||
callback: ResultCallback | None = None,
|
||||
error_callback: ErrorCallback | None = None,
|
||||
) -> None:
|
||||
"""Compose, build, and asynchronously run the current graph."""
|
||||
|
||||
# Always regenerate before running, then validate and simulate as one
|
||||
# background operation so the two phases cannot compete for the worker.
|
||||
self._prepare_compilation(graph)
|
||||
run_simulation_async(
|
||||
self.openmodelica_path,
|
||||
self.last_compilation_output,
|
||||
self.model_name,
|
||||
self.simulation_progress = None
|
||||
|
||||
def report_progress(progress: SimulationProgress) -> None:
|
||||
self.simulation_progress = progress
|
||||
if progress_callback is not None:
|
||||
progress_callback(progress)
|
||||
|
||||
def run_model(model_path: str) -> None:
|
||||
try:
|
||||
arguments = self.build_simulation_arguments()
|
||||
except Exception as error:
|
||||
if error_callback is not None:
|
||||
error_callback(error)
|
||||
else:
|
||||
log.exception("Could not prepare simulation arguments")
|
||||
return
|
||||
self.openmodelica.run_model(
|
||||
model_path,
|
||||
arguments,
|
||||
report_progress,
|
||||
message_callback,
|
||||
callback,
|
||||
error_callback,
|
||||
)
|
||||
|
||||
self.compose(graph, run_model, error_callback)
|
||||
|
||||
def get_progress(self) -> SimulationProgress | None:
|
||||
"""Return the most recently received simulation status."""
|
||||
|
||||
return self.simulation_progress
|
||||
|
||||
def shutdown(self, *, wait: bool = True) -> None:
|
||||
"""Close OpenModelica and clean its generated working directory."""
|
||||
self.openmodelica.shutdown(wait=wait)
|
||||
self.model_path = None
|
||||
|
||||
def build_simulation_arguments(self) -> list[str]:
|
||||
opts = self.last_composition_input["implementation"]["graph"].get(
|
||||
"simulation", {}
|
||||
)
|
||||
start_time = float(opts.get("startTime", 0.0))
|
||||
stop_time = float(opts.get("stopTime", 1.0))
|
||||
interval_mode = opts.get("intervalMode", "numberOfIntervals")
|
||||
interval_time = float(opts.get("intervalTime", 0.002))
|
||||
if interval_mode == "numberOfIntervals":
|
||||
intervals = int(opts.get("numberOfIntervals", 500))
|
||||
if intervals <= 0:
|
||||
raise ValueError("Number of simulation intervals must be positive")
|
||||
interval_time = (stop_time - start_time) / intervals
|
||||
if interval_time <= 0:
|
||||
raise ValueError("Simulation interval must be positive")
|
||||
arguments = [
|
||||
"-outputFormat=csv",
|
||||
f"-startTime={start_time}",
|
||||
f"-stopTime={stop_time}",
|
||||
f"-stepSize={interval_time}",
|
||||
]
|
||||
log.info("Running model with: %s", arguments)
|
||||
return arguments
|
||||
|
||||
BIN
BEdit/src/bedit/data/libraries/default.beb
Normal file
BIN
BEdit/src/bedit/data/libraries/default.beb
Normal file
Binary file not shown.
@@ -345,7 +345,7 @@ class PasteSelectionCommand(QUndoCommand):
|
||||
def __init__(
|
||||
self,
|
||||
controller,
|
||||
owner_id: str,
|
||||
owner_id: str | None,
|
||||
blocks: dict[str, Component],
|
||||
connections: dict[str, Connection],
|
||||
) -> None:
|
||||
|
||||
@@ -168,7 +168,13 @@ class DocumentController(QObject):
|
||||
name=self._available_component_name(base_name, self.document.roots.values(), number),
|
||||
implementation_kind=kind,
|
||||
icon=Icon(text="Graph" if kind == "graph" else "Text"),
|
||||
source={"equations": ""} if kind == "text" else {},
|
||||
source={
|
||||
"declarations": "",
|
||||
"initialEquations": "",
|
||||
"equations": "",
|
||||
}
|
||||
if kind == "text"
|
||||
else {},
|
||||
)
|
||||
self.undo_stack.push(AddComponentCommand(self, None, component))
|
||||
self.activate_component(component.id)
|
||||
@@ -187,7 +193,13 @@ class DocumentController(QObject):
|
||||
name=self._available_component_name(base_name, owner.graph.blocks.values(), number),
|
||||
implementation_kind=kind,
|
||||
icon=Icon(text="Graph" if kind == "graph" else "Text"),
|
||||
source={"equations": ""} if kind == "text" else {},
|
||||
source={
|
||||
"declarations": "",
|
||||
"initialEquations": "",
|
||||
"equations": "",
|
||||
}
|
||||
if kind == "text"
|
||||
else {},
|
||||
)
|
||||
self.undo_stack.push(AddComponentCommand(self, owner_id, component))
|
||||
return component.id
|
||||
@@ -421,17 +433,35 @@ class DocumentController(QObject):
|
||||
if old != new:
|
||||
self.undo_stack.push(EditGraphParametersCommand(self, old, new))
|
||||
|
||||
def compile_active_graph(self) -> None:
|
||||
def compose_active_graph(self) -> None:
|
||||
component = self.active_component
|
||||
if component is None or component.implementation_kind != "graph":
|
||||
raise ValueError("Open a graph component before compiling")
|
||||
self.simulation.compile(component.to_dict())
|
||||
raise ValueError("Open a graph component before composing")
|
||||
self.simulation.compose(component.to_dict())
|
||||
|
||||
def run_simulation(self) -> None:
|
||||
def compose_active_graph_source(self) -> tuple[str, str]:
|
||||
component = self.active_component
|
||||
if component is None or component.implementation_kind != "graph":
|
||||
raise ValueError("Open a graph component before exporting a model")
|
||||
return self.simulation.compose_source(component.to_dict())
|
||||
|
||||
def run_simulation(
|
||||
self,
|
||||
progress_callback=None,
|
||||
message_callback=None,
|
||||
callback=None,
|
||||
error_callback=None,
|
||||
) -> None:
|
||||
component = self.active_component
|
||||
if component is None or component.implementation_kind != "graph":
|
||||
raise ValueError("Open a graph component before running a simulation")
|
||||
self.simulation.run_simulation(component.to_dict())
|
||||
self.simulation.run_simulation(
|
||||
component.to_dict(),
|
||||
progress_callback,
|
||||
message_callback,
|
||||
callback,
|
||||
error_callback,
|
||||
)
|
||||
|
||||
def set_route_waypoints(self, item_kind: str, item_id: str, waypoints: list[QPointF]) -> None:
|
||||
item = (
|
||||
@@ -624,6 +654,8 @@ class DocumentController(QObject):
|
||||
self,
|
||||
inputs: list[Port],
|
||||
outputs: list[Port],
|
||||
declarations: str,
|
||||
initial_equations: str,
|
||||
equations: str,
|
||||
parameters: list[Parameter],
|
||||
) -> None:
|
||||
@@ -670,6 +702,8 @@ class DocumentController(QObject):
|
||||
"outputs": [port.to_dict() for port in outputs],
|
||||
"source": {
|
||||
"equations": equations,
|
||||
"declarations": declarations,
|
||||
"initialEquations": initial_equations,
|
||||
},
|
||||
"parameters": [parameter.to_dict() for parameter in parameters],
|
||||
}
|
||||
@@ -951,6 +985,68 @@ class DocumentController(QObject):
|
||||
self.undo_stack.push(PasteSelectionCommand(self, owner.id, blocks, connections))
|
||||
return list(blocks)
|
||||
|
||||
def paste_components_to(
|
||||
self,
|
||||
owner_id: str | None,
|
||||
source_components: list[Component],
|
||||
source_connections: list[Connection] | None = None,
|
||||
) -> list[str]:
|
||||
"""Clone components into the document root or a graph at origin."""
|
||||
|
||||
if self.document is None:
|
||||
raise ValueError("Open or create a document before pasting components")
|
||||
if owner_id is None:
|
||||
siblings = self.document.roots.values()
|
||||
else:
|
||||
owner = self.document.find_component(owner_id)
|
||||
if owner is None or owner.implementation_kind != "graph":
|
||||
raise ValueError("Components can only be pasted into a graph")
|
||||
siblings = owner.graph.blocks.values()
|
||||
|
||||
pairs = [(source, clone_component(source)) for source in source_components]
|
||||
if not pairs:
|
||||
return []
|
||||
id_map = {source.id: clone.id for source, clone in pairs}
|
||||
used = list(siblings)
|
||||
minimum_x = min(source.x for source, _clone in pairs)
|
||||
minimum_y = min(source.y for source, _clone in pairs)
|
||||
blocks: dict[str, Component] = {}
|
||||
for source, clone in pairs:
|
||||
clone.name = self._available_component_name(source.name, used, 0)
|
||||
if owner_id is not None:
|
||||
clone.x = source.x - minimum_x
|
||||
clone.y = source.y - minimum_y
|
||||
blocks[clone.id] = clone
|
||||
used.append(clone)
|
||||
|
||||
connections: dict[str, Connection] = {}
|
||||
if owner_id is not None:
|
||||
for source in source_connections or []:
|
||||
if source.source.block not in id_map or source.target.block not in id_map:
|
||||
continue
|
||||
properties = deepcopy(source.properties)
|
||||
for point in properties.get("waypoints", []):
|
||||
if isinstance(point, dict):
|
||||
point["x"] = float(point.get("x", 0)) - minimum_x
|
||||
point["y"] = float(point.get("y", 0)) - minimum_y
|
||||
connection = Connection(
|
||||
id=str(uuid4()),
|
||||
source=Endpoint(
|
||||
block=id_map[source.source.block], port=source.source.port
|
||||
),
|
||||
target=Endpoint(
|
||||
block=id_map[source.target.block], port=source.target.port
|
||||
),
|
||||
name=source.name,
|
||||
properties=properties,
|
||||
)
|
||||
connections[connection.id] = connection
|
||||
|
||||
self.undo_stack.push(
|
||||
PasteSelectionCommand(self, owner_id, blocks, connections)
|
||||
)
|
||||
return list(blocks)
|
||||
|
||||
def _graph_for(self, owner_id: str):
|
||||
if self.document is None:
|
||||
raise ValueError("There is no open document")
|
||||
|
||||
@@ -14,7 +14,7 @@ PROPERTIES_ROLE = Qt.ItemDataRole.UserRole + 1
|
||||
|
||||
|
||||
class TextDefinitionEditor(QWidget):
|
||||
"""Editor for a text component's equations, ports, and parameters."""
|
||||
"""Editor for a text component's Modelica source, ports, and parameters."""
|
||||
|
||||
modifiedChanged = Signal(bool)
|
||||
definitionEdited = Signal()
|
||||
@@ -32,7 +32,10 @@ class TextDefinitionEditor(QWidget):
|
||||
QHeaderView.ResizeMode.Stretch
|
||||
)
|
||||
self.ui.columnSplitter.setSizes([560, 340])
|
||||
self.ui.sourceSplitter.setSizes([180, 180, 240])
|
||||
self.ui.definitionSplitter.setSizes([300, 300])
|
||||
self.ui.declarationsEdit.textChanged.connect(self._mark_modified)
|
||||
self.ui.initialEquationsEdit.textChanged.connect(self._mark_modified)
|
||||
self.ui.equationsEdit.textChanged.connect(self._mark_modified)
|
||||
self.ui.portsTable.cellChanged.connect(self._symbols_modified)
|
||||
self.ui.parametersTable.cellChanged.connect(self._symbols_modified)
|
||||
@@ -52,6 +55,14 @@ class TextDefinitionEditor(QWidget):
|
||||
def equations(self) -> str:
|
||||
return self.ui.equationsEdit.toPlainText()
|
||||
|
||||
@property
|
||||
def declarations(self) -> str:
|
||||
return self.ui.declarationsEdit.toPlainText()
|
||||
|
||||
@property
|
||||
def initial_equations(self) -> str:
|
||||
return self.ui.initialEquationsEdit.toPlainText()
|
||||
|
||||
@property
|
||||
def ports(self) -> tuple[list[Port], list[Port]]:
|
||||
inputs: list[Port] = []
|
||||
@@ -87,12 +98,16 @@ class TextDefinitionEditor(QWidget):
|
||||
|
||||
def set_definition(
|
||||
self,
|
||||
declarations: str,
|
||||
initial_equations: str,
|
||||
equations: str,
|
||||
inputs: list[Port],
|
||||
outputs: list[Port],
|
||||
parameters: list[Parameter],
|
||||
) -> None:
|
||||
self._loading = True
|
||||
self.ui.declarationsEdit.setPlainText(declarations)
|
||||
self.ui.initialEquationsEdit.setPlainText(initial_equations)
|
||||
self.ui.equationsEdit.setPlainText(equations)
|
||||
self.ui.portsTable.setRowCount(0)
|
||||
for port in inputs:
|
||||
@@ -102,11 +117,7 @@ class TextDefinitionEditor(QWidget):
|
||||
self.ui.parametersTable.setRowCount(0)
|
||||
for parameter in parameters:
|
||||
self._append_parameter(parameter)
|
||||
self.ui.equationsEdit.set_symbols(
|
||||
[port.name for port in inputs],
|
||||
[port.name for port in outputs],
|
||||
[parameter.name for parameter in parameters],
|
||||
)
|
||||
self._set_editor_symbols(inputs, outputs, parameters)
|
||||
self._loading = False
|
||||
self.set_modified(False)
|
||||
self._update_buttons()
|
||||
@@ -128,11 +139,22 @@ class TextDefinitionEditor(QWidget):
|
||||
|
||||
def _refresh_editor_symbols(self) -> None:
|
||||
inputs, outputs = self.ports
|
||||
self.ui.equationsEdit.set_symbols(
|
||||
self._set_editor_symbols(inputs, outputs, self.parameters)
|
||||
|
||||
def _set_editor_symbols(
|
||||
self,
|
||||
inputs: list[Port],
|
||||
outputs: list[Port],
|
||||
parameters: list[Parameter],
|
||||
) -> None:
|
||||
symbols = (
|
||||
[port.name for port in inputs],
|
||||
[port.name for port in outputs],
|
||||
[parameter.name for parameter in self.parameters],
|
||||
[parameter.name for parameter in parameters],
|
||||
)
|
||||
self.ui.declarationsEdit.set_symbols(*symbols)
|
||||
self.ui.initialEquationsEdit.set_symbols(*symbols)
|
||||
self.ui.equationsEdit.set_symbols(*symbols)
|
||||
|
||||
def _new_combo(self, values: list[tuple[str, str]], current: str) -> QComboBox:
|
||||
combo = QComboBox(self)
|
||||
|
||||
@@ -862,6 +862,75 @@ N\xa7\xd3>==\xfd\xa1\xc3\xe1\x98\x92$\xe9I\x00\
|
||||
\xbf\xc9\xd3\x01\x9f\xa3\x0f\x17Z/\xe3\x7f\xe1/\x17\x85\
|
||||
\xd6\x06q(\x0e\x10\x00\x00\x00\x00IEND\xaeB\
|
||||
`\x82\
|
||||
\x00\x00\x04)\
|
||||
\x89\
|
||||
PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\
|
||||
\x00\x00 \x00\x00\x00 \x08\x06\x00\x00\x00szz\xf4\
|
||||
\x00\x00\x00\x06bKGD\x00\xff\x00\xff\x00\xff\xa0\xbd\
|
||||
\xa7\x93\x00\x00\x00\x09pHYs\x00\x007\x5c\x00\x00\
|
||||
7\x5c\x01\xcb\xc7\xa4\xb9\x00\x00\x03\x9bIDATx\
|
||||
\xda\xedT=o\x1bG\x10}\xbb\xb7w$\xf5A\x9e\
|
||||
lJEB\x18\xb1\x0a\x1bv\x13\xdb\x85\xaa\x18P$\
|
||||
\xa4\x89\x81\x94\xd6_\x08`\xb8r\x93 \x85\x02\x01\xa9\
|
||||
\x9c\x1f\xe0>\x85\x81\x94F\x00\xa7\x11\xd88\x85\x1bK\
|
||||
6@)\x94-\xc8\x96\x10\x18\x81\x22\xf3C\x22i\xf2\
|
||||
\xf6v\xf3B.s\xd1\xb1H\x80\xb83\x07x\x98\xbd\
|
||||
\xdd\x99y3\xb3\xb7\x83\xb1\x8ce,\xef\xbd\x88\x1f\x97\
|
||||
\x97\xe1\x05\x01\x820D~~\x1e\xdb\xf7\xee\xa1st\
|
||||
\x94\x188H\x07/\x05\xe5\xe0\x0f\xb5C\xf0\xb7N\xd6\
|
||||
\xb9\xb3g\x11\xde\xba\x85\xf8\xd5+\xc4\xb5\x1a`\x0c\xc4\
|
||||
\x83B\x01\x82\xe4\xe1\xcd\x9b\xf2\x8f'Ol.\x9f\xb7\
|
||||
\x96\x07\xd1\xc9\x09\xbeX_\xc7\xbb\x90\xd7\xd7\xafCN\
|
||||
M\x01RB7\x9bbraA4\xee\xdf7q\xa3\
|
||||
\x01\xf1\xc3\xf9\xf3\xf0\xc3P\xac\x90\xfc\xd1\xda\x9a|v\
|
||||
\xf7\xee4\xc9\xbdw\xda\x01\x87\xec\xf4t<\xb7\xba\xda\
|
||||
\xcc\xdc\xb9c\xebW\xae\x88\xb8^\xb7\xa2|\xfb\xb6\xf8\
|
||||
\xe0\xeaU\xdbl4>?\xda\xd8\xf8\xf6\xa0\x5c\xfe\xa8\
|
||||
yp \xff=\x01G\x9eN\x22!\x1fM\xa0T2\
|
||||
S\x8b\x8b{\xb9\x85\x85U\xe4r?G\x9b\x9bB\xd5\
|
||||
\xaaU[\x7f\xfe|)\xbcp\xe1Avv\xd6\x93a\
|
||||
h\xdb\x07\x07B\xfc\xe7\x04\x122\xe3`\x07p~\x09\
|
||||
\x04c\xa3X\x9c\xd5;;?\x89\xdd\xdd\xcf\xa41e\
|
||||
e\x94B\xb3Z\xfd\xca\xfa\xbeWZZ\x8a>^Y\
|
||||
Q\xf3\xec\x88\xa7\x94#'\xac\x85L\x05\x1c\x09\x9e\xe8\
|
||||
S~\x88cxR\x22\xc8\xe7\xa1\xe7\xe6`\x84\x88\xf4\
|
||||
\xe3\xc7\xbe\xa8V\xbf6\x17/\x96\xd5\xeb\x87\x0f\x0bZ\
|
||||
\xa9K\xad(\xc2\x87\xd7\xaey\xc1\x8b\x17b\xe6\xf8\x18\
|
||||
\xca\xf3\xe0Y\x9bT<B\x98\x00B\x0c\xaa\xa6\xbd!\
|
||||
bc\xfa\xdad2\x00\x89\xdbL`\xfb\xe9S\xfc\xba\
|
||||
\xb5\x85Oo\xdc\xf0J\x95\x0a\xec\xfe\xfe\xa5\xdc\xcb\x97\
|
||||
\x05\x15[\xabzQ\xe4\xd7\xf6\xf7qD\x833$\xb7\
|
||||
LF1\xa8JZ\x9dJ\xc2\x81$\x18VJX\x12\
|
||||
\x81\xa4rr\x12&\x9bE\xa7\xd3\xc1\xef\x9b\x9b\xf8m\
|
||||
{\x1b\xf5\xb7o\xd1e\xcc\xe3j\x15zo\x0f\xf4\xf1\
|
||||
\xd9\x0d\xa5\x0c\x00\x87~\xe6\xacf\x00\x0a\x83\x9e\xd6\xff\
|
||||
l=\xc9$\xbb$\x95\x02\x82\x00\xa0\x8e\xe9\xd7k\xb7\
|
||||
\xd1\x22A\x83o\xbd~x\x88\xb6\xf3\xcb\xf2\xacEm\
|
||||
\xc8A\xe2~\xd2\xc6\x15\xa7\xb9\x88b\x00o8\x1c\xba\
|
||||
t\x0a\xba]L\xb1\x82\xac\xef#\xabT\x9f\xcc#\x04\
|
||||
\x1d\xe5\x10\x0c \xb4\x86\xe9\xf5`834\xdft\xaf\
|
||||
^G\xf7\xafJ\x1di\x86v\x9a~]\xdaj\x12c\
|
||||
b\x02\xbe\xbb\x22IN^\x99V\x87B4&\xac\xad\
|
||||
\x00(\xedll\xe8\xe2\xb9s\xbeGbEC\x9fW\
|
||||
\xe1\xc71|!\x86W\xd2\xdfW\x0c\xe0q_\x11\xc3\
|
||||
\xffD\xce\xcc@\x16\x8b\x10\x1e\xbf\x5c\x85Y\x22\x00P\
|
||||
\xa0\xd6\xd4>\x8b9\xb3\xbb\xab\xa3A\xcf*5r\x8b\
|
||||
5\xf4\xe5\x93\x0e\xb0~\xc2\x03\x1eZ#%\xfd\x93\xb6\
|
||||
\xb3\xda\xd3O\x8f\x04\xbe\xd3\xa7\xde<\xed2\xc0\x08\xb2\
|
||||
\x0e\x19\x06\xa5\xbf\xe0\xbaG\xbfe\x00\x8f\xd4174\
|
||||
\x17\x0c\xb0\x04\xe0;\x03\x5cf\x8b\xa4M?\xad\xd4\xcf\
|
||||
G\x0dV\x9f\x9e\x0f\xce~ v\xf8o\x11zpn\
|
||||
\x14\xb0\xc5\xbdo\xda\xc0/\x92\xa6j\xd2\xcd\x8c<7\
|
||||
\x9e\x01\x8b4\xca\xd3X%\x09$\xc3%\x91\xd1\xa4b\
|
||||
\x87\xd40J\xdbk\xee5\xc9\x09=\xd8\xb2\xea\x8dK\
|
||||
\xb6\x05\xc8\x90Z\xd0\x00\xceY\x11\xdf\xe3\xffI%\xf5\
|
||||
mI\xdc\x224`\xfaE~\xe9\x0e\xa4\xd3=B\xa7\
|
||||
F\xe9\xe8\xe8\x1dE\x90B&\xd1)\x0c\xc4`,c\
|
||||
\x19\xcbX\x06\xf2'\xe3\xdf\x9d\x06\x06\xf6\x92\x0e\x00\x00\
|
||||
\x00\x22zTXtSoftware\x00\x00\
|
||||
x\xda+//\xd7\xcb\xcc\xcb.NN,H\xd5\xcb\
|
||||
/J\x07\x006\xd8\x06X\x10S\xca\x5c\x00\x00\x00\x00\
|
||||
IEND\xaeB`\x82\
|
||||
\x00\x00\x02V\
|
||||
\x89\
|
||||
PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\
|
||||
@@ -2326,6 +2395,158 @@ K\x80@\x89\x15\x8d\xc04\xd5\xb5^\xaf\x1bx\xfa\x19\
|
||||
\x84\xe7\x04\xcf\x88\xfd\xfd\xfd\xe4\xe8\xe8\xc8\x9dL&\x14\
|
||||
\xc7\xcc\x7f5p\xf2g\x94\xf7\x1f\xdf\x9a\xd2\x93\xfbC\
|
||||
\xb7\xa7\x00\x00\x00\x00IEND\xaeB`\x82\
|
||||
\x00\x00\x03m\
|
||||
\x89\
|
||||
PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\
|
||||
\x00\x00 \x00\x00\x00 \x08\x06\x00\x00\x00szz\xf4\
|
||||
\x00\x00\x00\x01sRGB\x00\xae\xce\x1c\xe9\x00\x00\x00\
|
||||
\x06bKGD\x00\xff\x00\xff\x00\xff\xa0\xbd\xa7\x93\x00\
|
||||
\x00\x00\x09pHYs\x00\x00\x1b\xaf\x00\x00\x1b\xaf\x01\
|
||||
^\x1a\x91\x1c\x00\x00\x00\x07tIME\x07\xd9\x02\x10\
|
||||
\x17\x22\x16\x993\xa5<\x00\x00\x02\xedIDATx\
|
||||
\xda\xed\x97_H\xd3Q\x14\xc7\xcf\xd9\xef7\xcb\xca\x89\
|
||||
B \x91\x0f\xc9\xcczha\xf6\xa8\xb4\x06M\x90f\
|
||||
aiV$\x96V\x12\xf9P-S\x90d%Lh\
|
||||
V/B.\x8d\xc2\xb2\xc0\x1erS\xc1\x84\x1cdo\
|
||||
a\xa0\x0f>h\x0f\xfdy\xf0-\x9b\xa6\x0f\xb1{\xfb\
|
||||
n\xf4\x8b\x91\xe2\x5cn\xae\x07\x0f\xdc\x9dq/\xfc>\
|
||||
\xe7{\xce\xe1\xdc\xdf\x8f\xd6M\xb3\x86\x86\x86\xe2Dp\
|
||||
u\xbf\xe19pG\x82>!\x01\x04\xe1\x9aOd\x09\
|
||||
:\x13V\x02\xcd\xd6\x03H\x84\xa9\x04\xab\xaf\xaf\xef\x84\
|
||||
\xcb\x8f\x07\xe0z\xcf\x82AU\xc8\xa6\xeax\xfc\xf6\xd1\
|
||||
\x8dcKf\xa0\xa5\xa5\xa5\x0an$V\xd0\xea\xc7\xf3\
|
||||
\x86\x9a\xae\xf9\xd3\xb5\xdd\xf3\xaf\x84\xa4\xcfRR\xa9\x5c\
|
||||
&\x031\xb3\xf2\xf6\x1f\xb9P\xdb\x14\x90\xd2\xacH\xf6\
|
||||
\x01\xda\x13\x10T\xd1Z\x96\xec\xa7x\x07P\xd26\xc7\
|
||||
P\xdb!\x04\xbd\x10L\x15\xedg7-\x82\xc65\x00\
|
||||
\xc0m\x02?\x82\xd9\xf5\xa4j\xb3\x5c\xd3&,\xba\x1f\
|
||||
R\x8f\xd4\x93\xe3\xe5\xc5\x08\xf0X7\xa1\xa6> B\
|
||||
\xde\xbb&s\xc0\xb3\xf3x\x81'\xbbt\x1f\xc1,w\
|
||||
f\x19M\xd7$\xa0\xbe\xf7\xf2\x16\x19\xf5\x1c\x88\x0e|\
|
||||
L!\xc9\x8d$u\x97X\xa8\x0b\xde\xac\x0aS\xab$\
|
||||
3\x07\xd5\xb3\xd4\xd4\xc7'\x00\xa8\xce\x00\xfc)\xe0\xcc\
|
||||
\xa4\xdbK2\xe9\x96\x94\xaa\x0bu\xcfc\xa8\x1f\xbc\x92\
|
||||
\x22\xffq\x14GnB\xa4\xdbBRy\xcfRy\xcb\
|
||||
\xa4XmS\xcf\xa7I\xe8\xed,\xf4\x85\xbb&\xc7\xb4\
|
||||
\xda\xc7\xfe:\x06X\xf1d\x975y\x8c\xe5_\xbd\xc6\
|
||||
\x93\x96\xf0\xb3\x5c\x87\x9f++\xdf\x8d\xf6m\xbf\xfa\xa9\
|
||||
o[\x9d!\xe6\x97\x11\xc0\x198\x1e\x84\xea\x02\xa4|\
|
||||
?T\xbf\x09?\x97\x92\x8a\xc7\xb3\xf6H)\x92^#\
|
||||
\x1b\xae\xe5 \x03\x06\xb7e \xa5\xc3\xb4\xd2\x00\x00?\
|
||||
\x91\x87Z\x87R\x0e_h\x9b\xea\x9e\x0e?\xdf\xdd\xf8\
|
||||
\x9d\x03B\xde\x0cv>\x9a\xf1\x1aK\xbd\xb5\x7fk\xb3\
|
||||
u1\xb8\xdd0`x\xe8F\xf9\x1e\xe19\xea\x8a\x03\
|
||||
`\xa9\xfb\x09\xf8)\x80\x1d\xb6\x8f\xcf\x02\xda~\xa6}\
|
||||
\x86v\xdc\x981\x06\x045\x02NB\x90\xf7\xf0t\xb3\
|
||||
\x1f\x19\xb8\x80\xe5\xeeOo5\x84\xa9>\x040\x1aD\
|
||||
!\xc0MEs\xe7F\x97diM\xc8\xcc\xf9N\xa7\
|
||||
3'\xfc0\xb9\xe6\x1b\xe9\x98\x8c\xaaB\x07\x92\x142\
|
||||
\xebU6\xeb\xf1\xbc$\x85}\xd8\xbb;\xd1\x9c\xfa\xe1\
|
||||
\x0f0\xfd\x9e;\x04\x13\x1b\xecD\xec\x02\xdcJ\x92\xcf\
|
||||
\x03<\x14\xf5$\x04\xd8\x84\xd5\x85\xbf_P\xeba,\
|
||||
3\x96\x0f\x8a\x0fB}\xe6\xa43\xf5L\x08\x1enB\
|
||||
\xb5\x13J\x01\xb5\x13a\xaa\x87V3\x07|X\x0eI\
|
||||
4\xe5oK\x8b|\x1f\xcc\xd4\xfa\xd1h%\x00\xa7\x02\
|
||||
<\xbc\xaaA\xb4\xf0 m\x0c\x0e+:+\x9a\xad\x1e\
|
||||
\xfd\xaf\xdf\x091k\xea\xfe\xfe\xf8\xe1H\xdf\x05R\xca\
|
||||
|f\x1e\x89\xd1\x9ef\xbdhx\x0fE4mL\xaf\
|
||||
b/B\x06\x12o\xbf\x00\xa3\x17WYZq\xd9W\
|
||||
\x00\x00\x00\x00IEND\xaeB`\x82\
|
||||
\x00\x00\x05\xcf\
|
||||
\x89\
|
||||
PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\
|
||||
\x00\x00 \x00\x00\x00 \x08\x06\x00\x00\x00szz\xf4\
|
||||
\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\
|
||||
\x00\x00\x00\x09pHYs\x00\x00\x03v\x00\x00\x03v\
|
||||
\x01}\xd5\x82\xcc\x00\x00\x00\x19tEXtSof\
|
||||
tware\x00www.inksca\
|
||||
pe.org\x9b\xee<\x1a\x00\x00\x05LID\
|
||||
ATx\xda\xc5\x97\xdboTE\x1c\xc7\xbf3s\xce\
|
||||
\x9e\xeeni\x0b\xbd@\x01C1\x05B\x10\x0d\xf4\x22\
|
||||
\x18\x95D0i\xc4\x17|21\xc6\x17\xc3\x93\x89\xd1\
|
||||
\xc8\x8b\xfaP#oj\x8c\x89O\xfc\x03\xc6K\x0c\xf1\
|
||||
\x01!B\xa8\xc1j\x88D\x90@)\x14\xac\xb5\x86K\
|
||||
K\xaf\xdb\xdd={\xce\xcc\xef\xe7\xec\x9cficb\
|
||||
\xd2\x98\x13f\xf3\xdd93\xbf\x93\x9d\xcf\xfengW\
|
||||
03\x1e\xe6\xf0\xb0\xc2\xf1\xca\xe9\x17wok\xda~\
|
||||
lh\xe6\xe2\xd6\xbf\x0a#\xab\x94\x92h\xcb\xad\x9d{\
|
||||
z\xdd\xfe\x9b\xf9 \xf7\xce\xe1\xad\xef\x0d`\x05Cb\
|
||||
\x05\xa3\xe7\xcb\xce\xc7\x0emz\xf9\xfc\xab\x9d\x87\xbb\xf6\
|
||||
\xb4\xec[\x15k\x82\x8e\x09\x9d\xf9\xed\x8d\x07\xda\x0fu\
|
||||
=\xd5\xd2w\xe6\x83K\x87{S\xf3@N\xe4>\x9d\
|
||||
)M{>\xd5\xa1\xab\xad\x17\x1b\x1a\xda\xdd~V\xe6\
|
||||
\xb1)\xb7\x05\xe7\xee\x9e\x94\xf3\xa5\xe2'\x00\x9eI\x05\
|
||||
\xe0^a\xa2\xe7\xdc\xdf\x03\xe8\x5c\xb3\x05\xf3\xb9k\x10\
|
||||
A\xc5\xed\x87\x98\xc4\x99\xdb\xdf\xe1\xd4\xd8\xb7\x18-\x0e\
|
||||
\xefL\xcd\x03aTi\x1c\x1c\xff\x11\xdd\x1bw\xa3I\
|
||||
\x99\xe5F3\x87+\xf7/\xc2W\xb215\x00\x133\
|
||||
\x08\x11E(\xc7\xcb\x01<\xa3\x9d]2#5\x00\
|
||||
\xd2\x04!$\x8c!\x94u\xb4\xccVG1\x8c6\x10\
|
||||
@\x9a\x00\x0c\x08\x86!B\x18G\x80X\xea\x01\x03c\
|
||||
\xed\x02\x94\x1e\x80Y\x04\xd0d`,\x80\x00j\x10\x01\
|
||||
i\x18\xc3\x10\xd6\x9ej\x0e\x08\xc5 bD:^\xe6\
|
||||
\x01M\xfa\xffy\xe0\xe8\xe0\xd1\x17\xaeN\x5c\xed\x1f\x18\
|
||||
\x1d\xd869w\xafA\x92\x84d\xc0\xbeC\xb1\x80\x94\
|
||||
\x02JHw81!2\x0e\xa0\xc6\xa0\x8dv9b\
|
||||
\xd0ul\x03{\xbe\x84\xaf\x14<_\xc1\xf7\xecu\
|
||||
F\xa15\xd76\xff\xc4\xda\x9e\xeb\x1d\xab\xb6\xf7\xbf\xb4\
|
||||
\xf9\xf5\x13\xb5N\xd8\xf7E_\xefTi\xea\xf8\xc6\xfa\
|
||||
\x8d=mA[\x03\x99$\xdel\xd8\xcd\xb48\x1bw\
|
||||
M\xd0\xdaX\x00\x8d\xd8\x98%\x8a@D\xee^c\xc8\
|
||||
\xddk(\xb9\xdfp\xb2W\xef564\xaa\xd6\x9e\xf9\
|
||||
h\xea\xf8G\xc3o\xb8\x8e\xe9\x1eF\x1d\x9fw\xfc\xb0\
|
||||
\xabm\xd7\x81\xbd\xeb\xf7\x02\xc2`.\x9aAu\x9f\x85\
|
||||
\x15\x5c\xdc\x935\x0c\x84\x00r\xb9,\xee\x9a?!\x93\
|
||||
$p{\x1b\xbcGQ\xa9\x84P\xd2\x83'\xfd\x9a\x94\
|
||||
\xf2\x90\xb1{\x81\xca\xc2g\xcf\xda\x0d\xc6\xc2!\xdc\x89\
|
||||
n\x9e\xf9\xec\xc9\xef\x0f\xb8\x10\x8c\xcf\x8dw#\x06z\
|
||||
\xda\xbb0T\xb8\x00-4 Q\x93\x84\x80\x14\x02J\
|
||||
J7\xcb(Y\x0b'\xc7\x87\xb1\xe8\x06X\x00L\x9c\
|
||||
x\x81\xaa\x22\x042\x8b\xbcX\x8d\x91\x89Q\x9c\x1a:\
|
||||
\x8d\xf7\xf7\xbd\x85\xdb4\x8cyLv\xd5r\x80\x88\x9a\
|
||||
\xc6\xa6\xc602u\x1dEQN\x0eVp\xb3\x10H\
|
||||
\x0e\x96\x02\xcc\xb2\x06\xc2\xe2\x01Dm0\x83\x00x\xc2\
|
||||
\xc3\xba\xecz\xcc\x95\x8b\xb81}\x0bgG\xbfF\x1c\
|
||||
\x11\x00\xd8\xf50\x8a\xc1md|\xd9T\x03\x00[\x91\
|
||||
k\xb5\xa8\xa88\x01 \x07\x91$\x1fK+\x07\x90\x1c\
|
||||
\x0e\x86\xaa\x02A8\xefdT\x1d\x9a\x83V\x17\x8e0\
|
||||
\x0a1\xb10\x81o\xfe\xf8\x0a\x85J\x11\xa5(\xb6\xa0\
|
||||
\x12\x90\xe42V\xb3v\xf9@\x9e\xc0R\x80Y\x10\x9a\
|
||||
f\x0a\xb3\xb8^\xbc\x09?\xf0\x9c\x82L\x80l\x10\xc0\
|
||||
>\xe7\x91\xf7\xb2\x8eI2\x01,]G\x0cD\x00\x22\
|
||||
\x8d\xf9h\x1a\xc3\x93\xbf!\xd4\x15h\x22D\xc6\x00\xd2\
|
||||
\xc0S\xca\xca@\x19W.N\x19\xcf\xc3\x02\xbb\xf0\xcc\
|
||||
.-\xc3A\x10\x0e\x0e\x0e\xff\x82\x1d\xebw .\xc5\
|
||||
@9\x09A$\x04H\x85(\x8b\x18\x9e'\xdc\x87\xd6\
|
||||
5H\xdc\xc1-\x04\x9erkea\x1e\xf1;Q\xd1\
|
||||
\x06\xbc\x987\xe43L\x96\xa09)[cU\xefe\
|
||||
1e\x93\x97du\x8f\x7f~\x00\xa0q\x04\xc0\xfe\x85\
|
||||
\xf2B\xdd\xf9k\xe7\x81x1\x04\x9cP\x0b+)\x92\
|
||||
^ \x94\xc0\xb3{z\xe1\xafV\xc8T3\xbc\x0a!\
|
||||
%\xc2B\x8c\x9f.\xffj!%\xaa=@YyK\
|
||||
\xe4\xfb\x0a\x85\x8cB&c\xd7\x19\xaf\xacY\x1f\xa9\xf5\
|
||||
\x01\xfe\x90\xaf\x81\xd0\x03\xe0,\x08\x0b0@M\x1a`\
|
||||
;SU\x94\x5ck\x13\xbbC}%\x1d@\xe0{\xae\
|
||||
D\x99\x01\x02\xbb\xba\xa7\x7f\x89\xacx\xce\xdaN\xda\xb9\
|
||||
\xfbD\xdf\xc8\xd0\xb2N\xc8\x1f\xf3\x15\x00\xcf\xfdg\xdb\
|
||||
|M2\x0b\xd7\xf5\x9cG\xbc*\x80\xb2\x00\x9e\x87J\
|
||||
r\x00$\x0b\x8c\xbd;#R\xf9MH&\xa9\xf3\x98\
|
||||
b\xf0b|\x94L\xbc\x00h\x07@)\xfe\x1ep\x87\
|
||||
3\x0bT\xe2\x18\xc2\x18\x18J\xbe\xb5X\xecF\xc9+\
|
||||
E\x80\x04\x02(\xeb\x0a8\xd2P2\xb2J\x1aR1\
|
||||
\xa2\xa4\x9d\xa4\x0e \x18\xa5(D\x14F\xae\xe6+\xb1\
|
||||
F!\xac ,\xf9 k\xb3<)\x02\x88D\x0bq\
|
||||
\x08*VP\xac\xc4\xae\x17\xb8\xf2,f\xc0\x92\xacd\
|
||||
z\x00^F\x15\x1b\xb2A\xbeE\x05\xb8Q\x9aK\xda\
|
||||
\xb4U\xf5\xb5)\xee@=1B.\x15R\xfbg\x94\
|
||||
\xad\xf7\x7f\xdf\xd9\xde\x82\x83\xcdk\xb03n\x86\x9cR\
|
||||
\xc0\xb4D\xb7\xea\xc5V\xde\x82<\xea!H^H\x0d\
|
||||
\xdf\x1c\xbc\xb9ym\xa0W7*\xb4\xe6\xf3 c\
|
||||
\xc0Dx\xa2\xf9q\xc8@Add$`\xdeN\x0d\
|
||||
\xe0N\xff\xec\x05\xd9\x1c=?\xee\xf3\xe5\xfb\x22Z\xa0\
|
||||
,\x83\xeb\x18*\xab\xc2 \x9b\xb9\x12\xa0n\xffD\x7f\
|
||||
\xf1\x12V0\x1e\xfa\xdf\xf3\x7f\x00j\xf0\xda\xe8\xbc\xba\
|
||||
\xd0\x0a\x00\x00\x00\x00IEND\xaeB`\x82\
|
||||
\x00\x00\x04<\
|
||||
\x89\
|
||||
PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\
|
||||
@@ -2396,6 +2617,35 @@ f\xa2\xd1\xa5\x5c\x22\xb4\x91SZ\xd5u\xd7\x0a\xd2]\
|
||||
|\x01\x85\x09\x800\x7fss\xd3{\xf6\x7fABG\
|
||||
Y\x01\x05l*\xfc\x00!\x00\x12\xf1%U\xb6\x0e\x00\
|
||||
\x00\x00\x00IEND\xaeB`\x82\
|
||||
\x00\x00\x01\xad\
|
||||
\x89\
|
||||
PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\
|
||||
\x00\x00 \x00\x00\x00 \x08\x03\x00\x00\x00D\xa4\x8a\xc6\
|
||||
\x00\x00\x00\x01sRGB\x00\xae\xce\x1c\xe9\x00\x00\x00\
|
||||
\x09pHYs\x00\x00\x0d\xd7\x00\x00\x0d\xd7\x01B(\
|
||||
\x9bx\x00\x00\x00\x07tIME\x07\xd9\x0c\x1c\x03\x1c\
|
||||
\x0e%S,b\x00\x00\x00uPLTE\x00\x00\x00\
|
||||
\x13\x13\x13\x0a\x0a\x0a\x0b\x0b\x0b\x00\x00\x00\x00\x00\x00\x00\
|
||||
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc6\xc6\xc8\xc7\xc7\
|
||||
\xc9\xc9\xc9\xcb\xcc\xcc\xce\xce\xce\xd0\xd0\xd0\xd2\xd4\xd4\xd6\
|
||||
\xd7\xd7\xd8\xd7\xd7\xd9\xd8\xd8\xda\xd9\xd9\xdb\xda\xda\xdb\xda\
|
||||
\xda\xdc\xdb\xdb\xdc\xdb\xdb\xdd\xdd\xdd\xdf\xde\xde\xdf\xe2\xe2\
|
||||
\xe3\xe3\xe3\xe5\xe3\xe3\xe6\xe4\xe4\xe6\xe6\xe6\xe7\xe7\xe7\xe9\
|
||||
\xe9\xe9\xea\xeb\xeb\xec\xed\xed\xee\xf0\xf0\xf1\xf3\xf3\xf4\xff\
|
||||
\xff\xff\xd3\x9b\xcc\x0e\x00\x00\x00\x0atRNS\x00\x09\
|
||||
\x15\x15\x1825678\xb5\xcc\xc0\x1e\x00\x00\x00\x01\
|
||||
bKGD&Z\x08\x98\xb5\x00\x00\x00\x9bIDA\
|
||||
Tx\xda\xd5\x93\xcb\x0e\x820\x10\x00\x8b\x0aEP|\
|
||||
u\xc1G)\x94\x02\xff\xff\x89.]\x0e\x18\xccr1\
|
||||
F\xe72\xd9d\xd26\x9bT\xfc\x02\xc1\x86%\x10a\
|
||||
\xcf\x12\x0a\xd9)\x86N\x0a\xd9^\x18Z\x0c\xdc\x91\xc1\
|
||||
a\xd0\x1c\x18\x1a\x0c\xec\x9e\xc1bP'\x9et\x97\xce\
|
||||
\x95\xd4\x18\x94=q#\xddIWR\x89\x81\x1e\x03E\
|
||||
\x82\x97IO\x02\x98\x8b\x82G\x01\x9e\xec\x8d\x8aj\xf1\
|
||||
\x84\xcf\xbc!W\x03\x90\x8d\x02oR^-^\xf1?\
|
||||
{\xe0\x83\xc8\x1a=`\xce\xc6\xebd\xa6\x93\x8b\xc4*\
|
||||
\xde2\xc4\xeb/|\xcd'\xec\xbfO\xbf\x90M\x1a\x0a\
|
||||
\x00\x00\x00\x00IEND\xaeB`\x82\
|
||||
\x00\x00\x02\x92\
|
||||
\x89\
|
||||
PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\
|
||||
@@ -2563,6 +2813,10 @@ qt_resource_name = b"\
|
||||
\x0f\xba\x1e'\
|
||||
\x00d\
|
||||
\x00r\x00a\x00w\x00-\x00p\x00a\x00t\x00h\x00.\x00p\x00n\x00g\
|
||||
\x00\x0f\
|
||||
\x020\x8b\xe7\
|
||||
\x00l\
|
||||
\x00i\x00s\x00t\x00-\x00r\x00e\x00m\x00o\x00v\x00e\x00.\x00p\x00n\x00g\
|
||||
\x00\x0d\
|
||||
\x0b\xe6\x1f\xa7\
|
||||
\x00d\
|
||||
@@ -2632,10 +2886,24 @@ qt_resource_name = b"\
|
||||
\x00d\
|
||||
\x00o\x00c\x00u\x00m\x00e\x00n\x00t\x00-\x00s\x00a\x00v\x00e\x00.\x00p\x00n\x00g\
|
||||
\
|
||||
\x00\x15\
|
||||
\x02\xb4\x1f\x07\
|
||||
\x00o\
|
||||
\x00f\x00f\x00i\x00c\x00e\x00-\x00c\x00h\x00a\x00r\x00t\x00-\x00l\x00i\x00n\x00e\
|
||||
\x00.\x00p\x00n\x00g\
|
||||
\x00\x0c\
|
||||
\x09\xc6\x19'\
|
||||
\x00l\
|
||||
\x00i\x00s\x00t\x00-\x00a\x00d\x00d\x00.\x00p\x00n\x00g\
|
||||
\x00\x10\
|
||||
\x03\xe6\xd3g\
|
||||
\x00d\
|
||||
\x00r\x00a\x00w\x00-\x00e\x00l\x00l\x00i\x00p\x00s\x00e\x00.\x00p\x00n\x00g\
|
||||
\x00\x13\
|
||||
\x07\xd6O\x07\
|
||||
\x00v\
|
||||
\x00i\x00e\x00w\x00-\x00f\x00o\x00r\x00m\x00-\x00t\x00a\x00b\x00l\x00e\x00.\x00p\
|
||||
\x00n\x00g\
|
||||
\x00\x12\
|
||||
\x09\xb3>\xc7\
|
||||
\x00d\
|
||||
@@ -2653,63 +2921,71 @@ qt_resource_struct = b"\
|
||||
\x00\x00\x00\x00\x00\x00\x00\x00\
|
||||
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\
|
||||
\x00\x00\x00\x00\x00\x00\x00\x00\
|
||||
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x1c\x00\x00\x00\x03\
|
||||
\x00\x00\x00\x00\x00\x02\x00\x00\x00 \x00\x00\x00\x03\
|
||||
\x00\x00\x00\x00\x00\x00\x00\x00\
|
||||
\x00\x00\x01\xfe\x00\x00\x00\x00\x00\x01\x00\x00N\xe8\
|
||||
\x00\x00\x02\x22\x00\x00\x00\x00\x00\x01\x00\x00S\x15\
|
||||
\x00\x00\x01\x9f{C\xf1'\
|
||||
\x00\x00\x02>\x00\x00\x00\x00\x00\x01\x00\x00Z\x1a\
|
||||
\x00\x00\x02b\x00\x00\x00\x00\x00\x01\x00\x00^G\
|
||||
\x00\x00\x01\x9f\x7f\xa8\xa8)\
|
||||
\x00\x00\x02\xec\x00\x00\x00\x00\x00\x01\x00\x00tV\
|
||||
\x00\x00\x03\x10\x00\x00\x00\x00\x00\x01\x00\x00x\x83\
|
||||
\x00\x00\x01\x9f{0\xc99\
|
||||
\x00\x00\x01\xc4\x00\x00\x00\x00\x00\x01\x00\x00D2\
|
||||
\x00\x00\x01d\x00\x00\x00\x00\x00\x01\x00\x004B\
|
||||
\x00\x00\x01\x9f\x84\xbd\x03\xb8\
|
||||
\x00\x00\x03\xc8\x00\x00\x00\x00\x00\x01\x00\x00\x91\xd7\
|
||||
\x00\x00\x01\x9f\x84\x8f\x00\xb9\
|
||||
\x00\x00\x01\xe8\x00\x00\x00\x00\x00\x01\x00\x00H_\
|
||||
\x00\x00\x01\x9f\x7f&\x83\xcd\
|
||||
\x00\x00\x01\xa4\x00\x00\x00\x00\x00\x01\x00\x00<J\
|
||||
\x00\x00\x01\xc8\x00\x00\x00\x00\x00\x01\x00\x00@w\
|
||||
\x00\x00\x01\x9f{C\xf1\x18\
|
||||
\x00\x00\x03\xa4\x00\x00\x00\x00\x00\x01\x00\x00\x8d\xaa\
|
||||
\x00\x00\x04\x16\x00\x00\x00\x00\x00\x01\x00\x00\x9b\x1b\
|
||||
\x00\x00\x01\x9f\x7fY\xceg\
|
||||
\x00\x00\x02\xa2\x00\x00\x00\x00\x00\x01\x00\x00f\xc8\
|
||||
\x00\x00\x02\xc6\x00\x00\x00\x00\x00\x01\x00\x00j\xf5\
|
||||
\x00\x00\x01\x9f\x7fV\xd5\xc0\
|
||||
\x00\x00\x03Z\x00\x00\x00\x00\x00\x01\x00\x00\x84\xc5\
|
||||
\x00\x00\x03~\x00\x00\x00\x00\x00\x01\x00\x00\x88\xf2\
|
||||
\x00\x00\x01\x9f\x7f&\x83r\
|
||||
\x00\x00\x02\xce\x00\x00\x00\x00\x00\x01\x00\x00m[\
|
||||
\x00\x00\x02\xf2\x00\x00\x00\x00\x00\x01\x00\x00q\x88\
|
||||
\x00\x00\x01\x9f\x7f&\x83\xb1\
|
||||
\x00\x00\x01\x1c\x00\x00\x00\x00\x00\x01\x00\x00,\x08\
|
||||
\x00\x00\x01\x9f\x7fY\xce\x82\
|
||||
\x00\x00\x01\xe0\x00\x00\x00\x00\x00\x01\x00\x00Kh\
|
||||
\x00\x00\x02\x04\x00\x00\x00\x00\x00\x01\x00\x00O\x95\
|
||||
\x00\x00\x01\x9f{C\xf1.\
|
||||
\x00\x00\x01\x84\x00\x00\x00\x00\x00\x01\x00\x006\x9c\
|
||||
\x00\x00\x04<\x00\x00\x00\x00\x00\x01\x00\x00\x9f[\
|
||||
\x00\x00\x01\x9f\x84\x8f\xa6\x10\
|
||||
\x00\x00\x01\xa8\x00\x00\x00\x00\x00\x01\x00\x00:\xc9\
|
||||
\x00\x00\x01\x9f{{\xa5\xd5\
|
||||
\x00\x00\x03\xca\x00\x00\x00\x00\x00\x01\x00\x00\x91\xea\
|
||||
\x00\x00\x04h\x00\x00\x00\x00\x00\x01\x00\x00\xa1\x0c\
|
||||
\x00\x00\x01\x9f\x7f&\x83\x10\
|
||||
\x00\x00\x03\xf8\x00\x00\x00\x00\x00\x01\x00\x00\x95H\
|
||||
\x00\x00\x01\x9f\x84\xbd\x03\xde\
|
||||
\x00\x00\x00\xfe\x00\x00\x00\x00\x00\x01\x00\x00(e\
|
||||
\x00\x00\x01\x9f\x7f&\x83~\
|
||||
\x00\x00\x036\x00\x00\x00\x00\x00\x01\x00\x00\x80\xe2\
|
||||
\x00\x00\x03Z\x00\x00\x00\x00\x00\x01\x00\x00\x85\x0f\
|
||||
\x00\x00\x01\x9f\x7f&\x83T\
|
||||
\x00\x00\x00~\x00\x00\x00\x00\x00\x01\x00\x00\x14M\
|
||||
\x00\x00\x01\x9f\x7fY\xce^\
|
||||
\x00\x00\x00\xa2\x00\x00\x00\x00\x00\x01\x00\x00\x19Y\
|
||||
\x00\x00\x01\x9f{0\xc9B\
|
||||
\x00\x00\x01d\x00\x00\x00\x00\x00\x01\x00\x004B\
|
||||
\x00\x00\x01\x88\x00\x00\x00\x00\x00\x01\x00\x008o\
|
||||
\x00\x00\x01\x9f\x7f&\x83)\
|
||||
\x00\x00\x03\x14\x00\x00\x00\x00\x00\x01\x00\x00{`\
|
||||
\x00\x00\x038\x00\x00\x00\x00\x00\x01\x00\x00\x7f\x8d\
|
||||
\x00\x00\x01\x9f{C\xf1N\
|
||||
\x00\x00\x02p\x00\x00\x00\x00\x00\x01\x00\x00b\x99\
|
||||
\x00\x00\x02\x94\x00\x00\x00\x00\x00\x01\x00\x00f\xc6\
|
||||
\x00\x00\x01\x9f\x7f&\x82\xf2\
|
||||
\x00\x00\x00\xd0\x00\x00\x00\x00\x00\x01\x00\x00!\xc5\
|
||||
\x00\x00\x01\x9f{\x8d\xf34\
|
||||
\x00\x00\x00\x10\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
|
||||
\x00\x00\x01\x9f{0\xc9+\
|
||||
\x00\x00\x02\x1e\x00\x00\x00\x00\x00\x01\x00\x00RH\
|
||||
\x00\x00\x02B\x00\x00\x00\x00\x00\x01\x00\x00Vu\
|
||||
\x00\x00\x01\x9f{C\xf1=\
|
||||
\x00\x00\x006\x00\x00\x00\x00\x00\x01\x00\x00\x05\x86\
|
||||
\x00\x00\x01\x9f\x7f&\x83\x99\
|
||||
\x00\x00\x03\xf4\x00\x00\x00\x00\x00\x01\x00\x00\x94\x80\
|
||||
\x00\x00\x04\x92\x00\x00\x00\x00\x00\x01\x00\x00\xa3\xa2\
|
||||
\x00\x00\x01\x9f{{\xa5\xe3\
|
||||
\x00\x00\x00^\x00\x00\x00\x00\x00\x01\x00\x00\x0c\xc1\
|
||||
\x00\x00\x01\x9f\x7f\xac\xf2\xc6\
|
||||
\x00\x00\x01D\x00\x00\x00\x00\x00\x01\x00\x00/{\
|
||||
\x00\x00\x01\x9f\x7fV\xd5\xe5\
|
||||
\x00\x00\x03|\x00\x00\x00\x00\x00\x01\x00\x00\x88\xb7\
|
||||
\x00\x00\x03\xa0\x00\x00\x00\x00\x00\x01\x00\x00\x8c\xe4\
|
||||
\x00\x00\x01\x9f{0\xc9R\
|
||||
"
|
||||
|
||||
|
||||
@@ -39,91 +39,99 @@ class Ui_MainWindow(object):
|
||||
self.actionGraphParameters = QAction(MainWindow)
|
||||
self.actionGraphParameters.setObjectName(u"actionGraphParameters")
|
||||
icon1 = QIcon()
|
||||
icon1.addFile(u":/icons/icons/configure.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
icon1.addFile(u":/icons/icons/view-form-table.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionGraphParameters.setIcon(icon1)
|
||||
self.actionCompile = QAction(MainWindow)
|
||||
self.actionCompile.setObjectName(u"actionCompile")
|
||||
self.actionCompose = QAction(MainWindow)
|
||||
self.actionCompose.setObjectName(u"actionCompose")
|
||||
icon2 = QIcon()
|
||||
icon2.addFile(u":/icons/icons/run-build.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionCompile.setIcon(icon2)
|
||||
self.actionCompose.setIcon(icon2)
|
||||
self.actionRunSimulation = QAction(MainWindow)
|
||||
self.actionRunSimulation.setObjectName(u"actionRunSimulation")
|
||||
icon3 = QIcon()
|
||||
icon3.addFile(u":/icons/icons/media-playback-start.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionRunSimulation.setIcon(icon3)
|
||||
self.actionSimulationWindow = QAction(MainWindow)
|
||||
self.actionSimulationWindow.setObjectName(u"actionSimulationWindow")
|
||||
icon4 = QIcon()
|
||||
icon4.addFile(u":/icons/icons/office-chart-line.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionSimulationWindow.setIcon(icon4)
|
||||
self.actionExportModel = QAction(MainWindow)
|
||||
self.actionExportModel.setObjectName(u"actionExportModel")
|
||||
icon5 = QIcon()
|
||||
icon5.addFile(u":/icons/icons/document-save-as.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionExportModel.setIcon(icon5)
|
||||
self.actionNew = QAction(MainWindow)
|
||||
self.actionNew.setObjectName(u"actionNew")
|
||||
icon4 = QIcon()
|
||||
icon4.addFile(u":/icons/icons/document-new.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionNew.setIcon(icon4)
|
||||
icon6 = QIcon()
|
||||
icon6.addFile(u":/icons/icons/document-new.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionNew.setIcon(icon6)
|
||||
self.actionRotateClockwise = QAction(MainWindow)
|
||||
self.actionRotateClockwise.setObjectName(u"actionRotateClockwise")
|
||||
icon5 = QIcon()
|
||||
icon5.addFile(u":/icons/icons/transform-rotate.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionRotateClockwise.setIcon(icon5)
|
||||
icon7 = QIcon()
|
||||
icon7.addFile(u":/icons/icons/transform-rotate.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionRotateClockwise.setIcon(icon7)
|
||||
self.actionZoomIn = QAction(MainWindow)
|
||||
self.actionZoomIn.setObjectName(u"actionZoomIn")
|
||||
icon6 = QIcon()
|
||||
icon6.addFile(u":/icons/icons/zoom-in.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionZoomIn.setIcon(icon6)
|
||||
icon8 = QIcon()
|
||||
icon8.addFile(u":/icons/icons/zoom-in.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionZoomIn.setIcon(icon8)
|
||||
self.actionZoomOut = QAction(MainWindow)
|
||||
self.actionZoomOut.setObjectName(u"actionZoomOut")
|
||||
icon7 = QIcon()
|
||||
icon7.addFile(u":/icons/icons/zoom-out.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionZoomOut.setIcon(icon7)
|
||||
icon9 = QIcon()
|
||||
icon9.addFile(u":/icons/icons/zoom-out.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionZoomOut.setIcon(icon9)
|
||||
self.actionCenterView = QAction(MainWindow)
|
||||
self.actionCenterView.setObjectName(u"actionCenterView")
|
||||
icon8 = QIcon()
|
||||
icon8.addFile(u":/icons/icons/zoom-original.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionCenterView.setIcon(icon8)
|
||||
icon10 = QIcon()
|
||||
icon10.addFile(u":/icons/icons/zoom-original.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionCenterView.setIcon(icon10)
|
||||
self.actionOpen = QAction(MainWindow)
|
||||
self.actionOpen.setObjectName(u"actionOpen")
|
||||
icon9 = QIcon()
|
||||
icon9.addFile(u":/icons/icons/document-open.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionOpen.setIcon(icon9)
|
||||
icon11 = QIcon()
|
||||
icon11.addFile(u":/icons/icons/document-open.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionOpen.setIcon(icon11)
|
||||
self.actionReloadLibraries = QAction(MainWindow)
|
||||
self.actionReloadLibraries.setObjectName(u"actionReloadLibraries")
|
||||
self.actionReloadSimulation = QAction(MainWindow)
|
||||
self.actionReloadSimulation.setObjectName(u"actionReloadSimulation")
|
||||
self.actionSave = QAction(MainWindow)
|
||||
self.actionSave.setObjectName(u"actionSave")
|
||||
icon10 = QIcon()
|
||||
icon10.addFile(u":/icons/icons/document-save.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionSave.setIcon(icon10)
|
||||
icon12 = QIcon()
|
||||
icon12.addFile(u":/icons/icons/document-save.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionSave.setIcon(icon12)
|
||||
self.actionSaveAs = QAction(MainWindow)
|
||||
self.actionSaveAs.setObjectName(u"actionSaveAs")
|
||||
icon11 = QIcon()
|
||||
icon11.addFile(u":/icons/icons/document-save-as.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionSaveAs.setIcon(icon11)
|
||||
self.actionSaveAs.setIcon(icon5)
|
||||
self.actionExit = QAction(MainWindow)
|
||||
self.actionExit.setObjectName(u"actionExit")
|
||||
self.actionClose = QAction(MainWindow)
|
||||
self.actionClose.setObjectName(u"actionClose")
|
||||
self.actionUndo = QAction(MainWindow)
|
||||
self.actionUndo.setObjectName(u"actionUndo")
|
||||
icon12 = QIcon()
|
||||
icon12.addFile(u":/icons/icons/edit-undo.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionUndo.setIcon(icon12)
|
||||
icon13 = QIcon()
|
||||
icon13.addFile(u":/icons/icons/edit-undo.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionUndo.setIcon(icon13)
|
||||
self.actionRedo = QAction(MainWindow)
|
||||
self.actionRedo.setObjectName(u"actionRedo")
|
||||
icon13 = QIcon()
|
||||
icon13.addFile(u":/icons/icons/edit-redo.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionRedo.setIcon(icon13)
|
||||
icon14 = QIcon()
|
||||
icon14.addFile(u":/icons/icons/edit-redo.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionRedo.setIcon(icon14)
|
||||
self.actionCut = QAction(MainWindow)
|
||||
self.actionCut.setObjectName(u"actionCut")
|
||||
icon14 = QIcon()
|
||||
icon14.addFile(u":/icons/icons/edit-cut.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionCut.setIcon(icon14)
|
||||
icon15 = QIcon()
|
||||
icon15.addFile(u":/icons/icons/edit-cut.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionCut.setIcon(icon15)
|
||||
self.actionCopy = QAction(MainWindow)
|
||||
self.actionCopy.setObjectName(u"actionCopy")
|
||||
icon15 = QIcon()
|
||||
icon15.addFile(u":/icons/icons/edit-copy.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionCopy.setIcon(icon15)
|
||||
icon16 = QIcon()
|
||||
icon16.addFile(u":/icons/icons/edit-copy.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionCopy.setIcon(icon16)
|
||||
self.actionPaste = QAction(MainWindow)
|
||||
self.actionPaste.setObjectName(u"actionPaste")
|
||||
icon16 = QIcon()
|
||||
icon16.addFile(u":/icons/icons/edit-paste.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionPaste.setIcon(icon16)
|
||||
icon17 = QIcon()
|
||||
icon17.addFile(u":/icons/icons/edit-paste.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionPaste.setIcon(icon17)
|
||||
self.actionSelectAll = QAction(MainWindow)
|
||||
self.actionSelectAll.setObjectName(u"actionSelectAll")
|
||||
self.actionDelete = QAction(MainWindow)
|
||||
@@ -213,18 +221,18 @@ class Ui_MainWindow(object):
|
||||
self.workspaceHeaderLayout.setContentsMargins(6, 2, 6, 2)
|
||||
self.navigateUpButton = QToolButton(self.workspaceHeader)
|
||||
self.navigateUpButton.setObjectName(u"navigateUpButton")
|
||||
icon17 = QIcon()
|
||||
icon17.addFile(u":/icons/icons/arrow-up.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.navigateUpButton.setIcon(icon17)
|
||||
icon18 = QIcon()
|
||||
icon18.addFile(u":/icons/icons/arrow-up.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.navigateUpButton.setIcon(icon18)
|
||||
|
||||
self.workspaceHeaderLayout.addWidget(self.navigateUpButton)
|
||||
|
||||
self.navigateDownButton = QToolButton(self.workspaceHeader)
|
||||
self.navigateDownButton.setObjectName(u"navigateDownButton")
|
||||
self.navigateDownButton.setEnabled(False)
|
||||
icon18 = QIcon()
|
||||
icon18.addFile(u":/icons/icons/arrow-down.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.navigateDownButton.setIcon(icon18)
|
||||
icon19 = QIcon()
|
||||
icon19.addFile(u":/icons/icons/arrow-down.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.navigateDownButton.setIcon(icon19)
|
||||
|
||||
self.workspaceHeaderLayout.addWidget(self.navigateDownButton)
|
||||
|
||||
@@ -244,9 +252,9 @@ class Ui_MainWindow(object):
|
||||
|
||||
self.pointerToolButton = QToolButton(self.workspaceHeader)
|
||||
self.pointerToolButton.setObjectName(u"pointerToolButton")
|
||||
icon19 = QIcon()
|
||||
icon19.addFile(u":/icons/icons/edit-select.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.pointerToolButton.setIcon(icon19)
|
||||
icon20 = QIcon()
|
||||
icon20.addFile(u":/icons/icons/edit-select.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.pointerToolButton.setIcon(icon20)
|
||||
self.pointerToolButton.setCheckable(True)
|
||||
self.pointerToolButton.setChecked(True)
|
||||
|
||||
@@ -254,43 +262,43 @@ class Ui_MainWindow(object):
|
||||
|
||||
self.connectToolButton = QToolButton(self.workspaceHeader)
|
||||
self.connectToolButton.setObjectName(u"connectToolButton")
|
||||
icon20 = QIcon()
|
||||
icon20.addFile(u":/icons/icons/network-connect.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.connectToolButton.setIcon(icon20)
|
||||
icon21 = QIcon()
|
||||
icon21.addFile(u":/icons/icons/network-connect.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.connectToolButton.setIcon(icon21)
|
||||
self.connectToolButton.setCheckable(True)
|
||||
|
||||
self.workspaceHeaderLayout.addWidget(self.connectToolButton)
|
||||
|
||||
self.boxToolButton = QToolButton(self.workspaceHeader)
|
||||
self.boxToolButton.setObjectName(u"boxToolButton")
|
||||
icon21 = QIcon()
|
||||
icon21.addFile(u":/icons/icons/draw-rectangle.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.boxToolButton.setIcon(icon21)
|
||||
icon22 = QIcon()
|
||||
icon22.addFile(u":/icons/icons/draw-rectangle.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.boxToolButton.setIcon(icon22)
|
||||
self.boxToolButton.setCheckable(True)
|
||||
|
||||
self.workspaceHeaderLayout.addWidget(self.boxToolButton)
|
||||
|
||||
self.lineToolButton = QToolButton(self.workspaceHeader)
|
||||
self.lineToolButton.setObjectName(u"lineToolButton")
|
||||
icon22 = QIcon()
|
||||
icon22.addFile(u":/icons/icons/draw-bezier-curves.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.lineToolButton.setIcon(icon22)
|
||||
icon23 = QIcon()
|
||||
icon23.addFile(u":/icons/icons/draw-bezier-curves.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.lineToolButton.setIcon(icon23)
|
||||
self.lineToolButton.setCheckable(True)
|
||||
|
||||
self.workspaceHeaderLayout.addWidget(self.lineToolButton)
|
||||
|
||||
self.textToolButton = QToolButton(self.workspaceHeader)
|
||||
self.textToolButton.setObjectName(u"textToolButton")
|
||||
icon23 = QIcon()
|
||||
icon23.addFile(u":/icons/icons/draw-text.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.textToolButton.setIcon(icon23)
|
||||
icon24 = QIcon()
|
||||
icon24.addFile(u":/icons/icons/draw-text.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.textToolButton.setIcon(icon24)
|
||||
self.textToolButton.setCheckable(True)
|
||||
|
||||
self.workspaceHeaderLayout.addWidget(self.textToolButton)
|
||||
|
||||
self.rotateToolButton = QToolButton(self.workspaceHeader)
|
||||
self.rotateToolButton.setObjectName(u"rotateToolButton")
|
||||
self.rotateToolButton.setIcon(icon5)
|
||||
self.rotateToolButton.setIcon(icon7)
|
||||
|
||||
self.workspaceHeaderLayout.addWidget(self.rotateToolButton)
|
||||
|
||||
@@ -435,7 +443,9 @@ class Ui_MainWindow(object):
|
||||
self.menuHelp.addAction(self.actionAboutQt)
|
||||
self.menuSimulation.addAction(self.actionSimulationSettings)
|
||||
self.menuSimulation.addAction(self.actionGraphParameters)
|
||||
self.menuSimulation.addAction(self.actionCompile)
|
||||
self.menuSimulation.addAction(self.actionCompose)
|
||||
self.menuSimulation.addAction(self.actionExportModel)
|
||||
self.menuSimulation.addAction(self.actionSimulationWindow)
|
||||
self.menuSimulation.addAction(self.actionRunSimulation)
|
||||
self.fileToolbar.addAction(self.actionNew)
|
||||
self.fileToolbar.addAction(self.actionOpen)
|
||||
@@ -451,7 +461,8 @@ class Ui_MainWindow(object):
|
||||
self.cameraToolbar.addAction(self.actionCenterView)
|
||||
self.simulationToolbar.addAction(self.actionSimulationSettings)
|
||||
self.simulationToolbar.addAction(self.actionGraphParameters)
|
||||
self.simulationToolbar.addAction(self.actionCompile)
|
||||
self.simulationToolbar.addAction(self.actionCompose)
|
||||
self.simulationToolbar.addAction(self.actionSimulationWindow)
|
||||
self.simulationToolbar.addAction(self.actionRunSimulation)
|
||||
|
||||
self.retranslateUi(MainWindow)
|
||||
@@ -472,12 +483,12 @@ class Ui_MainWindow(object):
|
||||
#if QT_CONFIG(statustip)
|
||||
self.actionGraphParameters.setStatusTip(QCoreApplication.translate("MainWindow", u"Edit parameters throughout the active graph", None))
|
||||
#endif // QT_CONFIG(statustip)
|
||||
self.actionCompile.setText(QCoreApplication.translate("MainWindow", u"Compile", None))
|
||||
self.actionCompose.setText(QCoreApplication.translate("MainWindow", u"Compose", None))
|
||||
#if QT_CONFIG(statustip)
|
||||
self.actionCompile.setStatusTip(QCoreApplication.translate("MainWindow", u"Compile the active graph for simulation", None))
|
||||
self.actionCompose.setStatusTip(QCoreApplication.translate("MainWindow", u"Compose the active graph as an OpenModelica model", None))
|
||||
#endif // QT_CONFIG(statustip)
|
||||
#if QT_CONFIG(shortcut)
|
||||
self.actionCompile.setShortcut(QCoreApplication.translate("MainWindow", u"F5", None))
|
||||
self.actionCompose.setShortcut(QCoreApplication.translate("MainWindow", u"F5", None))
|
||||
#endif // QT_CONFIG(shortcut)
|
||||
self.actionRunSimulation.setText(QCoreApplication.translate("MainWindow", u"Run", None))
|
||||
#if QT_CONFIG(statustip)
|
||||
@@ -486,6 +497,14 @@ class Ui_MainWindow(object):
|
||||
#if QT_CONFIG(shortcut)
|
||||
self.actionRunSimulation.setShortcut(QCoreApplication.translate("MainWindow", u"F6", None))
|
||||
#endif // QT_CONFIG(shortcut)
|
||||
self.actionSimulationWindow.setText(QCoreApplication.translate("MainWindow", u"Simulation Window", None))
|
||||
#if QT_CONFIG(statustip)
|
||||
self.actionSimulationWindow.setStatusTip(QCoreApplication.translate("MainWindow", u"Show the simulation results window", None))
|
||||
#endif // QT_CONFIG(statustip)
|
||||
self.actionExportModel.setText(QCoreApplication.translate("MainWindow", u"Export Model\u2026", None))
|
||||
#if QT_CONFIG(statustip)
|
||||
self.actionExportModel.setStatusTip(QCoreApplication.translate("MainWindow", u"Save the composed OpenModelica model to a file", None))
|
||||
#endif // QT_CONFIG(statustip)
|
||||
self.actionNew.setText(QCoreApplication.translate("MainWindow", u"&New", None))
|
||||
#if QT_CONFIG(statustip)
|
||||
self.actionNew.setStatusTip(QCoreApplication.translate("MainWindow", u"Create a new document", None))
|
||||
|
||||
244
BEdit/src/bedit/gui/generated/ui_simulation_window.py
Normal file
244
BEdit/src/bedit/gui/generated/ui_simulation_window.py
Normal file
@@ -0,0 +1,244 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
################################################################################
|
||||
## Form generated from reading UI file 'simulation_window.ui'
|
||||
##
|
||||
## Created by: Qt User Interface Compiler version 6.11.1
|
||||
##
|
||||
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||
################################################################################
|
||||
|
||||
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
|
||||
QMetaObject, QObject, QPoint, QRect,
|
||||
QSize, QTime, QUrl, Qt)
|
||||
from PySide6.QtGui import (QAction, QBrush, QColor, QConicalGradient,
|
||||
QCursor, QFont, QFontDatabase, QGradient,
|
||||
QIcon, QImage, QKeySequence, QLinearGradient,
|
||||
QPainter, QPalette, QPixmap, QRadialGradient,
|
||||
QTransform)
|
||||
from PySide6.QtWidgets import (QAbstractItemView, QApplication, QDockWidget, QHBoxLayout,
|
||||
QHeaderView, QLabel, QListWidget, QListWidgetItem,
|
||||
QMainWindow, QMenu, QMenuBar, QProgressBar,
|
||||
QSizePolicy, QTabWidget, QToolBar, QTreeWidget,
|
||||
QTreeWidgetItem, QVBoxLayout, QWidget)
|
||||
from . import resources_rc
|
||||
|
||||
class Ui_SimulationWindow(object):
|
||||
def setupUi(self, SimulationWindow):
|
||||
if not SimulationWindow.objectName():
|
||||
SimulationWindow.setObjectName(u"SimulationWindow")
|
||||
SimulationWindow.resize(900, 650)
|
||||
icon = QIcon()
|
||||
icon.addFile(u":/icons/icons/office-chart-line.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
SimulationWindow.setWindowIcon(icon)
|
||||
self.actionOpen = QAction(SimulationWindow)
|
||||
self.actionOpen.setObjectName(u"actionOpen")
|
||||
icon1 = QIcon()
|
||||
icon1.addFile(u":/icons/icons/document-open.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionOpen.setIcon(icon1)
|
||||
self.actionSave = QAction(SimulationWindow)
|
||||
self.actionSave.setObjectName(u"actionSave")
|
||||
icon2 = QIcon()
|
||||
icon2.addFile(u":/icons/icons/document-save.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionSave.setIcon(icon2)
|
||||
self.actionClear = QAction(SimulationWindow)
|
||||
self.actionClear.setObjectName(u"actionClear")
|
||||
icon3 = QIcon()
|
||||
icon3.addFile(u":/icons/icons/document-new.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionClear.setIcon(icon3)
|
||||
self.actionSaveAs = QAction(SimulationWindow)
|
||||
self.actionSaveAs.setObjectName(u"actionSaveAs")
|
||||
icon4 = QIcon()
|
||||
icon4.addFile(u":/icons/icons/document-save-as.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionSaveAs.setIcon(icon4)
|
||||
self.actionExit = QAction(SimulationWindow)
|
||||
self.actionExit.setObjectName(u"actionExit")
|
||||
self.actionAbout = QAction(SimulationWindow)
|
||||
self.actionAbout.setObjectName(u"actionAbout")
|
||||
self.actionAboutQt = QAction(SimulationWindow)
|
||||
self.actionAboutQt.setObjectName(u"actionAboutQt")
|
||||
self.actionToggleResults = QAction(SimulationWindow)
|
||||
self.actionToggleResults.setObjectName(u"actionToggleResults")
|
||||
self.actionToggleResults.setCheckable(True)
|
||||
self.actionToggleResults.setChecked(True)
|
||||
self.actionAddGraph = QAction(SimulationWindow)
|
||||
self.actionAddGraph.setObjectName(u"actionAddGraph")
|
||||
icon5 = QIcon()
|
||||
icon5.addFile(u":/icons/icons/list-add.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionAddGraph.setIcon(icon5)
|
||||
self.actionRemoveGraph = QAction(SimulationWindow)
|
||||
self.actionRemoveGraph.setObjectName(u"actionRemoveGraph")
|
||||
icon6 = QIcon()
|
||||
icon6.addFile(u":/icons/icons/list-remove.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
|
||||
self.actionRemoveGraph.setIcon(icon6)
|
||||
self.centralWidget = QWidget(SimulationWindow)
|
||||
self.centralWidget.setObjectName(u"centralWidget")
|
||||
self.resultsLayout = QVBoxLayout(self.centralWidget)
|
||||
self.resultsLayout.setObjectName(u"resultsLayout")
|
||||
self.graphTabs = QTabWidget(self.centralWidget)
|
||||
self.graphTabs.setObjectName(u"graphTabs")
|
||||
self.graphTabs.setTabsClosable(False)
|
||||
self.graphTabs.setMovable(True)
|
||||
|
||||
self.resultsLayout.addWidget(self.graphTabs)
|
||||
|
||||
SimulationWindow.setCentralWidget(self.centralWidget)
|
||||
self.menuBar = QMenuBar(SimulationWindow)
|
||||
self.menuBar.setObjectName(u"menuBar")
|
||||
self.menuBar.setGeometry(QRect(0, 0, 900, 24))
|
||||
self.menuFile = QMenu(self.menuBar)
|
||||
self.menuFile.setObjectName(u"menuFile")
|
||||
self.menuView = QMenu(self.menuBar)
|
||||
self.menuView.setObjectName(u"menuView")
|
||||
self.menuPanels = QMenu(self.menuView)
|
||||
self.menuPanels.setObjectName(u"menuPanels")
|
||||
self.menuToolbars = QMenu(self.menuView)
|
||||
self.menuToolbars.setObjectName(u"menuToolbars")
|
||||
self.menuHelp = QMenu(self.menuBar)
|
||||
self.menuHelp.setObjectName(u"menuHelp")
|
||||
self.menuGraph = QMenu(self.menuBar)
|
||||
self.menuGraph.setObjectName(u"menuGraph")
|
||||
SimulationWindow.setMenuBar(self.menuBar)
|
||||
self.workspaceToolbar = QToolBar(SimulationWindow)
|
||||
self.workspaceToolbar.setObjectName(u"workspaceToolbar")
|
||||
self.workspaceToolbar.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonIconOnly)
|
||||
SimulationWindow.addToolBar(Qt.ToolBarArea.TopToolBarArea, self.workspaceToolbar)
|
||||
self.fileToolbar = QToolBar(SimulationWindow)
|
||||
self.fileToolbar.setObjectName(u"fileToolbar")
|
||||
self.fileToolbar.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonIconOnly)
|
||||
SimulationWindow.addToolBar(Qt.ToolBarArea.TopToolBarArea, self.fileToolbar)
|
||||
self.statusDock = QDockWidget(SimulationWindow)
|
||||
self.statusDock.setObjectName(u"statusDock")
|
||||
self.statusDockContents = QWidget()
|
||||
self.statusDockContents.setObjectName(u"statusDockContents")
|
||||
self.horizontalLayout = QHBoxLayout(self.statusDockContents)
|
||||
self.horizontalLayout.setObjectName(u"horizontalLayout")
|
||||
self.timeLabel = QLabel(self.statusDockContents)
|
||||
self.timeLabel.setObjectName(u"timeLabel")
|
||||
|
||||
self.horizontalLayout.addWidget(self.timeLabel)
|
||||
|
||||
self.progressBar = QProgressBar(self.statusDockContents)
|
||||
self.progressBar.setObjectName(u"progressBar")
|
||||
self.progressBar.setMaximum(10000)
|
||||
self.progressBar.setValue(0)
|
||||
|
||||
self.horizontalLayout.addWidget(self.progressBar)
|
||||
|
||||
self.statusLabel = QLabel(self.statusDockContents)
|
||||
self.statusLabel.setObjectName(u"statusLabel")
|
||||
|
||||
self.horizontalLayout.addWidget(self.statusLabel)
|
||||
|
||||
self.statusDock.setWidget(self.statusDockContents)
|
||||
SimulationWindow.addDockWidget(Qt.DockWidgetArea.BottomDockWidgetArea, self.statusDock)
|
||||
self.logDock = QDockWidget(SimulationWindow)
|
||||
self.logDock.setObjectName(u"logDock")
|
||||
self.logDock.setFloating(False)
|
||||
self.logDock.setFeatures(QDockWidget.DockWidgetFeature.DockWidgetFloatable|QDockWidget.DockWidgetFeature.DockWidgetMovable)
|
||||
self.logDockContents = QWidget()
|
||||
self.logDockContents.setObjectName(u"logDockContents")
|
||||
self.logLayout = QVBoxLayout(self.logDockContents)
|
||||
self.logLayout.setObjectName(u"logLayout")
|
||||
self.messageList = QListWidget(self.logDockContents)
|
||||
self.messageList.setObjectName(u"messageList")
|
||||
self.messageList.setAlternatingRowColors(True)
|
||||
|
||||
self.logLayout.addWidget(self.messageList)
|
||||
|
||||
self.logDock.setWidget(self.logDockContents)
|
||||
SimulationWindow.addDockWidget(Qt.DockWidgetArea.BottomDockWidgetArea, self.logDock)
|
||||
self.signalsDock = QDockWidget(SimulationWindow)
|
||||
self.signalsDock.setObjectName(u"signalsDock")
|
||||
self.signalsDockContents = QWidget()
|
||||
self.signalsDockContents.setObjectName(u"signalsDockContents")
|
||||
self.signalsLayout = QVBoxLayout(self.signalsDockContents)
|
||||
self.signalsLayout.setObjectName(u"signalsLayout")
|
||||
self.signalsTree = QTreeWidget(self.signalsDockContents)
|
||||
self.signalsTree.setObjectName(u"signalsTree")
|
||||
self.signalsTree.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
|
||||
self.signalsTree.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
self.signalsTree.setHeaderHidden(True)
|
||||
|
||||
self.signalsLayout.addWidget(self.signalsTree)
|
||||
|
||||
self.signalsDock.setWidget(self.signalsDockContents)
|
||||
SimulationWindow.addDockWidget(Qt.DockWidgetArea.RightDockWidgetArea, self.signalsDock)
|
||||
|
||||
self.menuBar.addAction(self.menuFile.menuAction())
|
||||
self.menuBar.addAction(self.menuView.menuAction())
|
||||
self.menuBar.addAction(self.menuGraph.menuAction())
|
||||
self.menuBar.addAction(self.menuHelp.menuAction())
|
||||
self.menuFile.addAction(self.actionOpen)
|
||||
self.menuFile.addAction(self.actionSave)
|
||||
self.menuFile.addAction(self.actionSaveAs)
|
||||
self.menuFile.addSeparator()
|
||||
self.menuFile.addAction(self.actionClear)
|
||||
self.menuFile.addSeparator()
|
||||
self.menuFile.addAction(self.actionExit)
|
||||
self.menuView.addAction(self.menuPanels.menuAction())
|
||||
self.menuView.addAction(self.menuToolbars.menuAction())
|
||||
self.menuHelp.addAction(self.actionAbout)
|
||||
self.menuHelp.addAction(self.actionAboutQt)
|
||||
self.menuGraph.addAction(self.actionAddGraph)
|
||||
self.menuGraph.addAction(self.actionRemoveGraph)
|
||||
self.workspaceToolbar.addAction(self.actionAddGraph)
|
||||
self.workspaceToolbar.addAction(self.actionRemoveGraph)
|
||||
self.fileToolbar.addAction(self.actionClear)
|
||||
self.fileToolbar.addAction(self.actionOpen)
|
||||
self.fileToolbar.addAction(self.actionSave)
|
||||
self.fileToolbar.addAction(self.actionSaveAs)
|
||||
|
||||
self.retranslateUi(SimulationWindow)
|
||||
|
||||
QMetaObject.connectSlotsByName(SimulationWindow)
|
||||
# setupUi
|
||||
|
||||
def retranslateUi(self, SimulationWindow):
|
||||
SimulationWindow.setWindowTitle(QCoreApplication.translate("SimulationWindow", u"Simulation", None))
|
||||
self.actionOpen.setText(QCoreApplication.translate("SimulationWindow", u"&Open\u2026", None))
|
||||
#if QT_CONFIG(shortcut)
|
||||
self.actionOpen.setShortcut(QCoreApplication.translate("SimulationWindow", u"Ctrl+O", None))
|
||||
#endif // QT_CONFIG(shortcut)
|
||||
self.actionSave.setText(QCoreApplication.translate("SimulationWindow", u"&Save\u2026", None))
|
||||
#if QT_CONFIG(shortcut)
|
||||
self.actionSave.setShortcut(QCoreApplication.translate("SimulationWindow", u"Ctrl+S", None))
|
||||
#endif // QT_CONFIG(shortcut)
|
||||
self.actionClear.setText(QCoreApplication.translate("SimulationWindow", u"&Clear", None))
|
||||
self.actionSaveAs.setText(QCoreApplication.translate("SimulationWindow", u"Save &As\u2026", None))
|
||||
#if QT_CONFIG(shortcut)
|
||||
self.actionSaveAs.setShortcut(QCoreApplication.translate("SimulationWindow", u"Ctrl+Shift+S", None))
|
||||
#endif // QT_CONFIG(shortcut)
|
||||
self.actionExit.setText(QCoreApplication.translate("SimulationWindow", u"E&xit", None))
|
||||
#if QT_CONFIG(shortcut)
|
||||
self.actionExit.setShortcut(QCoreApplication.translate("SimulationWindow", u"Ctrl+W", None))
|
||||
#endif // QT_CONFIG(shortcut)
|
||||
self.actionAbout.setText(QCoreApplication.translate("SimulationWindow", u"&About Simulation Window", None))
|
||||
self.actionAboutQt.setText(QCoreApplication.translate("SimulationWindow", u"About &Qt", None))
|
||||
self.actionToggleResults.setText(QCoreApplication.translate("SimulationWindow", u"Results", None))
|
||||
self.actionAddGraph.setText(QCoreApplication.translate("SimulationWindow", u"Add Graph", None))
|
||||
#if QT_CONFIG(statustip)
|
||||
self.actionAddGraph.setStatusTip(QCoreApplication.translate("SimulationWindow", u"Add a graph workspace tab", None))
|
||||
#endif // QT_CONFIG(statustip)
|
||||
self.actionRemoveGraph.setText(QCoreApplication.translate("SimulationWindow", u"Remove Current Graph", None))
|
||||
#if QT_CONFIG(statustip)
|
||||
self.actionRemoveGraph.setStatusTip(QCoreApplication.translate("SimulationWindow", u"Remove the current graph workspace tab", None))
|
||||
#endif // QT_CONFIG(statustip)
|
||||
self.menuFile.setTitle(QCoreApplication.translate("SimulationWindow", u"&File", None))
|
||||
self.menuView.setTitle(QCoreApplication.translate("SimulationWindow", u"&View", None))
|
||||
self.menuPanels.setTitle(QCoreApplication.translate("SimulationWindow", u"&Panels", None))
|
||||
self.menuToolbars.setTitle(QCoreApplication.translate("SimulationWindow", u"&Toolbars", None))
|
||||
self.menuHelp.setTitle(QCoreApplication.translate("SimulationWindow", u"&Help", None))
|
||||
self.menuGraph.setTitle(QCoreApplication.translate("SimulationWindow", u"&Graph", None))
|
||||
self.workspaceToolbar.setWindowTitle(QCoreApplication.translate("SimulationWindow", u"Workspace", None))
|
||||
self.fileToolbar.setWindowTitle(QCoreApplication.translate("SimulationWindow", u"File", None))
|
||||
self.statusDock.setWindowTitle(QCoreApplication.translate("SimulationWindow", u"Status", None))
|
||||
self.timeLabel.setText(QCoreApplication.translate("SimulationWindow", u"Time: 0 s", None))
|
||||
self.progressBar.setFormat(QCoreApplication.translate("SimulationWindow", u"%p%", None))
|
||||
self.statusLabel.setText(QCoreApplication.translate("SimulationWindow", u"No simulation has been run yet.", None))
|
||||
self.logDock.setWindowTitle(QCoreApplication.translate("SimulationWindow", u"Log", None))
|
||||
self.signalsDock.setWindowTitle(QCoreApplication.translate("SimulationWindow", u"Signals", None))
|
||||
___qtreewidgetitem = self.signalsTree.headerItem()
|
||||
___qtreewidgetitem.setText(0, QCoreApplication.translate("SimulationWindow", u"Signal", None))
|
||||
# retranslateUi
|
||||
|
||||
@@ -34,7 +34,31 @@ class Ui_TextDefinitionEditor(object):
|
||||
self.columnSplitter.setObjectName(u"columnSplitter")
|
||||
self.columnSplitter.setOrientation(Qt.Orientation.Horizontal)
|
||||
self.columnSplitter.setChildrenCollapsible(False)
|
||||
self.equationsGroup = QGroupBox(self.columnSplitter)
|
||||
self.sourceSplitter = QSplitter(self.columnSplitter)
|
||||
self.sourceSplitter.setObjectName(u"sourceSplitter")
|
||||
self.sourceSplitter.setOrientation(Qt.Orientation.Vertical)
|
||||
self.sourceSplitter.setChildrenCollapsible(False)
|
||||
self.declarationsGroup = QGroupBox(self.sourceSplitter)
|
||||
self.declarationsGroup.setObjectName(u"declarationsGroup")
|
||||
self.declarationsLayout = QVBoxLayout(self.declarationsGroup)
|
||||
self.declarationsLayout.setObjectName(u"declarationsLayout")
|
||||
self.declarationsEdit = OpenModelicaEditor(self.declarationsGroup)
|
||||
self.declarationsEdit.setObjectName(u"declarationsEdit")
|
||||
|
||||
self.declarationsLayout.addWidget(self.declarationsEdit)
|
||||
|
||||
self.sourceSplitter.addWidget(self.declarationsGroup)
|
||||
self.initialEquationsGroup = QGroupBox(self.sourceSplitter)
|
||||
self.initialEquationsGroup.setObjectName(u"initialEquationsGroup")
|
||||
self.initialEquationsLayout = QVBoxLayout(self.initialEquationsGroup)
|
||||
self.initialEquationsLayout.setObjectName(u"initialEquationsLayout")
|
||||
self.initialEquationsEdit = OpenModelicaEditor(self.initialEquationsGroup)
|
||||
self.initialEquationsEdit.setObjectName(u"initialEquationsEdit")
|
||||
|
||||
self.initialEquationsLayout.addWidget(self.initialEquationsEdit)
|
||||
|
||||
self.sourceSplitter.addWidget(self.initialEquationsGroup)
|
||||
self.equationsGroup = QGroupBox(self.sourceSplitter)
|
||||
self.equationsGroup.setObjectName(u"equationsGroup")
|
||||
self.equationsLayout = QVBoxLayout(self.equationsGroup)
|
||||
self.equationsLayout.setObjectName(u"equationsLayout")
|
||||
@@ -43,7 +67,8 @@ class Ui_TextDefinitionEditor(object):
|
||||
|
||||
self.equationsLayout.addWidget(self.equationsEdit)
|
||||
|
||||
self.columnSplitter.addWidget(self.equationsGroup)
|
||||
self.sourceSplitter.addWidget(self.equationsGroup)
|
||||
self.columnSplitter.addWidget(self.sourceSplitter)
|
||||
self.definitionSplitter = QSplitter(self.columnSplitter)
|
||||
self.definitionSplitter.setObjectName(u"definitionSplitter")
|
||||
self.definitionSplitter.setOrientation(Qt.Orientation.Vertical)
|
||||
@@ -141,6 +166,8 @@ class Ui_TextDefinitionEditor(object):
|
||||
# setupUi
|
||||
|
||||
def retranslateUi(self, TextDefinitionEditor):
|
||||
self.declarationsGroup.setTitle(QCoreApplication.translate("TextDefinitionEditor", u"Declarations", None))
|
||||
self.initialEquationsGroup.setTitle(QCoreApplication.translate("TextDefinitionEditor", u"Initial Equations", None))
|
||||
self.equationsGroup.setTitle(QCoreApplication.translate("TextDefinitionEditor", u"Equations", None))
|
||||
self.portsGroup.setTitle(QCoreApplication.translate("TextDefinitionEditor", u"Ports", None))
|
||||
___qtablewidgetitem = self.portsTable.horizontalHeaderItem(0)
|
||||
|
||||
@@ -1892,6 +1892,22 @@ class GraphWorkspaceView(QGraphicsView):
|
||||
if self.controller is None:
|
||||
return
|
||||
mime_data = QApplication.clipboard().mimeData()
|
||||
if mime_data.hasFormat(COMPONENT_MIME_TYPE):
|
||||
try:
|
||||
payload = json.loads(
|
||||
bytes(mime_data.data(COMPONENT_MIME_TYPE)).decode("utf-8")
|
||||
)
|
||||
source = Component.from_dict(payload)
|
||||
except (KeyError, TypeError, ValueError, json.JSONDecodeError):
|
||||
return
|
||||
component_id = self.controller.add_component_copy(source, QPointF(0, 0))
|
||||
scene = self.scene()
|
||||
if isinstance(scene, GraphScene):
|
||||
scene.clearSelection()
|
||||
item = scene.component_items.get(component_id)
|
||||
if item is not None:
|
||||
item.setSelected(True)
|
||||
return
|
||||
if not mime_data.hasFormat(SELECTION_MIME_TYPE):
|
||||
return
|
||||
try:
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import json
|
||||
from copy import deepcopy
|
||||
from pathlib import Path
|
||||
|
||||
from PySide6.QtCore import Qt, Slot
|
||||
from PySide6.QtCore import QByteArray, QMimeData, Qt, Slot
|
||||
from PySide6.QtGui import QCloseEvent
|
||||
from PySide6.QtWidgets import (
|
||||
QButtonGroup,
|
||||
QApplication,
|
||||
QFileDialog,
|
||||
QMainWindow,
|
||||
QMenu,
|
||||
@@ -12,7 +14,7 @@ from PySide6.QtWidgets import (
|
||||
QTabWidget,
|
||||
)
|
||||
|
||||
from bedit.core.model import Component
|
||||
from bedit.core.model import Component, Connection
|
||||
from bedit.core.application_log import get_logger
|
||||
from bedit.core.serializer import DocumentSerializer
|
||||
from bedit.core.simulation import Simulation
|
||||
@@ -22,16 +24,20 @@ from bedit.gui.dialogs.graph_parameters import GraphParametersDialog
|
||||
from bedit.gui.dialogs.item_options import ItemOptionsDialog
|
||||
from bedit.gui.models.library_repository import LibraryRepository
|
||||
from bedit.gui.models.library_tree import (
|
||||
COMPONENT_MIME_TYPE,
|
||||
COMPONENT_ROLE,
|
||||
COMPONENT_ID_ROLE,
|
||||
COMPONENT_INSTANCE_ROLE,
|
||||
ITEM_KIND_ROLE,
|
||||
DocumentTreeModel,
|
||||
LibraryTreeModel,
|
||||
)
|
||||
from bedit.gui.graphics.workspace import SELECTION_MIME_TYPE
|
||||
from bedit.gui.dialogs.settings import SettingsDialog
|
||||
from bedit.gui.dialogs.port_options import PortOptionsDialog
|
||||
from bedit.gui.dialogs.parameter_options import ParameterOptionsDialog
|
||||
from bedit.gui.dialogs.simulation_settings import SimulationSettingsDialog
|
||||
from bedit.gui.simulation_window import SimulationWindow
|
||||
from bedit.gui.preferences import application_settings
|
||||
from bedit.gui.simulation_reload import reload_simulation
|
||||
from bedit.gui.generated.ui_main_window import Ui_MainWindow
|
||||
@@ -54,6 +60,9 @@ class MainWindow(QMainWindow):
|
||||
self.log.info("BEdit started")
|
||||
self.settings = application_settings()
|
||||
self._applying_text_definition = False
|
||||
# Keep a Python-owned top-level window. Giving it MainWindow as its Qt
|
||||
# parent makes some Linux window managers inherit the BEdit window icon.
|
||||
self._simulation_window = SimulationWindow()
|
||||
|
||||
self.libraries = LibraryRepository(self)
|
||||
self.simulation = Simulation(
|
||||
@@ -67,6 +76,7 @@ class MainWindow(QMainWindow):
|
||||
)
|
||||
self.document_tree_model = DocumentTreeModel(self.document_controller, self)
|
||||
self._configure_models()
|
||||
QApplication.clipboard().dataChanged.connect(self._update_edit_actions)
|
||||
self._connect_actions()
|
||||
self._populate_view_menu()
|
||||
self._restore_window_geometry()
|
||||
@@ -100,6 +110,10 @@ class MainWindow(QMainWindow):
|
||||
self.ui.documentTreeView.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
|
||||
self.ui.documentTreeView.customContextMenuRequested.connect(self.show_library_context_menu)
|
||||
self.ui.documentTreeView.doubleClicked.connect(self.activate_tree_component)
|
||||
self.ui.documentTreeView.clicked.connect(
|
||||
lambda _index: self._update_edit_actions()
|
||||
)
|
||||
self.ui.treeView.clicked.connect(lambda _index: self._update_edit_actions())
|
||||
self.document_tree_model.rebuilt.connect(self.ui.documentTreeView.expandAll)
|
||||
self.ui.graphView.set_model(self.document_controller)
|
||||
self.ui.graphView.componentOptionsRequested.connect(self.show_component_options)
|
||||
@@ -153,9 +167,9 @@ class MainWindow(QMainWindow):
|
||||
self.ui.actionUndo.triggered.connect(self.document_controller.undo_stack.undo)
|
||||
self.ui.actionRedo.triggered.connect(self.document_controller.undo_stack.redo)
|
||||
self.ui.actionDelete.triggered.connect(self.ui.graphView.delete_selected)
|
||||
self.ui.actionCopy.triggered.connect(self.ui.graphView.copy_selection)
|
||||
self.ui.actionCut.triggered.connect(self.ui.graphView.cut_selection)
|
||||
self.ui.actionPaste.triggered.connect(self.ui.graphView.paste_selection)
|
||||
self.ui.actionCopy.triggered.connect(self.copy_selection)
|
||||
self.ui.actionCut.triggered.connect(self.cut_selection)
|
||||
self.ui.actionPaste.triggered.connect(self.paste_selection)
|
||||
self.ui.actionSelectAll.triggered.connect(self.ui.graphView.select_all)
|
||||
self.ui.actionRotateClockwise.triggered.connect(self.ui.graphView.rotate_selected)
|
||||
self.addAction(self.ui.actionRotateClockwise)
|
||||
@@ -166,7 +180,9 @@ class MainWindow(QMainWindow):
|
||||
self.show_simulation_settings
|
||||
)
|
||||
self.ui.actionGraphParameters.triggered.connect(self.show_graph_parameters)
|
||||
self.ui.actionCompile.triggered.connect(self.compile_active_graph)
|
||||
self.ui.actionCompose.triggered.connect(self.compose_active_graph)
|
||||
self.ui.actionExportModel.triggered.connect(self.export_model)
|
||||
self.ui.actionSimulationWindow.triggered.connect(self.show_simulation_window)
|
||||
self.ui.actionRunSimulation.triggered.connect(self.run_simulation)
|
||||
self.document_controller.undo_stack.canUndoChanged.connect(self.ui.actionUndo.setEnabled)
|
||||
self.document_controller.undo_stack.canRedoChanged.connect(self.ui.actionRedo.setEnabled)
|
||||
@@ -239,20 +255,59 @@ class MainWindow(QMainWindow):
|
||||
QMessageBox.warning(self, "Cannot change graph parameters", str(error))
|
||||
|
||||
@Slot()
|
||||
def compile_active_graph(self) -> None:
|
||||
def compose_active_graph(self) -> None:
|
||||
try:
|
||||
self.document_controller.compile_active_graph()
|
||||
self.document_controller.compose_active_graph()
|
||||
except ValueError as error:
|
||||
self.log.error("Compile failed: %s", error)
|
||||
QMessageBox.warning(self, "Cannot compile", str(error))
|
||||
self.log.error("Composition failed: %s", error)
|
||||
QMessageBox.warning(self, "Cannot compose", str(error))
|
||||
|
||||
@Slot()
|
||||
def export_model(self) -> None:
|
||||
try:
|
||||
model_name, source = self.document_controller.compose_active_graph_source()
|
||||
except ValueError as error:
|
||||
self.log.error("Model export composition failed: %s", error)
|
||||
QMessageBox.warning(self, "Cannot Export Model", str(error))
|
||||
return
|
||||
file_name, _selected_filter = QFileDialog.getSaveFileName(
|
||||
self,
|
||||
"Export OpenModelica Model",
|
||||
f"{model_name}.mo",
|
||||
"Modelica Models (*.mo);;All Files (*)",
|
||||
)
|
||||
if not file_name:
|
||||
return
|
||||
path = Path(file_name)
|
||||
if not path.suffix:
|
||||
path = path.with_suffix(".mo")
|
||||
temporary_path = path.with_suffix(path.suffix + ".tmp")
|
||||
try:
|
||||
temporary_path.write_text(source, encoding="utf-8")
|
||||
temporary_path.replace(path)
|
||||
except OSError as error:
|
||||
self.log.error("Could not export model %s: %s", path, error)
|
||||
QMessageBox.critical(self, "Cannot Export Model", str(error))
|
||||
return
|
||||
self.log.info("Exported OpenModelica model to %s", path)
|
||||
|
||||
@Slot()
|
||||
def show_simulation_window(self) -> None:
|
||||
self._simulation_window.show()
|
||||
self._simulation_window.raise_()
|
||||
self._simulation_window.activateWindow()
|
||||
|
||||
@Slot()
|
||||
def run_simulation(self) -> None:
|
||||
window = self._simulation_window
|
||||
callbacks = window.begin_run()
|
||||
self.show_simulation_window()
|
||||
try:
|
||||
self.document_controller.run_simulation()
|
||||
self.document_controller.run_simulation(*callbacks)
|
||||
window.prepare_run_model(self.simulation.model_name)
|
||||
except Exception as error:
|
||||
self.log.exception("Simulation run failed")
|
||||
QMessageBox.warning(self, "Cannot run simulation", str(error))
|
||||
window.report_start_error(error)
|
||||
|
||||
def _restore_window_geometry(self) -> None:
|
||||
geometry = self.settings.value("window/geometry")
|
||||
@@ -281,7 +336,8 @@ class MainWindow(QMainWindow):
|
||||
self._set_graph_controls_visible(False)
|
||||
self.ui.actionSimulationSettings.setEnabled(False)
|
||||
self.ui.actionGraphParameters.setEnabled(False)
|
||||
self.ui.actionCompile.setEnabled(False)
|
||||
self.ui.actionCompose.setEnabled(False)
|
||||
self.ui.actionExportModel.setEnabled(False)
|
||||
self.ui.actionRunSimulation.setEnabled(False)
|
||||
self._update_edit_actions()
|
||||
return
|
||||
@@ -292,7 +348,8 @@ class MainWindow(QMainWindow):
|
||||
is_graph = component.implementation_kind == "graph"
|
||||
self.ui.actionSimulationSettings.setEnabled(is_graph)
|
||||
self.ui.actionGraphParameters.setEnabled(is_graph)
|
||||
self.ui.actionCompile.setEnabled(is_graph)
|
||||
self.ui.actionCompose.setEnabled(is_graph)
|
||||
self.ui.actionExportModel.setEnabled(is_graph)
|
||||
self.ui.actionRunSimulation.setEnabled(is_graph)
|
||||
self.ui.workspaceModeLabel.setText("Graph" if is_graph else "Text")
|
||||
self.ui.workspaceStack.setCurrentWidget(
|
||||
@@ -311,8 +368,24 @@ class MainWindow(QMainWindow):
|
||||
has_selection = bool(
|
||||
self.ui.graphView.scene() and self.ui.graphView.scene().selectedItems()
|
||||
)
|
||||
for action in (self.ui.actionCut, self.ui.actionCopy, self.ui.actionDelete):
|
||||
action.setEnabled(is_graph and has_selection)
|
||||
document_component_selected = bool(
|
||||
self.ui.documentTreeView.currentIndex().data(COMPONENT_ID_ROLE)
|
||||
)
|
||||
library_component_selected = isinstance(
|
||||
self.ui.treeView.currentIndex().data(COMPONENT_ROLE), dict
|
||||
)
|
||||
document_has_focus = self._view_has_focus(self.ui.documentTreeView)
|
||||
library_has_focus = self._view_has_focus(self.ui.treeView)
|
||||
self.ui.actionCopy.setEnabled(
|
||||
(is_graph and has_selection)
|
||||
or (document_has_focus and document_component_selected)
|
||||
or (library_has_focus and library_component_selected)
|
||||
)
|
||||
self.ui.actionCut.setEnabled(
|
||||
(is_graph and has_selection)
|
||||
or (document_has_focus and document_component_selected)
|
||||
)
|
||||
self.ui.actionDelete.setEnabled(is_graph and has_selection)
|
||||
self.ui.actionRotateClockwise.setEnabled(
|
||||
is_graph and self.ui.graphView.has_selected_components()
|
||||
)
|
||||
@@ -320,11 +393,114 @@ class MainWindow(QMainWindow):
|
||||
is_graph and self.ui.graphView.has_selected_components()
|
||||
)
|
||||
self.ui.actionSelectAll.setEnabled(is_graph)
|
||||
self.ui.actionPaste.setEnabled(is_graph)
|
||||
can_paste_component = QApplication.clipboard().mimeData().hasFormat(
|
||||
COMPONENT_MIME_TYPE
|
||||
) or QApplication.clipboard().mimeData().hasFormat(SELECTION_MIME_TYPE)
|
||||
self.ui.actionPaste.setEnabled(
|
||||
(is_graph and not document_has_focus and not library_has_focus)
|
||||
or (
|
||||
document_has_focus
|
||||
and self.document_controller.document is not None
|
||||
and can_paste_component
|
||||
)
|
||||
)
|
||||
self.ui.navigateDownButton.setEnabled(
|
||||
is_graph and self.ui.graphView.has_single_selected_component()
|
||||
)
|
||||
|
||||
def copy_selection(self) -> bool:
|
||||
if self._view_has_focus(self.ui.documentTreeView):
|
||||
return self._copy_tree_component(self.ui.documentTreeView)
|
||||
if self._view_has_focus(self.ui.treeView):
|
||||
return self._copy_tree_component(self.ui.treeView)
|
||||
return self.ui.graphView.copy_selection()
|
||||
|
||||
def cut_selection(self) -> None:
|
||||
if self._view_has_focus(self.ui.documentTreeView):
|
||||
index = self.ui.documentTreeView.currentIndex()
|
||||
component_id = index.data(COMPONENT_ID_ROLE)
|
||||
if component_id and self._copy_tree_component(self.ui.documentTreeView):
|
||||
self.document_controller.delete_component(component_id)
|
||||
return
|
||||
if self._view_has_focus(self.ui.treeView):
|
||||
self._copy_tree_component(self.ui.treeView)
|
||||
return
|
||||
self.ui.graphView.cut_selection()
|
||||
|
||||
def paste_selection(self) -> None:
|
||||
if self._view_has_focus(self.ui.documentTreeView):
|
||||
self._paste_into_document_tree()
|
||||
return
|
||||
self.ui.graphView.paste_selection()
|
||||
|
||||
def _copy_tree_component(self, tree) -> bool:
|
||||
component = tree.currentIndex().data(COMPONENT_ROLE)
|
||||
if not isinstance(component, dict):
|
||||
return False
|
||||
mime_data = QMimeData()
|
||||
mime_data.setData(
|
||||
COMPONENT_MIME_TYPE,
|
||||
QByteArray(json.dumps(component).encode("utf-8")),
|
||||
)
|
||||
QApplication.clipboard().setMimeData(mime_data)
|
||||
return True
|
||||
|
||||
def _paste_into_document_tree(self) -> None:
|
||||
index = self.ui.documentTreeView.currentIndex()
|
||||
kind = index.data(ITEM_KIND_ROLE)
|
||||
owner_id = None
|
||||
if kind == "current-component":
|
||||
component_id = index.data(COMPONENT_ID_ROLE)
|
||||
component = (
|
||||
self.document_controller.document.find_component(component_id)
|
||||
if self.document_controller.document
|
||||
else None
|
||||
)
|
||||
if component is None or component.implementation_kind != "graph":
|
||||
QMessageBox.warning(
|
||||
self, "Cannot Paste", "Select a graph component or the document root."
|
||||
)
|
||||
return
|
||||
owner_id = component.id
|
||||
elif kind != "current-document":
|
||||
QMessageBox.warning(
|
||||
self, "Cannot Paste", "Select a graph component or the document root."
|
||||
)
|
||||
return
|
||||
try:
|
||||
components, connections = self._clipboard_components()
|
||||
self.document_controller.paste_components_to(
|
||||
owner_id, components, connections
|
||||
)
|
||||
except ValueError as error:
|
||||
QMessageBox.warning(self, "Cannot Paste", str(error))
|
||||
|
||||
@staticmethod
|
||||
def _clipboard_components() -> tuple[list[Component], list]:
|
||||
mime_data = QApplication.clipboard().mimeData()
|
||||
try:
|
||||
if mime_data.hasFormat(SELECTION_MIME_TYPE):
|
||||
payload = json.loads(
|
||||
bytes(mime_data.data(SELECTION_MIME_TYPE)).decode("utf-8")
|
||||
)
|
||||
return (
|
||||
[Component.from_dict(item) for item in payload.get("components", [])],
|
||||
[Connection.from_dict(item) for item in payload.get("connections", [])],
|
||||
)
|
||||
if mime_data.hasFormat(COMPONENT_MIME_TYPE):
|
||||
payload = json.loads(
|
||||
bytes(mime_data.data(COMPONENT_MIME_TYPE)).decode("utf-8")
|
||||
)
|
||||
return [Component.from_dict(payload)], []
|
||||
except (KeyError, TypeError, ValueError, json.JSONDecodeError) as error:
|
||||
raise ValueError("The clipboard does not contain a valid component") from error
|
||||
raise ValueError("The clipboard does not contain a BEdit component")
|
||||
|
||||
@staticmethod
|
||||
def _view_has_focus(view) -> bool:
|
||||
focus = QApplication.focusWidget()
|
||||
return focus is view or (focus is not None and view.isAncestorOf(focus))
|
||||
|
||||
@Slot()
|
||||
def navigate_up(self) -> None:
|
||||
if self._resolve_source_edits():
|
||||
@@ -361,6 +537,8 @@ class MainWindow(QMainWindow):
|
||||
if component is None:
|
||||
return
|
||||
self.ui.textDefinitionEditor.set_definition(
|
||||
component.source.get("declarations", ""),
|
||||
component.source.get("initialEquations", ""),
|
||||
component.source.get("equations", ""),
|
||||
component.inputs,
|
||||
component.outputs,
|
||||
@@ -378,7 +556,8 @@ class MainWindow(QMainWindow):
|
||||
answer = QMessageBox.question(
|
||||
self,
|
||||
"Apply text component changes?",
|
||||
"The text component has unapplied equation, port, or parameter changes.",
|
||||
"The text component has unapplied declaration, initial-equation, "
|
||||
"equation, port, or parameter changes.",
|
||||
QMessageBox.StandardButton.Apply
|
||||
| QMessageBox.StandardButton.Discard
|
||||
| QMessageBox.StandardButton.Cancel,
|
||||
@@ -396,6 +575,8 @@ class MainWindow(QMainWindow):
|
||||
self.document_controller.replace_active_text_definition(
|
||||
inputs,
|
||||
outputs,
|
||||
self.ui.textDefinitionEditor.declarations,
|
||||
self.ui.textDefinitionEditor.initial_equations,
|
||||
self.ui.textDefinitionEditor.equations,
|
||||
self.ui.textDefinitionEditor.parameters,
|
||||
)
|
||||
@@ -528,6 +709,8 @@ class MainWindow(QMainWindow):
|
||||
if scene is not None:
|
||||
scene.update()
|
||||
self.ui.graphView.viewport().update()
|
||||
self.ui.textDefinitionEditor.ui.declarationsEdit.reload_highlighting()
|
||||
self.ui.textDefinitionEditor.ui.initialEquationsEdit.reload_highlighting()
|
||||
self.ui.textDefinitionEditor.ui.equationsEdit.reload_highlighting()
|
||||
|
||||
def _document_opened_changed(self, opened: bool) -> None:
|
||||
@@ -547,6 +730,8 @@ class MainWindow(QMainWindow):
|
||||
def show_library_context_menu(self, position) -> None:
|
||||
tree_view = self.ui.documentTreeView
|
||||
index = tree_view.indexAt(position)
|
||||
if index.isValid():
|
||||
tree_view.setCurrentIndex(index)
|
||||
kind = index.data(ITEM_KIND_ROLE)
|
||||
if kind == "current-component":
|
||||
component_id = index.data(COMPONENT_ID_ROLE)
|
||||
@@ -564,6 +749,11 @@ class MainWindow(QMainWindow):
|
||||
options_action = menu.addAction("Component Options…")
|
||||
ports_action = menu.addAction("Port Options…")
|
||||
parameters_action = menu.addAction("Parameter Options…")
|
||||
menu.addSeparator()
|
||||
copy_action = menu.addAction("Copy")
|
||||
cut_action = menu.addAction("Cut")
|
||||
paste_action = menu.addAction("Paste")
|
||||
paste_action.setEnabled(component.implementation_kind == "graph")
|
||||
delete_action = menu.addAction("Delete")
|
||||
selected = menu.exec(tree_view.viewport().mapToGlobal(position))
|
||||
if graph_action is not None and selected is graph_action:
|
||||
@@ -576,6 +766,13 @@ class MainWindow(QMainWindow):
|
||||
self.show_component_port_options(component_id)
|
||||
elif selected is parameters_action:
|
||||
self.show_component_parameter_options(component_id)
|
||||
elif selected is copy_action:
|
||||
self._copy_tree_component(tree_view)
|
||||
elif selected is cut_action:
|
||||
if self._copy_tree_component(tree_view):
|
||||
self.document_controller.delete_component(component_id)
|
||||
elif selected is paste_action:
|
||||
self._paste_into_document_tree()
|
||||
elif selected is delete_action:
|
||||
answer = QMessageBox.question(
|
||||
self,
|
||||
@@ -591,24 +788,34 @@ class MainWindow(QMainWindow):
|
||||
menu = QMenu(self)
|
||||
graph_action = menu.addAction("New Graph Block")
|
||||
text_action = menu.addAction("New Text Block")
|
||||
menu.addSeparator()
|
||||
paste_action = menu.addAction("Paste")
|
||||
selected = menu.exec(tree_view.viewport().mapToGlobal(position))
|
||||
if selected is graph_action:
|
||||
self.document_controller.add_root("graph")
|
||||
elif selected is text_action:
|
||||
self.document_controller.add_root("text")
|
||||
elif selected is paste_action:
|
||||
self._paste_into_document_tree()
|
||||
|
||||
@Slot(object)
|
||||
def show_external_library_context_menu(self, position) -> None:
|
||||
tree = self.ui.treeView
|
||||
index = tree.indexAt(position)
|
||||
if index.isValid():
|
||||
tree.setCurrentIndex(index)
|
||||
component = index.data(COMPONENT_INSTANCE_ROLE)
|
||||
if not isinstance(component, Component):
|
||||
return
|
||||
menu = QMenu(self)
|
||||
copy_action = menu.addAction("Copy")
|
||||
menu.addSeparator()
|
||||
ports_action = menu.addAction("Port Options…")
|
||||
parameters_action = menu.addAction("Parameter Options…")
|
||||
selected = menu.exec(tree.viewport().mapToGlobal(position))
|
||||
if selected is ports_action:
|
||||
if selected is copy_action:
|
||||
self._copy_tree_component(tree)
|
||||
elif selected is ports_action:
|
||||
dialog = PortOptionsDialog(component, self)
|
||||
if dialog.exec() == dialog.DialogCode.Accepted:
|
||||
old_inputs, old_outputs = deepcopy(component.inputs), deepcopy(component.outputs)
|
||||
@@ -760,6 +967,8 @@ class MainWindow(QMainWindow):
|
||||
event.ignore()
|
||||
return
|
||||
self.settings.setValue("window/geometry", self.saveGeometry())
|
||||
self._simulation_window.close()
|
||||
self.simulation.shutdown()
|
||||
self.log.info("BEdit closed")
|
||||
self.application_logger.removeHandler(self.log_handler)
|
||||
event.accept()
|
||||
|
||||
@@ -20,6 +20,8 @@ def _saved_instance_state(instance) -> dict:
|
||||
def reload_simulation(current):
|
||||
"""Reload the simulation package and return a fresh state-preserving instance."""
|
||||
saved_state = _saved_instance_state(current)
|
||||
saved_state.pop("openmodelica", None)
|
||||
current.shutdown(wait=True)
|
||||
importlib.invalidate_caches()
|
||||
package = importlib.import_module(SIMULATION_PACKAGE)
|
||||
discovered: list[ModuleType] = []
|
||||
@@ -30,4 +32,5 @@ def reload_simulation(current):
|
||||
package = importlib.reload(package)
|
||||
replacement = package.Simulation()
|
||||
vars(replacement).update(saved_state)
|
||||
replacement.openmodelica.configure(replacement.openmodelica_path)
|
||||
return replacement
|
||||
|
||||
726
BEdit/src/bedit/gui/simulation_window.py
Normal file
726
BEdit/src/bedit/gui/simulation_window.py
Normal file
@@ -0,0 +1,726 @@
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
from matplotlib.backend_bases import MouseButton
|
||||
from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg, NavigationToolbar2QT
|
||||
from matplotlib.figure import Figure
|
||||
from PySide6.QtCore import Qt, Signal
|
||||
from PySide6.QtGui import QCloseEvent
|
||||
from PySide6.QtWidgets import (
|
||||
QFileDialog,
|
||||
QInputDialog,
|
||||
QMainWindow,
|
||||
QMenu,
|
||||
QMessageBox,
|
||||
QTreeWidgetItem,
|
||||
QVBoxLayout,
|
||||
QWidget,
|
||||
)
|
||||
|
||||
from bedit.core.simulation.openmodelica import SimulationMessage, SimulationProgress
|
||||
from bedit.core.simulation.results import (
|
||||
SimulationExecutionResult,
|
||||
SimulationGraph,
|
||||
SimulationResults,
|
||||
SimulationTrace,
|
||||
load_simulation_results,
|
||||
save_simulation_results,
|
||||
)
|
||||
from bedit.gui.generated.ui_simulation_window import Ui_SimulationWindow
|
||||
from bedit.gui.preferences import application_settings
|
||||
|
||||
|
||||
class SimulationWindow(QMainWindow):
|
||||
"""Persistent viewer for live and previously saved simulation results."""
|
||||
|
||||
progressReceived = Signal(object)
|
||||
messageReceived = Signal(object)
|
||||
simulationFinished = Signal(object)
|
||||
simulationFailed = Signal(str)
|
||||
|
||||
def __init__(self, parent=None) -> None:
|
||||
super().__init__(parent)
|
||||
self.ui = Ui_SimulationWindow()
|
||||
self.ui.setupUi(self)
|
||||
self.settings = application_settings()
|
||||
self._running = False
|
||||
self._run_generation = 0
|
||||
self._file_path: Path | None = None
|
||||
self._rebuilding_graph_tabs = False
|
||||
self._updating_signal_checks = False
|
||||
self.results = SimulationResults()
|
||||
self._connect_actions()
|
||||
self._populate_view_menu()
|
||||
self.splitDockWidget(
|
||||
self.ui.statusDock, self.ui.logDock, Qt.Orientation.Vertical
|
||||
)
|
||||
self.ui.statusDock.setFixedHeight(self.ui.statusDock.sizeHint().height())
|
||||
self._restore_window_layout()
|
||||
self.progressReceived.connect(self._show_progress)
|
||||
self.messageReceived.connect(self._show_message)
|
||||
self.simulationFinished.connect(self._show_finished)
|
||||
self.simulationFailed.connect(self._show_error)
|
||||
|
||||
def _connect_actions(self) -> None:
|
||||
self.ui.actionOpen.triggered.connect(self.open_results)
|
||||
self.ui.actionSave.triggered.connect(self.save_results)
|
||||
self.ui.actionSaveAs.triggered.connect(self.save_results_as)
|
||||
self.ui.actionClear.triggered.connect(self.clear)
|
||||
self.ui.actionExit.triggered.connect(self.close)
|
||||
self.ui.actionAbout.triggered.connect(self.show_about)
|
||||
self.ui.actionAboutQt.triggered.connect(
|
||||
lambda: QMessageBox.aboutQt(self, "About Qt Framework")
|
||||
)
|
||||
self.ui.actionToggleResults.toggled.connect(self.ui.centralWidget.setVisible)
|
||||
self.ui.actionAddGraph.triggered.connect(self.add_graph_tab)
|
||||
self.ui.actionRemoveGraph.triggered.connect(self.remove_current_graph_tab)
|
||||
self.ui.graphTabs.tabBarDoubleClicked.connect(self.rename_graph_tab)
|
||||
self.ui.graphTabs.tabBar().tabMoved.connect(self._move_graph_tab)
|
||||
self.ui.graphTabs.currentChanged.connect(self._current_graph_changed)
|
||||
self.ui.signalsTree.itemChanged.connect(self._signal_check_changed)
|
||||
self.ui.signalsTree.customContextMenuRequested.connect(
|
||||
self.show_signal_context_menu
|
||||
)
|
||||
|
||||
def _populate_view_menu(self) -> None:
|
||||
self.ui.menuPanels.addAction(self.ui.actionToggleResults)
|
||||
for panel in (self.ui.statusDock, self.ui.logDock, self.ui.signalsDock):
|
||||
self.ui.menuPanels.addAction(panel.toggleViewAction())
|
||||
self.ui.menuToolbars.addAction(self.ui.fileToolbar.toggleViewAction())
|
||||
self.ui.menuToolbars.addAction(self.ui.workspaceToolbar.toggleViewAction())
|
||||
|
||||
def _restore_window_layout(self) -> None:
|
||||
geometry = self.settings.value("simulationWindow/geometry")
|
||||
if geometry is not None:
|
||||
self.restoreGeometry(geometry)
|
||||
state = self.settings.value("simulationWindow/state")
|
||||
if state is not None:
|
||||
self.restoreState(state)
|
||||
results_visible = self.settings.value(
|
||||
"simulationWindow/resultsVisible", True, type=bool
|
||||
)
|
||||
self.ui.actionToggleResults.setChecked(results_visible)
|
||||
|
||||
def _save_window_layout(self) -> None:
|
||||
self.settings.setValue("simulationWindow/geometry", self.saveGeometry())
|
||||
self.settings.setValue("simulationWindow/state", self.saveState())
|
||||
self.settings.setValue(
|
||||
"simulationWindow/resultsVisible",
|
||||
self.ui.actionToggleResults.isChecked(),
|
||||
)
|
||||
self.settings.sync()
|
||||
|
||||
def begin_run(self) -> tuple:
|
||||
"""Reset transient run state while retaining the current workspace."""
|
||||
|
||||
self._run_generation += 1
|
||||
generation = self._run_generation
|
||||
self._running = True
|
||||
self._file_path = None
|
||||
self.results.status = {}
|
||||
self.results.messages.clear()
|
||||
self.results.metadata.clear()
|
||||
self.ui.progressBar.setValue(0)
|
||||
self.ui.timeLabel.setText("Time: 0 s")
|
||||
self.ui.messageList.clear()
|
||||
self.ui.statusLabel.setText("Preparing simulation…")
|
||||
return (
|
||||
lambda progress: self._report_progress(generation, progress),
|
||||
lambda message: self._report_message(generation, message),
|
||||
lambda result: self._report_finished(generation, result),
|
||||
lambda error: self._report_error(generation, error),
|
||||
)
|
||||
|
||||
def prepare_run_model(self, model_name: str | None) -> None:
|
||||
"""Retain graph configuration only when rerunning the same model."""
|
||||
|
||||
if not model_name:
|
||||
return
|
||||
if self.results.model_name != model_name:
|
||||
self.results = SimulationResults(model_name=model_name)
|
||||
self.clear_result_views()
|
||||
self.load_result_views()
|
||||
else:
|
||||
self.results.model_name = model_name
|
||||
self.ui.statusLabel.setText("Preparing simulation…")
|
||||
self._update_title()
|
||||
|
||||
def clear(self, checked: bool = False, *, model_name: str = "") -> None:
|
||||
"""Discard the displayed run and prepare an empty results document."""
|
||||
|
||||
del checked
|
||||
self._run_generation += 1
|
||||
self._running = False
|
||||
self._file_path = None
|
||||
self.results = SimulationResults(model_name=model_name)
|
||||
self.ui.statusLabel.setText("No simulation has been run yet.")
|
||||
self.ui.progressBar.setValue(0)
|
||||
self.ui.timeLabel.setText("Time: 0 s")
|
||||
self.ui.messageList.clear()
|
||||
self.clear_result_views()
|
||||
self.load_result_views()
|
||||
self._update_title()
|
||||
|
||||
def clear_result_views(self) -> None:
|
||||
"""Clear custom plots before a run or loaded document is displayed.
|
||||
|
||||
Future graph widgets should be placed in the Designer-owned
|
||||
``resultsLayout`` and reset here.
|
||||
"""
|
||||
|
||||
self._rebuilding_graph_tabs = True
|
||||
self._clear_graph_tab_widgets()
|
||||
self._rebuilding_graph_tabs = False
|
||||
self.ui.signalsTree.clear()
|
||||
|
||||
def load_result_views(self) -> None:
|
||||
"""Populate custom plots from ``self.results.data`` and traces.
|
||||
|
||||
This is the intended integration point for a future plotting widget.
|
||||
"""
|
||||
|
||||
self._rebuild_graph_tabs()
|
||||
self._rebuild_signal_tree()
|
||||
|
||||
def _rebuild_graph_tabs(self) -> None:
|
||||
current_page = self.ui.graphTabs.currentWidget()
|
||||
current_graph_id = (
|
||||
current_page.graph_id
|
||||
if isinstance(current_page, GraphWorkspacePage)
|
||||
else None
|
||||
)
|
||||
self._rebuilding_graph_tabs = True
|
||||
self._clear_graph_tab_widgets()
|
||||
for graph in self.results.graphs:
|
||||
self.ui.graphTabs.addTab(
|
||||
GraphWorkspacePage(graph, self.results), graph.title
|
||||
)
|
||||
if current_graph_id is not None:
|
||||
for index, graph in enumerate(self.results.graphs):
|
||||
if graph.id == current_graph_id:
|
||||
self.ui.graphTabs.setCurrentIndex(index)
|
||||
break
|
||||
self._rebuilding_graph_tabs = False
|
||||
self._update_graph_actions()
|
||||
self._sync_signal_checks()
|
||||
|
||||
def _clear_graph_tab_widgets(self) -> None:
|
||||
while self.ui.graphTabs.count():
|
||||
page = self.ui.graphTabs.widget(0)
|
||||
self.ui.graphTabs.removeTab(0)
|
||||
page.deleteLater()
|
||||
|
||||
def add_graph_tab(self) -> None:
|
||||
used_titles = {graph.title for graph in self.results.graphs}
|
||||
number = 1
|
||||
while f"Graph {number}" in used_titles:
|
||||
number += 1
|
||||
graph = SimulationGraph(title=f"Graph {number}")
|
||||
self.results.graphs.append(graph)
|
||||
index = self.ui.graphTabs.addTab(
|
||||
GraphWorkspacePage(graph, self.results), graph.title
|
||||
)
|
||||
self.ui.graphTabs.setCurrentIndex(index)
|
||||
self._update_graph_actions()
|
||||
|
||||
def remove_current_graph_tab(self) -> None:
|
||||
index = self.ui.graphTabs.currentIndex()
|
||||
if index < 0 or index >= len(self.results.graphs):
|
||||
return
|
||||
self.results.graphs.pop(index)
|
||||
page = self.ui.graphTabs.widget(index)
|
||||
self.ui.graphTabs.removeTab(index)
|
||||
page.deleteLater()
|
||||
self._update_graph_actions()
|
||||
self._sync_signal_checks()
|
||||
|
||||
def rename_graph_tab(self, index: int) -> None:
|
||||
if index < 0 or index >= len(self.results.graphs):
|
||||
return
|
||||
graph = self.results.graphs[index]
|
||||
title, accepted = QInputDialog.getText(
|
||||
self, "Rename Graph", "Title:", text=graph.title
|
||||
)
|
||||
title = title.strip()
|
||||
if accepted and title:
|
||||
graph.title = title
|
||||
self.ui.graphTabs.setTabText(index, title)
|
||||
page = self.ui.graphTabs.widget(index)
|
||||
if isinstance(page, GraphWorkspacePage):
|
||||
page.refresh_chart()
|
||||
|
||||
def _move_graph_tab(self, old_index: int, new_index: int) -> None:
|
||||
if self._rebuilding_graph_tabs or old_index == new_index:
|
||||
return
|
||||
graph = self.results.graphs.pop(old_index)
|
||||
self.results.graphs.insert(new_index, graph)
|
||||
self._sync_signal_checks()
|
||||
|
||||
def _update_graph_actions(self) -> None:
|
||||
self.ui.actionRemoveGraph.setEnabled(bool(self.results.graphs))
|
||||
|
||||
def _rebuild_signal_tree(self) -> None:
|
||||
"""Build a hierarchy while retaining each leaf's complete signal name."""
|
||||
|
||||
tree = self.ui.signalsTree
|
||||
self._updating_signal_checks = True
|
||||
try:
|
||||
tree.clear()
|
||||
items: dict[tuple[str, ...], QTreeWidgetItem] = {}
|
||||
for signal_name in sorted(self.results.data, key=str.casefold):
|
||||
parts = _signal_tree_parts(signal_name)
|
||||
if not parts:
|
||||
continue
|
||||
parent = tree.invisibleRootItem()
|
||||
for depth, part in enumerate(parts, start=1):
|
||||
path = parts[:depth]
|
||||
item = items.get(path)
|
||||
if item is None:
|
||||
item = QTreeWidgetItem(parent, [part])
|
||||
items[path] = item
|
||||
parent = item
|
||||
parent.setData(0, Qt.ItemDataRole.UserRole, signal_name)
|
||||
parent.setToolTip(0, signal_name)
|
||||
parent.setFlags(parent.flags() | Qt.ItemFlag.ItemIsUserCheckable)
|
||||
parent.setCheckState(0, Qt.CheckState.Unchecked)
|
||||
tree.expandToDepth(0)
|
||||
finally:
|
||||
self._updating_signal_checks = False
|
||||
self._sync_signal_checks()
|
||||
|
||||
def _current_graph_changed(self, _index: int) -> None:
|
||||
if not self._rebuilding_graph_tabs:
|
||||
self._sync_signal_checks()
|
||||
|
||||
def _current_graph(self) -> SimulationGraph | None:
|
||||
index = self.ui.graphTabs.currentIndex()
|
||||
if 0 <= index < len(self.results.graphs):
|
||||
return self.results.graphs[index]
|
||||
return None
|
||||
|
||||
def _sync_signal_checks(self) -> None:
|
||||
graph = self._current_graph()
|
||||
enabled = {trace.name for trace in graph.traces} if graph else set()
|
||||
self._updating_signal_checks = True
|
||||
try:
|
||||
root = self.ui.signalsTree.invisibleRootItem()
|
||||
pending = [root.child(index) for index in range(root.childCount())]
|
||||
while pending:
|
||||
item = pending.pop()
|
||||
pending.extend(
|
||||
item.child(index) for index in range(item.childCount())
|
||||
)
|
||||
signal_name = item.data(0, Qt.ItemDataRole.UserRole)
|
||||
if isinstance(signal_name, str):
|
||||
item.setCheckState(
|
||||
0,
|
||||
Qt.CheckState.Checked
|
||||
if signal_name in enabled
|
||||
else Qt.CheckState.Unchecked,
|
||||
)
|
||||
finally:
|
||||
self._updating_signal_checks = False
|
||||
self.ui.signalsTree.setEnabled(graph is not None)
|
||||
|
||||
def _signal_check_changed(self, item: QTreeWidgetItem, _column: int) -> None:
|
||||
if self._updating_signal_checks:
|
||||
return
|
||||
signal_name = item.data(0, Qt.ItemDataRole.UserRole)
|
||||
graph = self._current_graph()
|
||||
if not isinstance(signal_name, str) or graph is None:
|
||||
return
|
||||
enabled = item.checkState(0) == Qt.CheckState.Checked
|
||||
existing = next(
|
||||
(trace for trace in graph.traces if trace.name == signal_name), None
|
||||
)
|
||||
if enabled and existing is None:
|
||||
graph.traces.append(SimulationTrace(name=signal_name))
|
||||
elif not enabled and existing is not None:
|
||||
graph.traces.remove(existing)
|
||||
page = self.ui.graphTabs.currentWidget()
|
||||
if isinstance(page, GraphWorkspacePage):
|
||||
page.refresh_chart()
|
||||
|
||||
def selected_signal_names(self) -> list[str]:
|
||||
"""Return full column names selected for future plotting actions."""
|
||||
|
||||
names = []
|
||||
for item in self.ui.signalsTree.selectedItems():
|
||||
name = item.data(0, Qt.ItemDataRole.UserRole)
|
||||
if isinstance(name, str):
|
||||
names.append(name)
|
||||
return names
|
||||
|
||||
def show_signal_context_menu(self, position) -> None:
|
||||
item = self.ui.signalsTree.itemAt(position)
|
||||
signal_name = (
|
||||
item.data(0, Qt.ItemDataRole.UserRole) if item is not None else None
|
||||
)
|
||||
graph = self._current_graph()
|
||||
if not isinstance(signal_name, str) or graph is None:
|
||||
return
|
||||
menu = QMenu(self)
|
||||
use_as_x_action = menu.addAction("Use as X Axis")
|
||||
use_as_x_action.setCheckable(True)
|
||||
use_as_x_action.setChecked(graph.x_axis == signal_name)
|
||||
selected = menu.exec(
|
||||
self.ui.signalsTree.viewport().mapToGlobal(position)
|
||||
)
|
||||
if selected is use_as_x_action:
|
||||
self.set_x_axis_signal(signal_name)
|
||||
|
||||
def set_x_axis_signal(self, signal_name: str) -> None:
|
||||
"""Set the current graph's persisted horizontal data column."""
|
||||
|
||||
graph = self._current_graph()
|
||||
if graph is None or signal_name not in self.results.data:
|
||||
return
|
||||
graph.x_axis = signal_name
|
||||
page = self.ui.graphTabs.currentWidget()
|
||||
if isinstance(page, GraphWorkspacePage):
|
||||
page.refresh_chart()
|
||||
|
||||
def open_results(self) -> None:
|
||||
file_name, _selected_filter = QFileDialog.getOpenFileName(
|
||||
self,
|
||||
"Open Simulation Results",
|
||||
"",
|
||||
"BEdit Binary Simulation Results (*.ber);;JSON Simulation Results (*.json)",
|
||||
)
|
||||
if not file_name:
|
||||
return
|
||||
try:
|
||||
results = load_simulation_results(file_name)
|
||||
except ValueError as error:
|
||||
QMessageBox.warning(self, "Cannot Open Simulation Results", str(error))
|
||||
return
|
||||
self._run_generation += 1
|
||||
self._running = False
|
||||
self._file_path = Path(file_name)
|
||||
self.results = results
|
||||
self._display_results()
|
||||
|
||||
def save_results(self) -> None:
|
||||
file_path = self._file_path
|
||||
if file_path is None:
|
||||
self.save_results_as()
|
||||
return
|
||||
self._save_results_to(file_path)
|
||||
|
||||
def save_results_as(self) -> None:
|
||||
default_name = f"{_safe_file_stem(self.results.model_name)}-results.ber"
|
||||
file_name, selected_filter = QFileDialog.getSaveFileName(
|
||||
self,
|
||||
"Save Simulation Results As",
|
||||
default_name,
|
||||
"BEdit Binary Simulation Results (*.ber);;JSON Simulation Results (*.json)",
|
||||
)
|
||||
if not file_name:
|
||||
return
|
||||
file_path = Path(file_name)
|
||||
if file_path.suffix.lower() not in {".ber", ".json"}:
|
||||
suffix = ".json" if selected_filter.startswith("JSON") else ".ber"
|
||||
file_path = file_path.with_suffix(suffix)
|
||||
self._save_results_to(file_path)
|
||||
|
||||
def _save_results_to(self, file_path: Path) -> None:
|
||||
try:
|
||||
save_simulation_results(file_path, self.results)
|
||||
except OSError as error:
|
||||
QMessageBox.warning(self, "Cannot Save Simulation Results", str(error))
|
||||
return
|
||||
self._file_path = file_path
|
||||
self._update_title()
|
||||
|
||||
def _display_results(self) -> None:
|
||||
status = self.results.status
|
||||
self.ui.statusLabel.setText(str(status.get("phase", "Loaded results")))
|
||||
self.ui.progressBar.setValue(int(status.get("progress", 0)))
|
||||
self.ui.timeLabel.setText(f"Time: {float(status.get('time', 0)):g} s")
|
||||
self.ui.messageList.clear()
|
||||
for message in self.results.messages:
|
||||
prefix = message.get("stream") or message.get("type") or "OpenModelica"
|
||||
self.ui.messageList.addItem(f"{prefix}: {message.get('text', '')}")
|
||||
self.clear_result_views()
|
||||
self.load_result_views()
|
||||
self._update_title()
|
||||
|
||||
def _update_title(self) -> None:
|
||||
name = self.results.model_name or "Simulation"
|
||||
self.setWindowTitle(f"{name} — Simulation")
|
||||
|
||||
def _report_progress(self, generation: int, progress: SimulationProgress) -> None:
|
||||
if generation == self._run_generation:
|
||||
self.progressReceived.emit(progress)
|
||||
|
||||
def _report_message(self, generation: int, message: SimulationMessage) -> None:
|
||||
if generation == self._run_generation:
|
||||
self.messageReceived.emit(message)
|
||||
|
||||
def _report_finished(self, generation: int, result) -> None:
|
||||
if generation == self._run_generation:
|
||||
self.simulationFinished.emit(result)
|
||||
|
||||
def _report_error(self, generation: int, error: Exception) -> None:
|
||||
if generation == self._run_generation:
|
||||
self.simulationFailed.emit(str(error))
|
||||
|
||||
def report_start_error(self, error: Exception) -> None:
|
||||
self.simulationFailed.emit(str(error))
|
||||
|
||||
def _show_progress(self, progress: SimulationProgress) -> None:
|
||||
self.results.status = {
|
||||
"phase": progress.phase,
|
||||
"currentStepSize": progress.current_step_size,
|
||||
"time": progress.time,
|
||||
"progress": progress.progress,
|
||||
}
|
||||
self.ui.statusLabel.setText(progress.phase or "Running")
|
||||
self.ui.timeLabel.setText(f"Time: {progress.time:g} s")
|
||||
self.ui.progressBar.setValue(max(0, min(10000, progress.progress)))
|
||||
|
||||
def _show_message(self, message: SimulationMessage) -> None:
|
||||
self.results.messages.append(
|
||||
{"stream": message.stream, "type": message.type, "text": message.text}
|
||||
)
|
||||
prefix = message.stream or message.type or "OpenModelica"
|
||||
self.ui.messageList.addItem(f"{prefix}: {message.text}")
|
||||
self.ui.messageList.scrollToBottom()
|
||||
|
||||
def _show_finished(self, result) -> None:
|
||||
self._running = False
|
||||
self.results.status.update(phase="Simulation finished", progress=10000)
|
||||
if isinstance(result, SimulationExecutionResult):
|
||||
self.results.data = result.data
|
||||
available_signals = set(result.data)
|
||||
for graph in self.results.graphs:
|
||||
graph.traces = [
|
||||
trace
|
||||
for trace in graph.traces
|
||||
if trace.name in available_signals
|
||||
]
|
||||
if graph.x_axis not in available_signals:
|
||||
graph.x_axis = (
|
||||
"time"
|
||||
if "time" in available_signals
|
||||
else next(iter(result.data), "")
|
||||
)
|
||||
self.results.metadata["processReturnCode"] = result.return_code
|
||||
self.results.metadata["sourceResultFile"] = Path(result.result_file).name
|
||||
else:
|
||||
self.results.metadata["processResult"] = result
|
||||
self.ui.progressBar.setValue(10000)
|
||||
self.ui.statusLabel.setText("Simulation finished")
|
||||
self.load_result_views()
|
||||
|
||||
def _show_error(self, message: str) -> None:
|
||||
self._running = False
|
||||
self.results.status["phase"] = "Simulation failed"
|
||||
self.results.messages.append(
|
||||
{"stream": "BEdit", "type": "error", "text": message}
|
||||
)
|
||||
self.ui.statusLabel.setText("Simulation failed")
|
||||
self.ui.messageList.addItem(f"Error: {message}")
|
||||
|
||||
def show_about(self) -> None:
|
||||
QMessageBox.about(
|
||||
self,
|
||||
"About BEdit Simulation",
|
||||
"<h3>BEdit Simulation</h3>"
|
||||
"<p>View live progress and open or save simulation results.</p>",
|
||||
)
|
||||
|
||||
def closeEvent(self, event: QCloseEvent) -> None: # noqa: N802 (Qt API name)
|
||||
self._save_window_layout()
|
||||
super().closeEvent(event)
|
||||
|
||||
@property
|
||||
def is_running(self) -> bool:
|
||||
return self._running
|
||||
|
||||
|
||||
class GraphWorkspacePage(QWidget):
|
||||
"""Matplotlib view of one persisted simulation graph definition."""
|
||||
|
||||
def __init__(
|
||||
self, graph: SimulationGraph, results: SimulationResults, parent=None
|
||||
) -> None:
|
||||
super().__init__(parent)
|
||||
self.graph_id = graph.id
|
||||
self.graph = graph
|
||||
self.results = results
|
||||
self.plot_layout = QVBoxLayout(self)
|
||||
self.figure = Figure(layout="constrained")
|
||||
self.canvas = InteractiveFigureCanvas(self.figure)
|
||||
self.axes = self.figure.add_subplot(111)
|
||||
self.canvas.axes = self.axes
|
||||
self.navigation_toolbar = GraphNavigationToolbar(self.canvas, self)
|
||||
self.canvas.navigation_toolbar = self.navigation_toolbar
|
||||
self.plot_layout.addWidget(self.navigation_toolbar)
|
||||
self.plot_layout.addWidget(self.canvas)
|
||||
self.refresh_chart()
|
||||
|
||||
def refresh_chart(self) -> None:
|
||||
self.axes.clear()
|
||||
x_values = self.results.data.get(self.graph.x_axis)
|
||||
for trace in self.graph.traces:
|
||||
y_values = self.results.data.get(trace.name)
|
||||
if y_values is None:
|
||||
continue
|
||||
horizontal = x_values if x_values is not None else range(len(y_values))
|
||||
sample_count = min(len(horizontal), len(y_values))
|
||||
color = trace.properties.get("color")
|
||||
self.axes.plot(
|
||||
list(horizontal)[:sample_count],
|
||||
y_values[:sample_count],
|
||||
label=trace.name,
|
||||
color=color if isinstance(color, str) and color else None,
|
||||
)
|
||||
self.axes.set_title(self.graph.title)
|
||||
self.axes.set_xlabel(self.graph.x_axis if x_values is not None else "sample")
|
||||
self.axes.grid(True, alpha=0.25)
|
||||
if self.axes.lines:
|
||||
self.axes.legend()
|
||||
self.axes.relim()
|
||||
self.axes.autoscale_view()
|
||||
self.canvas.set_home_view()
|
||||
self.canvas.draw_idle()
|
||||
|
||||
|
||||
class GraphNavigationToolbar(NavigationToolbar2QT):
|
||||
"""Navigation toolbar whose Home action includes direct canvas navigation."""
|
||||
|
||||
def home(self, *args) -> None:
|
||||
del args
|
||||
self.canvas.reset_home_view()
|
||||
|
||||
|
||||
class InteractiveFigureCanvas(FigureCanvasQTAgg):
|
||||
"""Matplotlib canvas with always-available wheel zoom and drag pan."""
|
||||
|
||||
def __init__(self, figure: Figure) -> None:
|
||||
super().__init__(figure)
|
||||
self.axes = None
|
||||
self.navigation_toolbar = None
|
||||
self._pan_start = None
|
||||
self._home_view = None
|
||||
self.mpl_connect("scroll_event", self._zoom_at_cursor)
|
||||
self.mpl_connect("button_press_event", self._start_pan)
|
||||
self.mpl_connect("motion_notify_event", self._pan)
|
||||
self.mpl_connect("button_release_event", self._finish_pan)
|
||||
|
||||
def _toolbar_is_active(self) -> bool:
|
||||
return bool(
|
||||
self.navigation_toolbar is not None
|
||||
and self.navigation_toolbar.mode
|
||||
)
|
||||
|
||||
def set_home_view(self) -> None:
|
||||
if self.axes is not None:
|
||||
self._home_view = (self.axes.get_xlim(), self.axes.get_ylim())
|
||||
|
||||
def reset_home_view(self) -> None:
|
||||
if self.axes is None or self._home_view is None:
|
||||
return
|
||||
x_limits, y_limits = self._home_view
|
||||
self.axes.set_xlim(x_limits)
|
||||
self.axes.set_ylim(y_limits)
|
||||
self.draw_idle()
|
||||
|
||||
def _zoom_at_cursor(self, event) -> None:
|
||||
if (
|
||||
self.axes is None
|
||||
or event.inaxes is not self.axes
|
||||
or event.xdata is None
|
||||
or event.ydata is None
|
||||
or self._toolbar_is_active()
|
||||
):
|
||||
return
|
||||
scale = 0.8 if event.button == "up" else 1.25
|
||||
left, right = self.axes.get_xlim()
|
||||
bottom, top = self.axes.get_ylim()
|
||||
self.axes.set_xlim(
|
||||
event.xdata - (event.xdata - left) * scale,
|
||||
event.xdata + (right - event.xdata) * scale,
|
||||
)
|
||||
self.axes.set_ylim(
|
||||
event.ydata - (event.ydata - bottom) * scale,
|
||||
event.ydata + (top - event.ydata) * scale,
|
||||
)
|
||||
self.draw_idle()
|
||||
|
||||
def _start_pan(self, event) -> None:
|
||||
if (
|
||||
self.axes is None
|
||||
or event.inaxes is not self.axes
|
||||
or event.button != MouseButton.LEFT
|
||||
or self._toolbar_is_active()
|
||||
):
|
||||
return
|
||||
self._pan_start = (
|
||||
event.x,
|
||||
event.y,
|
||||
self.axes.get_xlim(),
|
||||
self.axes.get_ylim(),
|
||||
)
|
||||
|
||||
def _pan(self, event) -> None:
|
||||
if (
|
||||
self.axes is None
|
||||
or self._pan_start is None
|
||||
or event.x is None
|
||||
or event.y is None
|
||||
):
|
||||
return
|
||||
start_x, start_y, x_limits, y_limits = self._pan_start
|
||||
width = max(self.axes.bbox.width, 1.0)
|
||||
height = max(self.axes.bbox.height, 1.0)
|
||||
delta_x = (event.x - start_x) * (x_limits[1] - x_limits[0]) / width
|
||||
delta_y = (event.y - start_y) * (y_limits[1] - y_limits[0]) / height
|
||||
self.axes.set_xlim(x_limits[0] - delta_x, x_limits[1] - delta_x)
|
||||
self.axes.set_ylim(y_limits[0] - delta_y, y_limits[1] - delta_y)
|
||||
self.draw_idle()
|
||||
|
||||
def _finish_pan(self, _event) -> None:
|
||||
self._pan_start = None
|
||||
|
||||
|
||||
def _safe_file_stem(model_name: str) -> str:
|
||||
stem = re.sub(r"[^A-Za-z0-9_.-]+", "_", model_name).strip("._")
|
||||
return stem or "simulation"
|
||||
|
||||
|
||||
def _signal_tree_parts(signal_name: str) -> tuple[str, ...]:
|
||||
"""Split a result name into readable component, variable, and index levels.
|
||||
|
||||
OpenModelica emits state derivatives as names such as ``der(block.x)``.
|
||||
Keep those traces available, but display them below a ``Derivatives`` group
|
||||
on their owning component instead of creating a misleading top-level
|
||||
``der(block`` branch.
|
||||
"""
|
||||
|
||||
derivative = re.fullmatch(r"der\((.+)\)", signal_name)
|
||||
if derivative is not None:
|
||||
inner_name = derivative.group(1)
|
||||
inner_parts = _signal_tree_parts(inner_name)
|
||||
if inner_parts:
|
||||
index_count = len(re.findall(r"\[[^\]]+\]", inner_name.rsplit(".", 1)[-1]))
|
||||
variable_index = max(0, len(inner_parts) - index_count - 1)
|
||||
return (
|
||||
*inner_parts[:variable_index],
|
||||
"Derivatives",
|
||||
*inner_parts[variable_index:],
|
||||
)
|
||||
return ("Derivatives", signal_name)
|
||||
|
||||
parts: list[str] = []
|
||||
for segment in signal_name.split("."):
|
||||
if not segment:
|
||||
continue
|
||||
match = re.fullmatch(r"([^\[]+)((?:\[[^\]]+\])+)", segment)
|
||||
if match is None:
|
||||
parts.append(segment)
|
||||
continue
|
||||
parts.append(match.group(1))
|
||||
parts.extend(re.findall(r"\[([^\]]+)\]", match.group(2)))
|
||||
return tuple(parts)
|
||||
@@ -551,7 +551,9 @@
|
||||
</property>
|
||||
<addaction name="actionSimulationSettings"/>
|
||||
<addaction name="actionGraphParameters"/>
|
||||
<addaction name="actionCompile"/>
|
||||
<addaction name="actionCompose"/>
|
||||
<addaction name="actionExportModel"/>
|
||||
<addaction name="actionSimulationWindow"/>
|
||||
<addaction name="actionRunSimulation"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
@@ -644,7 +646,8 @@
|
||||
</attribute>
|
||||
<addaction name="actionSimulationSettings"/>
|
||||
<addaction name="actionGraphParameters"/>
|
||||
<addaction name="actionCompile"/>
|
||||
<addaction name="actionCompose"/>
|
||||
<addaction name="actionSimulationWindow"/>
|
||||
<addaction name="actionRunSimulation"/>
|
||||
</widget>
|
||||
<action name="actionSimulationSettings">
|
||||
@@ -662,7 +665,7 @@
|
||||
<action name="actionGraphParameters">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/resources.qrc">
|
||||
<normaloff>:/icons/icons/configure.png</normaloff>:/icons/icons/configure.png</iconset>
|
||||
<normaloff>:/icons/icons/view-form-table.png</normaloff>:/icons/icons/view-form-table.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Graph Parameters</string>
|
||||
@@ -671,16 +674,16 @@
|
||||
<string>Edit parameters throughout the active graph</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCompile">
|
||||
<action name="actionCompose">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/resources.qrc">
|
||||
<normaloff>:/icons/icons/run-build.png</normaloff>:/icons/icons/run-build.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Compile</string>
|
||||
<string>Compose</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Compile the active graph for simulation</string>
|
||||
<string>Compose the active graph as an OpenModelica model</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>F5</string>
|
||||
@@ -701,6 +704,30 @@
|
||||
<string>F6</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSimulationWindow">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/resources.qrc">
|
||||
<normaloff>:/icons/icons/office-chart-line.png</normaloff>:/icons/icons/office-chart-line.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Simulation Window</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Show the simulation results window</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExportModel">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/resources.qrc">
|
||||
<normaloff>:/icons/icons/document-save-as.png</normaloff>:/icons/icons/document-save-as.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Export Model…</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Save the composed OpenModelica model to a file</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNew">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/resources.qrc">
|
||||
|
||||
322
BEdit/ui/simulation_window.ui
Normal file
322
BEdit/ui/simulation_window.ui
Normal file
@@ -0,0 +1,322 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SimulationWindow</class>
|
||||
<widget class="QMainWindow" name="SimulationWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>900</width>
|
||||
<height>650</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Simulation</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../resources/resources.qrc">
|
||||
<normaloff>:/icons/icons/office-chart-line.png</normaloff>:/icons/icons/office-chart-line.png</iconset>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<layout class="QVBoxLayout" name="resultsLayout">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="graphTabs">
|
||||
<property name="tabsClosable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="movable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>900</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
<property name="title">
|
||||
<string>&File</string>
|
||||
</property>
|
||||
<addaction name="actionOpen"/>
|
||||
<addaction name="actionSave"/>
|
||||
<addaction name="actionSaveAs"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionClear"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionExit"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuView">
|
||||
<property name="title">
|
||||
<string>&View</string>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuPanels">
|
||||
<property name="title">
|
||||
<string>&Panels</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuToolbars">
|
||||
<property name="title">
|
||||
<string>&Toolbars</string>
|
||||
</property>
|
||||
</widget>
|
||||
<addaction name="menuPanels"/>
|
||||
<addaction name="menuToolbars"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuHelp">
|
||||
<property name="title">
|
||||
<string>&Help</string>
|
||||
</property>
|
||||
<addaction name="actionAbout"/>
|
||||
<addaction name="actionAboutQt"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuGraph">
|
||||
<property name="title">
|
||||
<string>&Graph</string>
|
||||
</property>
|
||||
<addaction name="actionAddGraph"/>
|
||||
<addaction name="actionRemoveGraph"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
<addaction name="menuView"/>
|
||||
<addaction name="menuGraph"/>
|
||||
<addaction name="menuHelp"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="workspaceToolbar">
|
||||
<property name="windowTitle">
|
||||
<string>Workspace</string>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonStyle::ToolButtonIconOnly</enum>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="actionAddGraph"/>
|
||||
<addaction name="actionRemoveGraph"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="fileToolbar">
|
||||
<property name="windowTitle">
|
||||
<string>File</string>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonStyle::ToolButtonIconOnly</enum>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="actionClear"/>
|
||||
<addaction name="actionOpen"/>
|
||||
<addaction name="actionSave"/>
|
||||
<addaction name="actionSaveAs"/>
|
||||
</widget>
|
||||
<widget class="QDockWidget" name="statusDock">
|
||||
<property name="windowTitle">
|
||||
<string>Status</string>
|
||||
</property>
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>8</number>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="statusDockContents">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="timeLabel">
|
||||
<property name="text">
|
||||
<string>Time: 0 s</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="format">
|
||||
<string>%p%</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="statusLabel">
|
||||
<property name="text">
|
||||
<string>No simulation has been run yet.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QDockWidget" name="logDock">
|
||||
<property name="floating">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="features">
|
||||
<set>QDockWidget::DockWidgetFeature::DockWidgetFloatable|QDockWidget::DockWidgetFeature::DockWidgetMovable</set>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Log</string>
|
||||
</property>
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>8</number>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="logDockContents">
|
||||
<layout class="QVBoxLayout" name="logLayout">
|
||||
<item>
|
||||
<widget class="QListWidget" name="messageList">
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QDockWidget" name="signalsDock">
|
||||
<property name="windowTitle">
|
||||
<string>Signals</string>
|
||||
</property>
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>2</number>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="signalsDockContents">
|
||||
<layout class="QVBoxLayout" name="signalsLayout">
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="signalsTree">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ContextMenuPolicy::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SelectionMode::ExtendedSelection</enum>
|
||||
</property>
|
||||
<property name="headerHidden">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Signal</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<action name="actionOpen">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/resources.qrc">
|
||||
<normaloff>:/icons/icons/document-open.png</normaloff>:/icons/icons/document-open.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Open…</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+O</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSave">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/resources.qrc">
|
||||
<normaloff>:/icons/icons/document-save.png</normaloff>:/icons/icons/document-save.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Save…</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+S</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionClear">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/resources.qrc">
|
||||
<normaloff>:/icons/icons/document-new.png</normaloff>:/icons/icons/document-new.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Clear</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSaveAs">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/resources.qrc">
|
||||
<normaloff>:/icons/icons/document-save-as.png</normaloff>:/icons/icons/document-save-as.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save &As…</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+Shift+S</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExit">
|
||||
<property name="text">
|
||||
<string>E&xit</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+W</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAbout">
|
||||
<property name="text">
|
||||
<string>&About Simulation Window</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAboutQt">
|
||||
<property name="text">
|
||||
<string>About &Qt</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionToggleResults">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Results</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAddGraph">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/resources.qrc">
|
||||
<normaloff>:/icons/icons/list-add.png</normaloff>:/icons/icons/list-add.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add Graph</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Add a graph workspace tab</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRemoveGraph">
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/resources.qrc">
|
||||
<normaloff>:/icons/icons/list-remove.png</normaloff>:/icons/icons/list-remove.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove Current Graph</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Remove the current graph workspace tab</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../resources/resources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -12,12 +12,28 @@
|
||||
<widget class="QSplitter" name="columnSplitter">
|
||||
<property name="orientation"><enum>Qt::Orientation::Horizontal</enum></property>
|
||||
<property name="childrenCollapsible"><bool>false</bool></property>
|
||||
<widget class="QSplitter" name="sourceSplitter">
|
||||
<property name="orientation"><enum>Qt::Orientation::Vertical</enum></property>
|
||||
<property name="childrenCollapsible"><bool>false</bool></property>
|
||||
<widget class="QGroupBox" name="declarationsGroup">
|
||||
<property name="title"><string>Declarations</string></property>
|
||||
<layout class="QVBoxLayout" name="declarationsLayout">
|
||||
<item><widget class="OpenModelicaEditor" name="declarationsEdit"/></item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="initialEquationsGroup">
|
||||
<property name="title"><string>Initial Equations</string></property>
|
||||
<layout class="QVBoxLayout" name="initialEquationsLayout">
|
||||
<item><widget class="OpenModelicaEditor" name="initialEquationsEdit"/></item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="equationsGroup">
|
||||
<property name="title"><string>Equations</string></property>
|
||||
<layout class="QVBoxLayout" name="equationsLayout">
|
||||
<item><widget class="OpenModelicaEditor" name="equationsEdit"/></item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QSplitter" name="definitionSplitter">
|
||||
<property name="orientation"><enum>Qt::Orientation::Vertical</enum></property>
|
||||
<property name="childrenCollapsible"><bool>false</bool></property>
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
"showName": false
|
||||
},
|
||||
"library": {
|
||||
"showSubtree": false
|
||||
"showSubtree": true
|
||||
},
|
||||
"implementation": {
|
||||
"kind": "graph",
|
||||
@@ -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+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": [],
|
||||
@@ -652,8 +943,8 @@
|
||||
"enabled": false,
|
||||
"startTime": 0.0,
|
||||
"stopTime": 10.0,
|
||||
"intervalMode": "numberOfIntervals",
|
||||
"numberOfIntervals": 5000,
|
||||
"intervalMode": "intervalTime",
|
||||
"numberOfIntervals": 50000,
|
||||
"intervalTime": 0.002
|
||||
}
|
||||
}
|
||||
|
||||
44
m_Test.mo
Normal file
44
m_Test.mo
Normal file
@@ -0,0 +1,44 @@
|
||||
model m_Test
|
||||
model m_Constant0
|
||||
output Real y;
|
||||
parameter Real v = 2;
|
||||
equation
|
||||
y = v;
|
||||
end m_Constant0;
|
||||
model m_gain0
|
||||
input Real u;
|
||||
output Real y;
|
||||
parameter Real k = 2.5;
|
||||
equation
|
||||
y = k*u;
|
||||
end m_gain0;
|
||||
model m_const_and_time
|
||||
output Real y;
|
||||
parameter Real v = 4.8;
|
||||
equation
|
||||
y = v+sin(time);
|
||||
end m_const_and_time;
|
||||
model m_gain1
|
||||
input Real u;
|
||||
output Real y;
|
||||
parameter Real k = -5;
|
||||
equation
|
||||
y = k*u;
|
||||
end m_gain1;
|
||||
model m_add0
|
||||
input Real u[2];
|
||||
output Real y;
|
||||
equation
|
||||
y = sum(u[i] for i in 1:2 );
|
||||
end m_add0;
|
||||
m_Constant0 Constant0;
|
||||
m_gain0 gain0;
|
||||
m_const_and_time const_and_time;
|
||||
m_gain1 gain1;
|
||||
m_add0 add0;
|
||||
equation
|
||||
gain0.u = Constant0.y;
|
||||
gain1.u = const_and_time.y;
|
||||
add0.u[1] = gain0.y;
|
||||
add0.u[2] = gain1.y;
|
||||
end m_Test;
|
||||
Reference in New Issue
Block a user