Date/Time for RSL5000, Compact L33

zacslade

Member
Join Date
Oct 2014
Location
Phoenix, AZ
Posts
84
So I'm working on a project where I need to communicate with a PLC which is being programmed by a third party.

The third party requested that our PLCs exchange/monitor heartbeats according to the following format:

5 or 6 digit DINT, with digits XHMMSS, where
XH is the hour with either 1 or 2 digits, ranging from 0-24,
MM is the minute with 2 digits, ranging from 00-59, and
SS is the second with 2 digits, ranging from 00-59,
on the PLC's internal clock.
Examples: 10000 = 1:00.00AM; 153000 = 3:30.00PM.
4 second timeout with no updates from other PLC causes fault.

All I'm finding in the RSLogix5000 help is WallClockTime (milliseconds since the epoch), which would make this very needlessly complicated for a heartbeat. It doesn't look like it will take that long to do it using WallClockTime, but I want to know: is there an easy way to match this format that I don't know about?

Also, can anyone tell me how to access WallClockTime? :unsure:

Thanks!
Zac Slade
 
Last edited:
Great question !

The Logix 5000's WallClockTime object has more attributes than just the 64-bit microsecond counter since the 1/1/1970 epoch.

It also has the current Zulu time, aka "Greenwich Mean Time", as well as the actual Local time in your timezone.

These are stored as an array of 7 DINTs:

Year
Month
Day
Hour
Minute
Second
Microsecond

Check out the "GSV/SSV Objects" section of the context-sensitive Help in Logix 5000 for a discussion of these contents, or look up GSV in the General Instruction Set Reference.
 
There are examples about how to get information from the wall clock using the gsv instruction on this forum. Also in the RS logix 5000 software help files.

But, why program the hours and minutes if the time out is after 4 seconds? A simple timer would give you that information.
 
zacslade said:
So I'm working on a project where I need to communicate with a PLC which is being programmed by a third party...

...The third party requested that our PLCs exchange/monitor heartbeats...

...All I'm finding in the RSLogix5000 help is WallClockTime (milliseconds since the epoch), which would make this very needlessly complicated for a heartbeat...

Yes, needlessly overcomplicated for a heartbeat.

Is the third party PLC also an AB controller?

The recommended method for a heartbeat between two AB Logix controllers is to continuously MSG an INT tag value constant of 1 from the first controller to an INT tag in the second controller. Use an XIO of the EN bit before the MSG instruction to make it continuous.

The second controller monitors the first bit of the INT tag on one rung using an XIO and TON timer set to whatever preset you wish. On the next rung you unlatch said tag bit using an unconditional OTU.
Lastly, use an XIC of the TON done bit (DN) as a precondition to an OTL for a comms loss tag.

When both controllers are running and comms are good, for every scan the first controller continuously writes a value of 1 to the second controller's monitoring tag bit. As the routine is scanned in the second controller, the XIO looking at the tag bit should be FALSE, holding the timer OFF. Then the OTU resets the tag bit to 0 for this scan. On the next scan, the first controller sets the tag bit of the second controller to 1 again, and the timer remains held OFF. The bit is yet again reset 0, and so on.

If the first controller stops writing a 1 to the tag bit in the second controller, then the next execution of the OTU sets the tag bit OFF, and it remains OFF for subsequent scans. This allows the XIO to be TRUE, enabling the timer which times to the preset and sets its DN bit TRUE. The TON DN bit then sets the comms loss tag, raising the alarm.

Sorry for the simplistic explanation and lack of a screenshot, but I'm not at my programming laptop until the morning.

Regards,
George
 
If both controllers are using Logix 5000, you can include the connection status in a produced/consumed tag. Just create a UDT and make the first member a tag called, say, "Status", of type CONNECTION_STATUS. This will give you two Bool's, ConnectionFaulted and RunMode, which tells you that there is (or isn't) a connection fault to the other PLC, and that the other PLC is (or isn't) in run mode. Even if both PLC's are in program mode, these tags still update. Then for the rest of the UDT just add a couple of DINT's for digital signals and an array of REAL's for analog signals, or whatever else you might need, and send the UDT to the OEM.

I did this recently - I programmed a central PLC and SCADA system to control a line of 5 third party machines. I just gave them all a UDT and told them what data to put where. It worked really well, I can map the UDT straight to an AOI to monitor the machine data, all the comms structures are identical, etc. Plus, this method of connection monitoring is (more or less) instant - instead of a heartbeat which takes a few seconds to flag the dropped connection.
 
Last edited:
All of which is fantastic, but there are no other methods of doing this heartbeat if it is so specified by the customer. Seems only Ken gave pertinent information here.

Once you have the individual fields of the clock time, it's just
(Hours * 10000) + (Minutes * 100) + Seconds.
Done and simple.

Why do we always over complicate things?
 
Awesome input, all.

This helped a lot. I'm glad I'm not the only one who thinks that doing the heartbeat this way is a little ridiculous -- and I am pretty new to this, so the examples were helpful.

Looks like I'll be using WallClockTime the way rdrast and Ken Roach mentioned.

Thanks for the responses!
Zac
 
A good Engineer always questions things...

zacslade said:
So I'm working on a project where I need to communicate with a PLC which is being programmed by a third party.

The third party requested that our PLCs exchange/monitor heartbeats according to the following format...

rdrast said:
Point 1. ...but there are no other methods of doing this heartbeat if it is so specified by the customer...

Point 2. ...Why do we always over complicate things?

I don't want to seem too argumentative here, but I disagree on both points, and for good reasons, I feel.

Point 1. There was no mention of a customer specification. A third party, programming another controller, does not imply customer. So anything they request, and you agree upon, is as a courtesy to them, or a mutual agreement. Unless they are working off a customer specification, then that is different, but still questionable from the OP's perspective.

Third party, in this case, sounds more like another integrator who seems to use the Wall Clock Time for a Heartbeat. This method looks overcomplicated for a Heartbeat. If I were dealing with them, I would be questioning their reason for using this method, as all good Engineers, Programmers, Integrators should do. If they have a valid reason for using it, such as "killing two birds with one stone", or such, well then you've learned something new. No harm done. But if they just use it because that's the best they have come up with, then you should have every right to question its use, especially once you know of better, or simpler methods of creating a communications watchdog Heartbeat.

Point 2. We were not trying to overcomplicate this. We were actually trying to simplify it. Perhaps you mean overcomplicate in that we are straying from what was asked, but sometimes what was asked was not the correct question. Or the answer to what was asked is not the best solution. By providing the OP with other options, which they seem appreciative of, they are in a better position to question the proposed method...

zacslade said:
...I'm glad I'm not the only one who thinks that doing the heartbeat this way is a little ridiculous...

Exactly, you are thinking correctly. But...

zacslade said:
...Looks like I'll be using WallClockTime...

Why settle for something you are, for good reasons, not happy about? Ask them why do they do this for a Heartbeat. If no valid reason is given, other than that's their way, end of, then you can suggest simpler methods. You are perhaps just a little inexperienced and afraid to confront them. That's understandable. But remember, a good Engineer is inquisitive, and second guesses many things they don't like the look of.

Having to read out the WCT, and then arrange the separate DateTime DINTs for XH:MM:SS into 1 DINT, to send to another controller, is in my opinion, convoluted for a what should be a simple Heartbeat.

If you have been tied to some pre-arrangement, or customer specification, of which you have not mentioned, then you are still within your rights to query this, politely. Customer specifications should be open to questioning where something does not look fundamentally correct.

Again, no argument here. I just felt that perspective important to put forward.

If you need to get the Wall Clock Time from one Logix controller to another, to set the WCT in the other controller, then that is a different story. You would not need to manipulate the DateTime DINTs in the first controller. Use a GSV instruction to read out the DateTime attribute into the 7 DINTs, as Ken outlined. You can then either Message the required DINTs, or use Produce/Consume to the other controller. Then use an SSV to set the DateTime attribute of the WCT in the second controller.

This is all on the proviso that we are talking about two Logix controllers here.

This also suggests further complication in this method...

zacslade said:
...4 second timeout with no updates from other PLC causes fault...

If you have to read, manipulate, and send WCT data, for which I assume they monitor in the "other PLC" for 4 seconds, then what are they sending to you from the "other PLC" to timeout after 4 seconds when there are "no updates"? Their WCT time in the same format? If so, that would be two different WCT data values being read, manipulated, and passing each other for monitoring a connection. Data that includes the WCT hours and minutes, of which are totally unnecessary for a 4 second watchdog time.

If so, this is highly convoluted indeed for a Heartbeat.

By definition, a Heartbeat is a "pulse".

In the computing world, a Heartbeat is defined as "a periodic signal generated by hardware or software to indicate normal operation".

A Heartbeat need only be a simple toggling over and back between controllers. That is all it needs be at its core. Anything else is not a Heartbeat.

It never hurts to ask...

Regards,
George.

p.s. For those interested, this is the logic I outlined earlier...

Logix_Heartbeat.jpg
 

Similar Topics

Hello Everyone, I want to upgrade the firmware of Powerflex 40 from 5.001 to 6.002 can anyone tell me how can I do that?
Replies
0
Views
66
Hello, I'm hoping someone can help me with understanding how to set/change these data types. We recently swapped from Invertek to AB drives...
Replies
1
Views
127
From the Red Lion website, after some customer enquiries in the last week or so... Rev. March 25, 2024 [18:30] Just thought it might help a...
Replies
9
Views
310
How do you install update on Red Lion Crimson ver 3.1. Do I just need to run the exe file on the host server?
Replies
1
Views
136
Has anyone found a way to convert/replace/update the firmware on old Parker TS80xx series HMIs (i.e. TS8010, TS8006, etc) to accept Crimson...
Replies
0
Views
125
Back
Top Bottom