diff --git a/models/Application_examples/Application_Process.mp b/models/Application_examples/Application_Process.mp index 45c77418a63ce74458bb8b1bd24f67088a3af572..8539cc8841eef321e087abb9959c310c8d20b2d0 100644 --- a/models/Application_examples/Application_Process.mp +++ b/models/Application_examples/Application_Process.mp @@ -3,13 +3,15 @@ │*│ │ Model of Application Process │ │ │*│ │ Created by Mikhail Auguston in 2018. │ │ │*│ │ Edited by Pamela Dyer in September, 2021. │ │ +│*│ │ Schedule analysis added by Kristin Giammarco in │ │ +│*│ │ December, 2021. │ │ │*│ └────────────────────────────────────────────────────┘ │ │*│ │ │*│ ┌─[ Purpose ]────────────────────────────────────────┠│ │*│ │ To provide a template for an application approval │ │ │*│ │ process involving multiple levels of approval. │ │ │*│ └────────────────────────────────────────────────────┘ │ -│*│ │ +│*│ │ │*│ ┌─[ Description ]────────────────────────────────────┠│ │*│ │ An applicant submits application and needs to get │ │ │*│ │ it approved by the bureaucratic chain of two │ │ @@ -46,55 +48,179 @@ │*│ ┌─[ Instructions ]───────────────────────────────────┠│ │*│ │ Run for Scopes 1 and up. │ │ │*│ ├─[ Run Statistics ]─────────────────────────────────┤ │ -│*│ │ Scope 1: 3 traces in less than 1 sec. │ │ -│*│ │ Scope 2: 9 traces in less than 1 sec. │ │ -│*│ │ Scope 3: 18 traces in less than 1 sec. │ │ +│*│ │ Scope 1: 21 traces in less than 1 sec. | │ +│*│ │ Scope 2: 273 traces in 4.6 sec. │ │ +│*│ │ Scope 3: 2730 traces in 379 sec. │ │ │*│ └────────────────────────────────────────────────────┘ │ └*┴───────────────────────────────────────────────────────*/ SCHEMA Application_Process ROOT Applicant: - prepare_application - submit_application - (* rework - submit_application *) - ( application_is_approved | - application_is_rejected ); + Prepare_application + Submit_application + (* Rework + Submit_application *) + ( Application_is_Approved | + Application_is_Rejected ) +; ROOT Official_1: - (+ receives_application_from_Applicant - (approves_and_forwards_to_Official_2 | - request_rework | - reject ) +) -BUILD{ ENSURE #reject <= 1; + (+ Receive_application_from_Applicant + In_Queue_for_Review + Review_application + ( Approve_and_forward_to_Official_2 | + Request_rework | + Reject ) + +) + + BUILD{ ENSURE #Reject <= 1; + ENSURE FOREACH $r: Reject #$$EVENT AFTER $r == 0; } +; + + In_Queue_for_Review: ( Available_to_do_work | + Busy_with_other_work | + Out_of_office ); + +COORDINATE $s: Submit_application FROM Applicant, + $r: Receive_application_from_Applicant FROM Official_1 + DO ADD $s PRECEDES $r; OD; -ENSURE FOREACH $r: reject #$$EVENT AFTER $r == 0; }; -COORDINATE $s: submit_application FROM Applicant, -$r: receives_application_from_Applicant FROM Official_1 -DO ADD $s PRECEDES $r; OD; ROOT Official_2: - (* receives_application_from_Official_1 - (approves_and_forwards_to_Applicant | - request_rework | reject ) *) -BUILD{ ENSURE #reject <= 1; -ENSURE FOREACH $r: reject #$$EVENT AFTER $r == 0; }; - -COORDINATE $s: approves_and_forwards_to_Official_2 FROM Official_1, -$r: receives_application_from_Official_1 FROM -Official_2 -DO ADD $s PRECEDES $r; OD; - -/*--- interactions with Applicant ---------*/ -COORDINATE $r: reject, /* this may come from several actors */ -$rr: application_is_rejected FROM Applicant -DO ADD $r PRECEDES $rr; OD; - -COORDINATE $r: request_rework, /* this may come from several actors */ -$rr: rework FROM Applicant -DO ADD $r PRECEDES $rr; OD; - -COORDINATE $a: approves_and_forwards_to_Applicant FROM Official_2, -$aa: application_is_approved FROM Applicant -DO ADD $a PRECEDES $aa; OD; + (* Receive_application_from_Official_1 + In_Queue_for_Review + Review_application + ( Approve_and_forward_to_Applicant | + Request_rework | + Reject ) + *) + + BUILD{ ENSURE #Reject <= 1; + ENSURE FOREACH $r: Reject #$$EVENT AFTER $r == 0; } +; + +COORDINATE $s: Approve_and_forward_to_Official_2 FROM Official_1, + $r: Receive_application_from_Official_1 FROM Official_2 + DO ADD $s PRECEDES $r; OD; + +/* --------- Interactions with Applicant --------- */ + +COORDINATE $r: Reject, /* this may come from several actors */ + $rr: Application_is_Rejected FROM Applicant + DO ADD $r PRECEDES $rr; OD; + +COORDINATE $r: Request_rework, /* this may come from several actors */ + $rr: Rework FROM Applicant + DO ADD $r PRECEDES $rr; OD; + +COORDINATE $a: Approve_and_forward_to_Applicant FROM Official_2, + $aa: Application_is_Approved FROM Applicant + DO ADD $a PRECEDES $aa; OD; + + +/* --------- Add duration attributes (hours) --------- */ + +COORDINATE $a1: Prepare_application DO SET $a1.duration AT LEAST 8; OD; + +COORDINATE $a3: Rework DO SET $a3.duration AT LEAST 1; OD; + +COORDINATE $a4: Available_to_do_work FROM Official_1 + DO SET $a4.duration AT LEAST 0.5; OD; + +COORDINATE $a4: Available_to_do_work FROM Official_2 + DO SET $a4.duration AT LEAST 1; OD; + +COORDINATE $a4: Busy_with_other_work FROM Official_1 + DO SET $a4.duration AT LEAST 24; OD; + +COORDINATE $a4: Busy_with_other_work FROM Official_2 + DO SET $a4.duration AT LEAST 24; OD; + +COORDINATE $a4: Out_of_office FROM Official_1 + DO SET $a4.duration AT LEAST 64; OD; + +COORDINATE $a4: Out_of_office FROM Official_2 + DO SET $a4.duration AT LEAST 64; OD; + +COORDINATE $a5: Review_application FROM Official_1 + DO SET $a5.duration AT LEAST 0.25; OD; + +COORDINATE $a7: Review_application FROM Official_2 + DO SET $a7.duration AT LEAST 0.03; OD; + +/* --------- Build trace tables and Gantt Charts --------- */ + +TABLE Gantt_Table{ + TABS string event_name, + number start_time, + number duration_time; +}; + CLEAR Gantt_Table; + +BAR CHART Gantt_Chart { TITLE("Application Process Timeline (hours)"); + FROM Gantt_Table; + X_AXIS event_name; + ROTATE; +}; + +COORDINATE $e: $$EVENT + DO + IF $e.duration.largest > 0 THEN + Gantt_Table <| + event_name: SAY($e), + start_time: $e.start.smallest, + duration_time: $e.duration.largest; + FI; + OD; + +SHOW Gantt_Chart; + +SAY("Trace " trace_id " Total Time: " THIS.duration/8 " days"); + +/* --------- Build global reports --------- */ + +ATTRIBUTES {number accumulated_max, + accumulated_min, + accumulated_durations, + smallest_trace_id, + longest_trace_id; }; + +GLOBAL.accumulated_durations +:= THIS.duration.smallest; + +IF GLOBAL.accumulated_max < THIS.duration.largest THEN + GLOBAL.accumulated_max := THIS.duration.largest; + GLOBAL.longest_trace_id := trace_id; +FI; + +IF GLOBAL.accumulated_min >= THIS.duration.smallest OR + GLOBAL.accumulated_min == 0 THEN + GLOBAL.accumulated_min := THIS.duration.smallest; + GLOBAL.smallest_trace_id := trace_id; +FI; + +GLOBAL + +REPORT Duration_Statistics_Report { TITLE ("Scope "$$scope" Duration Statistics"); + }; + CLEAR Duration_Statistics_Report; + +SAY("There are " #$$TRACE " traces total." ) + => Duration_Statistics_Report; + +SAY("Trace "longest_trace_id " has the max duration of " + accumulated_max/8" days." ) + => Duration_Statistics_Report; + +SAY("Trace "smallest_trace_id " has the min duration of " + accumulated_min/8" days." ) + => Duration_Statistics_Report; + +SAY("The average duration across all traces (assuming equal probability) is " + accumulated_durations/8/#$$TRACE" days.") + => Duration_Statistics_Report; + +SHOW Duration_Statistics_Report; + +/*SHOW ACTIVITY DIAGRAM Applicant, Official_1, Official_2; +*/ \ No newline at end of file