Clock without using GSV

5 posts in this topic

Hello, I'm new in this forum and I signed up because I have an issue that has been frustrating me over the past few days.

My problem is the following:
I need to find a way to have a clock that can be out of time 7 hours.

For example,

I am counting parts on a machine, the machine starts counting at 7AM on day 1, so I need that part count to continue counting until 7AM on day 2. If I use GSV, at 00:00 it starts on day 2 and the log is to be stored on day 2, I need it to be stored on day 1 until 7AM on day 2.

I hope I have explained myself correctly.

Do you know of any way to do this in ladder logic?

Any help would be appreciated.

Share this post

Link to post
Share on other sites

I am basing my answer on the following assumptions:

You have a variable called PartsProduced of type DINT.  For troubleshooting and historical purposes you also have a DINT called PartsProducedYesterday.

Each time a part is produced you increment the DINT PartsProduced.

At 7am you want to copy PartsProduced to PartsProducedYesterday and Zero Out PartsProduced.

This can be done by a few simple lines of logic.

Line 1 - Contains the GSV Wallclock Instruction which takes the CLock time and deposits it into the array ClockDint[7] once every 500ms.

Line 2 - contains the logic EQU CLOCKDINT[3] 7  EQU ClockDint[4] 0 EQU CLOCKDINT[5] 0 ONS OneShotCountReset COP PartsProduceed PartsProducedYesterday 1 CLR PartsPRoduced.

Line 3 - XIC PartProducedBoolean CTU PartsPRoduced.

Hope that's clear enough.

Share this post

Link to post
Share on other sites

Thanks for your reply BobLfoot.

Actually I have a DINT array of 31 elements so I can be able to store all of the production of each day (1 element = 1 day).

So what happens is that the Tag "ActualProduction" is updating realtime during the day and it's being copied to the corresponding element of the day in the array using and indexer that changes as the "Day DINT" of the GSV changes. (ActualProduction[DayNumber]).

So the problem is that if I keep using that Day DINT from the GSV, as soon as the clock hits 00:00 the ActualProduction value will be copied into next day element, adding production from day 1 to day 2.

What I need to find is a way to keep the production numbers adding to the day one until the clock hits 7:00AM, then the program can start adding production to "Day 2".

Let me know what you think about this.




Share this post

Link to post
Share on other sites

Instead of moving DayDint into DayNumber every time it is scanned, perform the move of DayDint into DayNumber only at when HourDint = 7.

This way you'll use the previous DayDint as the DayNumber until 7am.

Share this post

Link to post
Share on other sites

Yes sir, you got it right.

I solved my issue by doing exactly what you posted. Sometimes I just don't keep it simple.

Thank you.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now