The procedure for requesting AWR support has changed. Please read all about the new AWR product support process.
Page tree
Skip to end of metadata
Go to start of metadata

There are a couple of differences between these two values. First parameters can take a range of different types on the right-hand-side (RSH) of the equals sign. They can be integers, enumerations, doubles, equations, strings, etc. So the RHS won't always be a valid double or even convertible to a double value. However a large percentage of the parameter values have a double value so it is convenient to be able to ask for the double value directly. The primary differences are that:

  1. The ValueAsString will give you the literal text on the RHS regardless of the type.

  2. The ValueAsDouble will scale the value into base MKS units if the parameter value can be evaluated to a double value or will give you zero otherwise.

Lets take a look at a quick example. Suppose we have a design like Figure 12 below with a MLIN element which also happens to have one parameter, 'W' which uses a value from a schematic equation.

Figure 12: MLIN Element with an equation.

Now consider the following script to output the parameter values for this schematic:

 ' Code Module
Sub Main
        Dim schem As Schematic
        Dim param As Parameter
        Dim elem As Element


        Set schem = Project.Schematics("MySchematic")
        Set elem = schem.Elements(1)
        For Each param In elem.Parameters
                If (param.ParameterDefinition.DataType  <> mwPDDT_DataModel And param.ParameterDefinition.DataType  <> mwPDDT_RealVector) Then
                        Debug.Print param.Name & " Value As Double = " & param.ValueAsDouble & " Value As String = " & param.ValueAsString
                End If
        Next param

End Sub



Running this program we get the following output:

ID Value As Double = 0 Value As String = TL1
W Value As Double = 0.00005 Value As String = W1 + 10
L Value As Double = 0.0005 Value As String = 500

Some things to note about this output:

The first line in the output gives the output for the ID parameter

ID Value As Double = 0 Value As String = TL1

The parameter ID has no double value equivalent so while ValueAsString comes out TL1 the ValueAsDouble returned is zero.

The second line in the output gives the values for the width parameter

W Value As Double = 0.00005 Value As String = W1 + 10

On the schematic the width parameter's value was derived from the equation W1 = 40. The ValueAsString gives the equation string for the parameter. The ValueAsDouble evaluates the equation, scales the value from user units to base MKS units and outputs the value in meters.

The third line in the output gives the values fro the length parameter.

L Value As Double = 0.0005 Value As String = 500

Here the ValueAsString gives the value 500 which is length value in user units of microns. The ValueAsDouble scales the value to base MKS units and prints the length in meters.

Another key difference between the two has to do with setting the values for parameters. The ValueAsDouble can only be used to set the parameter to a double value where ValueAsString can be used to set the parameter RHS text to any value. Say we wanted to set the width parameter to a different equation value we could use

param.ValueAsString = "W1 + 15"

to update the equation.

So while ValueAsDouble provides the convenience of a double value in base MKS units the ValueAsString provides the flexibility to directly set the equation text for the parameter.