Automation Studio Project
The first step is to create a new project by opening Automation Studio and then choose ‘New Project’.
After creating a project, give it a name and select ‘next’.
To define the hardware, select ‘Define a new hardware configuration manually’ and click ‘Next’.
Choose the desired controller, which in this example is ‘X20CP1584’ and click on ‘Finish’.
After selecting the hardware, in the ‘Logical View’ window on the left side, click on ‘Global.var’ and define the variables.
Once the variables are defined, create the program in the ‘Toolbox’ window on the right side of the screen, and select ‘Program’.
In this tutorial we are going to create two different programs. One to map the bytes variables into bit variables, and the other one to program the PLC logic.
First select ‘Program’, and pick ‘ST Program All In One’. Secondly select ‘Program’ again and pick ‘LD Program’.
Double click ‘IOmapping’ and assign the I/O variables to the bytes in the order seen in the image, first inputs and then the outputs.
Next, double click ‘Program’ and introduce the inputs and outputs like in the following image.
Once the program is created, the OPC-UA connection needs to be configured between Simumatik and Automation Studio. Inside ‘Physical View’ window, right click on the X20CP1584 hardware and select ‘Configuration’. Within ‘OPC-UA System’ select ‘ON’.
Once OPC-UA is activated, in the ‘Configuration View’ window, within X20CP1584 / Connectivity double click on OpcUA. In the ‘Toolbox’ window on the right side of the screen, double-click on ‘OPC UA Default View File’.
Double click on the ‘OpcUaMap.uad’ file that has been created.
Once inside the ‘OpcUaMap.uad’ file, first press ‘Build’ and then ‘Refresh Default View’ so that the declared global variables appear.
When the ‘Global Variables’ appear, select all of them and press ‘Enable Tag’.
To transfer the program, first press ‘Activate Simulation’, and once in ‘Run’ mode, press ‘Build’.
After building the program, click on ‘Transfer’ in the ‘Project Build’ and ‘Transfer to target’ windows.