Retentive Timers with no RTO command

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.
 
Heh, just realized you could also

  • TIME_TO_INT EffortTimer_MS EffortTimeInt
and then

  • COMPUTE (EffortTimeInt ÷ gTotal_EtSecInt_Standing) ÷ 10.
 
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.

Heh, just realized you could also

  • TIME_TO_INT EffortTimer_MS EffortTimeInt
and then

  • COMPUTE (EffortTimeInt ÷ gTotal_EtSecInt_Standing) ÷ 10.

These worked great, straightforward solutions for a simple problem. I'll be more aware of INT division going forward, thanks everyone.
 

Similar Topics

I am posting to pick your brains. I am trying to create an automated maintenace notification system for equipment. The one obstacle I think I am...
Replies
5
Views
2,310
Anyone please Whats the different between the retentive and non-retentive timers
Replies
4
Views
11,595
Does anybody know the maximum number of retentive timers I can use in a Mitsubishi FX series? As far as I can tell it's 10(T246-T255). Problem is...
Replies
4
Views
5,811
Ok here is my problem. Below is a picture of the ladder i am using to control two timers. T13 is simply a looping timer that counts down from 60...
Replies
19
Views
10,249
Back
Top Bottom