DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

FormulaCalc error when using variablesin variable files?

I defined two variables RForce_ and IntLength_' in variables files:
as following:
IntLength_ : I <1700>
RForce_ : R <1.4314>

in vbs file,I have following:
Call FormulaCalc("Ch('PSA_Kraft') := ('RForce_'-'RForce_'/'IntLength_'*'Gurtweg')")

When I run the vbs file,diadem reports following error:

The formula
Ch('PSA_Kraft') := ('RForce_'-'RForce_'/'IntLength_'*'Gurtweg')
contains an invalid mathematical operation .. ('RForce_'>-<'RForce_'/'IntLength_'*'G.. with text!

When I don't use variables, as following:
Call FormulaCalc("Ch('PSA_Kraft') := (1.4314-0.000842*'Gurtweg')")
my vbs file can run correctly.

Anything wrong with my code?


0 Kudos
Message 1 of 2
(3,399 Views)

Hi Junwei You,

 

Yes, there is a problem with the formula calculator expression.  You need to use the ' character only when you are referencing existing data channels, not for VAS file variables.  Also, I strongly recommend that you always use the full Ch('ChannelName') construct when you reference an existing data channel.  Try this instead:

 

Call FormulaCalc("Ch('PSA_Kraft') := RForce_ - RForce_/IntLength_*Ch('Gurtweg')")

 

Note that you may need to insert further parentheses to specify the exact order of the / and * operators.

 

Regards,

Brad Turpin
DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 2 of 2
(3,384 Views)