• No results found

Flexsim Tutorial

N/A
N/A
Protected

Academic year: 2021

Share "Flexsim Tutorial"

Copied!
171
0
0

Loading.... (view fulltext now)

Full text

(1)

Flexsim Tutorial

Bill KP Chan HW 1-6

(2)

Flexs im Con cept s & T erm in ol og y

• Model • Objects

- Fixed Resources

- Mobile Resources (task executors) - Flowitems - ports - triggers - task sequences • Libraries • Model Views

(3)

Models, Objects and Flowitems

Model

- A collection of Flexsim objects representing

an actual system -

with just enough detail to answer

the questions you are concerned with!

Object

- A building block with

inherited

behavior, and

user-definable

attributes

,

variables

, and

visual

properties

.

Flowitem

– the entities that flow through a model

such as products, customers, paperwork, phone

calls, etc.

(4)

Model

(5)

Flexsim Model

• A Flexsim

model

is a system of

queues

,

processes

, and

transportation

.

Queues

develop naturally in a model when

upstream arrival rates exceed the

downstream processing rates.

Processing

is simply a forced time delay on

the object being processed.

(6)

Object Classification

FixedResources

– objects which send

and/or receive

flowitems

ex.

(7)

Object Classification

Flowitems

-

The entities that are

passed from one fixed resource to

another within a model.

• Flowitems are actually Flexsim Objects.

• Flowitems hold information that can be

set and queried in the model.

– This information can do anything from

defining process times to making routing

decisions, and anything in between.

(8)

Model Behavior

Most modeling behaviour is defined on

the

fi xed re so ur ces

in a model:

– how long to process the flowitem

– where to send the flowitem next

– call a shared resource (operator) for

processing the flowitem

(9)

Object Port Connections

Out pu t/Inp ut Por ts

-

Output-to-Input port

connections define possible

flowitem

routes to/from

Fix ed Reso ur ces

.

(10)

Object Port Connections

Cente r Ports

-

for referencing purposes,

typically used to point to a

TaskExecuter

to be

called for the processing or transportation of a

(11)

Concept of Triggers

When key events occur on an

object

, a

trigger

is fired.

The user may specify a variety of things to

happen when a trigger fires (trigger logic).

There are triggers when a flowitem enters

or exits an object. There are triggers when

a process time finishes or a repair time is

complete.

Each type of object has a unique set of

triggers.

(12)

Triggers

• An opportunity to define

and customize system

behaviour at a specific

event occurrence.

– Write/read information to/from a flowitem.

– Change visual properties of flowitems or objects. – Send Messages to other

(13)

Tasks and Tasksequences

task

– a single instruction or action to be

performed by a

TaskExecuter

object.

ex.

LOAD flowitem

tasksequence

– a series of

tasks

to be

performed in sequence.

ex. TRAVEL to queue

LOAD flowitem

TRAVEL to processor

UNLOAD flowitem

(14)

Library

Library

-

a list of class objects to

be used in building a model.

Instance

– a copy of one of the

library objects - created in the

model when an object is dragged

from the library icon grid into a

(15)

Model Views

Perspective >

> Ort ho gr aph ic

• Additional Views:

– Planar

A

view

is a window into the model. You can have several

views open at the same time. Each view is a

different

(16)

Basic Steps of Modeling in Flexsim

1 - Create a layout using library objects

2 - Make port connections

3 - Edit the look and behavior of objects

4 - Compile and run the simulation

(17)

Mouse Operations

• View Window Navigation:

– Translate:

left click-drag

– Tilt and Rotate:

right click-drag

– Zoom:

left&right click-drag (or scroll wheel)

• Object:

– Translate in X and Y:

left click-drag on object

– Translate in Z:

right&left click-drag on object

Highlighted

= yellow box: left click

Selected

= red box: shift-click or ctrl-click

– select multiple objects by shift or ctrl click-dragging a

bounding box around a group of objects

(18)

Model 1

• Purpose

– Introduction to the 5 basic steps of model building

using a single queue, single server system (post

office).

• Description

– people arrive at a post office every 60 seconds, on

average. The statistical probability distribution

which best simulates the inter-arrival pattern is an

exponential distribution with a location value of 0

and a scale value of 60.

(19)
(20)

• Drag objects from the Library (icon grid) and drop them into the Orthographic Model View window using your mouse.

• Reposition, resize, or rotate objects as desired using mouse.

(21)

Flowitem Flow

Flowitems

are passed from one object to the

next in zero time regardless of where in the

model layout the objects are located.

• To create time delay in the flowitem flow, add

conveyors or task executers for

transport

.

– Convey time depends on the conveyor’s length and

speed.

– Transport time between objects depends on the

distance between the objects, plus the task

executer’s speed, acceleration, & deceleration.

(22)

To scale or not to scale?

1. Choose the time and distance unit that will be most common in your model.

• time: milliseconds, seconds, minutes, hours, days, weeks, months, years, etc.

• distance: inches, feet, meters, kilometers, miles, etc.

2. Once you have chosen your time and distance units, make the mental connection that EVERY mea sur ement in you r model must be set in your chosen units.

Flexsim is a “unitless” platform. Time & length

units are “user-definable” – consistency is the

key!

(23)

Port Connections

• Objects can have an

unlimited

number of

ports.

• A port connection is needed for

each

possible routing choice in the model.

• The actual port that a flowitem passes

through depends on the selected rule for

the object that is either doing the pushing

or the pulling.

(24)

Step 2. Make port connections

• While pressing the “

A

” key, click-and-drag

port connections

between the objects.

• Direction is important! Drag from thesending object to the receiving

object.

• These

output to input

port connections are needed between

the objects in your model that send and receive

flowitems

.

(25)

Viewing port connections

• Display of port

connections can be

toggled on/off within

the “View Settings”

view sidebar.

• The size of the port

connectors can be

adjusted with the

+/-buttons.

(26)

Keys used for Port Connections

Q

Q

W

W

Disconnect

Connect

(27)

Step 3. Edit the objects

Properties Window

– Right click then choose Properties

– Used to edit and view general info on all objects

• Visual shape, size, orientation, location • Name a local toggles

• Port connections • Labels

• Statistics

Parameters Window

– Double click (or right click then choose Parameters)

– Used to edit object specific behaviour

(28)

Properties Window

Every ob ject has th e

same se t o f p ro pert ies

tabs

• Visual Tab

– Look and size

• General Tab

– Port connections – Display switches

(29)

• Objects can be repositioned,

resized, and reoriented from

the Properties window.

• Additionally, objects can be

manipulated from within the

model view.

– Reposition an object by left-click dragging the object to a new location.

– Be sure “Edit | Resize and Rotate Object” is checked

• Left-click drag on the arrows to resize.

– Up and right are larger – Down and left are smaller

• Right-click drag on the arrows

(30)

Parameters Window

• Each object class has its

own Parameters Window

• Parameters affect the time

that flowitems stay in an

object and how they are

routed from object to object.

Apply

will accept changes

OK

will accept changes and

close the window

(31)

Parameter tabs

• Parameters are grouped into tab pages by category

• Every fixed resource object will have a “

Flow

” tab

(32)

Understanding the Basic Pick List

• The pick list

• The code template (friendly editing)

(33)

Understanding the Trigger Pick List

• The current code/selection

• Add a pick-option to the code

• Clear all of the existing code

• The code template (friendly editing)

(34)

Code Template

• Blue text in the

Template

may be

Code

replaced with any valid

number, string or

(35)

• The statistical probability

distribution which best

simulates the inter-arrival

pattern is an

exponential

distribution

with a

location value of

0

and a

scale value of

60

.

(36)

Step 4. Compile and

Run the Simulation

• Compile the model (for

models with C++ only)

• Reset, Run

• Control run speed with the

slide control (has no effect

(37)

Step 5. View the results

• Create a Full, Summary or

State Report using the

“Statistics” menu

• Other reporting features to be discussed later:

– VisualTool Object • Dynamic text – Recorder Object

• Time plots, histograms, pie charts, historical and

statistical tabular data

– Object Properties Statistics Tab – Triggers writing to GlobalTables

(38)

Summary Report

• Display a tabular

report for all objects

in model (or just

those that are

red-selected

).

• Choose from a list

of standard system

variables to include

in report.

(39)
(40)

Flexsim State Report

• State profile is listed

for all objects in the

model (or just those

that are

red-selected

).

• Displays amount of

time or percentage

of total simulation

time an object was

(41)
(42)

Full Report

• Requires Full History to be enabled

– Statistics | Full History On

• Records data as the model runs

• Data is saved in a database • Flexsim Chart makes charts

(43)
(44)

Model 1 Follow Up

• Questions

– What’s the maximum and average time

people wait in line?

– How many unhappy customers?

– What’s the utilization of the service window?

– How many customers were serviced?

(45)

Model 2

• Purpose

– learn how to duplicate objects

– see affects of adding a second service window

– introduction to the “Send to port” field (Flow tab)

• Description

– add another service window to the post office

• Questions

– answer the questions asked in Model 1 - Preview

– if the windows differ by the type of service they can

provide and 40% of the people need to use window

1 and 60% need to use window 2, how does the

queue time increase?

(46)

Editing Selected Objects

• Group editing can be performed on selected objects using

the “

Edi t Select ed Obj ect s

” menu in the view’s sidebar.

• Only one object can be

given view window.

highlighted

(YELLOW box) in a

• Multiple objects can be

selected

(RED box)

(47)

The Flexsim Object Library

• The Flexsim Family Tree

– Fixed Resource – Task Executer – Dispatcher • Model 3 – Sink – Queue – Conveyor – Flow Node – Processor - Transporter

- Task Executer Teams - Network Node - Recorder - Visual Tool - Multiprocessor - Seperator - Combiner - Rack - Operator

(48)

Flexsim Family Tree

Flexsim Flexsim

Flexsim

Flexsim Object Object Object Object

Fixed Resource Fixed Resource

Fixed Resource

Fixed Resource DispatcherDispatcherDispatcherDispatcher NavigatorNavigatorNavigatorNavigator Network Network NodeNetwork NodeNetwork NodeNode Visual Visual ToolVisual ToolVisual ToolTool Recorder Recorder Recorder Recorder Traffic Control Traffic Control Traffic Control Traffic Control Source Source Queue Queue Sink Sink Rack Rack T

Taassk k EExxeeccuutteer r NNeettwwoorrk k NNaavviiggaattoorr

Operator Operator Transporter Transporter Crane Crane ASRS Vehic le ASRS Vehic le Robot Robot

(49)

Flexsim Standard Objects

• Flexsim currently has 25

objects in its discrete object

library.

• Your ability to model will be

determined by how well you

understand these 25 objects

and more importantly, the three

main superclasses:

– Fixed Resource – Task Executer – Dispatcher

• Extensive coverage of the

Flexsim Object Library is found

in the

Flexsim

Users Ma nu al.

(50)

FixedResource Superclass

• FixedResource objects are the backbone of a simulation

model. They’re used to define the product flow.

• FixedResources can:

– push or pull flowitems

– process flowitems (forced delay)

– queue up flowitems (accumulate up to a max content) – call for an operator to be utilized (for process / setup)

(51)

TaskExecuter Superclass

• TaskExecuters execute tasksequences.

• A tasksequence is a list of tasks which are to be completed in the order listed.

• A task is an activity such as loading, unloading, traveling, delaying, or simply being utilized.

• When a TaskExecuter receives a tasksequence, it will start executing the tasks one after another until the tasksequence is either finished or preempted by a preempting tasksequence of higher priority .

• Tasksequences are created and dispatched automatically when th“Use Transport” or “Use Operator” boxes are checked on a FixedResource.

• Cust om taskseque nces can also be created and dispatched using commands (taught later).

(52)

• The Dispatcher receives tasksequences and either queues them up, or dispatches the tasksequences immediately to other Dispatchers and/or TaskExecuters connected to its output ports.

• A tasksequence may preempt the current tasksequence part way through the current list of tasks. The preemption can either

temporarily interrupt the current tasksequence or permanently destroy the current tasksequence as well as any other

tasksequences waiting in the preempted TaskExecuter’s tasksequence queue.

(53)

Model 3

• Purpose

Build a model which uses several objects in the Flexsim library

• Description:

A part enters a Separator every 20s where it is split into 3 separate parts. Each part moves down one of three separate lines:

1. The first part moves via an “s”-shaped conveyor to a Combiner where a total of 8 parts are packed on a pallet (supplied by another Source). The loaded pallet is then conveyed to a Sink.

2. The second part is conveyed to a Queue where it is then carried by an

Operator to a MultiProcessor object where 3 separate processing steps are performed. The first step can complete on it’s own in 3 seconds. The second step requires an operator (same operator that delivered the part) and takes 4 seconds, and the third step can complete on its own in 5 seconds. A Transporter then picks up the part and takes it to a Rack where it is stored. 3. The third part travels via FlowNodes to a Queue where 10 are accumulated before being released, one at a time, to a Processor with a 20 second cycle time. They are then placed in a Queue where a Robot transfers one part at a time over to a Sink.

(54)

Build Model 3 in Four Phases

• Phase 1: Create Flow

– Create flow with FixedResource Class objects only (neglect TaskExecuters).

• Phase 2: Add TaskExecutors

– Add TaskExecutors: Operator, Transporter and Robot.

• Phase 3: Network Node Paths

– Add a NetworkNode path to control the travel path of the Transporters.

(55)

Phase 1 Description

• Phase 1:

– Obtain flow with FixedResource Class objects only (neglect TaskExecuters).

(56)

Source

• The Source is used to

introduce flowitems into

the model.

• The arrival rate of

flowitems will be based

on an Inter-Arrival Time,

Arrival Schedule or

(57)

Sink

• The sink is used as an exit point for flowitems.

• FlowItems can only ‘exit’ the model via the Sink

• Your last chance to record information about th

(58)

Queue

• The Queue is used to

stage FlowItems for

downstream operations.

• Queues are used in the

model wherever

work-in-process (WIP) exists

(59)

Conveyor

• Used to convey flowitems from one location in the model

to another location.

• Time to convey depends on the conveyor’s length

divided by its speed.

• Can be accumulating or not. If not, all parts on the

conveyor stop when a part at reaches the end of the

conveyor and is blocked (like a Belt conveyor).

• Conveyors can take the actual length of the flowitems

and the Conveyor sections into account when calculating

accumulation and available space.

• You can define a combination of many straight and

curved sections all on one conveyor object!

(60)

Flow Node

• The FlowNode is used in a model where it is

desirable to have flowitems move along a

designated path to another object in the

model consuming time as they move.

• One use would be to move people (flowitems)

down an open corridor or in a building.

(61)

Processor

• A Processor is used anytime an operation is

performed on a FlowItem.

• A Processor can be any kind of machine or

station; anything that would take

time

to

manipulate a FlowItem.

• The FlowItems must stay in the Processor for

the sum of the Setup Time and the Process

Time plus any Blocked Time. The dwell time

may also include time waiting for an operator,

time waiting for a transporter and time waiting for

the Processor to be repaired if broken down.

(62)

Order of Execution

(pushed flowitem)

OnEntry

flowitem enters Setup Time Pick Operator OnSetupFinish

Process Time

(63)

MultiProcessor

• The MultiProcessor allows you to perform several operation steps at one location.

• Each operation can have a

different process time, and use a different number of operators. • A MultiProcessor is a good

object to use when you have large flowitems that move to a spot where several operations are performed before it moves again.

• Only 1 flowitem at a time is allowed in the MultiProcessor.

(64)

Combiner

• The Combiner is used to pack or join flowitems

• When using the pack option, the flowitems which enter ports 2 and higher are placed inside of the flowitem which entered port 1.

• When using the join option, the flowitems which enter ports 2 and higher are destroyed, and the flowitem which entered port 1

represents the “assembled” part.

• Note: Component rows are added automatically for each input port connections made for ports 2 and higher.

(65)

Separator

• The Separator is used to separate (unpack) or to split

(make copies of) flowitems.

• It can unpack flowitems that were previously combined

using the Combiner.

• Flowitems can be split into a specific number or call from

a table.

(66)

Rack

• The Rack is used to store flowitems in a

specific column and row (bay and level).

• You can toggle between three different

visual displays of the Rack by holding the

“X” key and clicking on the Rack.

(67)
(68)
(69)

Phase 2 Description

• Phase 2:

(70)

Operator

• An Operator will model human tasks such as machine setup or manual assembly.

• The Operator can also be used to transport FlowItems from one FixedResource to another.

(71)

Transporter

• A Transporter is used in a model where a fork truck, AGV or some other transport vehicle might be used.

• It is used to transport FlowItems from one FixedResource to anothe • The Transporter can travel in x, y and z directions.

• During offset travel the forks lift or lower in the z direction as neede to pick or place flowitems.

• Transporters can load many FlowItems from multiple locations and then unload the FlowItems separately to multiple locations.

(72)
(73)

Forming a TaskExecuter team

Output

Center

Dispatcher TaskExecuters

Input

(74)
(75)

• Phase 3:

– Add a NetworkNode path to control the travel path of the Transporter.

(76)

NetworkNodes

• NetworkNodes are used to define the path a

TaskExecutor will follow when executing its travel tasks

• A network path is made up of a group of interconnected

NetworkNodes.

• A TaskExecuter is assigned to move on the network by

connecting it to any NetworkNode in the path. The

(77)

Connecting NetworkNodes

• Click-and-drag a

connection while

pressing the “A” key.

• When connected you

will see a black line

between the nodes.

Two green direction

indicators show that

travel is allowed in

both directions.

(78)

Connecting a Fixed Resource to the Network

• Click-and-drag a

connection, while

holding the “A” key,

between a NetworkNode

and the object where the

load takes place.

(79)

Connecting a TaskExecutor

to the Network

• Click-and-drag a

connection between the

TaskExecutor and a

NetworkNode while

pressing the “A” key.

• A red line will indicate

that the connection has

been made. The line

does not connect to any

port.

(80)

Single Direction Paths

• A path can be restricted

to travel in a single

direction by pressing

the “Q” key and

click-dragging in the direction

you want to disallow

travel.

(81)

Non-Passing Paths

• A non-passing path can

be toggled by using the

“A” key and

click-and-dragging between two

nodes that are already

connected.

• The direction indicator

turns yellow, showing a

non-passing direction.

• “A” dragging a red or

yellow direction will

No t rave li ng

(82)

Direction Indicator Context Menu

“X” clicking a direction indicator with the mouse button will also toggle through the different direction modes.

Use the “Travel

Networks” section of Rather than “A” dragging the path to toggle path type, you can right click a direction indicator and choose from a context menu.

(83)

Spline Control Points

• To create a curved

path select “Curved”

from the direction

indicator context

menu.

• Spline control points

will appear on the

path.

• Drag the spline

control points to

(84)

5. A

1. a

2. A

3. A

• The display options for the

network can be toggled by

holding down the “X”

and then clicking on any

NetworkNode.

NetworkNode View Modes

(85)

Paths Tab

• Each path from a NetworkNode can be edited in many ways. • Different direction modes can be

set using the “Connection Type” dropdown list.

• Minimum spacing between travellers can be defined. • A maximum speed can be set

for this path connection.

• A Virt ual Distance can be set. Virtual distance is a forced distance value. Using virtual distance, you can give a path an artificial length.

(86)
(87)

Phase 4 Description

• Phase 4:

– Add a 3D pie chart to show the status of the Operator – Add 3D text to show the content of the Rack

(88)

Recorder

• The Recorder is used to display and record

statistical information.

• The Recorder can display 3D charts and

graphs from object data or tables.

• Enable the object to record data for Content

and Staytime graphs (Statistics tab of

(89)

VisualTool

• The VisualTool is one of

the most versatile Flexsim

Objects.

• VisualTool can be used as

a prop to display planes,

cubes, columns, spheres,

imported objects (2D CAD

or 3D shapes), 3D text and

even presentation slides

(bmp, jpg).

• The VisualTool can also

act as a container for other

(90)
(91)

Flexs im Hiera rchy

<understanding the tree structure>

And

The Mod eli ng Lang uage

(92)

What is a Node?

• Basic data structure of Flexsim is a hierarchal tree

– main tree (model and project related objects and data)

– view tree (GUI related objects and picklists)

– model tree (model related objects and data)

• The node is the basic building block of a tree

(93)

Node Structure

• Nodes have a name

• Nodes can have a data item

– number

– string

– object

• If nodes

have

object data, use

>

to view a

separate node list containing the object info

(data members and member functions)

• If nodes

contain

sub nodes, use + to expand

and view the child nodes

(94)

Node Symbols

Standard Folder

Object

Object data

Function (C++)

Function (FlexScript)

(95)
(96)

What is a function?

functionname(

argument1

,

argument2

,

etc

)

• An argument can be:

– Numerical value – String (“text“)

– Pointer (*) to an object or node

• Function example:

colorrandom(item)

(97)

General Rules

• language is case sensitive (A does not equal a)

• no specific format is required (free use of spaces, tabs and line

returns is encouraged for “readable” code)

• text strings are entered between quotes.

“mytext”

• parenthesis follow a function call and commas separate the

arguments of the function.

moveobject(object1, object2);

• a function or command will always end with a

SEMI-COLON (;)

• parenthesis can also be used freely to make associations in

your math and logic statements. Ex: ((x+3)*2)

• curly braces { } are used to define a block of statements.

• to comment the rest of a line use

// and ty pe not e here

• multi-line comments start with /* and end with */.

• don’t use spaces or special characters in name definitions

(

_

is ok).

(98)

Logic Statements - Available Help

– Existing Pick List options are great examples

– Commands

(99)

Variable Types

• int

• double

• string

• treenode

integer

(1, 2, 3, 14324)

double precision

(2.5, 3.14159)

text string

(“Anthony was here.”)

(100)

Declaring and Setting Variables

• int index = 1;

• double weight = 175.8;

• string category = “groceries”;

(101)

Math Operators

• x + y

• x - y

• x * y

• x / y

• sqrt(x)

• pow(x,y)

• round(x)

• frac(x)

• fmod(x,y)

• min(x,y)

• max(x,y)

x plus y

x minus y

x times y

x divided by y

square root of x

x to the power of y (x

y

)

x rounded to the nearest integer

returns the decimal portion of x

returns the remainder of x/y

returns minimum of x and y

returns maximum of x and y

(102)

Comparing

• x > y

• x < y

• x >= y

• x <= y

• x == y

• x != y

x greater than y

x less than y

x greater than or equal to y

x less than or equal to y

x equal to y

(103)

Relating

• &&

• ||

• !

logical AND

logical OR

logical NOT

(104)

Updating

x = y

x += y

x -= y

x *= y

x /= y

set x to y

set x to x plus y

set x to x minus y

set x to x times y

set x to x divided by y

(105)

Basic Object Referencing

• current -

the current object, the owner of the code

• item -

the involved flowitem that triggered the event

• model() -

references the model tree

• rank(

node, ranknum

)

rank(current,3)

• node(“relativepath”, object)

node(“/Operator1”,model())

• inobject(

object, portnum

)

inobject(current,1)

• outobject(

object, portnum

)

outobject(current,1)

• centerobject(

object, portnum

)

centerobject(current,1)

• first(

object

)

first(current)

(106)

Basic Object Statistics

• content(

object

)

• getinput(

object )

• getoutput(

object

)

(107)

Object Spatial Attributes

• xloc(

object

)

yloc(

object

)

zloc(

object

)

• setloc(

object, xnum, ynum, znum

)

• xsize(

object

)

ysize(

object

)

zsize(

object

)

• setsize(

object, xnum, ynum, znum

)

• xrot(

object

)

yrot(

object

)

zrot(

object

)

• setrot(

object, xdeg, ydeg, zdeg

)

(108)

Itemtypes

• itemtype

– all

flowitems

have an attribute

called

itemtype

. It’s a numeric identifier used

to distinguish one “type” of flowitem from

another in processing and routing decisions in

a model.

(109)

Basic Object Attributes

• getname(

object

)

• setname(

object, “name”

)

• getitemtype(

flowitem

)

• setitemtype(

flowitem, num

)

• setcolor(

object, red, green, blue

)

• color

red

(

object

) –

blue,green,random...

– How can you find the names of other color

functions?

(110)

Prompts and Printouts

• syntax

– pt(

text string

)

– pf(

float value

)

– pd(

discrete value

)

– pr( )

– msg(

“window title”, “message text”, button type

)

(111)

Processor Parameters

• Understanding the edit fields of the Processor

object will help you understand Flexsim.

• You should be able to answer the following

four questions about each edit field:

– what is its purpose?

– when is it evaluated?

– what are its access variables?

– what does it return?

(112)

Access Variables & Returns

Edit Field Access Variables Returns Setup Time current, item, port delay time Process Time current, item delay time

MTBF current delay time

MTTR current delay time

Send To Port current, item port number Pull From Port current port number Pull Requirement current, item, port true/false (1/0) Request Transport From current, item, port numeric pointer Pick Operator current, item numeric pointer

OnReset current N/A

(113)

Code Exercise 1

• Purpose

– Gain experience in writing code in the Code Edit windows.

– Introduction to special comments used to define Code Templatewindows. – Introduction to the bernoulli command.

bernoulli(num probability, num succeed-value, num fail-value, [num stream])

• Description

– Do not use code templates for these exercises (write your own code, beginning with most basic available option)!

– See next slide for model layout description.

– Using the “Send To Port” field of the Conveyor, send 30% of the flowitems to port 1 and 70% to port 2 (Use the bernoulli

(114)
(115)

Logical ‘if’ Statement

if (

test expression

)

{

code block

}

else

{

code block

}

if (content(item) == 2)

{

colorred(item);

}

else

{

colorblack(item);

}

(116)

Code Exercise 2

• Purpose

– Learn how to both set and read the itemtype of a flowitem using code.

– Introduction to the Flowitem Bin

• Description

– Uses same layout as Exercise 1.

– Set the itemtype of flowitems as they exit the Source.

– 60% of the flowitems are itemtype 7, the rest are itemtype 3. – Using an “if” statement in the “Send To Port” field of the

(117)

The Flowitem Bin

• Sources create copies

of objects in the

Flowitem Bin

• Any changes made to

objects in the Bin

affect the flowitems

that are created by

Sources

• Used to create labels,

set size, color, shape,

etc.

(118)

Labels

labels

– information can be

stored on flowitems (and

other modeling objects) in the

form of labels.

Flowitems and other Flexsim

objects can have an

(119)

examples

getlabelnum( item, “serialnumber” )

setlabelnum( item, “serialnumber”, 5 )

getlabelstr( current, “category” )

setlabelstr( current, “category”, “groceries” )

inc( label(item, “stepnum”), 1 )

• The increment command only works with number data nodes

Object Labels

• syntax

– getlabelnum(

object, “labelname”

)

– setlabelnum(

object, “labelname” , value

)

– getlabelstr(

object, “labelname”

)

– setlabelstr(

object, “labelname” , string

)

(120)

int type = getitemtype(item); switch (type) { case 1: { coloryellow(item); break; } case 5: { colorred(item); break; switch ( switchvariable ) { case casenum: { code block break; } case casenum2: { code block break;

(121)

Code Exercise 3

• Purpose

– Learn how to both set and read the labels on a flowitem using code.

• Description

– Uses same layout as Exercise 1.

– Create a numeric label named “routing” on the Textured Colored Box in the FlowItem Bin (see toolbar).

– Set the “routing” label of flowitems as they exit the Source with a random number between 1 and 4 (use duniform() command). – Use a switch() statement in the “Send To Port” field of the

Conveyor to send flowitems according to the following rules:

• Label values 1 and 3 go to port 2 • Label values 2 and 4 go to port 1

• Questions

– Can you change the color of the flowitems based on their label value using code?

(122)

Logical ‘while’ Statement

wh il e (

test expression

)

{

code block

}

while (content(current) > 0)

{

destroyobject(last(current));

}

(123)

Logical ‘for’ Statement

for (int index=1; index<=content(current); index++) {

colorblue(rank(current,index)); }

A

for loop

allows you to repeat a block of code a set

number of times. The head of the for loop defines the

repeat conditions:

1. specify a changing variable & give it an initial value 2. set a condition to exit the loop

3. how to treat your variable at the end of each iteration

Avoid infinite loops by ensuring that the test e xpr essi on will

for (start expression; test expression; count expression) {

//code block

(124)

Code Exercise 4

• Purpose

– Learn how to write your own “for” loop.

• Description

– A Combiner packs 8 boxes on a pallet.

– Use an infinite supply of pallets from one Source and an infinite supply of boxes from another Source.

– The Combiner sends to a Conveyor which then sends to another Conveyor.

– Using the OnExit trigger of the first Conveyor, write a “for” loop which changes the color of all the boxes on the pallet.

(125)
(126)

Model 4 - Concepts

• Itemtypes

• Push vs. Pull

(127)

Order of Execution

(pulled flowitem)

Pull From Pull Requirement Flowitem becomes available upstream Setup Time delay Pick Operator

Send To Port OnEntry

OnSetupFinish

Process Time Pick Operator

delay Request possible delay OnExit if true delay

(128)

Model 4

• Purpose

– Learn how to use pull logic in defining routings based on a flowitem’s itemtype.

• Description

– Electronic components need to be tested after manufacture.

– There are two types of components that arrive in a queue at random with the mix being 40% of one and 60% the other. – The inter-arrival time of components is exponential(0,30,1) – There are two testers for component 1 and three testers for

(129)
(130)

Model 5 - Concepts

• Global Tables

• Labels

• Triggers

(131)

Global Table Commands

• gettablenum(

“tablename”, rownum, colnum

)

• settablenum(

“tablename”, rownum, colnum, value

)

• gettablestr(

“tablename”, rownum, colnum

)

(132)

Model 5

• Purpose

– Small example of using a Global Table to define product routings. – Learn how to use a label to keep track of what step the flowitem is on.

• Description

– 3 different products (uniformly distributed) enter a 5 station work cell. – Products are processed at the following stations in the order specified

• Product 1 needs to be processed at station 1,3, and 2. • Product 2 needs to be processed at station 1, 2, and 4. • Product 3 need to be processed at station 2,4,3, and 5.

– Use a global table to make sure the products are sent to the right station in the proper sequence.

(133)
(134)

Model 6 - Concepts

• Labels and Itemtypes

• Empirical Distributions

• Trigger sequence

(135)

Model 6

• Purpose

– Learn how to assign and use labels on flowitems for routing and processing purposes. Learn how to use an empirical distribution to assign itemtypes.

• Description

– Parts arrive in a queue exponentially every 30 seconds. There are four part types (1,2,3,4) distributed (20%, 30%, 40%, 10%)

respectively (see dempirical in Flexsim Command Summary).

– The parts are processed on one of four machines. Each machine is dedicated to a single part type. The processing times at each

machine is uniform(100,120) seconds for first time parts, and uniform(120,130) seconds for rework parts.

– After the parts are machined, they are put in a queue and wait to be tested. The test time is a constant 10 seconds. Parts that pass, leave the model, failed parts are routed back to the first queue to be

reworked. 10% of the parts fail.

– Parts being reworked are given priority in the queue.

• Questions & Bonus

– Where is the bottleneck?

(136)
(137)

Model 7 - Concepts

• TaskSequence Priority

(138)

Model 7

• Purpose

– Learn how to use an Operator to both carry and process flowitems

• Description

– Parts arrive at a queue every 20 seconds exponentially

distributed and need to be carried by the operator to one of 3 machines, whichever is first available.

– The operator needs to setup the part which takes 10 seconds. – The part will then process for 20 seconds on its own.

(139)
(140)

Model 8 - Concepts

• Send To Port

(141)

Model 8

• Purpose

– Learn how to use the “Break To” Requirement field on TaskExecuters.

• Description

– A Source continuously sends Flowitems randomly to 3 Queues. – Flowitems are assigned an itemtype 1,2,3 uniformly distributed. – All three Queues can hold all three itemtypes.

– A Transporter carries Flowitems to three Queues that each hold 1 itemtype.

– These Queues then go to Processors and a Sink. – The Transporter can carry up to 5 items at a time.

– The Transporter should only carry items that have the same itemtypeat any time.

• Questions & Bonus

– Experiment with the other available “Break To” Requirement pick-options. How does the Transporter behave?

(142)
(143)

Model 9 - Concepts

• TaskExecuter Teams

• TaskSequence Preemption

• Time Tables

(144)

Model 9

• Purpose

– More practice working with teams, priorities and preempting

• Description

– A single work cell has 5 machines.

– Each part must be processed at each of the 5 machines – There are 3 operators who work in the cell as a team.

– The operators need to carry each part to the next machine as well as set up the machine for that part.

– Setup times are 5 seconds and process times are 15. – New parts arrive in the system every 25 seconds.

(145)
(146)

Model 10 - Concepts

• Update Combiner Component List OnEntry

• Excel Imports and Exports ~ Multi-Table

(147)

Custom Excel Import/Export

Example:

excelopen(“C:\mybook.xls”); excelsetsheet(“Sheet1”);

double thenum = excelreadnum(1,1); excelwritenum(5,2,thenum)

excelclose(true);

This opens a link to a workbook called “mybook,” and stores a value read from row 1, column 1 from Sheet1, then writes the stored value to row 5, column 2. The link with Excel is then closed.

See alsoexcelimporttable()and excelexporttable()

Rules:

You must call excelopen() once per workbook. Only one workbook can be open at a time. The user must call excelclose() before trying to open another workbook.

Before reading from the open file, excelsetsheet() must also be called to point to the appropriate worksheet. This command may be called several times to point to

different sheets in the active workbook.

See Flexsim’s browser based help for more information. Press the “?” button in the lower left corner of the Automatic Excel Import to open the contextual help.

(148)

Model 10

• Purpose

– Learn how to manipulate the Components List table on a Combiner object to do custom packing on the fly

– Learn how to import and use a Source arrival schedule

• Description

– A small distributor has 10 product types that he ships to the same 5 customers.

– Each customer has a different order profile.

– The distributor has a large supply of each of the 10 products so all he has to do is wait for an order to come through the door.

(149)
(150)
(151)

Model 10 Daily Arrival Schedule

1 5 OrderE 14400 Customer 5 1 4 OrderD 10800 Customer 4 1 3 OrderC 7200 Customer 3 1 2 OrderB 3600 Customer 2 1 1 OrderA 0 Customer 1 Quantity ItemType ItemName ArrivalTime

(152)

Mor e Ad vanc ed Conc ept s and

Models…

(153)

Model A1 - Concepts

• Closing and Opening Output/Input Ports

• Message Sending

(154)

Basic Object Control

• closeinput(

object

)

,

openinput(

object

)

• stopinput(

object

)

,

resumeinput(

object

)

• closeoutput(

object

), openoutput(

object

)

• stopoutput(

object

), resumeoutput(

object

)

• sendmessage(

toobject, fromobject, parameter1, parameter2,

parameter3 )

(155)

Order of Execution

(Messages)

sendmessage() delay OnMessage trigger of receiving object senddelayedmessage() OnMessage trigger of receiving object

(156)

Model A1

• Purpose

– Learn how to control product flow and send delayed messages.

• Description

– Assume an infinite supply of A and B components.

– The two components must be glued together with epoxy which takes lognormal(0,2.6,0.8) seconds.

– The assembled parts must wait in a staging area for at least 15 seconds for the epoxy to cure before they can enter the paint booth.

– It takes lognormal(0,2.5,0.5) seconds to paint each part separately.

(157)
(158)

Model A2 – Concepts

• Abstract Model Application

• Global Variables

• For Loop

(159)

Model A2

• Purpose

– Gain experience in building an abstract model

– Learn to write behavior logic in a trigger field using code

• Description

– Items arrive at a warehouse each day to be stored. – Orders arrive at a warehouse each day to be pulled.

– The average number of items and orders received each day is 10, but both are exponentially distributed.

– There are only 5 types of items (and therefore orders) received. The type of received items and orders is uniformly distributed 1 through 5 on a daily basis. – Whenever an order arrives it must search for a matching item and remove it. – Whenever an item arrives it must search for a matching order and remove it. – 1 model time unit = 1 day.

• Questions & Bonus

– How big must the warehouse be, so there is always room to store the itemsreceived each day? – Plot the number of unsatisfied orders each day for an entire year.

(160)
(161)

Model A3 - Concepts

• Custom TaskSequences

• Global TaskSequences

• Global Variables

(162)

TaskExecuter Control

Simple Commands

requestoperators(

preempting

taskexecuter, station, involvedobj, nrofops, priority,

)

freeoperators(

taskexecuter, involvedobj

)

Cust om Bui lt TaskSe qu enc e

(163)

Sample Code for tasksequence

treenode forklift = centerobject(current, 1);

treenode srcin = centerobject(current, 2);

treenode destination = centerobject(current, 3);

treenode item = first(origin);

treenode ts = createemptytasksequence(forklift, 0, 0);

inserttask(ts, TASKTYPE_TRAVEL, srcin, NULL);

inserttask(ts, TASKTYPE_FRLOAD, item, srcin);

inserttask(ts, TASKTYPE_TRAVEL, destination, NULL);

inserttask(ts, TASKTYPE_FRUNLOAD, item, destination);

dispatchtasksequence(ts);

(164)

Task Types

TASKTYPE_LOAD: flowitem, pickup

TASKTYPE_FRLOAD: flowitem, pickup, [outputport]

TASKTYPE_UNLOAD: flowitem, dropoff

TASKTYPE_FRUNLOAD: flowitem, dropoff, [inputport]

TASKTYPE_UTILIZE: involved, station, [state]

TASKTYPE_STOPREQUESTFINISH: stoppedobject, NULL

TASKTYPE_TRAVEL: destination, NULL

TASKTYPE_TRAVELTOLOC: NULL, NULL,xloc,yloc,zloc, [endspeed]

TASKTYPE_TRAVELRELATIVE: NULL, NULL,xloc,yloc,zloc, [endspeed]

TASKTYPE_BREAK: NULL, NULL

(165)

Global Task Sequences

• Global Task Sequences are reusable task

sequences

• No code is used to define them

• Two steps to create a global task sequence:

– Define references (static and dynamic)

• Objects that are used as involved1 or involved2 in the sequence

– Define the tasks in the sequence

• Call createglobaltasksequence() to use them

(166)

Define References

• References are objects that are used as

involved1 or involved2 • Static references are

fixed in the task sequence

– No limit on static references

(167)

Define Tasks

• Tasks can be dragged from the list

• Tasks can be added, deleted or reordered with the buttons • Use the fields on the

right to define each task

(168)

Model A3

• Purpose

– Learn how to manually build your own tasksequences

• Description

– The model consists of a Source, three Processors in series, and a Sink.

– An operator must pick up a part from the source, carry it to the first processor, be utilized for the process time, carry the part to the next processor, etc. until finally dropping it off at the sink. – Use Global Object Pointers instead of center port connections.

(169)
(170)

Model A4

• Purpose

– Learn how to create custom built task sequences

• Description

– The model consists of a Source, an Operator, a NetworkNode and a Sink.

– An operator must pick up a part from the source, carry it to the sink and travel to the NetworkNode location after dropping it off at the sink.

(171)

References

Related documents

The Kapan mining district in the southernmost Lesser Caucasus is one of the unique locations along the Central metallogenic Tethyan belt where ore-forming processes were

At Nelsonville High School, ninth-grade language arts teachers did not have consistent access to their ELL support teacher which limited their ability to co-plan lessons taking

Numbers of identified bats tested with definitive RABV test results (upper figure) and number of bats positive for RABV (lower figure) by month and year, and by species with

This set comprises publication output indicators such as (1) the share in the world total, (2) subject-based publication profiles, (3) citation-based indicators like journal-

Project Management, Configuration Services, Deployment Services, Asset Tagging, Apple One-to-One Services Solution, Remote Consulting, and Full-Time Resources are custom

3 shows an interesting trend of published papers: Com- pared to studies on variability management in general and publications related to software product line engineering that

Acknowledging the lack of empirical research on design rights, our paper wishes to investigate the risk of piracy and the perceptions of the registered and unregistered design

Thus, holding job requirements constant at a particular level (and therefore holding actual qualifications constant at the same level, since equation 4 is estimated only