OpenLCB: RR-CirKits Tower LCC+Q STL Editor

The Tower LCC+Q node from RR-CirKits has the same I/O capabilities as the original Tower LCC. The logic Conditionals have been replaced by a subset of the PLC (programmable logic controller) language from Siemens. The Siemens statement line language (STL) is a high performance language with a small memory requirement.

Here is the logic to set the aspect for a single head mast.

CLR // Signal mast B
= Q0.0
= Q0.1
= Q0.2
O I0.4
O I0.5
O I1.1
= Q0.2
JC E1
A Y0.0
= Q0.1
JC E1
SET
= Q0.0
E1: CLR // Signal mast C
etc.
      

The STL logic is based on item states instead of item change events. LCC events are collected in the input table (I) variables. The logic is processed every 20 ms with the true/false results set in the output table (Q) variables. At the end of the cycle, the LCC events for changed output variables are sent to the LCC network.

The STL Editor consists of a LCC node selector, five data tabs, a number of toolbar buttons and a File menu. The basic mode is to select a LCC node which loads the logic data. The node selector only shows Tower LCC+Q nodes. When changes have been made, they can be stored using the Store button.

Offline work is supported by exporting and importing the content using a CSV file set. This is a set of five files stored in a selected directory in the user files location. Each Tower LCC+Q node will need its own directory.

The online and offline modes can be used together. For example, select the node which loads the data. After making changes, export to CSV for a backup. Then do a store and compile. Later some offline changes are made and exported. To get them back to the node, select the node which loads the old data. Do the import to overwrite the old data and then do the store and compile.

The STL Editor has been added to the OpenLCB/LCC menu.

stl openLCB/lcc menu

Node Selector

The node selector lists the available Tower LCC+Q boards. Other LCC nodes are not shown. When a node is selected, the logic content will be loaded. If this is the first time the node has been selected during the PanelPro session, the load takes a long time. A dialog is shown while the load process is working.

stl cdi loading

When the load finishes, the dialog will close. If the node had been previously loaded, such as doing CDI configuration, the load is very fast and the dialog is not shown.

STL Editor

The STL Editor provides an alternative method for editing the STL code. It translates the code into a table that has 4 columns. The Label column has the jump labels. These are one to four character words and a colon (:). The Operator column contains a drop down with all of the PLC operators. The Name column contains names. This will have the user friendly name if one was defined in the IQYZ (input, output, receiver, transmitter) tables. Other "names" include labels for jump operators, timer definitions, Mn.n memory variables, etc. The Comment column is for comments. Note: Comments take up a lot of room.

stl editor tab

The program code is stored in the node. There are 16 logic groups. Each group has a 255 byte space. The percent button is used to calculate the current space utilization.

The Label data is validated to make sure that it has the proper format.

stl label error

Logic Inputs (I)

The Logic Inputs table has 128 entries. They are numbered from 0.0 to 15.7 (16x8). If names have been assigned to the rows, then the editor will translate between the In.n variable name and the user friendly name. Each row has two event ids. The first one is the event that the logic treats as true and the second for the event that is treated as false. The user has to decide what is true and what is false. In the image, thrown turnouts and active sensors are true. From a logic point of view, think of "is it thrown?" and "is it occupied?".

stl input tab

The event id format is validated for the IQYZ tables.

stl event error

Logic Outputs (Q)

The Logic Output table has 128 entries. They are numbered from 0.0 to 15.7 (16x8). If names have been assigned to the rows, then the editor will translate between the Qn.n variable name and the user friendly name. Each row has two event ids. The first one is the event that the will be sent when the variable has changed to true and the second for the event that will be sent when the variable has changed to false. The output events are only sent when the variable state changes between true and false.

In this image, the output events are signal aspects. The aspect will be sent when the variable changes to true. The sample PLC code at the beginning of this page shows 3 aspects being set to false. The subsequent logic will set one of them true. The net result is that at most one aspect will change from true to false and one will change from false to true. Most of the time, one variable will be set to false and then back to true. Only an occupancy change, turnout change or destination mast change (link speed) will result in two variables changing. The aspect false events use a zeros event with the aspect id in the last two bytes.

stl output tab

Track Receivers (Y)

The Track Receivers table has 16 entries. The Signal LCC Rule to Aspect has a Link Address for each mast, such as 02.01.57.10.01.6B.01.80. The link address is a node specific value and cannot be changed. The link address has to be copied and pasted from the Signal LCC.

In the Signal LCC, each mast Rule is assigned a track speed value. The default is Stop (0). These values translate to a number from 0 through 7. This number replaces the last digit of the link address when the aspect changes.

The actual receiver variable names consist of the row number and the speed number, such as Y0.7. That is the "Clear" speed for the first circuit. For the STL Editor, the Yn.n names are converted to the friendly name with a tilde and the speed number, such as Right-EB-Circuit~7.

stl receivers tab

Track Transmitters (Z)

The Track Transmitters table has 16 entries. Each entry will contain the link event id. The link event ids are node specific and cannot be changed.

Each Track Transmitter maps to 8 aspect/speed settings. These are 0 through 7. This results in Zn.n variable names. To represent this as a user friendly name, the STL editor name is name~n. The tilde character is the separator between the row name and the aspect/speed number.

stl transmitters tab

Tool Bar Buttons

File Buttons

Import

Import a CSV file set from a directory in the user files location. If the current data has changed, a warning dialog will request confirmation to revert the data.

stl select import directory

Select the directory and click on Select. Double clicking on the folder opens folder instead of selecting it.

Export

Export a CSV file set to a directory in the user files location.

stl select export directory

Select the directory and click on Save. Double clicking on the folder opens folder instead of selecting it.

If a new folder is created, it is necessary to back up one level and re-select the new folder.

Refresh

Reload the current data from the current node. If the current data has changed, a warning dialog will request confirmation to revert the data.

Store

Update the data on the current node. The current editor table content is converted to the PLC format using an encoding process. If the resulting PLC code is greater than 255 bytes, the encoding error dialog is shown (See the percent button). Only changed data is stored. The store complete dialog will be displayed when done.

stl store done

If there are changes that require compiling the STL logic, another dialog will be displayed.

stl compile required

If Use the CDI Configuration dialog to do the reboot is selected, use Configure Nodes ⇒ Open Configuration dialog to reboot the node. The reboot invokes the PLC compiler. The Syntax Messsage segment has to be checked for compile errors. Click on the Refresh button for Message 1. If it shows "Success, no syntax errors found" then the compile was good. If it has an error, also check the other messages.

If Have the STL Editor do the reboot is selected, the node will be rebooted. When the reboot and compile finish, the first syntax message will be displayed. Here is a good result.

stl compile good

Here is a result with an error.

stl compile error

If it shows "Success, no syntax errors found" then the compile was good. If it has an error, also check the other messages using the CDI configuration dialog.

The Import, Refresh, node selection and backup imports check for unsaved changes. A confirmation dialog is displayed if necessary.

stl revert warning

Editor Buttons

Add
Add a blank row to the end of the list.
Insert
Add a blank row above the selected row.
Move Up
Move the selected row up.
Move Down
Move the selected row down.
Delete
Delete the selected row.
Percent
Do the PLC encode process and calculate the utilization. If the resulting code is more that 255 bytes, a dialog is displayed. It shows the data that would be truncated during a store.
stl encode overflow

File Menu

The File menu has menu items that are the same as the tool bar file buttons.

stl file menu

The file menu also has a Load a CDI Backup file item. This extracts the STL data from a CDI backup file.

stl load backup