1. Home
  2. Engine
  3. Logic Overview

Logic Overview

Logic Structure 

Tags

  • Naming convention
  • Layout vs Param
  • HMI
  • Cross Reference vs Searching
  • Test tags

Structure 

All S88 objects have the same structural components.

  • Each is in its own program area
  • Main routine – (first routine) that tracks when to process specific objects and jumps into them.
  • Instance routine – (first or second routine) that begins the processing of a specific instance.  This may be mixed in with the main routine.
  • {object}_ACM… routines – (optional) Monitor for and raise abnormal conditions (scanned at different rate than object)
  • Series of supporting routines arranged in the order they are processed.  Includes many AOIs.
  • {object}_Interface routine – processes commands from other objects.  All objects are isolated from one another so they must communicate through input/output buffers via AOIs.  All commands ultimately end up in the target’s interface routine to be processed.
  • _Configuration routine(s) – processes downloaded configuration data and redirects instance pointers to the newly downloaded data. It is only called after an S88 Builder Studio download is completed.
  • …_Custom routines – All custom logic must be added to a routine that ends in the work Custom.  All other routines are considered S88 Builder firmware and are subject to change without notice.

Logic 

All S88 object have the same logical layout.

Main Routine 

  • Test for download to be complete
  • Some overhead pre-processing
  • Loop through all instances to determine which needs processed and to jump into that instance.
  • Process Overhead Custom Logic
  • Check for orphaned objects

Instance Routine 

  1. Copies instance from controller array to a local tag.
  2. Reads CP and PB inputs from HMI via an AOI
  3. Processes object data, modes and state machine
  4. Updates HMI status and parameters via an AOI
  5. Updates interface status to be shared with all other objects via an AOI called {object_OUT}.
  6. Returns the local instance tag to the global controller array element.

Troubleshooting 

Scanning 

  • Local vs Global tags All program areas include a local tag for the object being processed that is a copy of the global tag.  This greatly improves the performance, simplifies programming and makes it easier to read.
  • All local tags start with a lowercase to distinguish that they are local.
  • Each object has a monitor tag to focus the logical scanning on a specific object to aid in debug.  The name of the monitor tag is {object type}Monitor.

IDs

Objects are known to the control system by an ID number that indicates its position in a controller scoped array named after the object in its plural form, such as EMs[] or Units[].  Every object has at least 3 IDs and CMs have 4.

  • ID – This is the standard ID that is configured in S88 Builder (except for CMs).  This ID points the objects element in the “Home” controller array.  This ID may be duplicated across multiple controllers.
  • S88B ID – This is a global ID that simply prefixes the local ID with the controller ID.  For example Unit 3 in controller 2 would have a S88B ID of 2003.  This is why the highest addressable object is 999 in any one controller.  This ID is used by the firmware to identify the origin of an object and what is downloaded from S88 Builder Studio.
  • Local ID – This ID is not shown in S88 Builder Studio and is calculated by the controller from the S88B ID.  Every controller will calculate a different local ID.  However, the “Home” controller will calculate the local ID to be the same as the configured ID.  This is the ID that is provided when examining any object ID and always refers to that object when accessing via the “Interface” arrays.  There is an AOI called SToL that returns the Local ID given any S88B ID.
  • Class ID (CMs Only) – CMs have a side array unique to their class and this ID points, which is configured in S88 Builder Studio, points to an element of that array representing the object.

Configuration

  • Has one or more configuration routines.
    • The configuration routine is only called on first scan or after an S88 Builder download is complete.
    • Only one object configuration runs each scan so it will take 7 scans to complete.
    • When downloading from S88 Builder, some values go directly into active areas and take effect immediately.  Others go to unused areas of “dynamic” arrays and are unused until the download is complete and the configuration routine is processed.  Then those arrays are compressed and all object pointers are redirected to the newly downloaded information to be used on the same scan.

Commands / Status 

  • All objects command other objects through the same command structure via AOIs.
  • All commands go through a set of output/input message buffers (even if the target is local to the source) and end up in a unique set of command buffers to be processed later.
  • Local commands short circuit the message buffers and are processed immediately.
  • All commands ultimately end up in the target’s interface routine to be processed.

Command Structure 

Hdr (SID, Type, Context) – SID, S88B ID, and type indicates who is the target of the command. Context indicates the type of control (Acquiring, Controlling, Status, etc.)

Owner (SID, Type, Context) – indicates who is the originator of the command

Context – Indicates the command message

Set, Ivalue, Value, Data – represent the command data in different forms

Scan Rates and Sleeping 

S88 objects are not called every controller scan but periodically based on a configured scan rate.  All objects have a scan rate to determine how often to process the objects.  Most also have a sleep rate because they will doze off if not used for a few seconds.   Once sleeping, the object is scanned at a much slower rate.  There are several tags that may be set to wake up the object and/or force a faster scan.

  • WakeUp – Forces the object to be processed on this or next scan if it is sleeping.  Has no affect if the object is already awake.
  • ScanNow – Forces the object to be processed on this or next scan regardless if it is asleep or awake.
  • CallBack – Same as ScanNow but is set within the object.
  • Interrupt – Same as ScanNow but also force the object to process its abnormal conditions (reserved for inputs and process conditions)

 

Sleeping

An object will automatically wake up and scan now:

  • Its faceplate is opened (wakeup only)
  • It gets a command from another object
  • The status of a lower level object or input changes that it is monitoring

Abnormal Condition Management (ACM) 

Acquiring 

Alert 

Clear Failures

Updated on January 8, 2019

Related Articles

Password Protected