Error "Variable Uses an Automation Type Not Supported in VBScript" When Doing Channel Math in DIAdem

Updated Apr 12, 2018

Reported In

Software

  • DIAdem

Operating System

  • Windows

Issue Details

I am trying to write script to perform a mathematical operation on two channels using the standard operators (+, -, *, /) in DIAdem.  I can perform these operations through the analysis tab but see the error "Variable Uses an Automation Type Not Supported in VBScript" when I try to do this on the script tab, why?
 

Solution

This happens because channel math is not supported through the operators in DIAdem. There are two other approaches you can take to do channel math, explained below.
  • If you want to create new channels for each operation you perform, you can use the Channel Math functions. An example is included below, displaying how to create new channels called "Multipled" and "Added" based on existing channels Voltage, Current, and Voltage 2.
Set ChnResult = ChnMul("[1]/Voltage","[1]/Current","/Multiplied") 
Set ChnResult = ChnAdd("[1]/Voltage","[1]/Voltage2","/Added") 
  • If you don't need new channels, you can use variables and the calculate method to only output the end result of your channel math. There are multiple methods to do this explained on the DIAdem help page for Command:Calculate, but a simple example to calculate power is included below 
Dim Power, aSymbol(2), aValues(2)
Power = "Ch(""Pwr"") = Voltage*Current"
aSymbol(1) = "Voltage"
aSymbol(2) = "Current"
Set aValues(1) = Data.GetChannel("[1]/Voltage")
Set aValues(2) = Data.GetChannel("[1]/Current")
Call Calculate (Power, aSymbol, aValues)

WAS THIS ARTICLE HELPFUL?

Not Helpful