1 of 1 people found this helpful
A quick 'n dirty trick: Your ACE output tag can be a Performance Equation tag.
If you create a time scheduled PE tag where the expression is 0.0 and the scan class is 00:00:00 you will have it reset to 0 from the PE scheduler, and you don't have to define this within the bounds of your ACE project.
If you don't want to do that, I'd have to ask if your ACE calculation is time scheduled or naturally schedule (triggered from one or more PI tags)?
How do I set the PE tag expression to set to zero at noon? My ACE calculation is time scheduled to run every 2 mins. The source tag gets data from the field.
Take a look at this section from the PI Server manual on how to create, set up and schedule a Performance Equation. (If the link isn't working just go to http://livelibrary.osisoft.com and search for "Create a PE point")
You need to define a scan class to run at noon every day, this can be done with this: /f=24:00:00,12:00:00, meaning that for every 24 hours passed you should add a 12 hour offset before hitting.
Then just configure the expression of the PE tag to be 0, and set the PE tag to be clock scheduled - and select the scan class you just created.
Thank you Asle! That works. I created a PE tag with this equation:
If (Hour('*')=12 And Minute('*')=00 And Second('*')=00 ) then 0.0 else NoOutput()
The PE is on clock schedule with scan class as 1. I checked today and the value was set to 0 exactly at noon.
This piece of code works for me:
Dim lastArchiveTime As AFTime = Nothing
lastArchiveTime = New AFTime(discharge.PrevEvent)
Dim snapshotTime As AFTime = hesElement.Attributes("discharge").Attributes("value").GetValue.Timestamp
Dim startTime As PITime = Noon(Me.ExeTime)
Dim afStartTime As AFTime = New AFTime(startTime.UTCSeconds) 'current day noon timestamp in UTC
If DaySec(lastArchiveTime) < 43200 And DaySec(snapshotTime) > 43200 Then
lastCalculatedValue = 0.0
lastCalculatedValueDQ = ""
afDischargeTotal = New AFValue(lastCalculatedValue, afStartTime)
afDischargeTotalDQ = New AFValue(dischargeTotalForPeriodDQ, afStartTime)
PIACEBIFunctions.LogPIACEMessage(OSIsoft.PI.ACE.MessageLevel.mlErrors, "*** Have executed the code for noon reset " & dischargeTotalForPeriod.ToString & " : ", Context)
Catch ex As Exception
PIACEBIFunctions.LogPIACEMessage(OSIsoft.PI.ACE.MessageLevel.mlErrors, "*** Error with noon reset code " & calcTime.ToString & " : ", Context)