Low cost solutions to Data Acquisition & Control.
Data Sheets and Application Notes Product Warranty Return Policy How to Order Company Profile
 

 

Click for the BBB Business Review of this Computer Software Publishers & Developers in Fort Walton Beach FL  

Weeder Technologies
90-A Beal Pkwy NW
Fort Walton Beach FL 32548
850-863-5723
info@weedtech.com

Established: 1989
DUNS: 969723154
CAGE CODE: 4T5L9
 

Conditionals

Conditional statements, which are much like an IF/THEN statement in common programming languages, are used by ModCom to watch for certain events or conditions during run-time and then act upon them by executing a function or series of functions. Such a condition may be the reception of a specific data string from a Data Module, a Data Window which equals or exceeds a certain value, a Signal Lamp which turns on or off, a Text Window which displays a certain message, or even the system clock which reaches a specific time of day. Conditionals are very useful for reporting alarm trips, halting a Script when conditions mandate it, testing a multitude of Screen Objects for a specific outcome, as well as other functions which require some form of decision making.

To create or edit an existing Conditional statement, select "Conditionals" in the <Run-Loop> menu which will bring up the Conditional List dialog box. The following is a summery of the options available in this dialog box:

Conditional List Dialog Box:

Selection List: This is the list of current Conditional statements if any have been created. This field will be blank if you have not yet defined any Conditionals for this project.

Modify:

New: Click on this button to add a new Conditional statement to the project. This will bring up another dialog box which can be used to define the specific properties of the Conditional. See "Conditional Properties" below for more details.

Edit: To use this option, a Conditional must first be selected from the list at the left. Click on this button to edit the selected Conditional. This will bring up another dialog box which can be used to edit the properties of the Conditional. See "Conditional Properties" below for more details.

Delete: To use this option, a Conditional must first be selected from the list at the left. Click on this button to delete the selected Conditional from the project.

Copy: To use this option, a Conditional must first be selected from the list at the left. Click on this button to copy the selected Conditional and place it on the clipboard. This will then enable you to open another project and paste this Conditional into it.

Paste: To use this option, a Conditional must first be copied and placed on the clipboard. Click on this button to paste the current contents of the clipboard into the project.

Export: Click on this button to export all of the Conditional configurations to a file named "Conditionals.txt". This file can then be imported into another project, used for documentation, or edited using a text editor. Note, if editing make sure to maintain the same format as shown in the original file including all blank lines in the body as well as at the start and end of the file.

Import: Click on this button to import the Conditional configurations from the file named "Conditionals.txt". Note, any pre-existing Conditionals in this project will be deleted.

Conditional Properties Dialog Box:

ID Label: Type in the name of this Conditional statement.

If this expression evaluates to true:

Expression Edit Box: Use this box to compose a logical or relational expression. The "If" portion of the expression is implied and should not be included. An expression can contain logical operators (AND, OR, XOR), relational operators (>, >=, <, <=, =, <>), arithmetic operators (+, -, *, /), as well as parenthesis used for grouping. The number of operators is not limited however, to be recognized by ModCom each operator must have at least one space or carriage return on each side of it. When this expression evaluates to TRUE, ModCom will execute the Script which consists of the series of functions listed below. Note, this Script will execute only once even if the expression remains TRUE for an extended period of time. The expression will have to evaluate to FALSE before this Conditional can be triggered again.

To act on a Screen Object which reaches or exceeds a specific value, list it as a variable by encapsulating the Screen Object's ID label in curly braces like this: {DataWindow1} The value of two different Screen Objects can be compared to each other in this same fashion. To act on a specific data string which is received from a Data Module, use the global variable {recdata} which equals the last data packet received by the COM port. The global variable {systemtime} can be used to test for a specific time of day. See How to use variables for more info including a list of global variables which can be used in a Conditional expression.

Execute this Script:

Function List Box: This box will show the list of events or functions which will be performed when the above condition is TRUE. To edit the event list, click on the "Edit Script" button at the right which will pull up the Script Configuration Dialog Box.

Script Configuration Dialog Box:

ID Label: This will be automatically set to the same name as the Conditional ID label and can not be edited.

Available Functions: This box lists all of the Functions available to be used in the Script. Select an item and then click on "Add Step" to add it to the step list of the Script. Then click on "Edit Step" to edit the properties of that particular function.

Step List: This box lists all of the individual steps or events which make up the Script. When the conditional expression evaluates to true, these steps will be executed from top to bottom. Use the modify buttons at the right to edit each step or to move it up or down in the execution order.

Modify:

Add Step: To use this option, a function must first be selected from the "Available Functions" box on the left. Click on this button to add that function to the step list of the Script.

Edit Step: To use this option, a step must first be selected from the "Step List" box on the left. Click on this button to edit the selected step. This will bring up another dialog box which can be used to edit the properties of that particular step. See "Script Step Properties" below for more details.

Delete Step: To use this option, a step must first be selected from the "Step List" box on the left. Click on this button to delete the selected step from the Script.

Copy Step: To use this option, a step must first be selected from the "Step List" box on the left. Click on this button to copy the selected step and place it on the clipboard. This will then enable you to paste this step at multiple positions in the execution order, or to open another project and paste this step into it.

Paste Step: To use this option, a step must first be copied and placed on the clipboard. Click on this button to paste the current contents of the clipboard into the project. You can then use the "Move Up" and "Move Down" buttons to position the step appropriately.

Move Up: To use this option, a step must first be selected from the "Step List" box on the left. Click on this button to move the selected step one place up in the execution order.

Move Down: To use this option, a step must first be selected from the "Step List" box on the left. Click on this button to move the selected step one place down in the execution order.

Script Step Properties:

Step Function:

Depending on the particular function, one or more edit fields will appear and should be used to define the specific properties required for the operation of this function. Such as entering in data and/or Screen Object names, etc. Refer to the function's definition for details. Note, the edit fields in this dialog box supports variables.

Data Format of a Screen Object:

Keep in mind that the data format of any user-entered value which is being compared to the value of a Screen Object is determined by the type of Screen Object being tested. With a Data Window, Level Gauge, Dial Gauge, or Meter Gauge this number should be the decimal equivalent of the data value regardless of the type (Dec, Hex, Bin) chosen to be displayed in the Screen Object's window. With a Signal Lamp, this value should be the word "On" or "Off". With a Button Array, this value should be the title of one of the buttons in the array. With an Event Timer or an Input Window using a time format, this value should be a valid time structure such as one of the following:

"seconds" (with or without digits to the right of the decimal point)

"hrs:min:sec" (with or without digits to the right of the decimal point)

"hrs:min" (no decimal point)

A Conditional is also capable of testing for a specific text string, such as any message which is displayed in a Text Window, or an "Error" message shown by a data polling Screen Object which has timed out. The later being invaluable if there is a need to act upon or notify the operator in the event of any communications problems. A text string can be evaluated using the "equal to" or "not equal to" operators only, the "greater than" and "less than" operators can not be used and will always return FALSE. Note, quotation marks around the text are not necessary and should NOT be included, and any spaces are stripped from the text string before evaluating.