drbitboy
Lifetime Supporting Member
I have run into one more issue. This RTO is tracking how long a user does work/effort in a session. Now that I have the ACC time from the RTO, lets call it "EffortTimer_MS", I converted it to seconds and then from TIME to INT type ("EffortTimeInt") and have this displaying on my HMI. I want to simply find how much the effort was done over the session (PercentEffort). Its simple enough to find, and if I live monitor each value I have a value for each, but the output of the compute block is 0. I'm assuming there is something glaringly obvious I am missing.
Yes, it is an integer divide, which has in an integer with the remainder truncated, so if EffortTimeInt is 499 and gTotal_EtSecInt_Standing is 500, then the Compute expression [EffortTimeInt ÷ gTotal_EtSecInt_Standing] is [499 ÷ 500], which is [0 remainder 499], and since the remainder is discarded the result of the expression is integer 0.
Try (EffortTimeInt * 100) / gTotal_EtSecInt_Standing? It will still round down i.e. discard the percent remainder, but it will be closer to what you want.
Or you could convert everything to REALs.