Industry Online Support
Technical Forum
10/3/2012 5:22 PM  
Posts: 55 Rating: (1) 
Hello Experts I am trying to use a timer preset value in a math function to calculate Rate Of Change for a process value. The goal is to have logic that will run a timer and calculate rate of change for temperature. I was trying to use SFB4 timer function. At T=0, store the temperature as START_TEMP. At T=X (Timer Preset Value), store the temperature as END_TEMP. Then (END_TEMP  START_TEMP) / Timer Preset Value. This will allow me to change the timer preset to 1 minute, 10 minutes, etc and have the Rate of Change calculation give me the rate for the same time period. How can I use the Timer Preset in the division equation? Or is there a better way to do this? Regards 
10/3/2012 6:54 PM  
Joined: 1/28/2009 Last visit: 9/21/2021 Posts: 6739 Rating: (1308)

Hello, To do the task,the easiest way using "TIME" data type.This data type shows how many "ms" is in selected period. To obtain number of "seconds", you should divide the "TIME" by 1000 as "DINT". Also possible to find out the number of minutes! My suggestion would be conversion of data type "TIME" to its "REAL" equivalent which can be freely used in Arithmetic and Mathematics instructions. [code] L MD 100 //Data type TIME L 1000 /D DTR T MD 104[/code] Check a very detailed discussion here: Variable Time Value TimerBest regards, Hamid Hosseini 
This contribution was helpful to1 thankful Users 
Follow us on