Sends evenly-sampled data to a source in the Multisim circuit.

Syntax


Sub SetInputDataSampled ( _
      ByVal inputName As String, _
      ByVal sampleRate As Double, _
      ByVal dataArray As Variant, _
      ByVal repeatFlag As Boolean)

Parameters

inputName—The name of the source component in Multisim to replace with this data.

sampleRate—The sampling rate of the data, in samples per second.

dataArray—A one-dimensional array of double values containing the input data.

repeatFlag—Specifies, if true, that the input data will continue to repeat itself until it is explicitly cleared or the simulation ends.

Remarks

The X-Y input data contained in dataArray is sent to the simulation, via the source specified in inputName.

Calling SetInputDataSampled during simulation with an inputName that has previously been set immediately replaces the original data. Calling it on unspecified inputs results in an error.

Stopping or restarting the simulation discards the settings and data. SetInputDataRaw must be called before each simulation is run.

When the data is exhausted and the repeatFlag is False, the source continuously outputs its last value.

This method requires equally-sampled data. Otherwise, it is the same as SetInputDataRaw.

Example


Dim Circuit As MultisimInterface.MultisimCircuit
Dim inputs() As String
Dim DataValues(1, 1000) As Double ' 2-dimensional array of time-voltage data

Private Sub SetupInputs()
       If Circuit Is Nothing Then
              Exit Sub
       End If

       On Error GoTo ErrorHandler

       ' Set the input V1 use the array of data, sampled at 100 samples per second
       Call Circuit.SetInputDataSampled("V1", 100, DataValues, True)

       Exit Sub

ErrorHandler:
       MsgBox "Input Error" & vbCr & Circuit.LastErrorMessage

End Sub

See Also

EnumInputs

Note on Inputs