Code Generation Option for Non Template Robots

Generate POU Instances Option

With the Add Robot... dialog, you can create a program and call the robot instance and its corresponding task automatically.

Step

Action

1

For Node type (1), select Non  Template.

2

For Generate POU instance (2), select Yes.

G-SE-0069644.1.gif-high.gif

 

 

Generated POUs

If you select the Generate POU instances option, the three following elements are added to your project:

oA call program SR_Call_<Robot Name> (PRG) is added to your project.

G-SE-0065750.2.png

oA corresponding task TASK_SR_Call_<Robot Name> is added to your project.

G-SE-0065753.2.png

oThe POU call of the call program SR_Call_<Robot Name> (PRG) within the task is added to your project.

G-SE-0065754.1.gif-high.gif

After the automatic generation procedure by the system, the project can be build and downloaded to the controller.

NOTE: Once a robot node has been added to the Module structure, the node type cannot be modified. For further information about using the code generation option, refer to chapter Call Robot in Your Program.

Trigger for Program Call Regeneration

The most efficient way to exchange data with the robot is via ModuleInterface.

G-SE-0065757.1.gif-high.gif

 

 

For details, refer to Data Exchange with ModuleInterface.

Regeneration Trigger

If you added / deleted variables within the ModuleInterface dialog and then entered the Configuration data object under <Robot Name>, the call program SR_Call_<Robot Name> (PRG) is regenerated with the modified ModuleInterface variables.

The regeneration procedure implies the following for the program SR_Call_<Robot Name> (PRG):

oVariable declaration is adapted because of adding / deleting variables (1).

oCall of robot is adapted because of adding / deleting variables (2).

G-SE-0065759.2.gif-high.gif

 

 

Adding User-Specific Code to the SR_Call_<Robot Name> Program

Additional user-specific variables

Define additional user-specific variables in the declaration part of the SR_Call <Robot Name> program:

G-SE-0065761.1.gif-high.gif

 

 

Additional user-specific code

Only integrate additional user-specific code in the body of the generated program call at the following positions:

oBefore the generated code part (1) or

oAfter the generated code part (2)

G-SE-0065762.2.gif-high.gif

 

 

After code regeneration, the declaration is slightly different because there is only one section per variable type:

oThe section of the user-defined local variables is merged with the section of the generated local variables.

oThe other variable type sections (VAR_INPUT, VAR_OUTPUT, VAR_IN_OUT, …) remain unchanged.

G-SE-0065764.1.gif-high.gif

 

 

The body part remains unchanged after code regeneration if the following considerations are observed for additional code implementation:

G-SE-0065766.2.gif-high.gif

 

 

Restrictions Regarding Program Call Regeneration

Do not modify the system generated declaration and implementation of the code snippets.

This is essential for program call regeneration of the generated code.

Do not modify this generated variables block.

G-SE-0065768.2.gif-high.gif

 

 

Do not modify this generated body block (including the two comment lines).

G-SE-0065771.2.gif-high.gif