Hello! I imagine there is a simple solution here, and after reading multiple threads that are close, but not quite the same, I thought I'd ask myself.
I am trying to create a runtime accumulator for a Blower VFD that is not currently being read into the PLC. The client has a future site visit planned to bring the runtime into the logic, but wants something now so they don't need to visit the site themselves to read the meter directly.
The Blower VFD has a boolean tag read by the PLC for when it is ON, and I imagine simply creating a memory type tag that begins accumulating seconds whenever the blower is running, and stops when the blower is off, would be the simplest solution. I understand this would only work when the gateway is up and running, but the client is okay with that for a temporary fix.
Basically- is there an easy way to use ignition scripting to accumulate runtime in seconds (converted to hours) for a memory tag based on when an OPC boolean tag is set to 1?
Do you have the historian module?
Yes, they have the historian module.
I like to use the DurationOn from the system.tag.queryTagCalculations | Ignition User Manual.
What we have done, is have the boolean running tag historized, and set the history configuration on the tag to look something like this:
You should at least get every 15 minutes an entry in the historian that the motor is running or not, and then the DurationOn will give you how long that tag was on.
1 Like
I will give this a shot! Thank you.
I feel rather silly now.
I fired up Ignition, went to the tag and changed the history to enabled- and then have no idea how to run this "DurationOn" tag calculation you mentioned.
The article you linked shows this:
system.tag.queryTagCalculations(paths, calculations, [startDate], [endDate], [rangeHours], [rangeMinutes], [aliases], [includeBoundingValues], [validatesSCExec], [noInterpolation], [ignoreBadQuality])
Where would I run this? And where is the "DurationOn" method? I'm rather lost, sorry!
So first off, how are you wanting to display this accumulator? That will determine where you call for the data.
In Perspective you can use a Tag History Bindings in Perspective | Ignition User Manual.
In vision, I would use a gateway timer script at a frequency that is acceptable and update a memory tag with the data.
An example script for a single tag would look like this:
paths = ['[default]Motors/FVNR/C100/MTR/Status/Sts_RunningFwd']
endTime = system.date.now()
startTime = system.date.addDays(endTime, -30)
dataSet = system.tag.queryTagHistory(
paths=paths,
startDate=startTime,
endDate=endTime,
returnSize=1, aggregationMode='DurationOn'
)
durationSec = dataSet.getValueAt(0,1)
The dataSet returned, is a single row with the first column as the startTime, and then each subsequent column as each tag included in the paths array.
You've nailed it- it will be used in Perspective; probably as a simple LED Display with the label "Blower Runtime".
I will try this shortly and get back to you. Thanks again!
Make sure that you are requesting the data at a pace that doesn't overwhelm your database or gateway.
If you have multiple of these, I would move it into a gateway timer script that queries all the ones that you want, and then update a tag for each one so that the perspective views aren't doing this query for each device.