Workflow Composition
Accepted Delay Workflow
Loop and Accumulate
A workflow can scan repeated inputs, accept the values within a limit, and accumulate a summary.
Program
Play the program to choose a delay limit and watch the loop update the accepted count and total.
accepted_delay_workflow.f90
Replay: real traced execution (multi-file project)
program accepted_delay_workflow_demo
implicit none
integer :: delays(3)
integer :: delay_limit
integer :: accepted_count
integer :: total_delay
integer :: i
delays = [3, 7, 5]
delay_limit = 6
accepted_count = 0
total_delay = 0
do i = 1, 3
if (delays(i) <= delay_limit) then
accepted_count = accepted_count + 1
total_delay = total_delay + delays(i)
end if
end do
print '(I0, 1X, I0)', accepted_count, total_delay
end program accepted_delay_workflow_demo
program accepted_delay_workflow_demo
implicit none
integer :: delays(3)
integer :: delay_limit
integer :: accepted_count
integer :: total_delay
integer :: i
delays = [3, 7, 5]
delay_limit = 4
accepted_count = 0
total_delay = 0
do i = 1, 3
if (delays(i) <= delay_limit) then
accepted_count = accepted_count + 1
total_delay = total_delay + delays(i)
end if
end do
print '(I0, 1X, I0)', accepted_count, total_delay
end program accepted_delay_workflow_demo
program accepted_delay_workflow_demo
implicit none
integer :: delays(3)
integer :: delay_limit
integer :: accepted_count
integer :: total_delay
integer :: i
delays = [3, 7, 5]
delay_limit = 10
accepted_count = 0
total_delay = 0
do i = 1, 3
if (delays(i) <= delay_limit) then
accepted_count = accepted_count + 1
total_delay = total_delay + delays(i)
end if
end do
print '(I0, 1X, I0)', accepted_count, total_delay
end program accepted_delay_workflow_demo
delays ← [3, 7, 5]
9delays = [3, 7, 5]10delay_limit = 6values this step[3, 7, 5]delaysdelay_limit ← 6
9delays = [3, 7, 5]10delay_limit = 611accepted_count = 0values this step6delay_limitaccepted_count ← 0
10delay_limit = 611accepted_count = 012total_delay = 0values this step0accepted_counttotal_delay ← 0
11accepted_count = 012total_delay = 013do i = 1, 3values this step0total_delayi ← 1
12total_delay = 013do i = 1, 314 if (delays(i) <= delay_limit) thenvalues this step1iif (delays(i) <= delay_limit) then
13do i = 1, 314 if (delays(i) <= delay_limit) then15 accepted_count = accepted_count + 1values this step.true.delays(1) <= delay_limitaccepted_count ← 1
14if (delays(i) <= delay_limit) then15 accepted_count = accepted_count + 116 total_delay = total_delay + delays(i)values this step1accepted_counttotal_delay ← 3
15 accepted_count = accepted_count + 116 total_delay = total_delay + delays(i)17end ifvalues this step0 → 3total_delay3delays(1)i ← 2
12total_delay = 013do i = 1, 314 if (delays(i) <= delay_limit) thenvalues this step2iif (delays(i) <= delay_limit) then
13do i = 1, 314 if (delays(i) <= delay_limit) then15 accepted_count = accepted_count + 1values this step.false.delays(2) <= delay_limiti ← 3
12total_delay = 013do i = 1, 314 if (delays(i) <= delay_limit) thenvalues this step3iif (delays(i) <= delay_limit) then
13do i = 1, 314 if (delays(i) <= delay_limit) then15 accepted_count = accepted_count + 1values this step.true.delays(3) <= delay_limitaccepted_count ← 2
14if (delays(i) <= delay_limit) then15 accepted_count = accepted_count + 116 total_delay = total_delay + delays(i)values this step2accepted_counttotal_delay ← 8
15 accepted_count = accepted_count + 116 total_delay = total_delay + delays(i)17end ifvalues this step3 → 8total_delay5delays(3)print '(I0, 1X, I0)', accepted_count, total_delay
18 end do19 print '(I0, 1X, I0)', accepted_count, total_delay20end program accepted_delay_workflow_demooutput2 8values this step2accepted_count8total_delay
delays ← [3, 7, 5]
9delays = [3, 7, 5]10delay_limit = 4values this step[3, 7, 5]delaysdelay_limit ← 4
9delays = [3, 7, 5]10delay_limit = 411accepted_count = 0values this step4delay_limitaccepted_count ← 0
10delay_limit = 411accepted_count = 012total_delay = 0values this step0accepted_counttotal_delay ← 0
11accepted_count = 012total_delay = 013do i = 1, 3values this step0total_delayi ← 1
12total_delay = 013do i = 1, 314 if (delays(i) <= delay_limit) thenvalues this step1iif (delays(i) <= delay_limit) then
13do i = 1, 314 if (delays(i) <= delay_limit) then15 accepted_count = accepted_count + 1values this step.true.delays(1) <= delay_limitaccepted_count ← 1
14if (delays(i) <= delay_limit) then15 accepted_count = accepted_count + 116 total_delay = total_delay + delays(i)values this step1accepted_counttotal_delay ← 3
15 accepted_count = accepted_count + 116 total_delay = total_delay + delays(i)17end ifvalues this step0 → 3total_delay3delays(1)i ← 2
12total_delay = 013do i = 1, 314 if (delays(i) <= delay_limit) thenvalues this step2iif (delays(i) <= delay_limit) then
13do i = 1, 314 if (delays(i) <= delay_limit) then15 accepted_count = accepted_count + 1values this step.false.delays(2) <= delay_limiti ← 3
12total_delay = 013do i = 1, 314 if (delays(i) <= delay_limit) thenvalues this step3iif (delays(i) <= delay_limit) then
13do i = 1, 314 if (delays(i) <= delay_limit) then15 accepted_count = accepted_count + 1values this step.false.delays(3) <= delay_limitprint '(I0, 1X, I0)', accepted_count, total_delay
18 end do19 print '(I0, 1X, I0)', accepted_count, total_delay20end program accepted_delay_workflow_demooutput1 3values this step1accepted_count3total_delay
delays ← [3, 7, 5]
9delays = [3, 7, 5]10delay_limit = 10values this step[3, 7, 5]delaysdelay_limit ← 10
9delays = [3, 7, 5]10delay_limit = 1011accepted_count = 0values this step10delay_limitaccepted_count ← 0
10delay_limit = 1011accepted_count = 012total_delay = 0values this step0accepted_counttotal_delay ← 0
11accepted_count = 012total_delay = 013do i = 1, 3values this step0total_delayi ← 1
12total_delay = 013do i = 1, 314 if (delays(i) <= delay_limit) thenvalues this step1iif (delays(i) <= delay_limit) then
13do i = 1, 314 if (delays(i) <= delay_limit) then15 accepted_count = accepted_count + 1values this step.true.delays(1) <= delay_limitaccepted_count ← 1
14if (delays(i) <= delay_limit) then15 accepted_count = accepted_count + 116 total_delay = total_delay + delays(i)values this step1accepted_counttotal_delay ← 3
15 accepted_count = accepted_count + 116 total_delay = total_delay + delays(i)17end ifvalues this step0 → 3total_delay3delays(1)i ← 2
12total_delay = 013do i = 1, 314 if (delays(i) <= delay_limit) thenvalues this step2iif (delays(i) <= delay_limit) then
13do i = 1, 314 if (delays(i) <= delay_limit) then15 accepted_count = accepted_count + 1values this step.true.delays(2) <= delay_limitaccepted_count ← 2
14if (delays(i) <= delay_limit) then15 accepted_count = accepted_count + 116 total_delay = total_delay + delays(i)values this step2accepted_counttotal_delay ← 10
15 accepted_count = accepted_count + 116 total_delay = total_delay + delays(i)17end ifvalues this step3 → 10total_delay7delays(2)i ← 3
12total_delay = 013do i = 1, 314 if (delays(i) <= delay_limit) thenvalues this step3iif (delays(i) <= delay_limit) then
13do i = 1, 314 if (delays(i) <= delay_limit) then15 accepted_count = accepted_count + 1values this step.true.delays(3) <= delay_limitaccepted_count ← 3
14if (delays(i) <= delay_limit) then15 accepted_count = accepted_count + 116 total_delay = total_delay + delays(i)values this step3accepted_counttotal_delay ← 15
15 accepted_count = accepted_count + 116 total_delay = total_delay + delays(i)17end ifvalues this step10 → 15total_delay5delays(3)print '(I0, 1X, I0)', accepted_count, total_delay
18 end do19 print '(I0, 1X, I0)', accepted_count, total_delay20end program accepted_delay_workflow_demooutput3 15values this step3accepted_count15total_delay
loop replay
Each `do` iteration revisits the same source lines with new index state.
guarded update
The `if` body runs only for delays within the selected limit.
summary
The final line reports the count and accumulated total.