Parameters & Model Validation
Applies to: CoModel cloud modeling & simulation platform (v1.7+) Related articles: Canvas & Component Browser, Component Drag-and-Drop & Connections
1. Overview
In CoModel, every component instance carries a set of parameters. Through the parameter panel on the right, you can edit these parameters and immediately see the resulting changes in the generated Julia code. As models grow, the model validation feature quickly surfaces connection errors, parameter type mismatches, or isolated nodes.

2. Editing Component Parameters
2.1 Opening the Parameter Panel
- Click a component node on the canvas to select it.
- The properties panel on the right switches to that node's parameter view.
The parameter view contains the following information:
| Group | Contents |
|---|---|
| Basic info | Instance name, component type |
| Parameter list | Parameter name, type, current value, unit, description tooltip |
| Port info | Port name, type, connected/unconnected state |
2.2 Parameter Types and Input Controls
CoModel renders different input controls based on the parameter types in the component definition:
| Parameter type | Input control | Example |
|---|---|---|
| Numeric | Number input supporting scientific notation | 1.5e-3, 100.0 |
| Boolean | Toggle switch | true / false |
| Enumeration | Dropdown | "Forward" / "Backward" |
| Expression | Text input | 2 * m * g, R1 + R2 |
After you change a parameter, the platform updates the instantiation statement in the code view on the right after a 500ms debounce. For example, changing the spring stiffness from the default 1000.0 to 1500.0:
# Before
@named spring1 = Spring(k=1000.0)
# After
@named spring1 = Spring(k=1500.0)

2.3 Parameter Validation
Every parameter change triggers front-end validation:
| Check | Description |
|---|---|
| Type check | A string cannot be assigned to a Float64 parameter |
| Range check | e.g. a resistance must be a positive number |
| Expression validity | Expression parameters must be parseable by Julia |
| Unit consistency | Some parameters check unit matching (e.g. length, mass) |
If validation fails, the input shows a red bottom border; hover to see the error message.
3. Viewing Connection Properties
After selecting a connection, the parameter panel shows the connection's metadata:
- Connection ID
- Source and target port names
- Physical domain (mechanical / electrical / thermal, etc.)
- Optional label text
A connection itself has no adjustable parameters; it exists to record the connection relationship.
4. Model-Level Parameters and Variables
Click empty canvas (deselecting all nodes) and the panel on the right switches to Model Properties:
| Group | Description |
|---|---|
| Model name | The current model's Julia module name |
| Model-level parameters | Symbolic parameters in the @parameters block; can be added, removed, and edited |
| Model-level variables | The @variables block, usually imported automatically from component instances; display only |
| Initial conditions | Initial values marked with [u0=...]; can be edited in one place |
For example, to add a global parameter to the model:
@parameters t g = 9.81
5. Model Validation
5.1 Triggering Validation
You can run model validation in the following ways:
- Click the Validate button on the top toolbar.
- Automatically when you manually save the model (
Ctrl + S).
Results appear in the bottom status bar and as icons on the corresponding canvas elements:
| Icon | Level | Meaning |
|---|---|---|
| Red circle | Error | Must be fixed; otherwise saving or simulation may fail |
| Yellow triangle | Warning | Worth checking, but does not block saving |

5.2 Validation Checks
| Check | Description | Level |
|---|---|---|
| Isolated node | All ports of the component are unconnected | Warning |
| Required port unconnected | A port declared with required=true is unconnected |
Error |
| Multi-connected signal input | One signal input port is connected by multiple outputs | Error |
| Parameter type error | The parameter value type does not match the definition | Error |
| Invalid model name | Not a valid Julia identifier | Error |
| Duplicate instance name | Two instances at the same level share a name | Error |
| Cyclic connection | The signal graph contains an algebraic loop | Warning |
5.3 Locating Diagnostics
Click an error/warning in the bottom status bar and the canvas automatically navigates to the corresponding node or connection. You can also click the relevant line in the code view; the corresponding element flashes and highlights on the canvas.
6. MTK Syntax Pre-Validation
For complex models, CoModel also provides pre-validation at the Julia/MTK level:
- Click Run Syntax Check (an advanced validation option).
- The front end sends the generated
.jlcode to the back-end Julia sandbox. - The back end parses
@named sys = ...(without solving) and returns compile-level errors. - The front end displays the Julia error message and navigates to the corresponding line in the code view.
Security note: Syntax pre-validation runs in an isolated sandbox with a 10-second timeout and no network access, preventing malicious code injection.
7. Saving and Versions
After parameters change, the model is in an unsaved state. You can:
- Press
Ctrl + Sto save manually. - Wait for the 5-minute autosave (triggered silently when there are changes).
- Review autosaved snapshots and manual versions in Version History.
On save, CoModel also generates the .jl file and writes the graphical comments, so the diagram state is fully restored the next time the model opens.
8. FAQ
The code view does not change after editing a parameter?
The code view has an 800ms debounce. If it does not update for a long time, check whether the parameter value passes validation (values that fail validation are not synced to the code).
Validation reports "Required port unconnected" but the model really does not need that port?
Contact the component author to confirm whether the required flag in the port definition is correct. For standard library components, see Julia Component Code Conventions for port declarations.
How do I see a parameter's unit?
Hover over the ⓘ icon to the right of the parameter name to see the parameter description, unit, and default value.