Repository navigation
Home
hart-sim simulates HART field devices, a pressure and a temperature transmitter, that speak HART-IP over TCP and UDP on port 5094. Develop and test control-system links, asset management, commissioning scripts and gateways without devices, a HART modem or a commercial simulator, also in CI.
- Developing HART software without a device on the bench. Anything that speaks HART-IP can talk to it.
- Running HART code in CI. A new bench for every test, in a pytest fixture or as a background process.
- Testing the unhappy paths. Sensor failure, saturation, busy, communication errors, missing answers and drift, switched on at runtime.
- Getting the details right. The process value becomes a 4-20 mA loop current with saturation and NAMUR NE 43 alarm currents. A bad checksum or a wrong address gets no answer, never a lenient guess.
| If you want to … | read |
|---|---|
| install it and read a first value | Getting started |
| change a device or write your own | Device profiles |
| use it in pytest and CI pipelines | Testing in CI |
| check that your code copes with misbehaving devices | Fault injection recipes |
| find out why something does not answer | Troubleshooting |
The README is the complete reference: all commands, the profile format, the control channel, the limitations. This wiki adds walkthroughs and background.
| Install |
pip install hart-sim (Python 3.10+, only dependency PyYAML) |
| Transport | HART-IP version 1 over TCP and UDP, port 5094; control channel on 5095 |
| Commands | HART revision 7 universal and common practice: 0-3, 6-9, 11-22, 33-38, 40-42, 44-46, 48, 59 |
| Profiles |
pressure, temperature, and your own in YAML |
| Faults |
no_response, delay, busy, comm_error, sensor_failure, saturate, cold_start, more_status, drift, write_protect
|
| Tested on | Linux, Windows, macOS; decoded frames checked with Wireshark |
| License | MIT |
The two bundled devices are invented, with a manufacturer ID that deliberately belongs to nobody. Most device-specific HART commands are not public, so hart-sim has no profiles after real products.
The byte layouts come from public sources, not from the paid HART specification. hart-sim is not registered with FieldComm Group and has not been tested against real HART hosts. There is no serial HART, burst mode, device description (DD) or secure connection. If your host disagrees with it, please open an issue.
hart-sim · MIT licensed · HART is a trademark of the FieldComm Group; hart-sim is not affiliated with it.