An event fired by Multisim to indicate a change in simulation state.

Syntax


Event SimulationStop ( _
       ByVal newState As SimulationState, _
       ByVal outputNames As Variant)

Parameters

newState—Indicates what state the simulator has now entered.

outputNames—A list of output requests, which are complete but uncollected at this time. If no outputs are ready, this array will be empty.

Remarks

A SimulationStop event is fired when one of the following occurs:

If the simulation is resumed without calling GetOutputData on the completed outputs, those outputs remain in the list on subsequent SimulationStop events. In this way, multiple data sets for a specific output result in multiple entries in the outputNames array.

If outputNames contains the same probe name more than once, this indicates that several blocks of data are available for that probe. You can use a loop to call GetOutputData for each block.

Example


Private Sub Circuit_SimulationStop( _
       ByVal newState As MultisimInterface.SimulationState, _
       ByVal outputNames As Variant)

On Error GoTo ErrorHandler

Select Case newState
       Case MultisimInterface.SimulationState.SimulationPaused
              MsgBox ("Event: Simuation paused")
       Case MultisimInterface.SimulationState.SimulationRunning
              MsgBox ("Event: Simulation running")
       Case MultisimInterface.SimulationState.SimulationStopped
              ' Retrieve results and put into dataArray
              Dim dataArray As Variant
              ' Convert variant to string array
              Dim outNames() As String
              outNames = outputNames
              Dim iOutput As Integer
              For iOutput = 0 To UBound(outNames)
                            Call Circuit.GetOutputData(outNames(iOutput), dataArray, _
                                   SimulationInterpolationRaw)
              ' Do some processing or display of the data
              Next
End Select

Exit Sub

ErrorHandler:
       MsgBox "Error:" & Circuit.LastErrorMessage & vbCr & Error(Err)

End Sub