Writing Ignition Time to PLC

Good Morning -

I am wanting to use the Ignition Server time to log some PLC stored data. Has anyone ever used Ignition time to sync with an Allen-Bradley PLC?

Thanks in Advance,
Caitlyn

Hi Caitlyn,

It is much easier and more accurate to go the other way. Sync your Logix PLC to something like a Time Machines’ TM2000B, and also have your Ignition Server use that as its NTP source. In the PLC when logging data into an array, use a GSV of the WallClock object’s CurrentValue. That is an LINT microseconds UTC, and it will be accurate to single-digit microseconds or better. Ignition can’t do that itself.

+1 for the TM2000B device, but for the instances where a customer doesn’t want the extra device and at a minimum you need SCADA and the PLC at the same time (even though it may not be accurate) here is a script we use. For later versions of Ignition this runs in a gateway event script (Scheduled) or just put it in a gateway event script (Timer)

year = system.date.format(system.date.now(), "yyyy")
month = system.date.format(system.date.now(), "M")
day = system.date.format(system.date.now(), "d")
hour = system.date.format(system.date.now(), "H")
min = system.date.format(system.date.now(), "m")
second = system.date.format(system.date.now(), "s")
msecond = system.date.format(system.date.now(), "S")

#Specify the full tag path to the PLC OPC tags
paths = [
		"pathToPLCTag_year",
		"pathToPLCTag_month",
		"pathToPLCTag_day",
		"pathToPLCTag_hour",
		"pathToPLCTag_min",
		"pathToPLCTag_sec",
		"pathToPLCTag_mSec"
		]

# Specify the values
values = [
		year,
		month,
		day,
		hour,
		min,
		second,
		msecond	
		]

if not initialChange:
	system.tag.writeBlocking(paths, values)
2 Likes

Typically I would take that route but no additional hardware is part of this project unfortunately. Gotta work with what we have.

That’s exactly what I was looking for. Thank you so much!

Even if you don’t have a precision source, use the LINT format to read and write time. Messaging can interleave with logic, so broken-out time elements will eventually bite you in the [expletive].

2 Likes

Using that, you could - in very rare instances - end up with the values out of sync with each other depending on when it's run. For example, imagine it calculates just before midnight of the eve of the last day of december, and it actually crosses over into 1st jan of next year in the time that the code runs. You could end up with:

year = 2021
## ticks over to 2022
month = 1
day = 1
hour = 0
min = 0
second = 0
msecond = 100

instead of

year = 2021
month = 12
day = 31
hour = 23
min = 59
second = 59
msecond = 300

for example.
Best to store now and then manipulate that, despite the slight offset it'll cause imo.

3 Likes

+1 for the TM2000B, as well. Especially because I use one. (Okay, it was the 2000A. I was an early adopter)

Other alternatives to consider.

  • Linux: install PTPd on the gateway and configure it as a master. Logix platforms use PTP, so you would just have to tick on the clock sync checkbox on the PLC.
  • Also Linux: install NTPd. Later CompactLogix firmwares support sockets, and some ContorlLogix ethernet modules already supported them. Install the NTP AOI available at Rockwell’s sample code section.
  • Windows: install the Logix5000 Clock Update Tool and run it as a service.

I have a need for this type of device on an air gapped network, does anyone know what kind of cable length can be used with the amplified antenna? Ive read everything on their web site and, don’t see any mention of realistic cable length.

I’m not sure how cable length matters for an air-gapped setup… But the Time Machines’ outdoor antenna products brochure says they can use 250ft of rg58 cable.

1 Like

It doesn’t matter for the air-gapped part, it matters because the building is a huge concrete structure. Ty for the info!