Tray allocation for a sortation system
Real-time version
Iteration III
TI-VDM2 Project
by
José Antonio Esparza
and
Kim Bjerge
TIVDM2
Sortation System, Tray Allocation
1
Today’s presentation
• Status on real-time model
• Update on concurrent model behavior (UML)
• Update on real-time model (VDM)
TIVDM2
Sortation System, Tray Allocation
2
Status for RT model
•
•
•
•
•
•
•
Thread’s deployed to CPU’s
CPU for each induction
TrayAllocator on a central CPU controller
Removed TimeStamp and TrayStep
Made periodic thread for TrayAllocator
duration used for induction rate
Version running
Issues for next time
• How to feed items on based on time?
• Alternative deployment one CPU for two InductionControllers
• Error reading logrt?
• (30 errors encoutered in file)
• Why we can’t fill the sorter (19/20)?
TIVDM2
Sortation System, Tray Allocation
3
Object diagram concurrent version
class Obj ectModel
:TimeStamp
:World
:SC
«thread»
:InductionController
«thread»
:SorterEnv ironment
«thread»
:TrayStep
TIVDM2
«thread»
:InductionController
«thread»
:TrayAllocator
«thread»
:InductionController
Sortation System, Tray Allocation
4
Behavior of concurrent model (Sequence #1)
sd SequenceModel2
«thread»
«thread»
«thread»
«thread»
:SorterEnvironment
:InductionController
:TrayAllocator
:TrayStep
TimeStamp
FeedItem
Awake
ItemsToInduct
Block
WaitStep
Block
RequestTray
Wait
Block
NotifyAndIncTime
NotifyAll
UnblockAwake
Run
TIVDM2
Sortation System, Tray Allocation
IncCounts
5
Wait
Block
Behavior of concurrent model
(Sequence part #2)
NotifyAndIncTime
NotifyAll
UnblockAwake
Run
IncCounts
NotifyWaitingThreads
FeedItem
UnblockWaitStep
Run
CheckAndInduct
InductItem
InductFirstItem
ReleaseWaitingIC
UnblockWait
Run
WaitSteps
TIVDM2
Sortation System, Tray Allocation
6
RT version of SC – system
instance variables
cpuIC1 : CPU := new CPU (<FCFS>,1E6);
cpuIC2 : CPU := new CPU (<FCFS>,1E6);
cpuIC3 : CPU := new CPU (<FP>,1E9);
cpuTA4 : CPU := new CPU (<FCFS>,1E6);
bus1 : BUS := new BUS (<FCFS>,1E3,{cpuIC1,cpuTA4});
bus2 : BUS := new BUS (<FCFS>,1E3,{cpuIC2,cpuTA4});
bus3 : BUS := new BUS (<FCFS>,1E3,{cpuIC3,cpuTA4});
public static ic1 : InductionController := new InductionController(1);
public static ic2 : InductionController := new InductionController(2);
public static ic3 : InductionController := new InductionController(3);
public static inductionGroup : seq of InductionController := [ic1, ic2, ic3];
public static allocator : TrayAllocator := new TrayAllocator(inductionGroup);
operations
public SC: () ==> SC
SC() ==
(
cpuIC1.deploy(ic1);
cpuIC2.deploy(ic2);
cpuIC3.deploy(ic3);
cpuTA4.deploy(allocator);
);
TIVDM2
Sortation System, Tray Allocation
7
RT version of TrayAllocator periodic thread
-- Periodic thread operation that simulates the TrayStep
TrayStep: () ==> ()
TrayStep () ==
(
trayCount := trayCount + 1;
IO`print("< " ^ String`NatToStr(trayCount) ^ ">");
CardReader(trayCount mod TrayAllocator`NumOfTrays + 1, <Empty>);
-- Induct items for all waiting inductions
CheckItemsToInduct();
);
thread
-periodic (20000, 0, 0, 0) (TrayStep);
TIVDM2
Sortation System, Tray Allocation
8
RT version of InductionController thread
-- Permission predicate on Wait operation (Moved from TrayAllocator)
per Wait => threadid not in set dom allocator.icThreadsWaiting;
thread
(
while (ItemsToInduct()) do
(
-- Request tray allocator to induct item and wait for induction
let item = GetFirstItem()
in
(
allocator.RequestTray(threadid, selfIC, item);
Wait();
);
-- In teory this value should be 2x20000 see periodic thread in TrayAllocator
duration(30000) WaitInductionRate();
);
);
TIVDM2
Sortation System, Tray Allocation
9
RT version of SorterEnviroment thread
while busy do
(
timeStep := timeStep + 1;
for all i in set {1,...,TrayAllocator`NumOfInductions}
do
(
-- Check for item to feed induction at time step
let size = itemLoader.GetItemAtTimeStep(timeStep, i)
in
if (size > 0)
then
(
itemId := itemId + 1;
IO`print("[ " ^ String`NatToStr(timeStep) ^ "]");
inductionGroup(i).FeedItem(new Item(size, itemId));
);
);
-- Check if simulation is finish
if (time >= itemLoader.GetNumTimeSteps()) then
busy := false;
);
TIVDM2
Sortation System, Tray Allocation
10
Async operation FeedItem in InductionController
-- Enviroment feeds a new item on induction
async
public FeedItem: Item ==> ()
FeedItem(i) ==
items := items ^ [i];
sync
-- Enviroment and TrayAllocator threads
mutex (FeedItem); -- Async new mutex needed!
mutex (FeedItem, InductFirstItem);
TIVDM2
Sortation System, Tray Allocation
11
Simulation Result
*Induction id 1
-> Item id 16 size 100 on tray id 1
*Induction id 3
-> Item id 20 size 300 on tray id 5
< 18 >< 19 >< 20 >< 21 >*Induction id 2
-> Item id 19 size 200 on tray id 7
< 22 >--------------------------------------------Simulation completed for sorter configuration
--------------------------------------------Specified throughput [items/hour]: 10000
Sorter speed
[mm/sec]: 2000
Item max size
[mm]: 1500
Item min size
[mm]: 100
Tray size
[mm]: 600
Number of trays
: 20
Number of inductions
: 3
Induction rate
: 2
Induction separation
[trays]: 2
---------------------------------------------Number of trays with items
: 19
Two tray items on sorter
: 0
Number of tray steps
: 23
Number of inducted items
: 19
Calculated throughput[items/hour]: 9913
---------------------------------------------**** Sorter is not full ****
---------------------------------------------new World().Run() = ()
TIVDM2
Sortation System, Tray Allocation
12
© Copyright 2026 Paperzz