You are here: Statements and Functions > Loc()

Loc()

Name-Index-Number Conversion Function

Syntax samples

Loc(<location name-index number>)

Order 10 EntA TO Loc(5)

Display “EntA arrived at” $ Loc(5)

Description

Converts a name-index number or integer to a location name. Use this function when a statement or function needs the name of a location but whose name-index number is stored in an attribute, variable, or some other expression. It can also be used to vary a selected location based on the name-index number stored in the expression. When used in a string expression, as in the second syntax example above, ProModel will convert the name-index number to the actual name of the location. If the expression points to a unit of a multi-unit location, then the Loc() function will return the name of the parent location.

Valid In

Any statement where a location name is normally used, including the Destination field of the Routing edit table. Also used in string expressions.

Components

<location name-index number>

The name-index number of the desired location. This component may be an expression, allowing the location to vary as the simulation progresses. Real numbers will be truncated to integers.

Example

Suppose there are five locations which appear one after the other in the Location edit table as follows: Dock1, Dock2, Dock3, Dock4, Dock5. Shipments could be ordered to each of the five locations in rotation with the following logic. Note that Dist() is a user-defined distribution that returns an integer value for the number of Shipments to order.

Int Var1 = 1

While Var1 <= 5 Do

{

Order Dist() Shipments TO Loc(Var1)

Inc Var1

}

See Also

Ent(), Res(), and Location().


 

© 2019 ProModel Corporation • 705 E Timpanogos Parkway • Orem, UT 84097 • Support: 888-776-6633 • www.promodel.com