Skip to content

Commit e08776d

Browse files
committed
Added parameters documentation
1 parent 6dff33d commit e08776d

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Input parameters
2+
3+
Simulator supports input parameters, these parameters are defined on the xml file with optional default values which can be customized by command line arguments.
4+
5+
## How to configure the parameters?
6+
7+
1. Adding parameters section to the XML
8+
2. Define the parameters and its optional default value (in case the default value is not specified this parameter becomes mandatory)
9+
10+
```xml
11+
<?xml version="1.0" encoding="US-ASCII" ?>
12+
<device ip="0.0.0.0" port="502">
13+
<parameters>
14+
<parameter symbol="PARAM_CURRENT_SELECTION" datatype="INT16">15</parameter>
15+
<parameter symbol="PARAM_SET_TEMPERATURE" datatype="FLOAT32">5.45</parameter>
16+
<parameter symbol="PARAM_ENABLE_FAST_MODE" datatype="BOOL">1</parameter>
17+
</parameters>
18+
<configuration initializeUndefinedRegisters="true" initialValue="0">
19+
...
20+
</configuration>
21+
<simulation plcScanTime="1000">
22+
...
23+
</simulation>
24+
</device>
25+
```
26+
27+
These parameters can be used like any other register on the simulation, but as **read-only variables**.
28+
29+
## How to change the parameters dynamically?
30+
Specified parameters can be overwritten by command line arguments, by specifying the argument -e -env.
31+
32+
Example:
33+
```
34+
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
35+
```
36+
37+
Please note the value specified as argument needs to match the parameter's datatype specified on the xml.

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ nav:
1818
- Overview: index.md
1919
- Quick start: getting-started/quick-start.md
2020
- Operations: getting-started/operations.md
21+
- Input parameters: getting-started/input-parameters.md
2122
- License: getting-started/license.md
2223
- Contributing: getting-started/contributing.md
2324

0 commit comments

Comments
 (0)