SIMUL8 Feature List - Visual Logic / Programming

Visual Logic is SIMUL8's internal Programming Language. It lets you build detailed logic into your simulation to describe exactly how you want it to behave. It is only available with SIMUL8 Professional.


Where You Can Use Visual Logic

On Simulation Open
When the simulation file is opened this logic will be run.

Before Reset
When the simulation clock is reset to zero this logic will run BEFORE SIMUL8's own reset logic is processed.

On Reset
When the simulation clock is reset to zero this logic will run AFTER SIMUL8's own reset logic is processed.

On Start Run
Whenever the simulation begins a new run.

On Stop Run
When the simulation is stopped in the mid run.

On End Run
When the model reaches the end of the run.

On End Trial
When the model has finished running all the runs in a trial.

On Time Check
Time Check allows logic to written which is dependent on time rather than an event. Logic written in this section will be processed whenever the clock reaches a time check intervals. The frequency of the Time Check intervals is set by the user.

End Warm Up
When the end of warm up time is complete, this is useful for special results calculations.

In Start Points
In Label Actions when label values are being set.

In Queues

- On Entry to the queue
- On Exit from the queue
- When work items expire in the queue
- On simulation start up, to allow you to set the attributes of the work items

In Activities
There are many events in Activity which Visual Logic can be assigned to:

- In Routing In before the work item is chosen
- After the work item is loaded to the Activity
- When the Activity completes work
- When a Work Item is Blocked on exit
- When a work item leaves
- When the labels are being set
- When a breakdown starts
- When a breakdown repair starts and ends
- When the state of the Activity changes, e.g. it goes from awaiting work to working.
- On start and end of a Shift.

In Tanks
There are many events in a Tank that Visual Logic can be assigned to:

- When the Tank has reached capacity.
- When the Tank capacity changes from full.
- On pass up.
- On pass down.
- On change from empty.
- On empty
- When the flow into the Tank restarts.
- When the flow in and out of the Tank isn't balanced.
- When the rate of flow into the Tank changes.
- When the flow into the Tank stops.

On Button Click
Images placed on screen and functions keys can be used as buttons for SIMUL8 by writing Visual Logic here.

[Top of the page]


Writing Visual Logic

The Visual Logic editor is designed to free you from needing to remember syntax. The menus guide you through every step in creating Visual Logic.

Some people prefer to type the logic directly. The non-checked edit mode allows you to do this.

Menu Driven Mode:

[Top of the page]


Predictive Text

When writing Visual Logic in Free Edit mode you SIMUL8 will predict what you’re trying to type, dramatically speeding up code writing.

This feature is only available with SIMUL8 Professional

[Top of the page]


Commands Available

New Commands in SIMUL8 Professional 2012

  • Get Label Total in Object
  • Select Mimimum Label in Object
  • Select Maximum Label in Object
  • Select Work Item with Label value in Object
  • Promote to Head of Queue
  • Find Value in Sheet Column
  • Find Value in Sheet Area
  • Find Minimum Value in Sheet Area
  • Find Maximum Value in Sheet Area
  • Total Sheet Area
  • Average Sheet Area

Standard Commands

- If...ElseIF....Else
- And, Or, Either Or
- While
- Until
- Set
- Loop

Comment
Allows comment lines which will not affect the code to be added.

Call
Calls a named Visual Logic section. When the called section is complete, the Visual Logic Processor returns to obeying the current section at the line immediately after the CALL. This is useful if you have some common VL code which you want to use in a number of places.

Clock

Set Clock Properties
Changes the Clock's properties: start of day, length of day, days in week.

Set Next Time Check
Changes the time of the Next Time Check

Schedule Next Event
This command lets you schedule the time that a piece of Visual Logic will run.

Deschedule Event
When Schedule Next Event has been used it may be that the Event scheduled is not required. This command allows the Scheduled Event to be removed from the scheduled event list.

Schedule Event on Simulation Object
This command lets you schedule the time that a piece of Visual Logic will run and pass an object name to the piece of code.

Deschedule Event on Simulation Object
When Schedule Event on Simulation Object has been used it may be that the Event scheduled is not required. This command allows the Scheduled Event to be removed from the scheduled event list.

Run Trial
Run a Trial of x runs.

COM

Call COM Event
Sends a string of text to a programming language, such as Microsoft Visual Basic, Microsoft Visual Basic for Applications, Borland Delphi, or any other COM enabled package

Signal VBA
Sends a text message to EXCEL/VB.

More Extensive COM commands are available with SIMUL8 COM

Conveyor

Select Work Item on Conveyor
Selects a work item on a conveyor as the current work item.

Count work Items in Region
Returns the number of items currently in a certain area of a conveyor.

Display+

Display Image
Places an image from the Image Library onto the simulation window, or a sub-window if preferred, at location X, Y. This command automatically deletes any image at the same x and y location to prevent many images getting placed on top of each other

Display Image Without Clear
Places an image from the Image Library onto the simulation window, or a sub-window if preferred, at location X, Y. This command will NOT delete any image currently at the X and Y location, so allows images to be layered on top of each other.

Display Text Parameters
Creates a text box and places it on the simulation window or a nominated sub-window, at location X, Y. This command automatically deletes any image at the same x and y location.

Display Text Without Clear
Creates a text box and places it on the simulation window or a nominated sub-window, at location X, Y. This command will not delete any text at the same location, so allows text to be layered on top of existing text.

Clear all Display+
Deletes all text and images that have been created using Display+

Clear Image
Deletes the image at location X, Y.

Clear Text
Clears a text box containing specified text at location X, Y on the nominated Window.

Clear Text at Any Location
Clears a text box containing any text at location X, Y on the nominated Window.

Distributions

Set Distribution Parameters
Changes the parameters of a named distribution.

Set Object Distribution Parameters
Changes the type of distribution used by an object.

Set Prob-Profile Distrib Column
Sets the sample value and percentage values for a single column in a probability profile distribution.

Reschedule Arrival
Changes the time of the next scheduled arrival at a Start Point.

Next Set Distribution Accepts Formula
Allows the next distribution set from Visual Logic to accept formulas for its parameters.

Efficiency

Break Down
Stops a simulation object for a specified time, after this time the object automatically restarts. If the time is set to 0 then the object won't automatically restart it must be restarted by Visual Logic.

Break Restart
Restarts a stopped or broken down simulation object

Break Restart
Restarts a stopped or broken down simulation object

Set Efficiency
Sets the Automated Efficiency percentage of an Activity.

Select Breakdown Type
Types of breakdowns can be specified by the user. This command allows the user to selects a breakdown type they have created.

Excel

Get from EXCEL
Copies information from EXCEL sheet into a SIMUL8 variable. If the variable item is a spreadsheet then Width and Height can be used to copy an area of a spreadsheet from EXCEL to SIMUL8.

Set in EXCEL
Copies information to EXCEL from a SIMUL8.

File

Append to File
Adds a text string, either typed in or from a variable to the end of a file.

Create File
Creates a new file of the desired name and location.

Read File
Reads the next location in a file to a variable or a cell in a spreadsheet

Begin Reading
Tells SIMUL8 to prepare to read data from a file.

Close All Files
Shuts down the links to any Read or Append files.

Sheet to File
Exports the contents of a SIMUL8 internal spreadsheet to a file. The file can be .txt, .csv, . .rtf. This allows results or other data to be collected in SIMUL8 internal arrays and then exported to another application for analysis.

File to Sheet
Allows the contents of a .txt, .csv, .rtf file to be imported to a SIMUL8 internal spreadsheet.

Run External Programs
Run external (.EXEs) from within SIMUL8, e.g. to load a Visual Basic Form.

Graphics

Set Object Image
Changes the image of a simulation object.

Set Object Location
Positions a simulation object at a specified location.

Get Object Location
Returns the current position of a simulation object

Load Image
Loads an image from the users disk to the graphics library

Interactive

Beep
Sounds the PC Hooter

Delay
Stops the model for specified number of seconds. Model continues after the time has elapsed. The main tool bar shows "Pausing" during the time. Clicking the word "Pausing" will continue the model immediately.

Display Message
Displays message text on screen with OK button. Model stops until OK clicked. With Professional you can also control the buttons displayed. By default "OK" and "Cancel" are shown but you can choose to display any combination of Yes, No, Abort and Cancel buttons.

Get PC Clock
Returns the PC clock time

Open Dialog
This command opens a SIMUL8 Dialog. The simulation will pause while the dialog is open.

Do Not Display Dialog
This command allows you to use dialogs to display spreadsheets or run .exes as part of your simulation's interface but without the end user having to see the intermediate dialog. This makes for a much smoother and professional looking interface.

Open Help File
Opens a file (hlp, doc, htm or txt)

Play Sound
Plays a .wav file.

Loops

Loop on Objects of type ....
Loops through all objects of the nominated type, selecting each as the Current object and allowing an operation to be undertaken on the object.

Loop on number from .. to ..
Loops through a section of code incrementing a set variable by 1 each time.

Break
Jumps out of a LOOP and begins execution at the line after the loop.

Math Functions

ABS
Convert negative number to positive number.

ARCTAN
Returns Arc Tangent of the parameter.

COS
Returns the cosine of the parameter.

Day
Converts the parameter from time to Day (1-7) calculated from the Clock Properties.

EXP
Returns e to the power of the parameter (natural anti-log).

Hour
Converts the parameter from time to Hour (1-23) calculated from the Clock Properties.

Log
Returns the natural logarithm of the parameter

Minute
Converts the parameter from time to Minute (0-59) calculated from the Clock Properties.

Neg
Multiplies by -1.

Random
Returns a random number between 1 and 0.

Round
Rounds to the nearest integer.

Sample
Gets a random value from a statistical distribution.

SIN
Returns the sine of the parameter.

SQRT
Returns the square root of the parameter.

TAN
Returns the tangent of the parameter.

Trunc
Rounds to integer by moving towards 0.

Week
Converts the parameter from time to Week (1-...) calculated from the Clock Properties.

WIProperty
Access advanced work item properties.

Object Properties

Start Point Properties
The following properties of an Activity can be read or changed using Visual Logic:

- Arrived Count
- Batching Out Size
- First at Start
- Ignore Lost
- Image
- In count
- Index
- Inter-arrival Time
- Lost Count
- Name
- Other Costs
- Other Revenue
- Out Count
- Unique ID
- Unlimited

Queue Properties
The following properties of a Queue can be read or changed using Visual Logic:

- Count Current Contents
- Image
- In count
- Index
- Initial Contents
- Maximum Size
- Minimum Wait Time
- Name
- Other Costs
- Other Revenue
- Out Count
- Quantity
- Shelf Life
- Travel and Contents
- Unique ID

Activity Properties
The following properties of an Activity can be read or changed using Visual Logic:

- Batching Out Size
- Change Over Time
- Completed
- Count Current Contents
- Cycle Matrix Task
- Efficiency Repair Time
- Efficiency Work Time
- Fixed Type Label Value
- Ignore Blocked Routes
- Ignore Starved Routes
- Images
- In count
- Index
- Interrupt Store
- Label Batching Max
- Label Batching Min
- Locked In Route
- Name
- Operation Time
- Other Costs
- Other Revenue
- Out Count
- Priority
- Replication
- State
- Unique ID

End Properties
The following properties of an Activity can be read or changed using Visual Logic:

- Count Current Contents
- Half Limit
- Image
- In count
- Index
- Name
- Other Costs
- Other Revenue
- Out Count
- Unique ID

Conveyor Properties
The following properties of a conveyor can be read or changed using Visual Logic:

- Allow Gaps
- Count Current Contents
- Efficiency Repair Time
- Efficiency Work Time
- Ignore Blocked Routes
- Image
- In count
- Index
- Length
- Load Space
- Name
- Out Count
- Ready Time
- Speed
- State
- Unique ID

Resource Properties
The following properties of a conveyor can be read or changed using Visual Logic:

- Current Available
- Image
- In count
- Index
- Max Available
- Load Space
- Name
- Other Costs
- Other Revenue
- Out Count
- Unique ID

Resources

Set Resources Required
Changes the number of resources required at an Activity to complete a task.

Set Resource Travel Time
Changes the travel duration of a Resource between locations.

Get Held Resource Count
Gets the number of resources currently being used by an Activity.

Remove Resource Requirement
Removes the requirement for a resource from an Activity.

Set Resource Requirement Type
Sets the Hold Only/Release Only options for Resources at an Activity.

Set Resources Required for Repair
Changes the number of resources required to repair an Activity.

Next Set Resource Requirement can interrupt
Resources can be interruptible at an Activity. This command allows you to specify that the next resource requirement set through Visual Logic should be set to interruptible.

Results

Get Result
Copies a result summary value to a variable.

Get Confidence Limit from Results
Allows you to get any confidence interval for any result on the summary.

Adjust Results Collection to Summary
Switches Results Collection on/off depending on use on Results Summary.

Remove Results
Removes results for the nominated object from the Results Summary.

Set % Within Time
Sets the Time used for Results Percentages

Recorded Data to File
Writes to a nominated file the desired selection of results.

Result To Summary
Add any result from any result dialog to the Result Summary.

Open Results Window
Opens the results summary

Close Results Window
Closes the Results Summary

Open TimeView Window
Opens the TimeView Gantt Chart

Close TimeView Window
Closes the TimeView Gantt Chart

Routing

Set Route In Priority
Changes the routing in rule being used by an Activity to priority.

Set Route Out Priority
Changes the routing out rule being used to priority.

Set Route Out Label
Changes the routing out rule being used to Label.

Set Route Out Percent
Changes the routing out rule being used to percent.

Set Route Out Discipline
Changes the routing out rule being used. All routing out disciplines are available.

Set Collect Number
For Activities which use Collect routing in, sets the number of work items to be collected from a particular route.

Percent Route Out Adjust to 100
This adjusts all percent routes out from the Activity so that they add up to 100%.

Set Travel Times
Alters the travel time between 2 suitable objects.

Block Current Routing
Prevents work items from entering an Activity.

Shifts

Set Shift Times
Sets the Start and Stop times of a Shift.

Set Shift Days
Sets the days a shift runs on.

Set Shift Resources
Sets the number of resources available during a shift.

Simulation Control

RunModel
Runs the model until End Run Time.

StopModel
Stops the simulation run

Reset Clock
The clock is set to zero, the random number generators reset using the new stream set number and all simulation objects initialized.

Simulation Speed
Changes the current running speed.

Save Model
Saves the model to disk as File Name.

Spreadsheets

Clear Sheet
Clears a SIMUL8 spreadsheet, deleting all data and any formatting features, graphs, buttons or other features.

Set main sheet
Selects the spreadsheet to be displayed to the user

Display main sheet
Displays the currently selected main sheet.

Sheet to Job Matrix
Nominate a SIMUL8 spreadsheet to copy to the Job Matrix. This command is designed to facilitate the use of Templates.

Job Matrix to Sheet
Copies the Job Matrix into a SIMUL8 spreadsheet at the desired location. This is intended to make it easier for end users to edit and amend Job Matrix data, especially when using Templates.

Sheet to File
Exports the contents of a SIMUL8 internal spreadsheet to a file. The file can be .txt, .csv, . .rtf. This allows results or other data to be collected in SIMUL8 internal arrays and then exported to another application for analysis.

File to Sheet
Allows the contents of a .txt, .csv, .rtf file to be imported to a SIMUL8 internal spreadsheet.

Structure

Create Object
Creates a new simulation object.

Erase Simulation Object
Removes a simulation object from the simulation

Copy Simulation Object
Creates a new object by making a copy of another

Link Simulation Objects
Links two simulation objects with a routing arrow

UnLink Simulation Objects
Removes routing arrow between two simulation objects

Unlink all out links
Removes all exit routing arrows from an object.

Clear Object Selection
Deselects all selected simulation objects

Select Simulation Object
Selects a simulation object for copying

Copy Selected Objects
Creates a copy of all selected simulation objects.

Get latest copy of
Returns object Global Data for latest copy of an object

Refresh Windows
Redraws all Windows

Get Current Object
Returns the name of the object that has referenced the Current piece of Visual Logic.

Get Component Copy Method
When a new component is created by copying an existing one the On Create Logic is now run. This command allows you to identify how it was copied to allow you to then control what events happen.

Get Original
This command lets you find the original component that was copied to create the current object. This is useful when you are copying a set of objects N times. If you do this then you can lose the original. Say you copy 5 Activities - which is the original? Visual Logic will retain the one that was last to be selected, so you lose the ability to copy over any data from the others.

SQL

Open Database
This command allows a table within a data source to be opened and a filter applied allowing a limited search to be undertaken. (Only available in SIMUL8 SQL.)

Get from Database Field
Looks up a nominated field in a database, and write the value returned to a SIMUL8 variable. (Only available in SIMUL8 SQL.)

Update SQL
Updates a record in an SQL compatible data source. This does not create a new record but can be used to find and then update an existing record. (Only available in SIMUL8 SQL.)

Insert Into SQL Database
Nominates an insertion point for a string of text or a variable into a nominated database table. Use the Insert into SQL Database command to complete the insertion. (Only available in SIMUL8 SQL.)

Set Field Number
Sets a numeric field in a database. (Only available in SIMUL8 SQL.)

Set Field Text
Adds a new database record to a database table. (Only available in SIMUL8 SQL.)

Complete SQL Insert or Update
Closes the link to a nominated database. (Only available in SIMUL8 SQL.)

SQL Command
This command allows SQL not contained in the standard SIMUL8 SQL Library to be typed in. (Only available in SIMUL8 SQL.)

Text

Extract Text
Extracts text from a Comma Separated Value field.

Find Text
Searches for the location of a text string in a nominated location (e.g. a variable), and returns the location of the start of the string of text.

Extract from CSV
Extracts text from a Comma Separated Value file.

Get Text Length
Calculates the length of a string of text and writes it to a variable.

Visual Logic Sampling

Get VL Random Number Seed
Returns the current seed for all Visual Logic based random numbers.

Set VL Random Number Seed
Changes the current seed for all Visual Logic based random numbers.

Work Items

Empty Simulation Object
Removes all work items from an object and deletes them from the simulation.

Add Work To Queue
Creates a work item and adds it to the Queue.

Delete Work Item
Deletes a work item from a Queue and from the simulation.

Move Work Item To
The Current Work Item is removed from its Queue moved to a new Queue.

Set Image
Changes the image used for the Current Work Item

Select Current Work Item
Selects a work items as the current work item.

Set Group Limit
Set the limit of work items allowed in a group

[Top of the page]


Visual Logic Command Builder

Command browser docked in the Visual Logic window.

You can easily view all the commands available to you and drag them into your Visual Logic code.

Create your own custom list of all commands you use repeatedly.

See an explanation of each command easily in the help panel at the bottom of your browser.

Great for new users getting to know Visual Logic and long term users of SIMUL8 making it quicker and easier to create your code.

Edit Multiple Visual Logic Sections

Every Visual Logic window has short cut tabs to last 9 edited sections of Visual Logic. You can also right click on any tab to add another section of Visual Logic as a shortcut.

[Top of the page]


Find

Visual Logic find searches all Visual Logic and allows double click instant access to the selected section. You can also choose to ignore some classes of Visual Logic lines, like comments, and search all Visual Logic or just one section. Click right on the "Find" list of line allows options for adding multiple breakpoints.

[Top of the page]


Parameterized Calls

Parameterized calls allow you to write much more efficient Visual Logic. You can pass a variable to a called section of code, this allows you to use the same piece of code to do different tasks. A great application for this is with components.

This feature is only available with SIMUL8 Professional

[Top of the page]


Allow Debugging Preference

Preference option to turn off error checking and debugging on Visual Logic which speeds up the runtime of your simulation. Great for when you're showing your simulation to others.

[Top of the page]


Fast Access to Recently Viewed Visual Logic

The Visual Logic "view All" code list lists the top 9 most recently edited blocks at top of list for fast access.

[Top of the page]


View All Visual Logic

Documentation option that allows you to view all the Visual Logic in your simulation. It also inserts a character symbol at the start of each new section that are translated into page breaks when pasted into Microsoft Word.

[Top of the page


Folding Options

Folding options added to let you quickly expand and fold your Visual Logic.


[Top of the page]


Code Bookmarks

Create up to 10 bookmark shortcuts to your code. You can then access them directly from the main menu or click Ctrl-n, where n is the bookmark number, in any Visual Logic section to go straight to your code.

This feature is only available with SIMUL8 Professional


Local Variables

Any variable you declare in the Information Store is global. That is it can be read and written to by any Visual Logic section. This is generally fine but sometimes can be a restrictive so SIMUL8 also has local variables.

A local variable only exists within the Visual Logic section that it is declared in. Once that block ends the variable is cleared and its values lost. A local variable of the same name can be declared elsewhere and will be treated as a different variable. A local variable can even exist multiple times simultaneously, if the Visual Logic section is entered again before it's exited each call of the Visual Logic section will have a distinct local variable.

This feature is only available with SIMUL8 Professional

[Top of the page]


Referenced By List

Get a list of all objects and other Visual Logic sections in your simulation that use a piece of code.

[Top of the page]


Customize the Look of the Editor

Change the colors of the Visual Logic Editor to get it the way you like.

[Top of the page]


Call Tree

The Call Tree shows you all the other sections your code calls and what they call too. This is really useful for easily navigating your code and helpful when you need to take over a simulation from another user.

This feature is only available with SIMUL8 Professional

[Top of the page]


Functions

Functions allow you to write reusable routines that so that your Visual Logic can be called in any SET line as the right hand side.

This feature is only available with SIMUL8 Professional

[Top of the page]


Drop Down Access

Access the Visual Logic you want through drop down lists, separated by object and simulation events.

This feature is only available with SIMUL8 Professional

[Top of the page]


Import & Export Visual Logic

We've created Visual Logic files allowing you to save all your commonly used Visual Logic routines. You can import them into any simulation and if the relevant variables don't exist SIMUL8 will create them for you.

This feature is only available with SIMUL8 Professional

[Top of the page]