DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Offset Values below zero [Script]

Solved!
Go to solution

Hello,

 

Is there a nice way to add an offset to certain values of a Channel?

for example add 360 to all values below 0, to have this curve run from 0 to 360?

BobRoss13_0-1716453962229.png

 

Thanks 

Regards G,

 

0 Kudos
Message 1 of 2
(221 Views)
Solution
Accepted by topic author BobRoss13

Found a nice solution myself,

 

Create a Channel with the same length and all 0 in

Compare if <0 with EventSearch and generate a channel with 360 if true

Add those two Channels

 

Call Data.Root.ActiveChannelGroup.Channels.Add("0",DataTypeChnFloat64)
Call Data.Root.ActiveChannelGroup.Channels("0").SetValues(0,1,2561,0)
ChnEventList1 = ChnEventCompareChnLT("", "[2]/Angle_Pred_zeroed [°]", "[2]/0")
Call ChnEventCreateStatusChn("/temp", ChnEventList1, "[2]/Angle_Pred_zeroed [°]", 0, 360)
Call ChnAdd(Data.Root.ActiveChannelGroup.Channels("Angle_Pred_zeroed [°]"),Data.Root.ActiveChannelGroup.Channels("temp"),Data.Root.ActiveChannelGroup.Channels("Angle_Pred_zeroed [°]"))

 

BobRoss13_0-1716460215980.png

 

0 Kudos
Message 2 of 2
(198 Views)