Hello,
We have 3 identical machines (MCS02, MCS03 & MCS04) and I am logging a cycle counter on each of them to the historian and showing these on a chart.
MCS02:
MCS03:
MCS04:
I would like it so that if the user checks the ‘All HQ Chamber Sealers’ checkbox that it shows a trend of the summation of all 3 of the of the machine’s cycle counters.
As the Easy Chart cannot sum multiple pens I had to create 2 calculated pens, one that sums MCS02 and MCS03 (named 'MCS02+MCS03) and one that sums MCS02+MCS03 and MCS04 (named ‘All HQ Chamber Sealers’). At this stage I would like to note that you cannot select a calculated pen as the driving or secondary pen on a ‘Sum’ function. I was able to get around this by typing them into the Calculated Pens property dataset:
I then needed to make it so that if the user checks the "All HQ Chamber Sealers’ pen, that it would enable each of the machine pens (needed for dependent calculated pens) and make them hidden (so that only the ‘All HQ Chamber Sealers’ pen was visible on the chart). And if the user unchecks the “All HQ Chamber Sealers” pen, it would make the machine pens not hidden. This is the propertyChange script I came up with to achieve this:
if event.propertyName == "calcPens":
old = event.oldValue
new = event.newValue
for row in range(old.getRowCount()):
if old.getValueAt(row, "Enabled") != new.getValueAt(row, "Enabled"):
rowName = new.getValueAt(row, "Name")
if rowName == 'All HQ Chamber Sealers':
tagPens = event.source.tagPens
if new.getValueAt(row, "Enabled") == 1:
for row1 in range(tagPens.getRowCount()):
if tagPens.getValueAt(row1, "Name")[0:3] == 'MCS':
if tagPens.getValueAt(row1, "Group_Name") == "Total Cycles":
updates = {"ENABLED": 1, "HIDDEN": 1}
tagPens = system.dataset.updateRow(tagPens, row1, updates)
else:
for row1 in range(tagPens.getRowCount()):
if tagPens.getValueAt(row1, "Name")[0:3] == 'MCS':
if tagPens.getValueAt(row1, "Group_Name") == "Total Cycles":
updates = {"HIDDEN": 0}
tagPens = system.dataset.updateRow(tagPens, row1, updates)
event.source.tagPens = tagPens
What’s weird is that when I check the All HQ Chamber Sealers
pen, this is what is displayed:
As you can see, the trend is nearly correct except that it is ‘noisy’ rather than doing what it should (always increase as time goes on).
Just wanted to share as a potential bug and to maybe get some help in resolving or coming up with a different approach.