[Plant Simulation Tutorial #05] – Basics of ExitControl & Method: Controlling MU Flow

✍️ [Plant Simulation Tutorial #05] – Basics of ExitControl & Method: Controlling MU Flow

 

📑 Summary
In this post, we’ll explore how to use ExitControl and the Method object to program the flow of MUs in Plant Simulation. Moving beyond simple linear flows, you'll learn how to apply condition-based and attribute-based routing logic.


🔍 1. What is ExitControl?

ExitControl is an event hook that allows you to define logic for when an MU leaves an object and moves to the next one.
It can be applied to most objects like Source and Station, and enables branching based on conditions, attributes, randomness, or priority.

FeatureDescription
Location Object Properties → Exit control tab
Types Front / Rear
Language SimTalk (built-in scripting)
 

💡 Why use ExitControl?

  • Branch flows based on conditions (if, case, etc.)
  • Control MU flow using attributes
  • ⚠️ Important: If you don’t use @.move(...) in Front ExitControl, the MU will stay at the current object and wait

🔧 2. What is a Method object?

A Method is a reusable script block written in SimTalk. It helps you modularize logic and avoid repetition.
You can call methods from various objects using MethodName~() syntax.

ItemDescription
Location [Objects] → [Controls] → Method
Features Supports local/global variables, parameters
 

🎯 3. Example: ExitControl + Method Usage

🔄 Scenario

  • A Source generates MUs
  • When reaching a Station, if the MU.name is "A", it moves to StationA; otherwise, it moves to StationB
  • A Method is used to separate the branching logic

📦 Object Flow

Source → Station → StationA / StationB → Drain

 

📌 Step 1. ExitControl on the Station

if @.name = "A"
	@.move(A)
else
	@.move(B)
end
 
 

📘 SimTalk Basics

SymbolMeaning
@ Refers to the current MU
? Refers to the current object
 

🧠 Tips

  • Always include @.move(...) in your conditional logic to avoid stuck MUs.
  • Use print(...) inside Methods for debugging.
  • Methods can be invoked from ExitControl, EntranceControl, Buttons, Events, and more.

📝 Conclusion

ExitControl and Method transform Plant Simulation from a configuration-based tool into a programmable simulation engine.
With this knowledge, you can define logic in code and create dynamic, condition-based workflows.


🔜 Next Post Preview
In [Plant Simulation Study #06], we’ll dive deeper into conditional routing by integrating Sorter, Sensor, and Decision Point objects.