Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched.
Close
You can make use of the SysTime library, get the starting time in st1 and the stop time in st2, then calculate the elapsed time inbetween. It can be within a cycle or several cycles later, it doesn't matter.
Hi,
I need to calculate step value for some time period like this:
bStep=(targetLevel-currentLevel)/(timePeriod/t#10ms)
targetLevel,currLevel,bStep - REAL
timePeriod - TIME
my TON1 has PT:=t#10ms and when TON1.Q I need to add bStep to bValue
Now I have Type mismatch in division so I think I need to convert TIME to REAL, or TIME to INT and INT to REAL
Is it possible?
Best Regards
Marek
Sorry newbie question
Conversion Operator TIME_TO_REAL
Best Regards
Marek
because the scantime is a problem, check if you can get the needed precision.
maybe you need the clocktime to get enough accuracy of the step.
another way to get correct results, is by adding the step/time in a way like an x/y line can be computed.
You can make use of the SysTime library, get the starting time in st1 and the stop time in st2, then calculate the elapsed time inbetween. It can be within a cycle or several cycles later, it doesn't matter.