Main page
PLC functions
Small tools
Technical links
Other links
Some information
Back to home
 Reactions: E-mail

Working people make mistakes, some people do never make mistakes! Working people
I work to live, my boss thinks I live to work!

Here are the functions i've made using mathematical functions in a plc.
The most are very easy, but mostly effective to make a program more readable. The variable type that is used can mostly easy be converted to another type. You have to change the In and Outputs of the FC's and change the math function to the type used in the new function.
Not all functions are tested to the bone!

download awl source (incl. functions.)

Symbol table:
Limit (int) FC 1040FC 1040Limit (int)
Y = a.X+b (int) FC 1041FC 1041Linear formal: Y = a . X + b
X = (Y-b)/a (int) FC 1042FC 1042Linear formal: X = (Y - b)/ a (invert of FC1040)
Y = a.X^2+b.X+c (int)FC 1043FC 1043formal: Y = a.X^2 + b.X + c

limit: FC 1040: Limits a value and write the min. or max. value is not in range.

Input: EN Enable function
Min Lower limit of the value
Max Upper limit of the value
In-/Output: Value If value is smaller then min then the value is set equal to min
If value is bigger then max then the value is set equal to max
Output: ENO If value is changed ENO is high.
top

Y=ax+b: FC 1041: Linear function Y = a.x + b

Input: EN Enable function
a, b & X The variables of the function
Output: Y Result of Y = a.x + b (linear formal)
ENO If there was an error in the formal ENO is high.
top

X=(Y-b)/a: FC 1041: inverted linear function X=(Y-b)/a

Input: EN Enable function
a, b & Y The variables of the function
Output: X Result of X = (Y - b)/ a (opposite of the linear function described above.
ENO If there was an error in the formal ENO is high.
top

2nd degree function: FC 1043: 2 end degree function

Input: EN Enable function
a,b,c & X The variables of the function
Output: Y Result of Y = a ·X² + b ·X + c
ENO If there was an error in the formal ENO is high.
The opposite formal:
X =-b ±√(b² - 4 ·a ·(c-Y))
2 ·a
It's possible, but I have not made it yet.
top