Formulas

From Phobos Wiki
Revision as of 09:03, 26 February 2015 by Roland (talk | contribs) (Uus lehekülg: 'Formulas are used quite often to group some signals, to control many objects with one command or do to some other logic.<br /> '''Columns:'''<br /> Type, Sub Type , Invert, Obje...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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 - as 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
Näide Näide Näide Näide Näide
Näide Näide Näide Näide Näide
Näide Näide Näide Näide Näide
Näide Näide Näide Näide Näide
Näide Näide Näide Näide Näide
Näide Näide Näide Näide Näide
Näide Näide Näide Näide Näide
Näide Näide Näide Näide Näide
Näide Näide Näide Näide Näide


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 2 / AI/CN Division @101/2 2 ^ AI/CN Exponentiation @101^2 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 with Normalized values that 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 double 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.