Skip to content

Commit

Permalink
Added parameters documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
paulorb committed May 6, 2024
1 parent 6dff33d commit e08776d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
37 changes: 37 additions & 0 deletions docs/getting-started/input-parameters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Input parameters

Simulator supports input parameters, these parameters are defined on the xml file with optional default values which can be customized by command line arguments.

## How to configure the parameters?

1. Adding parameters section to the XML
2. Define the parameters and its optional default value (in case the default value is not specified this parameter becomes mandatory)

```xml
<?xml version="1.0" encoding="US-ASCII" ?>
<device ip="0.0.0.0" port="502">
<parameters>
<parameter symbol="PARAM_CURRENT_SELECTION" datatype="INT16">15</parameter>
<parameter symbol="PARAM_SET_TEMPERATURE" datatype="FLOAT32">5.45</parameter>
<parameter symbol="PARAM_ENABLE_FAST_MODE" datatype="BOOL">1</parameter>
</parameters>
<configuration initializeUndefinedRegisters="true" initialValue="0">
...
</configuration>
<simulation plcScanTime="1000">
...
</simulation>
</device>
```

These parameters can be used like any other register on the simulation, but as **read-only variables**.

## How to change the parameters dynamically?
Specified parameters can be overwritten by command line arguments, by specifying the argument -e -env.

Example:
```
docker run -it -v $PWD/:/simulation -p5002:5002 paulorb/modbus-simulator-cli -f /simulation/configuration-simulation.xml -e PARAM_CURRENT_SELECTION=10 -e PARAM_SET_TEMPERATURE=0.5
```

Please note the value specified as argument needs to match the parameter's datatype specified on the xml.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ nav:
- Overview: index.md
- Quick start: getting-started/quick-start.md
- Operations: getting-started/operations.md
- Input parameters: getting-started/input-parameters.md
- License: getting-started/license.md
- Contributing: getting-started/contributing.md

Expand Down

0 comments on commit e08776d

Please sign in to comment.