DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

When I enter Ch("test") = 12 (for example) the channel list shows 0. has the Ch("") = changed in DIAdem 10.2?

When I enter Ch("test") = 12 (for example) the channel list shows 0.  The channel was created but has the value of 0.  Has the Ch("") = changed in DIAdem 10.2?
0 Kudos
Message 1 of 5
(4,096 Views)

Hi Bruce,

Where are you entering this?  In the Channel Calculator?  In a VBScript?  If you're using the Channel Calculator, how is it supposed to know how long to make the channel?  Usually there is at least one channel reference in the assignment that determines the length of the new channel.  I have verified the behavior you describe in DIAdem 10.2, but when I try this in the Channel Calculator in DIAdem 10.1, I get the error "Calculation is not a channel".  So it appears the behavior has changed.  Are you saying you prefer the error message?

What are you trying to accomplish?
Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 2 of 5
(4,086 Views)
Here is a line from the script i'm trying to use.  I need to output a point from a third order approximation to another graph that plots the trend of point N.  I also need to send the trend numbers to my customer in an excel file.
 
Call ChnCalculate("Ch(""[1]/NApoint"")=((ChnPropValGet(""[1]/ApproxYN"", ""ResultApprAnsatzCoef4""))*R28^3)+((ChnPropValGet(""ApproxYN"", ""ResultApprAnsatzCoef3""))*R28^2)+((ChnPropValGet(""ApproxYN"", ""ResultApprAnsatzCoef2""))*R28)+((ChnPropValGet(""ApproxYN"", ""ResultApprAnsatzCoef1"")))")
0 Kudos
Message 3 of 5
(4,079 Views)

Hi Bruce,

In DIAdem 10.1 and prior versions the ResultApprAnsatzCoef1,2,3,4 properties were not added to the ApproximatedY channel created by the ANALYSIS approximation routine, so this VBScript only has a chance in DIAdem 10.2 or later.  I can get this VBScript to work by consistently addressing the channel name I have in the Data Portal as well as the group index [1] that channel is in:

R28 = 4
FormulaTxt = "Ch(""[1]/NApoint"")="
FormulaTxt = FormulaTxt & " ((ChnPropValGet(""[1]/ApproximatedY"", ""ResultApprAnsatzCoef4""))*R28^3)"
FormulaTxt = FormulaTxt & "+((ChnPropValGet(""[1]/ApproximatedY"", ""ResultApprAnsatzCoef3""))*R28^2)"
FormulaTxt = FormulaTxt & "+((ChnPropValGet(""[1]/ApproximatedY"", ""ResultApprAnsatzCoef2""))*R28)"
FormulaTxt = FormulaTxt & "+((ChnPropValGet(""[1]/ApproximatedY"", ""ResultApprAnsatzCoef1"")))"
Call ChnCalculate(FormulaTxt)

But you're quite right that the resulting channel still contains the value 0.  If what you want is to recreate the approximation curve or to retrieve one value from the approximation curve, why don't you just reference out one of the values of the ApproximatedY channel based on the closest value in ApproximatedX to your desired R28 value?  The code would look like this:

Row = PNo("[1]/ApproximatedX", R28)
MsgBox ChD(Row, "[1]/ApproximatedY")

Let me know if that is not what you want,
Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 4 of 5
(4,056 Views)
Hi Brad,
 
I got it to work using the following:
 
Dim Row
Call ChnAlloc("[1]/NPoint",1,1,DataTypeFloat64,"Numeric",1,2)
Call ChnGenVal("[1]/NPoint",1,1,0,1,0)
Row = PNo("[1]/ApproxXN", 14000)
Ch("[1]/NPoint") =  Ch("[1]/NPoint") + ChD(Row, "[1]/ApproxYN")
 
The "PNo" is a great idea.
 
Thanks for your help.
 
Bruce
0 Kudos
Message 5 of 5
(4,049 Views)