Assigning more program types (= creating new instances)

Condition for the assignment of more program types: You have already created/saved the code or the logic for the program types (e.g. the ST-code). The program types have unique names and can be identified by its icon images/download/thumbnails/409862636/Program-version-1-modificationdate-1531214393443-api-v2.png in one of the views with projects and resources.

By default, one program type is already assigned in the PLC-object, after you have created a project. logi.CAD 3 provides the possibility to assign more program types. This creates new program →instances .

How to create a new program instance within the application navigator:

  1. Make the application navigator visible

  2. Point to the program type that is displayed below the folder Project blocks (or a subfolder of it).

  3. Press and hold the primary mouse button and drag the program type onto the →task that can be identified by its icon images/download/thumbnails/443056981/TaskPLC-version-1-modificationdate-1584622010056-api-v22.png and is displayed below the configuration and the resource within the application navigator .

  4. Release the primary mouse button.
    Result: The application navigator displays a new program instance that can be identified by its iconimages/download/thumbnails/414778740/ProgInstance-version-1-modificationdate-1534256819027-api-v22.png . This program instance has got the name of the program type and is displayed below the task. The PLC-object has been enhanced by the appropriate lines for the program instance and program type (see the following description and example for details).

How to create a new program instance within a PLC-object:

  1. Open the PLC-object.

  2. In the opened editor for the PLC-object, search for the already existing lines with the names of the program →instance and of the program type:

    Example for lines with program instance and program type
    PROGRAM TemplateInstance WITH DefaultTask :
        MyFirstProgram;
  3. Copy these lines onto the clipboard and paste them directly under the lines with the program instance and the program type – as often as you need the lines.

  4. Correct all pasted lines.

    Example for lines with program instance and program type (after the correction)
    PROGRAM TemplateInstance WITH DefaultTask :
        MyFirstProgram;
    PROGRAM Instance_2 WITH DefaultTask :
    TestProgram_2; 
    PROGRAM Instance_3 WITH DefaultTask :
    Counter;  

    Required corrections of the pasted lines:

    1. Replace the name of the already existing program instance (e.g. TemplateInstance) by a new name (e.g. Instance_2).

    Optional corrections of the pasted lines:

    1. Replace the name of the program type (e.g. MyFirstProgram) by the name of a different program type (e.g. TestProgram_2).
      Use the content assist to enter the assigned program type within the PLC-object quicker.

    2. Replace the name of the task (e.g. DefaultTask) by the name of a different task (e.g. SlowTask). Details: see "Declaring more tasks within PLC-object".

  5. Save the PLC-object: menu fileSave

If you load the application onto the PLC, the assigned program types are scheduled on the PLC according to the priority of the task. If multiple programs are assigned to the same task, these programs are executed successively on the PLC – execution is in the same order as the program instances have been entered in the PLC-object. Observe that your used →target system might also influence the scheduling of →POUs in the application (see "Properties and restrictions specific to the target system").

Restrictions

Observe the following for the scheduling of different program types – this is contrary to the →IEC-standard:

  • logi.CAD 3 does not provide information so that you are able to determine whether all POUs complete execution before being scheduled for re-execution.

  • logi.CAD 3 does not notify, if a task fails to be scheduled or to meet its execution deadline because of excessive resource requirements or other task scheduling conflicts.