DSL Project Report

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Jaypee University of Information Technology

Department of Computer Science & Engineering

PROJECT SUBMISSION
REPORT

Course Code:18B17CI473
Course Name: DATA SIMULATION LAB

Submitted by: Submitted to:

Name: Aditya Sinha / Kshitiz Tayal Name: Dr. Alok Kumar


Roll no: 211172/211173
Batch:CS43
MINI PROJECT - 1
Introduction:

In this project, we have simulated a movie booking counter using the SimPy
simulation framework. The simulation models the booking process of three movies
where customers can buy tickets for the desired movies. The booking counter has a
limited capacity of 1, which means only one customer can buy tickets at a time. The
counter is modeled as a resource object in SimPy, which enforces mutual exclusion.
Techniques Used:
1. Resources: Resource
2. Condition events
3. Shared events

Simulation Details:

The simulation has been set to run for 120 minutes. Initially, 50 tickets are available
for each movie. The simulation randomly generates the arrival of customers, the
movie they want to watch, and the number of tickets they want to buy. If tickets are
available, the customer proceeds to buy the tickets from the counter, else the
customer leaves. If a movie is sold out, the remaining customers in the queue leave
the queue.
The simulation model includes three main functions:
1. moviegoer(): This function simulates the behavior of a customer trying to buy
tickets for a particular movie. It checks if the counter is available and if the
requested number of tickets are available. If both conditions are met, the
customer buys the tickets and decreases the available ticket count. If the
available tickets for a movie are less than two, the movie is considered sold
out, and the remaining customers in the queue leave the queue.
2. customer_arrivals(): This function generates the arrival of customers at the
booking counter. It generates the arrival time of a customer and the movie
they want to watch. If tickets are available for that movie, the customer
proceeds to buy the tickets. Otherwise, the customer leaves.
3. main(): This function sets up the simulation environment and runs the
simulation for the specified time.

Results:

After running the simulation, the program prints the movies that are sold out and the
time at which they were sold out. It also prints the number of people who left the
queue when a movie was sold out.

Conclusion:

The simulation has shown that SimPy is an effective simulation framework for
modeling ticket booking counters for movies. It can be extended to include more
complex scenarios, such as different ticket prices or multiple counters.
OUTPUT:
MINI PROJECT - 2
Introduction:

The petrol pump model is a simulation model that uses the SimPy library to model
the operations of a petrol pump. This model simulates the process of fueling vehicles
at a petrol pump. It takes into account factors such as the number of fuel pumps
available, the amount of fuel available, and the rate at which vehicles arrive and
leave the petrol pump. The model also simulates the arrival of a fuel truck to refill the
petrol pump when the fuel level falls below a certain threshold. The purpose of this
model is to help petrol pump managers optimize their operations and improve
customer satisfaction.

Code Explanation:

The code begins by defining several constants such as the size of the petrol pump,
the minimum and maximum fuel tank levels, and the time it takes for the fuel truck to
arrive. It then defines four processes: car, gas_station_control, tank_truck, and
car_generator.
The car process represents a vehicle arriving at the petrol pump. It requests a fuel
pump and attempts to fill its fuel tank. If there is enough fuel in the petrol pump, the
car fills its tank and leaves. If there is not enough fuel, the car waits until the fuel
truck arrives to refill the petrol pump.
The gas_station_control process periodically checks the fuel level in the petrol pump.
If the fuel level falls below a certain threshold, the process calls the tank_truck
process to refill the petrol pump.
The tank_truck process represents the fuel truck arriving at the petrol pump to refill it.
It waits a certain amount of time before arriving and then refills the petrol pump.
The car_generator process generates new cars that arrive at the petrol pump at
random intervals. This process is an infinite loop that creates new cars and waits for
a random amount of time before creating the next car.
The simulation starts by creating a SimPy environment and defining the petrol pump
and fuel pump resources. It then starts the gas_station_control and car_generator
processes. The simulation is run for a specified amount of time, after which it ends.

Conclusion:

In conclusion, the petrol pump model using SimPy is a useful tool for petrol pump
managers to optimize their operations and improve customer satisfaction. It allows
managers to experiment with different scenarios and observe the effects on the
petrol pump's performance. The simulation model can be extended to include more
complex scenarios and variables to provide even more insights and
recommendations for petrol pump managers.
OUTPUT:
MINI PROJECT - 3
Project Report: Hostel Room Allotment Based on CGPA using SimPy

Introduction:
The objective of this project is to simulate a hostel room allocation system based on
students' CGPA using the SimPy library. The project is designed to demonstrate the
use of a discrete-event simulation approach in solving resource allocation problems.
The system simulates the allocation of hostel rooms to students based on their
CGPA, medical requirements, AC requirements, and double occupancy preference.
SimPy Overview:
SimPy is a Python library that provides a framework for discrete-event simulation.
Discrete-event simulation is a modeling approach that simulates the behavior of a
system as a sequence of discrete events that occur at specific points in time. In a
discrete-event simulation, the system is modeled as a collection of entities that
interact with each other and with the environment. SimPy provides a set of tools for
modeling the behavior of entities, the resources they use, and the events that trigger
their behavior.

System Design:

The system consists of a simulation environment, a set of students, and hostel


rooms. The simulation environment is implemented using the SimPy library. The
hostel rooms are modeled as a finite resource that is allocated to students based on
their CGPA, medical requirements, AC requirements, and double occupancy
preference. Each student is modeled as an entity that requests a room from the
hostel resource.
The system is designed to allocate hostel rooms to students in the following order:
1. Allocate medical rooms to students with medical requirements
2. Allocate AC rooms to students with AC requirements
3. Allocate double occupancy rooms to students with double occupancy
preference
4. Allocate single occupancy rooms to the remaining students based on their
CGPA

Simulation Process:

The simulation process is defined in the allocate_rooms function. This function takes
as input the simulation environment, the list of students, the number of hostel rooms
available, the maximum CGPA allowed for room allocation, and the hostel resource.
The function simulates the allocation of hostel rooms to each student in the list
based on their CGPA and preferences.
The simulation process works as follows:
1. For each student in the list, check if their CGPA is within the maximum limit. If
not, print a message stating that their CGPA is too high for room allocation.
2. If the student's CGPA is within the maximum limit, check if there are any
available rooms that match the student's preferences.
3. If there are available rooms that match the student's preferences, allocate a
room to the student and decrement the number of available rooms.
4. If there are no available rooms that match the student's preferences, print a
message stating that no more rooms are available for the student.
5. Randomly assign a warden to the student from the available wardens.

Simulation Results:

The simulation results show the allocation of hostel rooms to each student based on
their CGPA and preferences. The results demonstrate the effectiveness of the
system in allocating hostel rooms to students based on their preferences and CGPA.

Conclusion:

The simulation of the hostel room allocation system using SimPy demonstrates the
use of discrete-event simulation in solving resource allocation problems. The system
effectively allocates hostel rooms to students based on their preferences and CGPA.
The simulation results show that the system is effective in allocating rooms to
students with medical requirements, AC requirements, and double occupancy
preferences. The system can be further extended to include additional preferences
and constraints such as room location, gender, and other amenities.

Code:

You might also like