A library to communicate with Omron Sysmac Simulator
Project description
Omron Sysmac Simulator Driver
This project is a Python library that enables communication with the Sysmac Studio simulator using the NexSocket.dll installed with the Omron IDE. It can be used to exercise and unit test PLC projects in the simulator without the need to connect actual hardware. The main methods are similar to the APHYT Ethernet/IP project used for real Sysmac hardware on the network, so code can be reused to test both simulated and real systems. There are some limitations on simulated systems because the NexSocket.dll does not provide as much data as Ethernet/IP.
This code modifies and expands a GPL3 module released by Simumatik Digital Twin platform and the modifications:
- Allow it to be used as a stand-alone Python interface to the Simulator
- Variables can be assigned PLC data types in order to implicitly format the bytes during read and write operations
- Can import a text file created by pasting the results of Sysmac Studio's "Export Global Variables" in order to define the data types of PLC variables automatically
Creating an Import File of Published Global Variables
Begin by exporting a formatted list of published global variables by navigating Sysmac Studio's menu structure to: Tools - Export Global Variables - CX-Designer
This should result in a dialog that alerts the user that the data has been copied to the clipboard
Paste the results into a text file and save it in a location accessible to the Python code. The result should look something like this below:
The file "global_variables.txt", created using this process, is used in the example code below.
Example
The following code will connect to the running simulator
from sysmac_simulator import *
import time
sim_driver = SysmacSimulator()
sim_driver.connect()
sim_driver.populate_from_file('global_variables.txt')
var_name = "hmiPositionTarget"
for i in range(5):
print(sim_driver.read_variable(var_name))
time.sleep(1)
sim_driver.write_variable(var_name, 12.34)
print(sim_driver.read_variable(var_name))
time.sleep(1)
sim_driver.write_variable(var_name, 0.0)
sim_driver.disconnect()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file omron_sysmac_simulator-0.1.2.tar.gz.
File metadata
- Download URL: omron_sysmac_simulator-0.1.2.tar.gz
- Upload date:
- Size: 16.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec5243b4b957cf8457eebc88055e31aba46208526ed6191a6d0126409e033675
|
|
| MD5 |
caeefdd97af672e87c26f3dbd5fe270d
|
|
| BLAKE2b-256 |
45dc97d47e8be1756416a5616baea50d6159eff99e86623905e46d5fab03f9dc
|
File details
Details for the file omron_sysmac_simulator-0.1.2-py3-none-any.whl.
File metadata
- Download URL: omron_sysmac_simulator-0.1.2-py3-none-any.whl
- Upload date:
- Size: 17.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abacc0adb015bb60143aa6d705c69291ee5cd5ba9fee5d43d54976f601fa6e8c
|
|
| MD5 |
47ab00b7feddda07954d9c94a3ebb78b
|
|
| BLAKE2b-256 |
6eb1e6d5269c04ff34b3ce9bccaebec5534d8c677c97341fa13306d74739939c
|