Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ To open the graphical editor, run:
pysimblocks examples/quick_start/gui
```

The quick-start GUI project is stored in a single
`examples/quick_start/gui/project.yaml` file.

### Tutorials

See the [Getting Started Guide](./docs/User_Guide/getting_started.md) for
Expand Down
16 changes: 9 additions & 7 deletions docs/User_Guide/tutorial_2_gui.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,21 @@ Under the hood, the GUI generates the same `Model` structure used in [Tutorial 1

### Saving

Saving the project using the `Save` button in the `Toolbar` creates three YAML files in the current folder:
- `model.yaml` — defines the blocks and their connections
- `parameters.yaml` — contains block parameters, simulation settings, and plot definitions
- `layout.yaml` — stores the graphical layout of blocks and connections in the Diagram View
Saving the project using the `Save` button in the `Toolbar` creates a unified `project.yaml` file in the current folder.

Together, these files fully describe the model structure and its configuration. They can be used to reload the project in the GUI or to run the simulation programmatically using Python.
This file contains:
- project metadata
- simulation settings (`dt`, `T`, logging, plots)
- block diagram (`diagram.blocks`, `diagram.connections`)
- GUI layout (`gui.layout`)

This single file fully describes the model and can be reloaded in the GUI or executed programmatically in Python.

### Exporting a Python Runner

The `Export` button in the `Toolbar` generates a `run.py` file.

This script loads the YAML configuration (model and parameters) and builds the corresponding `Model` and `Simulator` objects programmatically.
This script loads `project.yaml` and builds the corresponding `Model` and `Simulator` objects programmatically.
It allows the project to be executed directly from the command line:

```bash
Expand Down Expand Up @@ -182,4 +185,3 @@ Run it from the command line to verify that the exported script reproduces the s
This tutorial demonstrates how to build and execute a model visually.
The next tutorials extend this approach to SOFA integration and real-time execution.


13 changes: 8 additions & 5 deletions examples/advanced/hardware/block_diagram.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import time
from pathlib import Path

import numpy as np
import parameters as prm
from emioapi import EmioMotors

from pySimBlocks.core import Model, Simulator
from pySimBlocks.project.load_project_config import load_simulation_config
from pySimBlocks.project import load_simulator_from_project
from pySimBlocks.real_time import RealTimeRunner

try:
BASE_DIR = Path(__file__).parent.resolve()
except Exception:
BASE_DIR = Path("")


# ------------------------------------------------------------------------------
# Process
Expand Down Expand Up @@ -85,9 +90,7 @@ def process_block_diagram(shared_markers_pos, shared_ref_ol, shared_ref_cl,
# Helpers
# ------------------------------------------------------------------------------
def setup_block_diagram():
sim_cfg, model_cfg = load_simulation_config("parameters.yaml")
model = Model( name="model", model_yaml="model.yaml", model_cfg=model_cfg)
sim = Simulator(model, sim_cfg)
sim, _plot_cfg = load_simulator_from_project(BASE_DIR / "project.yaml")
runner = RealTimeRunner(
sim,
input_blocks=["Camera", "Ref_cl", "Ref_ol", "Mode"],
Expand Down
63 changes: 0 additions & 63 deletions examples/advanced/hardware/layout.yaml

This file was deleted.

56 changes: 0 additions & 56 deletions examples/advanced/hardware/model.yaml

This file was deleted.

57 changes: 0 additions & 57 deletions examples/advanced/hardware/parameters.yaml

This file was deleted.

Loading