Signals from Simul8 to VB
Simul8 automatically sends signals to your Excel or VB extension:
Set:
A label action unit has been asked to request VB for a value. Set the value of the label using SetAttribValue. If you do not call SetAttribValue the label's value will be unchanged.
Note there is a space between the colon (:) and the start of the label name.
DISTRIB:
The distribution whose name follows DISTRIB: is about to be sampled - now is an opportunity to change its parameters (for example).
This message is only sent in the case of “named” distributions with the ASK VBA check box set.
Note there is a space between the colon (:) and the start of the distribution name.
ENDRUN:
The simulation has just reached the end of the “Results collection period”.
LOADED
LOADED: simulation name
The simulation has just been loaded into memory (File / Open or load from command line)
“simulation name” is the title set in File / simulation Details menu. If this is blank then no name is passed in this VB signal.
ROUTE_IN_AFTER:
The current Work Item has been loaded into a Work Center. The name of the Work Center appears after a space that follows the :
Example:
ROUTE_IN_AFTER: Work Center 1
Note there is a space between the colon (:) and the start of the Work Center name.
ROUTE_IN_BEFORE:
The Work Center whose name follows a space following the : is about to attempt to find a Work Item to load.
Example:
ROUTE_IN_BEFORE: Work Center 1
Note there is a space between the colon (:) and the start of the Work Center name.
- WARM:
Other Signals
Time Based Signals
Sometimes there is a need to ask VB to do a task when there is not a convenient place in Simul8 to tell VB to do (or consider doing) the task.
So that you can give VB a chance to undertake such tasks Simul8 provides the “Clock Extension”.
Use the menu CLOCK / EXTENSION to set how often (in simulation time units) you would like Simul8 to allow VB to check the current status of the simulation (and optionally modify it).
You should use a sensible time interval (one that is often enough to allow VB to see the things it needs to see - but not so often that your simulation is slowed down by VB. Every time VB is called some code in VB will have to run - this is quite fast - but unnecessary use of this feature will slow the simulation down).
Specify a time interval of zero to allow VB to check status EVERY time ANYTHING in the simulation changes during running.
The message you place in the LinkExecute box will be passed to your VB Form's LinkExecute method whenever the time interval occurs. Leave this box empty to switch off the Clock Extension.
External Distribution Signals
In Visual Basic an External Distribution signal is received in the Form's LinkExecute Sub (like all other signals)
Without any other code it would look like this:
Sub Form_LinkExecute (CmdStr As String, Cancel As Integer) End Sub
All you need to do is put code into it that responds to the messages you send it from Simul8.
For example:
If CmdStr = "TEST" then Label1 = 10