please help with writing the VBA code for the following algorithm. NOTE: THIS IS AN ALGORITHM FOR AN ACTUATED TRAFFIC LIGHT.
The key on the left is for the abbreviations used in the algorithm. please try to understand the algorithm before attempting the question so that you give a correct answer.
thank you.
A A B C F 1 Simulation of the number of vehicles in front of a robot at an intersection (actuated-timing) Boundary conditinos 2 Input Variable 3 Duration of the simulation (seconds) 4 5 Duration of the red light (seconds 25 15 to 30 15 45 6 Duration of the green light (seconds) 35 15 to 45 7 Average number of vehicles through the robot per second 0.40 0.50 0 to 1 Average number of vehicles arriving at the robot per second throughout 8 the duration of the simulation 0.80 1.20 0 to 2 9 Colour of the robot at start of simulation (red or green) red red or green 10 Number of vehicles at the robot when simulation starts 10 0 to 50 11 12 Chart 13 14 15 16 Number of vehicles in front of a robot at an intersection (actuated-timing) 17 700 18 19 20 600 21 22 500 23 24 25 400 26 27 300 28 29 30 200 31 32 Z 100 33 34 35 0 100 36 200 300 400 500 600 700 37 Time 38 39 Worksheet (pre-timed) Worksheet (actuated-timing) Number of cars in front fo the robot Period: (300 seconds) + D Quantity 900 Period 2 (300 seconds) Period 3 (300 seconds) 20 30 0.40 1.00 Clear input & output values Input values Simulate, Output & Plot Chart 800 4 900 H K Number of vehicles in front of a Output Time (seconds) Active light robot at an intersection 0 10 25 Red 30 44 60 Green 64 85 Red 120 Green 78. 145 Red 98 180 Green 112 205 Red 132 240 Green 146 265 Red 166 300 Green 180 315 Red 198 360 Green 230 375 Red 248 420] Green 279 435 Red 297 480 Green 329 495 Red 347 540 Green 378 555 Red 396 600 Green 428 448 620 Red 650 Green 466 670 Red 486 700 Green 504 720 Red 524 542 750 Green 720led 770 Red 800 Green 562 580 820 Red 600 850 Green 618 870 Red 638 900 Green 656 1000
A A B C F 1 Simulation of the number of vehicles in front of a robot at an intersection (actuated-timing) Boundary conditinos 2 Input Variable 3 Duration of the simulation (seconds) 4 5 Duration of the red light (seconds 25 15 to 30 15 45 6 Duration of the green light (seconds) 35 15 to 45 7 Average number of vehicles through the robot per second 0.40 0.50 0 to 1 Average number of vehicles arriving at the robot per second throughout 8 the duration of the simulation 0.80 1.20 0 to 2 9 Colour of the robot at start of simulation (red or green) red red or green 10 Number of vehicles at the robot when simulation starts 10 0 to 50 11 12 Chart 13 14 15 16 Number of vehicles in front of a robot at an intersection (actuated-timing) 17 700 18 19 20 600 21 22 500 23 24 25 400 26 27 300 28 29 30 200 31 32 Z 100 33 34 35 0 100 36 200 300 400 500 600 700 37 Time 38 39 Worksheet (pre-timed) Worksheet (actuated-timing) Number of cars in front fo the robot Period: (300 seconds) + D Quantity 900 Period 2 (300 seconds) Period 3 (300 seconds) 20 30 0.40 1.00 Clear input & output values Input values Simulate, Output & Plot Chart 800 4 900 H K Number of vehicles in front of a Output Time (seconds) Active light robot at an intersection 0 10 25 Red 30 44 60 Green 64 85 Red 120 Green 78. 145 Red 98 180 Green 112 205 Red 132 240 Green 146 265 Red 166 300 Green 180 315 Red 198 360 Green 230 375 Red 248 420] Green 279 435 Red 297 480 Green 329 495 Red 347 540 Green 378 555 Red 396 600 Green 428 448 620 Red 650 Green 466 670 Red 486 700 Green 504 720 Red 524 542 750 Green 720led 770 Red 800 Green 562 580 820 Red 600 850 Green 618 870 Red 638 900 Green 656 1000
TART DR, DG, RL, RA, T as Single Nvf, NVR as Integer Key Period as Byte DR - Duration of the red lights AL as String DG - Duration of the green light RA -Average number of vehicles arriving at the robot throughout the duration Simulation RL - Average number of Vehicies through the robot NVT Number of Vehicles in front. AL - Active light NVR - Number of vehicles at the robot when Simulation Start T - Time (sec) NO of the robot at an Intersection NVFLO Yes NVF = O Green T=T+ DG V NVF=NVF + DG (RA-RL) ↓ AL= Red No NVF AL, DR, DG, RA, RL, NVR IS 15 4DR ≤ 30 as Single 15 ≤ 04 ≤45, 0LRA≤2iOLRLLI Single AL: green or red as String OLNVR50 NVF Integer Period = 1 to 3 Period= Period = 3 Period=2 Persed NVR NVF T=0 > Red or Period=1 T≤ 90⁰ END No → No Period=2 green TZ 300 vyes TL 600 des -DR must be 154030 DG must be 15 to 45 RA must be o to z RL must be o to I -AL must be green or red NVR must be o to so NVF must be integer Red T= T+ DR V NvF= NVF +(DRX RA) AL- Green Period=2
please help with writing the VBA code for the following algorithm. NOTE: THIS IS AN ALGORITHM FOR AN ACTUATED TRAFFIC L
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am