Formulas: Difference between revisions

From Phobos Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 2: Line 2:


'''Columns:'''<br />
'''Columns:'''<br />
Type, Sub Type , Invert, Object Adr ^, DB %Fs, Inp. Min, Inp. Max, Outp. Min, Outp. Max, Forb.Ports - as in Objects Tab Card<br />
'''Type, Sub Type , Invert, Object Adr ^, DB %Fs, Inp. Min, Inp. Max, Outp. Min, Outp. Max, Forb.'''-Ports same as described in Objects Tab Card<br />
Formula: Formula string<br />
'''Formula:''' Formula string<br />
Comment: Comment of the formula<br />
'''Comment:''' Comment of the formula<br />
DO/AO addr.: Address of the object controlled by formula.<br />
'''DO/AO addr.:''' Address of the object controlled by formula.<br />
Execution count: The number of control operations executed. <br />
'''Execution count:''' The number of control operations executed. <br />
Delay Delay in seconds, delay applies to on and off state<br />
'''Delay:''' Delay in seconds, delay applies to on and off state<br />
Forb. DO The number of DO, which control is forbidden with the result of this formula <br />
'''Forb. DO:''' The number of DO, which control is forbidden with the result of this formula <br />
Enable First Control: If set to Yes, then control described in DO/AO will take place right after Telem device restart, otherwise change in the formula is necessary for control command.<br />
'''Enable First Control:''' If set to Yes, then control described in DO/AO will take place right after Telem device restart, otherwise change in the formula is necessary for control command.<br />


Formulas can be created between the values of analog and/or digital objects.
Formulas can be created between the values of analog and/or digital objects.
Line 37: Line 37:
|"-"||AI/CN||Subtraction||@101-0,49||3
|"-"||AI/CN||Subtraction||@101-0,49||3
|-
|-
|"*"||AI/CN||Multiplication||@101*2||2
|"*"||AI/CN||Multiplication||@101*2,0||2
|-
|-
|"/"||AI/CN||Division||@101/2,0||2
|"/"||AI/CN||Division||@101/2,0||2
Line 72: Line 72:
To remove a Formula, select Remove Formula  
To remove a Formula, select Remove Formula  
and to clear all formulas, select Clear.<br />
and to clear all formulas, select Clear.<br />
All analog values should be scaled before making calculations; therefore, it is very important to fill the Inp. Min, Inp. Max, Outp. Min, Outp. Max fields with Normalized values that are used in calculations.<br />
All analog values should be scaled before making calculations; therefore, it is very important to fill the '''Inp. Min, Inp. Max, Outp. Min, Outp. Max''' fields when normalized values are used in calculations.<br />
AI values can be comma separated values, while CN have only full scale values. (AI=1,7 while CN=2)<br />
AI values can be comma separated values, while CN have only full scale values. (AI=1,7 while CN=2)<br />
After editing the formula, the program automatically validates this formula and shows the result in the status area. If the formula is incorrect, the background of the edited formula is changed to pink and an error message is displayed in the status area. This formula will not be written to the device nor will it be saved.<br />
After editing the formula, the program automatically validates this formula and shows the result in the status area. If the formula is incorrect, the background of the edited formula is changed to pink and an error message is displayed in the status area. This formula will not be written to the device nor will it be saved.<br />
Line 80: Line 80:


'''Editing formulas'''<br />
'''Editing formulas'''<br />
Formulas can be edited form the formula string directly. In the formulas tab card, but it is more convenient to double click on the string and choose edit formula, then more information about the formula is visible.<br />
Formulas can be edited form the formula string directly. In the formulas tab card, but it is more convenient to right click on the string and choose edit formula, then more information about the formula is visible.<br />
 
Telem GW has the possibility to create formulas using PLC functionality. For enabling the PLC functionality, two folders: ActivePLC and plcEditor (provided by Martem AS) have to be copied to the same location as configuration tool GWS.<br />
Telem GW has the possibility to create formulas using PLC functionality. For enabling the PLC functionality, two folders: ActivePLC and plcEditor (provided by Martem AS) have to be copied to the same location as configuration tool GWS.<br />
'''Using PLC or editing formulas'''<br />
'''Using PLC or editing formulas'''<br />
Open configuration window and click on PLC button. PLC configuration window opens.<br />
Open configuration window and click on PLC button. PLC configuration window opens.<br />
Line 88: Line 90:
To use formula maker or editing formulas configuration has to be exported to .csv file format.<br />
To use formula maker or editing formulas configuration has to be exported to .csv file format.<br />
For opening or saving .csv file in formula maker choose:<br />
For opening or saving .csv file in formula maker choose:<br />
system>GWs<br />
:system>GWs<br />
file>open<br />
:file>open<br />
Saved .csv file has to be opened with Formula Maker.<br />
Saved .csv file has to be opened with Formula Maker.<br />


Note: PLC function changes only formula line, other parameters in the formula tab card such as Type, subtype etc. have to be changed in the GWS.
'''Note:'''<br />
PLC function changes only formula line, other parameters in the formula tab card such as Type, subtype etc. have to be changed in the GWS.

Latest revision as of 12:51, 20 March 2015

Formulas are used quite often to group some signals, to control many objects with one command or do to some other logic.

Columns:
Type, Sub Type , Invert, Object Adr ^, DB %Fs, Inp. Min, Inp. Max, Outp. Min, Outp. Max, Forb.-Ports same as described in Objects Tab Card
Formula: Formula string
Comment: Comment of the formula
DO/AO addr.: Address of the object controlled by formula.
Execution count: The number of control operations executed.
Delay: Delay in seconds, delay applies to on and off state
Forb. DO: The number of DO, which control is forbidden with the result of this formula
Enable First Control: If set to Yes, then control described in DO/AO will take place right after Telem device restart, otherwise change in the formula is necessary for control command.

Formulas can be created between the values of analog and/or digital objects. Referencing to object values To use the measurement object in the formula, insert an @ sign together with the object address up. Example: @101 points to the value of the object with an address to uplink 101.
Constants
Constants can be used in formulas. Example: 1.1+2.2+3.0 consists of 3 floating point constants. Analog constants should have at least one place after comma. (e.g. 1.0)
Brackets
Brackets should be used in formulas to change the priority of the operation. Example: sqrt(@101/2+@102); (@201+@202+@203)/3

Oper Obj. type Description Sample Priority*
and DI Logical conjunction @201and@202 5
or DI Logical disjunction @201or@202 6
xor DI Exclusive disjunction @201xor@202 6
not DI Logical negation not@201 0
dbl DI Converts 2 single digital inputs into a double signal @202dbl@201,where @202 – ON state signal @201 – OFF state signal 7
"+" AI/CN Addition @101+3,2 3
"-" AI/CN Subtraction @101-0,49 3
"*" AI/CN Multiplication @101*2,0 2
"/" AI/CN Division @101/2,0 2
"^" AI/CN Exponentiation @101^2,0 1
"<" AI/CN Greater than @101<0,499 4
> AI/CN Less than @101>0,5 4
sqr AI/CN Square sqr(@101*10) 0
sqrt AI/CN Square route sqrt(@101*10) 0
sin AI/CN sin@301 0
cos AI/CN cos@301 0
tan AI/CN tan@301 0
arcsin AI/CN arcsin@301 0
arccos AI/CN arccos@301 0
arctan AI/CN arctan@301 0
  • Priority determines the order of operations in the formula (highest priority is 0)

Notes
By clicking on the „+“ button, a new formula row with default settings is added.
By clicking on the button „-“ , the selected formula row is removed.

Formula rows can also be added, removed or cleared by using the extended control menu like in the Object Tab Card. It appears with a right mouse click on the Formula Tab Card.
To add a Formula, select Add Formulas, To remove a Formula, select Remove Formula and to clear all formulas, select Clear.
All analog values should be scaled before making calculations; therefore, it is very important to fill the Inp. Min, Inp. Max, Outp. Min, Outp. Max fields when normalized values are used in calculations.
AI values can be comma separated values, while CN have only full scale values. (AI=1,7 while CN=2)
After editing the formula, the program automatically validates this formula and shows the result in the status area. If the formula is incorrect, the background of the edited formula is changed to pink and an error message is displayed in the status area. This formula will not be written to the device nor will it be saved.
The formulas of DI type of objects can contain AI values and floating point constants. If the result of the formula is greater than 0, the value of the DI object is “1”; if the result of the formula is less than or equal to 0, the value of the DI object is “0”.
< or > statement: if the statement is true, the value of the DI object is 1; if the statement is false, the value of the DI object is 0.

Editing formulas
Formulas can be edited form the formula string directly. In the formulas tab card, but it is more convenient to right click on the string and choose edit formula, then more information about the formula is visible.

Telem GW has the possibility to create formulas using PLC functionality. For enabling the PLC functionality, two folders: ActivePLC and plcEditor (provided by Martem AS) have to be copied to the same location as configuration tool GWS.

Using PLC or editing formulas
Open configuration window and click on PLC button. PLC configuration window opens.
Double click on Main button in the upper left hand corner to open PLC configuration window. When main window is opened, user can choose logical function and variables. When PLC window is closed, logic functions are exported to formulas tab.
Another method or creating and changing formulas is to use Formula Maker (provided by Martem AS). To use formula maker or editing formulas configuration has to be exported to .csv file format.
For opening or saving .csv file in formula maker choose:

system>GWs
file>open

Saved .csv file has to be opened with Formula Maker.

Note:
PLC function changes only formula line, other parameters in the formula tab card such as Type, subtype etc. have to be changed in the GWS.