Using Visual Logic Functions by Wayne O'Rourke
For those of you have experience in programming the concept of functions will not be new, but if you're not familiar with this concept then this is the newsletter for you!
A function is a portion of Visual Logic (VL) within your model, which performs a specific task and is relatively independent of the remaining VL.
There are many advantages to breaking your VL up into subroutines, including:
1) Reducing the duplication of the VL (e.g., by replicating useful functionality, such as mathematical functions),
2) Enabling reuse of VL across multiple objects or other blocks of VL,
3) Decomposing complex problems into simpler pieces (this improves maintainability and ease of extension),
4) Improving readability of your VL,
5) Hiding or regulating part of the model
The components of a subroutine may include:
1) A body of VL to be executed when the subroutine is called
2) Parameters that are passed to the subroutine from the point where it is called
3) A value that is returned to the point where the call occurs
There are many examples of a function's use, the most common being a mathematical equation. Those of you familiar with Microsoft Excel probably use functions all the time, e.g. SUM, MIN, MAX etc.
Creating a VL function is similar to creating any block of VL.
Start by creating a new block of VL through the VL editor (Tools\All Visual Logic or CTRL+L or use the shortcut button on the Logic toolbar) and then click New.
To make this new block of VL into a function simply create a Local Variable called RESULT.
Below is an illustration of a VL function to return the Minimum of two values passed to it as parameters.

Now all you need to do is call the function anywhere within your simulation and it will return to you the minimum of two values.
To call a function you can:
1) In VL just type the name of the function to the right of a equals sign using the VL predictive text
2) Use the formula editor and select the VL Function radio button to display all the available user defined VL functions

Some examples of places where this function could be called are:
1) In other blocks of VL

2) In Work center Timings
 
3) Setting Label Actions

4) Storage Bin Minimum Wait Time

We hope this gives you some insight into functions and that you'll find them useful in your simulation development. As always if you have any questions please let us know, we're happy to help.
Operational Research Society Simulation Workshop - Call for Papers
The Simulation Workshop brings together practitioners and academics working in the field of discrete-event simulation. It provides an opportunity to exchange ideas on the current and future state-of-the-art in simulation and Modeling
It will be held 1 - 2 April 2008 at the Abbey Hotel Golf and Country Club, Worcestershire , England. The deadline to submit a paper is 31st October.
For more information visit the OR Society website.
Showcasing Simulation at Warwick
The OR Society Simulation Special Interest Group has organized a workshop day:“Showcasing Simulation At Warwick” on Wednesday 24th October 2007, 10.00am-3:30pm at Warwick Business School, The University of Warwick.
Speakers
- Professor Stewart Robinson: Overview of Simulation at Warwick.
- Professor Ruth Davies: Agent based simulation applied to Hospital acquired infectious diseases.
- Dr Katy Hoad: Automating the Analysis of Simulation Output Data. (Project co-sponsored by SIMUL8).
- Dr Kathy Kotiadis & Dr Navonil Mustafee: Conceptual modeling in health care.
- Ernie Lee: A quest for a better VIS-based knowledge elicitation tool
- Antuela Tako: Comparing Discrete-Event Simulation and System Dynamics: the user perspective.
- Chris Watts: Modeling Motivation: Understanding problem-solving processes in social networks.
- Stavrianna Dimitriou: Incentive Alignment in Supply Chains: The Use of Agent Based Simulation.
If you would like to attend this event please contact Dr Katy Hoad. Please note that there will be a small charge of £18 per person for refreshments and food.
If you have any questions generated from, or comments about this
newsletter then email Newsletter@SIMUL8.com

|