ControlLogix GSV Command (WallClockTime) 2


Intdoduction to ControlLogix GSV Command (WallClockTime)

In this post, we will discuss the ControlLogix GSV Command (WallClockTime).  Earlier processors, such as the SLC-500 and PLC-5 had a data file dedicated to system status (S2).   In the S2 file, you could find the data table addresses of system information such as the date and time, forcing status, faults, processor status, I/O status, etc.    We know that on a new ControlLogix project there are no tags whatsoever.   If you need any status from the system, you will use the GSV command.   The GSV command is a simple copy command.   The GSV gets data from the system (where we cannot see it).  Then it copies the data to a tag where we can see the data and use it in our project.

In this post, we will access the WALLCLOCKTIME object.  This object has several attributes.   Imagine a large clock on the wall with different sections.  These sections would be the attributes.  One section would display the current time in our own time zone.   Another section (attribute) would be for UTC.  Yet another section would display the total number of seconds that have passed since Jan 1, 1970.   This is good for time stamping because simple seconds are easy to compare without worrying about days, months, and years.

The attribute that we will talk about in this post will be the LocalDateTime.   For other attributes, and other classes in the GSV command, consult the help file.

Create your tag

This tag will store 7 DINT’s (Double Integers), so we will make this tag an array.   The seven elements of this tag will contain:  Year, Month, Day, Hour, Minute, Second, and MicroSeconds.

Go to the controller tag database, and in “Edit Tags” Mode, create a tag called SystemTime.

System Time

Click the elipsis (the three dots) next to the data type of DINT to get to the setup screen for the data type, then run DIM0 up to 7.   This will create the array of 7 DINTS that we need.   An array is just a group of elements with the same name, and same data type, but a different index after each one.

DINT Setup

Now, expand your SystemTime tag by clicking the “+” next to SystemTime, and you will see that we have all 7 elements.   Here, I will also add a description of what each of the 7 elements are used for.

Array Descriptions

 

Next, go to “Monitor Tags” Mode.   You will see that the tag has no data.   This is because we did not execute the GSV command yet.

GSV No Data

Add your logic

I’m going to put the GSV Command into the MainRoutine.    The class will be “WallClockTime”, and the attribute will be “LocalDateTime”.   Our destination is the first element of the array that we just created, which is SystemTime[0].

GSV Instruction

Now, I’m going to download my work.   If you are online, just finalize your edits.  Then we’ll go back to the Controller Tag Database, and “Monitor Tags”.

Values Wrong

Notice that our values are wrong.   Changing the values here seems to have no effect.   This is because if you change a value here, the value is immediately changed back to the value of the system clock as soon as the GSV Executes again.    To set the time, we will do this at the source.   Go to “Controller Properties”.   To get to controller properties, you can right-click the controller to get to properties.   Another option is to press the controller properties icon, which is directly beneath your keyswitch in the online toolbar.

Controller Properties

Next, click the Date/Time tab to set the date.

Set Date Time

If you click “Set Date, time, and Zone from Workstation”, the time will be loaded from your PC into the processor.   If the time is still incorrect, you can adjust the fields accordingly.    Note:  The checkbox does NOT automatically adjust for daylight savings time.   It just adds an hour if we are currently on DST.

Now, your tags will read the proper values:

Correct Time

For more information on ControlLogix, visit the ControlLogix Post Page!

 

— Ricky Bryce


Leave a comment

Your email address will not be published. Required fields are marked *

85 − = 83

2 thoughts on “ControlLogix GSV Command (WallClockTime)