Introduction
Sysmac Studio includes the ability to run your NA Project inside a simulator to check the functionality without needing to transfer to the actual NA HMI hardware. For more on the basics of the NA Simulator go to the 'Introduction To The NA Simulator' article.
In addition to basic simulation, Sysmac Studio has more advanced features that allow you to run the NA simulator alongside the integrated NJ simulator allowing you to test your project without the need for any hardware.
Sysmac Studio also allows you to pause the running of the NA simulator while running a VB.NET subroutine to allow you to single step through the code and be able to manually change the values of variables.
This article introduces these more advanced simulator features and how to use them.
Integrated Simulation of NA and NJ
To start integrated simulation, click on ‘Simulation | Start NA Integrated Simulation’. Like standalone simulation this will build the project if necessary and then launch both simulators. The user is asked which NJ controller they would like to simulate (if there are multiple controllers in the same project).
In the same way, integrated simulation can be started from the NJ side of the project and the user must then choose which HMI they wish to simulate.
Integrated simulation allows for testing of the relationship between the HMI and the controller, data can be more realistically controlled to reflect the real machine. The simulator can only simulate the one HMI and one Controller at the same time.
Setting Breakpoints
A breakpoint causes the simulator to pause during execution. It is only possible to use breakpoints when using the simulator (not a real NA). Breakpoints can be set on any line of VB.NET code. These can be set either before launching the simulator, or whilst running the simulator. To set a breakpoint there is an option in the simulation menu, or it is possible to click on the left hand margin within the code (or just press F9 whilst on a line of code).
There is an option to ‘Clear All Breakpoints’ which can be used when required.
When a breakpoint is reached during runtime, the execution stops and control returns to Sysmac Studio. The user is then able to control the program execution manually using the Simulation menu:
Step Over – Run the highlighted line of code and move onto the next line
Step In – If the line of code is a subroutine, step into the subroutine and keep debugging
Step Out – If currently in a subroutine, run until you have finished the subroutine.
Continue – Run until you reach another break point
Using the Watch Window
When execution is paused (e.g. a breakpoint is reached) variables can be added to the watch window by typing the variable name and using the intelli-sense prompt. For arrays, square brackets must be used (note: multi-dimension arrays are not supported in by the NA).