| View previous topic :: View next topic |
| Author |
Message |
nehidjayounes Junior

Joined: 13 May 2014 Posts: 3
|
Posted: 20/08/2014 11:59 Post subject: ANALOGIC FLOW TRANSMETER FUNCTION BLOC |
|
|
CAN ANYONE HELP ME TO UNDERSTAND THIS FUNCTION BLOC
OUT:=REAL_TO_INT ((YMAX-YMIN)/(XMAX-XMIN)*(INT_TO_REAL(IN)-XMIN)+YMIN);
IF INT_TO_REAL(IN) <XMIN> XMAX THEN
OUT:=REAL_TO_INT(YMAX);
END_IF;
 |
|
| Back to top |
|
 |
zeck Member 2

Joined: 08 Mar 2014 Posts: 308
|
Posted: 20/08/2014 20:24 Post subject: Re: ANALOGIC FLOW TRANSMETER FUNCTION BLOC |
|
|
| nehidjayounes wrote: | CAN ANYONE HELP ME TO UNDERSTAND THIS FUNCTION BLOC
OUT:=REAL_TO_INT ((YMAX-YMIN)/(XMAX-XMIN)*(INT_TO_REAL(IN)-XMIN)+YMIN);
IF INT_TO_REAL(IN) <XMIN> XMAX THEN
OUT:=REAL_TO_INT(YMAX);
END_IF;
 |
what you not understand...?
OUT:=REAL_TO_INT ((YMAX-YMIN)/(XMAX-XMIN)*(INT_TO_REAL(IN)-XMIN)+YMIN);
This is for scaling the analog value.
IF INT_TO_REAL(IN) <XMIN> XMAX THEN
If the value goes under min_value or over max_value then
at output the max-value.
OUT:=REAL_TO_INT(YMAX);
REAL_TO_INT and others are cast operators...convert real to integer for example... |
|
| Back to top |
|
 |
|