csen

Často kladené otázky

Entering mathematical expressions

Instead of writing the tag name, you can enter mathematical expressions. This way you can scale and offset the values read from the PLCs or create more complex data processing. These expressions can be entered either directly or through the dialog window.

11.2.1

11.2.2

In the equations you can use operators + – * / and common mathematical functions such as sin, cos, exp, etc…  You can also do a binary comparison and much more. To get the complete list of options, call the Tag Dialog and click on the tab Equation.

11.2.3

Formatting and Limits

  • Tag name is entered by the adr() function
  • Tag name can be also entered as an alias using the alias() function
  • You can use only supported functions and operators

The supported functions and operators are listed under the input box and are broken down into five groups: Oper, Func, Trig, Vers, and Const – they will be inserted into the box if selected.

You can use multiple tags in an expression.

Example:

  1. We read a value from Modbus H:0
  2. Let’s scale this value by 10 and offset it by 0.5
  3. Formula to enter is: =10*adr(H:0)+0.5

Supported Functions and Operators:

Operator

Function

Description

Standard Operators

+

add

addition and unary positive

– r –

Substract and negative

subtraction and negation

o

Multiply

multiplication

r÷

Divie

division

 

Percnt

modulus and percentage of a value

!

Facoial

factoria

**

Po

exponential

 

Deg

converts values to radians

Bitwise Operators

&

An

btise and

|

Or

bitwise or

^

Xor

bitwise xor

~

Not

bitwise not

<< 

Ishift

bitwise left shift

>> 

Rshift

bitwise right shift

Comparison Operators

=

I_eq

equal

!=

I_neq

not equal

< 

I_It

less than

> 

I_gt

greater than

<= or ≤

I_toe

greater than or equal

>= or ≥

I_gtoe

greater than or equal

Logical Operators

&& or _

I_and

logical and

|| or _

I_or

logical or

! or ¬

I_not

logical not

Degree operator °

The degree operator (°) is very useful when converting user input. Because all of the trigonometric functions require their parameters to be in radians, the degree operator will convert its operand into radians. Thus, 45° is equivalent to dtor(45).

Percentage sign %

When the percent sign is interpreted as the modulo, then:

10 % 3 … evaluates to 1 (the remainder after 10 is divided by 3); however, if you flip the switch to make the % sign stand for percentage, then it becomes:

250 + 10%

By default, the percentage sign % is usually shorthand for “/100”. In other words, 42% becomes 42/100 or 0.42.

However, if the % term on the right-hand side of subtraction or addition (such as in “250 + 10%”), then the percent is evaluated as a percentage of the left-hand side (i.e. “250 plus 10% of 250”).

If you choose to interpret the percent sign as the modulo operator, you can still request a percentage by using the function name directly:

(10 % 3) + percent (50) = 1.5

Factorial and Logical Not (!)

Differentiating between factorial (!) and logical NOT (!) is more difficult.

Logical NOT is interpreted as factorial (!) only if:

  • it is the first token
  • it is preceded by a binary operator
  • it is preceded by a right associative unary operator

Otherwise (!) is always treated as factorial and the negating token ¬ as logical NOT.

Supported Functions

Functions using more than one parameter:

  • sum() – returns a sum of the passed parameters
  • count() – returns the number of passed parameters
  • min() – returns the minimum of the passed parameters
  • max() – returns the maximum of the passed parameters
  • median() – returns the median of the passed parameters
  • stddev() – returns the standard deviation of the passed parameters
  • average() – returns the average of the passed parameters
  • random() – returns a random integer. Can take 0, 1, or 2 parameters. The first parameter (if given) is the lower bound of the random integer. The second parameter (if given) is the upper bound of the random integer.
  • nthroot() – returns the nth root of a number; for example, nthroot(27,3) returns the cube root of 27, or 3.

Functions using one parameter:

  • sqrt() – returns the square root of the passed parameter
  • log() – returns the base 10 log of the passed parameter
  • ln() – returns the base e log of the passed parameter
  • log2() – returns the base 2 log of the passed parameter
  • exp() – returns e raised to the power of the passed parameter
  • ceil() – returns the passed parameter rounded up
  • floor() – returns the passed parameter rounded down

Trigonometric functions:

  • sin(), cos(), tan()
  • inverses (asin, acos, atan)
  • reciprocals (csc, sec, cotan)
  • reciprocals of the inverses (acsc, asec, acotan)
  • hyperbolic variations (sinh, cosh, tanh, asinh, acosh, atanh, csch, sech, cotanh, acsch, asech, acotanh)
  • versine functions (versin, vercosin, coversin, covercosin, haversin, havercosin, hacoversin, hacovercosin, exsec, excsc, crd)
  • dtor() – converts the passed parameter from degrees to radians
  • rtod() – converts the passed parameter from radians to degrees

Functions using no parameters (“constant functions”):

  • phi() – returns the value of ϕ (the Golden Ratio), also recognized as ϕ()
  • pi() – returns the value of π. Also recognized as π()
  • pi_2() – returns the value of π/2
  • pi_4() – returns the value of π/4
  • tau() – returns the value of τ. Also recognized as τ()
  • sqrt2() – returns the value of the square root of 2
  • e() – returns the value of e
  • log2e() – returns the value of the log base 2 of e
  • log10e() – returns the value of the log base 10 of e
  • ln2() – returns the value of the log base e of 2
  • ln10() – returns the value of the log base e of 10

The parentheses are used for grouping sub-expressions and setting the order of execution, and they can be nested to any depth. All computation is carried out with a double precision floating point. In the case of error, the editor shows a warning, and the error expressions will not be evaluated.

You can always check the validity of the entered expression Clicking on the Test button.

11.2.4

Click on OK after completion to see the expression in the Tag(Address) field.

Examples of valid expressions:

  • adr(N100:0)*adr(F30:10)
  • sin(adr(N100:0))+cos(adr(F30:10))
  • median(adr(N100:0),adr(F30:10),adr(N20:5),adr(F10:10))
  • Note: Multiple arguments should be separated with commas 2>=1. Logical operations always return binary result (0 or 1).

Nenašli jste co jste hledali?

Kontaktujte nás.
ZAVOLEJTE
  • +420 541 217 220
Nebo nám napište a my se ozveme.
  • Obchodní oddělení
  • Technická podpora
  • Servis/Reklamace
  • Webmaster

AMiT Automation s.r.o.

  • info@amit-automation.cz
  • +420 541 217 220
    +420 549 210 403
    +420 549 210 276

Vídeňská 186/118


619 00 Brno


Česká republika

IČO: 276 52 203


DIČ: CZ27652203

Česká rada pro šetrné budovy

MODERNÍ ELEKTRONIKA PRO PRŮMYSLOVOU AUTOMATIZACI A AUTOMATIZACI BUDOV

Copyright © — AMiT Automation
Přihlášení a registrace
Registrací souhlasíte s našimi obchodními podmínkami a se zpracováním osobních údajů.

We often send out our newsletter with news and great offers. We will never disclose your data to third parties and you can unsubscribe from the newsletter at any time.

Unfortunately, we’re unable to offer free samples. As a retailer, we buy all magazines from their publishers at the regular trade price. However, you could contact the magazine’s publisher directly to ask if they can send you a free copy.

You can create a new account at the end of the order process or on the following page. You can view all of your orders and subscriptions in your customer account. You can also change your addresses and your password.

No, you don’t have to create an account. But there are a few advantages if you create an account.

  • You never have to enter your billing and shipping address again

  • Find all of your orders, subscriptions and addresses in your account

  • Download invoices of your orders

No, we don’t have a physical store location at the moment. We accept only orders through our online shop and we’re shipping all orders with the Swiss Post Service. Please visit our shipping section for more details.

From time to time you will find us at design fairs and popup markets in Switzerland. Subscribe to our newsletter and you’ll receive the latest news.

Tab Content

This is a basic text element.
Smazat účet?
Určitě si přejete smazat účet?

Tuto akci nelze vrátit zpět.
Fakturační a doručovací údaje

Pro zobrazení tohoto formuláře se musíte přihlásit.

Zapomenuté heslo

Zadejte svůj e-mail, na který vám zašleme odkaz pro obnovení hesla.

Přihlášení a registrace
Registrací souhlasíte s našimi obchodními podmínkami a se zpracováním osobních údajů.

We often send out our newsletter with news and great offers. We will never disclose your data to third parties and you can unsubscribe from the newsletter at any time.

Unfortunately, we’re unable to offer free samples. As a retailer, we buy all magazines from their publishers at the regular trade price. However, you could contact the magazine’s publisher directly to ask if they can send you a free copy.

You can create a new account at the end of the order process or on the following page. You can view all of your orders and subscriptions in your customer account. You can also change your addresses and your password.

No, you don’t have to create an account. But there are a few advantages if you create an account.

  • You never have to enter your billing and shipping address again

  • Find all of your orders, subscriptions and addresses in your account

  • Download invoices of your orders

No, we don’t have a physical store location at the moment. We accept only orders through our online shop and we’re shipping all orders with the Swiss Post Service. Please visit our shipping section for more details.

From time to time you will find us at design fairs and popup markets in Switzerland. Subscribe to our newsletter and you’ll receive the latest news.

Tab Content

This is a basic text element.
Přidat do seznamu
+ Přidat nový seznam