01-20-2023 11:58 AM
Is it possible to plot channel information only when another channel is true without creating new channels?
In example below, I only want to plot the Date vs Temp when State = Ramp.
Example:
Date,State,Temp
01/05/2023 11:38:00, "Initialize", 68
01/06/2023 05:30:00,"Ramp", 68
01/06/2023 05:31:00,"Ramp", 75
01/06/2023 05:32:00,"Ramp", 85
01/06/2023 05:33:00,"Ramp", 95
01/06/2023 05:34:00,"Dwell", 102
01/06/2023 05:35:00,"Dwell", 102
01-20-2023 03:42 PM
labels = dd.Data.Root.ChannelGroups(1).Channels("labels").GetValuesBlock()
dd.Data.Root.ChannelGroups(1).Channels.Add("labels_bool",dd.DataTypeFloat64)
labels_bool = dd.Data.Root.ChannelGroups(1).Channels("labels_bool")
labels_bool_list = []
for label in labels:
if label == 'a':
labels_bool_list.append(1)
else:
labels_bool_list.append(None)
labels_bool.SetValuesBlock(labels_bool_list, 1, dd.eValueBlockValueInsert)
dd.ChnMul("[1]/values", "[1]/labels_bool", "/filtered")
Load the example data and run the script. I essentialy create a channel of 1s and nulls based on what you want to plot and then multiply it by the channel with values to create a channels filtered to the desired label.
01-23-2023 07:35 AM
yeah. I can do it that way. was really hoping for a way that didn't involve making any new channels at all, since I actually have 19 different states and have to be able to plot to at least 6 of them.
01-23-2023 08:37 AM
I ended up using this instead:
ChnEventResultList= Null
ChnEventResultList = ChnEventDetectionEqualStr(, "[1]/[2]", "Ramp")
Call ChnEventCreateStatusChn("SteadyState/EventStatus", ChnEventResultList, "[1]/[2]", 0, 1)
Set ChnResult = ChnMul("[1]/DateTime", "[2]/EventStatus", "/DateTime")
Set ChnResult = ChnMul("[1]/DateTime", "[2]/EventStatus", "/Temp")
01-23-2023 09:10 AM
No real way of just plotting based on a condition without creating some extra index channel.
One strange solution if you really don't want any extra channels is to set the values that you don't want plotted to NOVALUE and appending the value with a separator to the state channel. That way you are not creating extra channels and the process is reversible (might be computationally expensive)
01-25-2023 05:29 AM
Hi 2Pale4TX,
As gsklyr mentioned, the easiest way for such cases is to create new filtered channels. In DIAdem you can find a example which helps to filter the data.
But there is also a second option. For this you need a script. You need a script for initialization and a user command script. This user command script is called right before DIAdem is displaying the channels of the 2D axis system. In this script you can manipulate the data which should be displayed. Attached you find an example.
Greetings
Walter
01-25-2023 05:30 AM
Here is the attachment.