@@ -25,4 +25,49 @@ is performed, write operations are ignored.
25
25
26
26
27
27
## Custom Simulation
28
- To be documented!
28
+ The simulation can be customized by providing a configuration (in XML format) to the simulator. This is an example of configuration:
29
+
30
+ ``` xml
31
+ <?xml version =" 1.0" encoding =" US-ASCII" ?>
32
+ <device ip =" 0.0.0.0" port =" 502" >
33
+ <configuration initializeUndefinedRegisters =" true" initialValue =" 0" >
34
+ <registers >
35
+ <register addressType =" HOLDING_REGISTER" address =" 14" symbol =" RPM_MOTOR" >500</register >
36
+ <register addressType =" HOLDING_REGISTER" address =" 10" datatype =" FLOAT32" symbol =" TEMPERATURE" >-12.5</register >
37
+ <register addressType =" HOLDING_REGISTER" address =" 0" datatype =" INT16" symbol =" RPM_MOTOR1" >1</register >
38
+ <register addressType =" COIL" address =" 1" symbol =" RELAYON" >1</register >
39
+ <register addressType =" DISCRETE_INPUT" address =" 0" symbol =" RELAY_STATUS" >1</register >
40
+ <register addressType =" INPUT_REGISTER" address =" 0" symbol =" RPM" >1</register >
41
+ </registers >
42
+ </configuration >
43
+ <simulation plcScanTime =" 1000" >
44
+ <set symbol =" TEMPERATURE" >2.0</set >
45
+ <set symbol =" RPM_MOTOR" >15</set >
46
+ <delay >500</delay >
47
+ <set symbol =" RPM" >1</set >
48
+ <delay >500</delay >
49
+ <set symbol =" RPM" >0</set >
50
+ <delay >500</delay >
51
+ <sub symbol =" RPM_MOTOR" >10</sub >
52
+ <delay >500</delay >
53
+ <add symbol =" RPM_MOTOR" >10</add >
54
+ </simulation >
55
+ </device >
56
+ ```
57
+
58
+ Sections ** device** and ** configuration** are ** mandatory**
59
+
60
+ ## Custom simulation with docker
61
+ For the custom simulation to work, the configuration file must be defined.
62
+
63
+ 1 . Place the configuration file in a folder for example * simulation* folder
64
+ 2 . From inside the folder (cd simulation) execute the following command
65
+
66
+ ```
67
+ docker run -it -v $PWD/:/simulation -p5002:5002 paulorb/modbus-simulator-cli -f /simulation/simulation.xml
68
+ ```
69
+
70
+
71
+ ## Device section
72
+ Device section is used to configure the network parameters of the driver
73
+ * TODO: define device section*
0 commit comments