DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Property Maximum for Channel doesn't work

Solved!
Go to solution

Hello,

 

I have a problem on the Maximum-Property for Data-Channels.

 

So if I create a new Channel and want to get the maximum of the new Channel like this:

Dim Grp: Set Grp =  data.Root.ChannelGroups.Add("Group_1")

Dim Channel1: Set Channel1 = Grp.Channels.Add("Channel1",DataTypeChnFloat64)    

'Fill Channel
Dim i
for i = 1 to 10
   Channel1(i) = i
Next

'Get Maximum
Dim ChnMax
ChnMax = Channel1.Maximum
LogfileWrite "ChnMax: " & ChnMax    'does not work: ChnMax = Null

'However:
LogfileWrite "Channel1(5)= " & Channel1(5)

 

The result is Null - however, if I want to get a specific value of the Channel (like the 5th value), it works. 

What is the problem here? Also in the data-portal the right value for the maximum will show up:

 

image.png

 Thanks in advanced for your help!

0 Kudos
Message 1 of 4
(1,180 Views)
Solution
Accepted by MaT_305

Hello MaT_305,

 

Which DIAdem version do you use?

With the command "ChnCharacter" you can calculate the chracteristics of a channel.

 

Dim Grp: Set Grp =  data.Root.ChannelGroups.Add("Group_1")

Dim Channel1: Set Channel1 = Grp.Channels.Add("Channel1",DataTypeChnFloat64)    

'Fill Channel
Dim i
for i = 1 to 10
   Channel1(i) = i
Next

call ChnCharacter(Channel1)
'Get Maximum
Dim ChnMax
ChnMax = Channel1.Maximum
LogfileWrite "ChnMax: " & ChnMax    'does not work: ChnMax = Null

'However:
LogfileWrite "Channel1(5)= " & Channel1(5)

 

Greetings

Walter

Message 2 of 4
(1,136 Views)

Hello Walter,

 

Thank you for your solution.

I´m using Diadem 2018.

 

So do I always have to "update" the created channel with the command 'ChnCharacter' in order to get min/max of a Channel? 

 

 

0 Kudos
Message 3 of 4
(1,132 Views)

Hello MaT_305,

 

Ideally, these characteristics would be calculated each time the value changes. We will have a look at this, and as long as it does not work this way, the ChnCharacter() command is a good workaround.

 

Greetings

Walter

Message 4 of 4
(1,123 Views)