GetSimulateParameter Procedure

Version 9

 

 

Returns the named or index parameter for the simulated callee.

 

Syntax

[ pParameter = ] GetSimulateParameter ( [vrParameterNameOrIndex] )

The GetSimulateParameter procedure syntax has the following parts:

 

Name

Type

Description

pParameter

Any

Pointer to the parameter data

vrParameterNameOrIndex

Val String

Parameter name or index (0 based)

Comments

Use this function to retrieve the simulated procedure parameters. If the simulated procedure is a function the return value for the function is taken from the return value of the OnSimulate event.

Example

The following example provides simulation for a DMM instrument, Handling two procedures, Measure and GetSystemIdentification. For the Measure the function set the pdResult parameter 6.0 always and for GetSystemIdentification it sets the Var parameter psID to "34401A".

 

Procedure OnSimulate(obModule, procCallee, penSimulateStatus): Variant Public ! Occurs when a simulated procedure or IOTable is called in simulation mode.

--------------------------------------------------------------------------------

    obModule: Val Object

    procCallee: Val Procedure

    penSimulateStatus: Var Internal.enumASimulateStatus

    sProc: String

    vrReturn: Variant

    p: Any

    sModule: String

{

    vrReturn=0           ! default return value

    sModule=obModule.name

    select sModule

    case "DMM"

        sProc=procCallee

        select sProc

            case "DMM.Measure"

                p=GetSimulateParameter("pdResult")

                p=6.0

            case "DMM.GetSystemIdentification"

                p=GetSimulateParameter("psID")

                p="34401A"

        endselect

        trace sProc ! trace all DMM calls

        penSimulateStatus=aSimulateDone

        case else

            penSimulateStatus=aSimulateCallSimulated

            trace sModule

            TestStatus=FAIL ! should not get here

        endselect

        return vrReturn     ! for functions set vrReturn before the return statement

    }

See Also

Simulation, AApp.Simulate Property, OnSimulate Event, SetSimulateProcedures