|  | 
| 1 | 1 | Simulator | 
| 2 | 2 | ========= | 
| 3 | 3 | 
 | 
| 4 |  | -The simulator is a full fledged modbus simulator, which is | 
| 5 |  | -constantly being evolved with user ideas / amendments. | 
|  | 4 | +**WORK IN PROGRESS, do NOT use** | 
|  | 5 | + | 
|  | 6 | +The simulator is a full fledged modbus server/simulator. | 
| 6 | 7 | 
 | 
| 7 | 8 | The purpose of the simulator is to provide support for client | 
| 8 | 9 | application test harnesses with end-to-end testing simulating real life | 
| 9 | 10 | modbus devices. | 
| 10 | 11 | 
 | 
| 11 |  | -The datastore simulator allows the user to (all automated) | 
|  | 12 | +The simulator allows the user to (all automated): | 
| 12 | 13 | 
 | 
| 13 | 14 | - simulate a modbus device by adding a simple configuration, | 
| 14 |  | -- test how a client handles modbus exceptions, | 
|  | 15 | +- simulate a multipoint line, but adding multiple device configurations, | 
|  | 16 | +- simulate devices that are not conforming to the protocol, | 
|  | 17 | +- simulate communication problems (data loss etc), | 
|  | 18 | +- test how a client handles modbus response and exceptions, | 
| 15 | 19 | - test a client apps correct use of the simulated device. | 
| 16 | 20 | 
 | 
| 17 |  | -The web interface allows the user to (online / manual) | 
|  | 21 | +The web interface (activated optionally) allows the user to: | 
| 18 | 22 | 
 | 
| 19 |  | -- test how a client handles modbus errors, | 
| 20 |  | -- test how a client handles communication errors like divided messages, | 
| 21 |  | -- run your test server in the cloud, | 
|  | 23 | +- introduce modbus errors (like e.g. wrong length), | 
|  | 24 | +- introduce communication errors (like splitting a message), | 
| 22 | 25 | - monitor requests/responses, | 
| 23 |  | -- inject modbus errors like malicious a response, | 
| 24 | 26 | - see/Change values online. | 
|  | 27 | +- inject modbus errors like malicious a response, | 
|  | 28 | +- run your test server in the cloud, | 
| 25 | 29 | 
 | 
| 26 | 30 | The REST API allow the test process to be automated | 
| 27 | 31 | 
 | 
| 28 |  | -- spin up a test server with unix domain sockets in your test harness, | 
|  | 32 | +- spin up a test server in your test harness, | 
| 29 | 33 | - set expected responses with a simple REST API command, | 
| 30 |  | -- check the result with another simple REST API command, | 
|  | 34 | +- check the result with a simple REST API command, | 
| 31 | 35 | - test your client app in a true end-to-end fashion. | 
| 32 | 36 | 
 | 
| 33 |  | -.. toctree:: | 
| 34 |  | -   :maxdepth: 4 | 
| 35 |  | -   :hidden: | 
|  | 37 | +The web server uses the REST API internally, which helps to ensure that it | 
|  | 38 | +actually works. | 
|  | 39 | + | 
|  | 40 | + | 
|  | 41 | +Data model configuration | 
|  | 42 | +------------------------ | 
|  | 43 | + | 
|  | 44 | +.. warning:: from v3.9.0 this is available as a "normal" datastore model. | 
|  | 45 | + | 
|  | 46 | +The simulator data model represent the registers and parameters of the simulated devices. | 
|  | 47 | +The data model is defined using :class:`SimData` and :class:`SimDevice` before starting the | 
|  | 48 | +server and cannot be changed without restarting the server. | 
|  | 49 | + | 
|  | 50 | +:class:`SimData` defines a group of continuous identical registers. This is the basis of the model, | 
|  | 51 | +multiple :class:`SimData` should be used to mirror the physical device. | 
|  | 52 | + | 
|  | 53 | +:class:`SimDevice` defines device parameters and a list of :class:`SimData`. | 
|  | 54 | +The list of :class:`SimData` can added as shared registers or as the 4 blocks, defined in modbus. | 
|  | 55 | +:class:`SimDevice` can be used to simulate a single device, while a list of | 
|  | 56 | +:class:`SimDevice` simulates a multipoint line (simulating a rs485 line or a tcp based serial forwarder). | 
|  | 57 | + | 
|  | 58 | +A server consist of communication parameters and a device or a list of devices | 
|  | 59 | + | 
|  | 60 | +:class:`SimDataType` is a helper class that defines legal datatypes. | 
|  | 61 | + | 
|  | 62 | +:class:`SimActions` is a helper class that defines built in actions. | 
|  | 63 | + | 
|  | 64 | +:github:`examples/simulator_datamodel.py` contains usage examples. | 
|  | 65 | + | 
|  | 66 | +SimData | 
|  | 67 | +^^^^^^^ | 
|  | 68 | + | 
|  | 69 | +.. autoclass:: pymodbus.simulator.SimData | 
|  | 70 | +    :members: | 
|  | 71 | +    :undoc-members: | 
|  | 72 | +    :show-inheritance: | 
|  | 73 | + | 
|  | 74 | +SimDevice | 
|  | 75 | +^^^^^^^^^ | 
|  | 76 | + | 
|  | 77 | +.. autoclass:: pymodbus.simulator.SimDevice | 
|  | 78 | +    :members: | 
|  | 79 | +    :undoc-members: | 
|  | 80 | +    :show-inheritance: | 
|  | 81 | + | 
|  | 82 | +SimDataType | 
|  | 83 | +^^^^^^^^^^^ | 
|  | 84 | + | 
|  | 85 | +.. autoclass:: pymodbus.simulator.SimDataType | 
|  | 86 | +    :members: | 
|  | 87 | +    :undoc-members: | 
|  | 88 | +    :show-inheritance: | 
|  | 89 | + | 
|  | 90 | + | 
|  | 91 | +Simulator server | 
|  | 92 | +---------------- | 
|  | 93 | + | 
|  | 94 | +.. note:: This is a v4.0.0 functionality currently not available, please see the 3x simulator server. | 
|  | 95 | + | 
|  | 96 | + | 
|  | 97 | +Web frontend | 
|  | 98 | +------------ | 
|  | 99 | + | 
|  | 100 | +.. note:: This is a v4.0.0 functionality currently not available, please see the 3x simulator server. | 
|  | 101 | + | 
|  | 102 | + | 
|  | 103 | +REST API | 
|  | 104 | +-------- | 
| 36 | 105 | 
 | 
| 37 |  | -   library/simulator/config | 
| 38 |  | -   library/simulator/datastore | 
| 39 |  | -   library/simulator/web | 
| 40 |  | -   library/simulator/restapi | 
|  | 106 | +.. note:: This is a v4.0.0 functionality currently not available, please see the 3x simulator server. | 
0 commit comments