Programming the Strategy Controller

<< Click to Display Table of Contents >>

Navigation:  Strategy Controller >

Programming the Strategy Controller

Previous pageReturn to chapter overviewNext page

 

The Strategy Controller is an event driven engine and therefore requires a completely different approach to programming from the more traditional procedural programming such as Basic.

 

The events are edge-driven so that they only fire when a change occurs. Therefore in an event that says, for example, 'If Bool1 = On' will only fire once, and will only fire again if the Boolean goes to Off and then back to On.

 

The order which events fire cannot be predetermined. The only way to ensure a particular sequence is to use the Enable-if mechanism.

For example:

Event: 'When Temp > 100'

Event: 'When  Pressure > 20'

 

If it is important that the Temp is checked first (and its actions performed) and then the Pressure, use the Enable On Boolean as an 'AND' operator:

(This example uses a SpecView User Variable 'Bool1')

Event: 'When Temp > 100 enable-if Bool1 is Off'

Action: ...

Action: 'Set Bool1 to On'

Event: 'When Pressure > 200 enable-if Bool1 is On'

Action: 'Set Bool1 to Off'

Action: ...

 

The actions for an event are performed in the order that they are listed.

 

The 'Startup event' is a 'Value Based Event' and can be used to initialize variables. There can only be one Startup event defined, but it can have many Actions, which are typically used for initialization of variables.

 

SC_StartupEvent

 

Therefore in order to create a Strategy Controller 'program' it is necessary to think of it in terms of events & actions. Write down all the significant events (such as values going outside thresholds) then think of the actions which need to be done when those events occur.

 

The list of Events in the Strategy Controller are always listed in alphabetic order. Therefore to make reading and understanding the list easier it is useful to number the events so that they are shown in an order which the programmer would expect,

For example:

000 Startup

010 When Temp > 100 & Bool1 Off

020 When  Pressure > 20 & Bool1 On

030 etc...

 

Leave intervals of, say, 9 between the event numbers to allow the addition of events in the future without the need to re-number them.

 

Step-by-step example of using the Strategy Controller