I. Introduction to Offline Simulation Function
(I) The significance and role of offline simulation
After editing the program using ZDevelop programming software, which is independently developed by ZDevelop Motion Technology, debugging can be easily solved using the built-in simulator ZMCSimulator in the ZDevelop programming software, even without controller hardware. Basic, PLC, and HMI programs developed by ZDevelop can all run on the simulation platform, including machine vision programs, which can also be simulated.
ZDevelop software supports offline simulation and debugging, allowing users to debug the program's logic, motion control, and communication functions. In the absence of a controller, the program can be simulated and debugged first, accelerating the overall project progress.
ZDevelop V3.10, the latest version of programming software, has a simulation function based on the VPLC5 series controller, which combines motion control and machine vision. It can also be equipped with touch screen simulation, providing a one-stop solution for PLC, Motion, Vision, HMI and other needs.
Offline debugging is the same as the actual debugging process on the controller platform. When using it, you only need to pay attention to the differences in hardware resources between the simulator and different controller models.
(II) Materials required for offline simulation
1. Computer.
2. ZDevelop programming software (with built-in emulator and xplcscreen touchscreen emulator).
Download the compressed package from the official website of Zmotion Technology (www.zmotion.com.cn), extract it, and run the application directly; no installation is required.
II. Hardware Platform Operation
If the hardware is available, the control module can be wired according to the following reference configuration:
The ZMC306X series controller has 6 pulse axes and can expand the number of pulse axes via CAN bus, supporting up to 12 axes of linear interpolation, arbitrary circular interpolation, spatial circular interpolation, helical interpolation, electronic cam, electronic gear, synchronous following, virtual axis setting, etc.; it can realize real-time motion control by adopting an optimized network communication protocol.
The communication interfaces include RS232, RS485, RS422, Ethernet, USB flash drive, and CAN.
The controller's input ports 0-1 support latching, and output ports 0-1 support PWM. It has two analog input and two analog output interfaces with 12-bit precision and a voltage range of 0-10V.
It supports the functionality of XPLC for positive motion technology, and uses ZDevelop software for HMI programming and configuration development, which can be configured and displayed over a network.
It can also connect to touchscreens from other manufacturers via serial port or network port. Any touchscreen that supports the MODBUS communication protocol can be connected to the positive motion controller.
III. Offline Simulation Function
Emulator resources: After connecting the emulator, enter ?*max in the online command prompt to view the output.
Emulator version: VPLC5xx-SimuVersion:4.91-20180213. The number of resources supported varies slightly depending on the emulator version.
The following are some of the parameters for printing: For a complete explanation of all parameters, please refer to the text description below the video.
max_axis: 64 Maximum number of axes for all axes
max_motor: 64 Maximum controllable number of motor shafts
max_movebuff: 4096 Maximum motion buffer for each axis or axis group.
max_in:27,4096 This is the maximum number of IN inputs supported by the controller.
`max_out: 15,4096` represents the maximum number of built-in OUT outputs and the maximum number of OUT outputs supported by the controller.
`max_ain:0,520` specifies the maximum number of analog inputs supported by the controller.
`max_aout: 2,520` specifies the maximum number of analog outputs supported by the controller.
max_pwm: 4 Number of PWM outputs
max_slot: 1 Number of buses
max_comport: 3 Number of serial ports
`max_ethport:3` specifies the network communication connection with the PC and API functions.
max_ethcustom:2 Custom network interface communication connection
max_ethiport:1 Ethernet communication connection for interconnection between the positive motion technology controller and other systems.
Four simulators are used
Without a controller, programs written using ZDevelop software support online simulation, and simulation and debugging are supported in all three programming modes (basic/PLC/HMI).
Usage steps:
1. Program editing: Open the ZDevelop software and edit the program.
2. Connect to the emulator: In the menu bar, select "Controller" → "Connect to Emulator". After clicking, a message indicating successful connection to the emulator will be printed, and the emulator interface will open.
3. Download the program to the emulator: Select "Download to RAM" or "Download to ROM" to download the program to the emulator and start running it.
The debugging function can be turned on when the program is running to debug the program or monitor its operation.
When connecting to the emulator, if you want to debug USB drive-related commands, create a simulated USB drive folder named udisk in the root directory of the ZDevelop programming software. Place the files needed for USB drive command operations into this folder. This folder will be used for loading and storing data when using USB drive commands.
Signal input in five simulation modes
Since actual sensors cannot be connected during simulation debugging, all functions related to external inputs are unusable. In this case, users can manually input simulated external signals to trigger them. The methods for manually simulating inputs for digital and analog quantities are different.
1. Digital Input
Using the simulator, as shown in the image below, you can click on "Input Simulation" to simulate digital input.
Alternatively, you can enter the command ZSIMU_IN in the online command bar to simulate digital inputs. The input number range on the simulator is 0-23. Inputs after the number range must be simulated using the command.
Syntax: ZSIMU_IN(input number, status)
2. Analog Input
The ZSIMU_AIN command simulates analog signal input.
Syntax: ZSIMU_AIN(input number, scale)
Analog signals are available in 12-bit and 16-bit precision. The analog signal interface built into the controller is generally 12-bit precision.
Both input and output are voltage scales, which are converted into corresponding voltage values according to the range. The 12-bit precision scale is 0-4095, corresponding to a voltage of 0-10V; the 16-bit precision scale is 0-65535, corresponding to a voltage of 0-10V.
A scale mark of 0 corresponds to an input voltage of 0V, and a full scale mark corresponds to a voltage of 10V.
Analog outputs use the AOUT command.
Syntax: AOUT(output number) = scale value
Six-touchscreen simulation operation
The ZHD touchscreen and controller in the positive motion technology primarily interact by transferring register data or calling SUB sub-functions. Touchscreen buttons access or retrieve register values for display, and pressing a button sends data to the controller or calls a sub-function, thus enabling human-computer interaction.
If a touchscreen is not available, a touchscreen program can be simulated, displaying the touch interface on a PC. Configuration programs written using the HMI programming method of ZDevelop software can be simulated on XPlcscreen.
No additional configuration is required when simulating the touchscreen. When using it, be sure to set the auto-run task number for the HMI touchscreen file before downloading the program to the emulator.
Touchscreen simulation operation process:
Method 1: Open the zpj file in ZDevelop software, connect to the ZMCSimulator simulator, and download the controller program and HMI touch screen program to the simulator together (note that the HMI program must be set to run automatically, otherwise it will not run). In the simulator, click "Display" to open xplcsreen and display the touch screen interface.
Method 2: After downloading the program to the simulator or controller, open the xplcterm application in the screen folder in the ZDevelop software root directory, or open it through the ZDevelop software shortcut button. After selecting the controller IP (simulator IP 127.0.0.1), the configuration interface will be displayed.
7 Third-party touchscreen simulation
The simulator for positive motion technology can be used in conjunction with third-party software for simulation. When in use, it connects to the simulator for positive motion via IP address 127.0.0.1.
Taking Weintek as an example, first download the controller program to the simulator, then use EasyBuilderPro to open the Weintek touchscreen configuration program, open the "System Parameter Settings" window as shown in the figure below, and add the device to be connected to the touchscreen.
The device list will display the local touchscreen and local devices. If you already have a local device, you can connect directly. If you do not have a local device, click "New Device/Server..." to bring up the device properties window.
You only need to change the device type and IP address.
Device type: Select mode MODBUSTCP/IP (Zero-based Addressing). The interface type is automatically changed to Ethernet.
IP: Enter the IP address of the controller to be connected, i.e., the IP address of the motion simulator.
After completing the settings, confirm and close the "System Parameter Settings" window.
Click "Online Simulation" in the menu bar to start compiling the configuration program. Once successful, it will establish a connection with the positive motion simulator and display the Weintek touch screen interface. The operation interface can send data to the simulator to realize the control process.
This concludes our offline simulation and debugging tutorial for ZhengMotion Technology, designed to expedite project progress.
For more exciting content, please follow the "Zheng Motion Assistant" WeChat official account. For related development environment and example code, please contact Zheng Motion's technical sales engineer: 400-089-8936.
This article is original content from Zheng Motion Technology. We welcome everyone to reprint it for mutual learning and to jointly improve China's intelligent manufacturing level. Copyright belongs to Zheng Motion Technology. Please indicate the source if you reprint this article.