You have to avoid a Failing Calculation
If needed, your code can write a System State at a desired timestamp. If it's not a String tag,
MyPIACEPoint.Value(MyTime) = "Error" ' or "Calc Failed" if you prefer
should work as desired.
- If it's a String tag, it won't turn into a System DigitalState
- System Management Tool shows you the list of all available System states
Thanks Michael for the reply. I should have noted that I'm new to .NET programming. So where/how would I code that.
My is basically an IF THEN ELSE. IF 1st of the month, then calc & output result, ELSE no output. HOw do I trap for calculation failure to code MyPIACEPoint.Value(MyTime) = "Calc Failed".
I figured out how to do this. Added FINALLY to my TRY CATCH. It seems to work. If anyone has a better solution, please let me know.
TRY 'calc code CATCH 'error message FINALLY OutputTag.Value(TimeStamp) = "Calc Failed" END TRY
If anyone has a better solution, please let me know.
Dim Timestamp as Double = FirstOfPrevMonth.UTCSeconds Try Dim result As Double = calculation( ) Outputtag.Value(Timestamp) = result Catch error message Outputtag.Value(Timestamp) = "Calc Failed" End Try
If you have problems calculating the correct timestamp or if
Outputtag.Value(Timestamp) = "Calc Failed"
should fail, well then you're lost anyway ;)
Sorry for my bad formatting in response 1. fixed now.
You know how to do a No Output in PIACE, don't you ?
If not, this might well be the reason why you're struggling with Calc Failed at all.
Not writing anything to Outputtag.Value is not the solution ...
Rather set Outputag.SendDataToPI = False
P.S. Initializing the PITime variable FirstOfPrevMonth correctly, is an exercise for the reader