Boolean values in my historian are not being recorded as true or false, instead the tag history just counts up or down forever, I see the same behavior with a memory tag or a OPC tag from my PLC.
I am using ignition maker edition 8.3 and historian core, so I don’t know if this is the normal behavior of historised boolean values, but I was expecting them to just be recorded a 0 or 1. Here is an example power trend of 2 boolean values (heat is currently on, cool is off).
That’s an interesting read! I did already set all my boolean tags to discrete style deadband that are set to “on change” recording. I might also change my process variable to discrete now, to get the more predicatable behavior.
Here are some more examples of trends for my same boolean tag:
I was able to fix this manually by changing the pen setup in my powerchart for boolean tags, specifically setting aggregateMode = "LastValue".
since I didn’t want to do do that everytime I added a new tag I applied this on change scipt to the props.pens attribute:
def valueChanged(self, previousValue, currentValue, origin, missedEvents):
# Iterate through all pens currently on the chart
pens = self.props.pens
for i in range(len(pens)):
try:
# 1. Get the Source Path safely
# Structure based on your JSON: pen -> data -> source
pen_data = pens[i].get("data", {})
source_path = pen_data.get("source", "")
# 2. Check if valid tag path
if source_path and "tag:" in str(source_path):
tag_path = str(source_path).split("tag:")[-1]
# 3. Check Tag Type
configs = system.tag.getConfiguration(tag_path, False)
# 4. Apply Logic for Boolean Tags
if configs and str(configs[0].get("dataType")) == "Boolean":
# Fix Interpolation: 'display' -> 'interpolation' = 'curveStep'
if pens[i].display.interpolation != "curveStep":
self.props.pens[i].display.interpolation = "curveStep"
# Fix Aggregation: 'data' -> 'aggregateMode' = 'LastValue'
if pens[i].data.aggregateMode != "LastValue":
self.props.pens[i].data.aggregateMode = "LastValue"
except Exception as e:
# Ignores initialization errors (e.g. when a pen is created but not yet populated)
pass