Resetting a totaliser yearly

JonAW

Member
Join Date
Sep 2013
Location
Somewhere
Posts
121
Hi Guys,

I hope someone here can help me. I'm using an ML1400 with RSL500, I want to take a pulse output 1P/L from a flow meter, totalise it and reset it each year. I'm happy doing this monthly, daily, hourly etc but I'm not sure how to reset the total when the RTC:0/yr changes. Can anyone help me?

thanks

Jonny
 
There are a couple of ways your could do this.


You could always just use the month (RTC:MON) inside and EQU.
When RTC:MON = 1 then oneshot (ONS) the RESET for your totalizer.
This will reset it on January 1st at 0001 every year.



Or you could make 2 rungs.
One you will have NEQ with source A being RTC:YR and source B will be another integer (N7:0) that reflects the current year, then have your totalizer reset output on the end of this rung

Rung # 2 will be unconditional MOV that Moves RTC:YR to N7:0.

This way the rung with your reset will be true once when the year changes and the next rung will move the current year into the NEQ source B. So your totalizer reset will only be true one scan per year.

Hopefully I worded this correctly.

BCS
 
Last edited:
Hi Bering C Sparky thanks for the quick reply. It makes sense alright. I had thought of version 1 but my problem with that is it is likely the machine will be isolated in the evenings which could mean that in the instance of Jan 1st xxxx 0001hr the machine may be switched off so the instruction wouldn't be able to run. Possibly the same case with version 2 as well. How would I force the reset on the initial re-powerup of the machine?

thanks

Jonny
 
Well I would think that version 2 would work in that case.
Machine is powered back on and will scan program, see year different, reset totalizer and them move current yr into N7:0

Attached is an example of version 2.

However if you are totalizing something for a year then it is highly likely that you will need to use another method than a simple counter as shown in my example.

I am pretty much a novice myself, but there are lots of talented people here who can give you better advice if I am leaving something out or missing something.


EDIT:
Sorry just dawned on me what you were saying about version 1 not working. It would work also.
When you turn the machine back on the EQU instruction will only be looking for it to be the month of January (1). So when the 1400 is powered back on the scan will see that EQU instruction source A is 1 which will be EQUAL to source B (1) so it will then one shot (ONS) the reset (RES) output.

If the 1400 is off then it was not totalizing anything anyway until it is powered back on and either of these examples should work to reset your totalizer on the first scan after power up.

EDIT # 2:
Looking at this from an efficency stand point it might be a good idea to put the same NEQ from rung # 1 onto rung # 2 also. This way it will only move RTC:YR one time per year and not every scan.

I am pretty sure this is correct, good luck on your project.

BCS

RTC_YR.jpg
 
Last edited:
Hello again JonAW,
Sorry for the edits and multiple replies, like I said I am still a novice to PLC myself and often see ways of improving what I have done once I step back and look at it.

All of the ways I have shown this would work but attached below is the way I would do what you are looking for. (final cut)
I added the NEQ to the second rung just to improve proccessor efficency, and I also added a one shot (ONS) to the first rung.(Dont think it was needed but cant hurt either.)

Regards
BCS

RTC_YR.jpg
 
I would think that version 1 would not work if the machine is powered down. it would reset the totalizer any time the machine was powered up in the month of January. version 2 should work though.
 
I would think that version 1 would not work if the machine is powered down. it would reset the totalizer any time the machine was powered up in the month of January. version 2 should work though.

Not true - a ONS (one-shot) after the EQU will prevent this happening - the pre-scan sets the storage bit true, and the "rung-condition-out" to false, this prevents false triggering on power-up.
 
really that's interesting. so are you saying that the plc will compare the state of the tags pre power down to the state on startup?
 
No, I'm not saying that... The processor does not retain any "rung-logic-continuity" states

The pre-scan essentially puts the ONS into the state that it has already been "fired", so that on the first proper scan, it will react correctly to the state of the conditionals preceding it.

If the rung evaluates as true, the ONS has already been triggered, so nothing happens.

If the rung evaluates as false, the one-shot is reset, ready to accept the next time the rung goes false-to-true.
 
Daba is correct.

The ONS triggers on the off to on transition of a bit, not on the first true scan. It has to first see the bit as OFF, then as ON. To accomplish that the prescan sets all ONS storage bits. If you don't understand the pre-scan then you need to read up on it or someday you might get into big trouble.
Also get the Micrologix instruction set reference manual. You can get the ISR online from the AB literature library if you don't have it.


That said, for this task no ONS is needed. All you need is to detect a data transition. The ML doesn't have a DTR instruction, fortunately one is really easy to build. See attached.

tc0819141.JPG
 
Last edited:
In the majority of cases, TConnolly's rung above will be adequate, but it only detects that the year has changed... not that it has "rolled over" naturally at the end of a year.

The year-change could have been instigated by a manual date/time change, for instance.

The dilemma is that the PLC could be off when a natural roll-over occurs....

You could add checks that it is a natural rollover by inspecting the Month and Day values, giving you a "time-window" (eg. Month=1, Day<15) during which it can be assumed a new-year has naturally occurred, and you could also check that the year has indeed incremented by 1, not just "changed".

Entirely up to you how far you go with this... add as many checks as needed by your application.
 
DISCLAIMER: I haven't been following this thread very closely – so I might be missing the main objectives ...

but ...

I'm pretty sure that your understanding of how the Pre-Scan operation handles the ONS instruction in the MicroLogix platform is incorrect ...

I'm basing this on my experiments with a MicroLogix 1100 system ... I don't have a MicroLogix 1400 available for testing right now – but I'll bet substantially more than pocket change that with the MicroLogix platform, the Pre-Scan operation will NOT write a status of ONE into the ONS instruction's bit/box ...

I don't have time to analyze whether or not this would affect the original poster's project – but you might want to take this into consideration ...

.

ONS_test.PNG
 
Hi Guys,

Thanks for all the responses. I think TConnolly has the solution for me. He is correct in that all I want to do is detect a change in data value. I can see this little rung will come in handy in various applications in the future.


🍻
 
DISCLAIMER: I haven't been following this thread very closely – so I might be missing the main objectives ...

but ...

I'm pretty sure that your understanding of how the Pre-Scan operation handles the ONS instruction in the MicroLogix platform is incorrect ...

I'm basing this on my experiments with a MicroLogix 1100 system ... I don't have a MicroLogix 1400 available for testing right now – but I'll bet substantially more than pocket change that with the MicroLogix platform, the Pre-Scan operation will NOT write a status of ONE into the ONS instruction's bit/box ...

I don't have time to analyze whether or not this would affect the original poster's project – but you might want to take this into consideration ...

.

If the Instruction Help is anything to go by, I win the bet....

Note : Base image is copyright Rockwell Automation, reproduced here for educational purposes.

2014-08-20_102413.jpg
 

Similar Topics

Hi, I recently installed 2 1783-NATR devices into two of our machines. The machines are pretty much identical, both having 1769- L24ER-QFC1B...
Replies
4
Views
280
How is it going y'all? So We have had a pesky problem with an EH 300 flow meter. We are using EIP to reset the totalizer, and for some reason the...
Replies
3
Views
710
MELSEQ "intelligent modules" configuration, programmatically resetting the CPU Hello. This is for the Mitsubishi experts, and thanks in advance...
Replies
5
Views
1,016
Hi all, is there an easy way to reset a user defined shift register to 0? i have a data type containing 8 bools for an array of 10 and would like...
Replies
12
Views
3,145
Hello, I am curious if there is a way to reset a safety password on the CPU mentioned in the title. The previous tech that retired(I took his...
Replies
11
Views
3,988
Back
Top Bottom