11-16-2023 08:15 AM
Hello,
I have a set of channels , Temperature, power, energy etc and I'm using a band cursor to select sections (start time - end time) using a band cursor. Is it possible to use the band cursor that is used on the temperature channel , to calculate the measurement value in the energy channel that corresponds with the right band cursor line and subtract it from the value that corresponds with the left band cursor line.
Basically set the range I'm interested in and calculate the total energy consumed in that temperature range.
Thanks
Nick
11-17-2023 08:33 AM
Hello Nick,
yes, that's possible. One option is to display the calculated value in the legend of the axis system. To do this, a free text containing a DIAdem expression enclosed in @@...@@ must be entered in the legend. The left and right of the band cursor or the point/index of the channel value can be retrieved with View.CurrSheet.Cursor.P2. The returned value is the index for your other channel from which you want to subtract the two values. You can either specify this as a fixed value with for example Data.GetChannel("[4]/Temperature_2").Values(View.CurrSheet.Cursor.P2) or you can use the channels of the axis system: Data.GetChannel(View.CurrSheet.CurrArea.DisplayObj.Curves2D(2).YChannelName).
Example:
2D axis system with two curves from the Example.tdm data set. Curve 1: Temperature_1 as Y-channel, curve 2: Temperature_2 as Y-channel. The difference of the temperature of temperature_2 of the range of the band cursor is to be displayed. You get the calculated value with this expression:
@@Data.GetChannel("[4]/Temperatur_2").Values(View.CurrSheet.Cursor.P2)-Data.GetChannel("[4]/Temperatur_2").Values(View.CurrSheet.Cursor.P1)@@
If you do not want to enter a fixed channel, but always want to use the Y-channel of the second curve in the axis system, for example, the expression would be as follows:
@@Data.GetChannel(View.CurrSheet.CurrArea.DisplayObj.Curves2D(2).YChannelName).Values(View.CurrSheet.Cursor.P2)-Data.GetChannel(View.CurrSheet.CurrArea.DisplayObj.Curves2D(2).YChannelName).Values(View.CurrSheet.Cursor.P1)@@
If you want to get the calculation for each curve then use CurrCurve:
@@Data.GetChannel(View.CurrSheet.CurrArea.DisplayObj.Curves2D.CurrCurve.YChannelName).Values(View.CurrSheet.Cursor.P2)-Data.GetChannel(View.CurrSheet.CurrArea.DisplayObj.Curves2D.CurrCurve.YChannelName).Values(View.CurrSheet.Cursor.P1)@@
I hope that helps.