НачатьНачать бесплатно

Modeling a petrol station: Run the model and analyze the results

In the previous exercise, you created a generator, car_generator(), to simulate the behavior of the cars arriving at a gas station, and another, gas_station_pumps_control(), to manage the gas station fuel storage.

Now, using these generators, we are ready to create a SimPy model, add resources and processes, and run simulations.

Это упражнение является частью курса

Discrete Event Simulation in Python

Посмотреть курс

Интерактивное практическое упражнение

Попробуйте выполнить это упражнение, дополнив этот пример кода.

env = simpy.Environment()

# Create the gas station resource
gas_station_pumps = simpy.____(env, capacity=____)

# Create the gas tank container
gas_station_tank = simpy.____(env, GAS_STATION_TANK_SIZE, init=GAS_STATION_TANK_SIZE)

# Add processes to the SimPy environment
env.____(gas_station_pumps_control(env, gas_station_tank))
env.____(car_generator(env, gas_station_pumps, gas_station_tank))

env.run(until=SIM_TIME)
Редактировать и запускать код