可以自己写一个:
-- AI转工程值
FUNCTION AItoP : real
VAR_STAT
En: bool;
END_VAR
VAR_INPUT
iAI: int;
iPLow: int;
iPHigh: int;
rPLow: real;
rPHigh: real;
END_VAR
VAR_OUTPUT
rVal: real;
END_VAR
VAR
iTmp: int;
rTmp1: real;
lTmp1: lint;
lTmp2: lint;
rTmp2: real;
END_VAR
-- ST程序
lTmp1:=INT_TO_LINT(iAI-iPLow);
lTmp2:=INT_TO_LINT(iPHigh-iPLow);
rTmp1:=LINT_TO_REAL(lTmp1);
rTmp2:=LINT_TO_REAL(lTmp2);
rVal:=rTmp1/rTmp2*(rPHigh-rPLow)+rPLow;