News:

  • October 26, 2025, 11:27:23 PM

Login with username, password and session length

Author Topic: TMRA in a stage  (Read 8411 times)

plcnut

  • Hero Member
  • *****
  • Posts: 813
    • premiersi.com
TMRA in a stage
« on: April 10, 2013, 11:41:40 AM »
I have a TMRA in a stage, and it is resetting every time I JMP.
I know the TMR resets, but I thought the TMRA would hold it's accumulated value.
Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
http://premiersi.com

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3762
    • Host Engineering
Re: TMRA in a stage
« Reply #1 on: April 10, 2013, 12:20:50 PM »
Yeah, that's one of those "scoping" A vs. B decisions.

Will customers be accumulating timer WITHIN the stage, off and on, or is this an INTER-STAGE TMRA (e.g. allow multile TMRA's across various stages???).  We chose to implement it as the FORMER, vs. trying to support multiple TMRAs across multiple stages.

If you need it to behave like an INTER-STAGE TMRA, then it needs to be scoped at the top of your program code-block, NOT within a specific stage.  You will have to stick it in ladder logic ABOVE your first stage, then the accumulator-leg will also need the S bit contact in serial with your existing logic.

An alternative is to save off the accumulator value at the JMP OUT of the stage, then load it back in when you get back to that stage (a positive differential contact w/S bit at the top of the stage can do that nicely; similarly a negative differential contact w/S bit at bottom of the stage can capture the accumulator value nicely).

plcnut

  • Hero Member
  • *****
  • Posts: 813
    • premiersi.com
Re: TMRA in a stage
« Reply #2 on: April 10, 2013, 12:23:30 PM »
I was afraid you might say something like that...
I placed it in the top of my ladder and that works fine.
Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
http://premiersi.com

Maxwell

  • Jr. Member
  • **
  • Posts: 18
Re: TMRA in a stage
« Reply #3 on: April 12, 2013, 07:36:36 PM »
I ran into this same issue of TMRA values resetting when the stage turns off on a recent project.  In my case, I wasn't really trying to continue the timer in other stages, but I had several timer values that were used in multiple processes and knowing the actual run time in cases where conditional logic might end a process early was very important to me.  I had planned to record data including the timer values in dedicated stages after each process run stage, but I ended up adding the data logging logic into each of the process run stages instead so that I didn't lose the timer values. No big deal, but it did make the run stages longer and more complicated. 

I understand the logic of handling the timers the way Host did.  I guess there are pluses and minuses both ways.  I think it would be helpful if this was spelled out in the Stage section of the on-line help file.

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3601
  • Darth Ladder
Re: TMRA in a stage
« Reply #4 on: April 12, 2013, 09:36:32 PM »
I often increment an integer in lieu of an accumulating timer (which would resolve the issue with getting reset on stage termination).

The caveat there, depending on the accuracy you're looking for, is the source of the bit that triggers the increment.  If you use a PLC internal flasher bit (that's not reset with the event you want to time), you may have up to a cycle and a half or so of inaccuracy in your accumulated count, not per count, but per each time you start and stop the accumulation.  You may have to write a local timer to eliminate any inaccuracy caused by the phase of the trigger bit if it's critical.
« Last Edit: April 14, 2013, 07:10:24 PM by Controls Guy »
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

plcnut

  • Hero Member
  • *****
  • Posts: 813
    • premiersi.com
Re: TMRA in a stage
« Reply #5 on: April 12, 2013, 10:28:55 PM »
I learned some bad habits with missusing stages in DS. DMD has the tools to do it right, and so now I'm trying to learn proper structure and practices.
Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
http://premiersi.com

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6127
  • Yes Pinky, Do-more will control the world!
Re: TMRA in a stage
« Reply #6 on: April 12, 2013, 10:55:49 PM »
I learned some bad habits with missusing stages in DS. DMD has the tools to do it right, and so now I'm trying to learn proper structure and practices.

Yeah...those darn Host guys spoiling everybody's fun. ;)

In truth, we're ragging on it because we *love* Stage and are trying to oversee a bit of a renaissance of it. It gets so misused...in many cases due to other deficiencies in DL...that lots of folks are very anti-Stage. That is unfortunate. Used correctly you can do some amazing things very efficiently with it, but until and unless folks start using it the right way for the right reasons, they will continue to struggle with it and it will continue to be maligned. So we continue to play that one stringed banjo..."use Stages for sequencing"...in the hopes that eventually it will take root.

Once the light turns on, and it clearly has for you, you will never go back. ;D
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

plcnut

  • Hero Member
  • *****
  • Posts: 813
    • premiersi.com
Re: TMRA in a stage
« Reply #7 on: April 13, 2013, 09:41:11 AM »
I'm a stage fan, but when I first started I didn't use enough stages. And then I also (without realizing it) was using them for modularity. Little by little I'm learning. ;)
Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
http://premiersi.com