Consider a road which consists of three segments-the east segment and the west segment allow vehicles to travel in east and west directions. The center road segment can only be used either for west to east or east to west at any given time. To control one-way traffic on the bridge, there are two traffic lights- East-Wast Light and West-East Lights.
Assume the followings:
1) each traffic light can be either green or red at any time. And EWL and WEL are always opposite to one another (one is red and the other is green and the switch from green to red or vice versa is instantaneous)
2) a green light allows vehicles to cross the bridge. However any time only one vehicle can be on the bridge. As necessary, vehicles are queued on both east and west points of the bridge.
3) since the traffic lights may switch at any time, a green light can change to red when a vehicle is still in the middle of the bridge. If that happens, the vehicles on the opposite direction have to wait until this vehicle finishing its crossing.
Develop a petri net model for the bridge segment system described above and also develop a finite state machine model for the bridge segment. FSM has to have separated states(atleast 4 states) to represent different situations of the system.