This example shows how to generate logic for IO cards in bulk.


Objectives:

Create ControlLogix-Routines for Card/Module-Status, and Input and Output-Signal-Handling automatically based on a provided I/O Configuration.


Requirements:

1) Creation of a Periodic Task for I/O signal handling

2) Creation of separate IO signal handling routines for each IO-Module.

3) Creation of Logic and Module-Alarms.


Step 1

Create a new project and give it a Name



Step 2

Enter all the needed information (name, status, etc.) and save the Project Element (PRJ001)



Step 3

Right-click on the Project Element and select "Import Branch"



Step 4

Point to the import file "PLC Rack and IO generation.kiptr" and click "Open"


(go to the end of this page to find attachments)





Step 5

After successful import, you can switch to Studio5000 and add your IO cards.

Save your file as *.L5X.




Step 6

Now, add the *.L5X file to Kiptr. You need to attach it to the "Empty L5X Project with IO cards” element. 

Select this element in the tree and click on the “Edit” button, click on "Add file" and "Upload".


(go to the end of this page (attachments) to find an example L5X project)



Navigate to your recently saved L5X project and click Open. Now, click “Save” to upload the file.



Step 7

Once the file is uploaded - navigate to the "Configuration" element.


Click "Edit" and select your desired action:

  • Generate IO Map from L5X file
  • Generate L5X file from IO Map
  • Generate new L5X from defaults.


Gen IO Map from L5X

This option will generate an Excel spreadsheet that will list all your IO cards arranged by the IO rack.

Every tab of the sheet will correspond to one rack (local or remote).

Each tab will list all the IO cards by their order in the rack.

Each card will list all the IO channels, their type, default logic for each card, and default logic for each channel.


Note: This option will NOT generate an L5X file.


Gen L5X from IO Map

This option will generate the L5X file with the logic taken from the Excel Spreadsheet (attached to element “IO Map”) instead of default logic from Configuration elements.


Gen L5X from defaults

This option will generate the new L5X files with the default logic - taken from Configuration elements. This option will not generate an IO Map spreadsheet. 



Step 8

The "Configuration" elements contain all the default values for each IO card type.



“Prefixes” define if an IO card belongs to a certain type.

For example, prefix IA will include cards like 1756-IA16, 1756-IA8D, 1769-IA16, and others. The script will parse the catalog numbers of all cards and sort them depending on the prefixes found. The number of channels is also detected automatically by the script.


“Add lead zero to Ch” field defines if a leading zero should be added to the channel number of this IO type. Leading zeros may or may not be required for different types of cards and versions of Studio5000 software. For example, V28 requires a leading zero for AI cards (Local:15:I.Ch00Data) and requires its absence for AO cards (Local:16:O.Ch0Data).



“Default Card Logic” element contains up to 10 rungs of code that will be included at the beginning of each routine. One routine will hold the logic for one card. This logic can be changed either in the element or in the IO Map. Logic should be in "Neutral Text" format.

(Check screenshot "Neutral Text" at the end of the document)


“Default Channel Logic” element contains up to 10 rungs of code that will be included for each of the IO channels. This logic can be changed either in the element or in the IO Map (IO Map allows the change for each individual channel). Logic should be in "Neutral Text" format.


Placeholders for logic already added o script:

${parent} Parent of the card (Remote Rack or such)

${position} Position in the rack

${channel} IO Channel number

${name} Name of the card (routine)

${EntryStatusTagName} Name of tag to store Entry Status value (consists of card name + "_EntryStatus")

${Connection_OKTagName} Name of tag that holds connection status to the card

  (consists of card name + "_Connection_OK")


You can add more to the script code.


Step 9

Once the desired action is set and saved - select the “PLC Rack script” and click “Run Script” button.


Note: The generation of the L5X file may take up to several minutes depending on the amount of IO channels.



Note: You can check the progress and the presence of errors in the browser console. To get to the console in Chrome - please go to View -> Developer -> Javascript Console.



Example of option: "Gen L5X from IO Map"



"Neutral Text" selection in Rockwell Studio5000 software