The problem is to optimized trafic light timings.
There is a simulation made by you that does not run fast. http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=139
This one can help me. Can you transform it to EJS?