Lab File Os Upto 8th
Lab File Os Upto 8th
Lab File Os Upto 8th
ON
OPERATION AND SIMULATION LAB
(IEA-551)
Submitted By:
Name: Udit Narain Gupta
Theory
The value of pi can be estimated using a Monte Carlo simulation, a statistical technique that relies
on repeated random sampling. The key idea is to generate random points inside a square that
contains a quarter circle and determine how many of those points fall inside the quarter circle.
Consider a unit square (side length = 1) with a quarter circle of radius 1 inscribed within it. The
area of the square is 1 x 1 = 1, and the area of the quarter circle is π/4. The ratio of points that
land inside the quarter circle to the total points in the square will approximate π/4.
This method becomes more accurate as the number of random points increases.
Apparatus/Software Used
- Computer with Python/Java/C++ (any programming language that supports random number
generation)
- Random number generator function
- Visualization software (optional)
Procedure
1. Initialize a counter for points inside the quarter circle.
2. Generate random points within the unit square by producing random x and y coordinates
between 0 and 1.
3. For each point, calculate the distance from the origin (0,0) using the formula: Distance =
sqrt(x^2 + y^2).
4. If the distance is less than or equal to 1, the point lies inside the quarter circle, and the counter
is incremented.
5. Repeat the process for a large number of points (e.g., 10,000 or 100,000).
6. Estimate the value of pi using the formula: π ≈ 4 * (Number of points inside the circle / Total
number of points).
7. Compare the estimated value with the actual value of pi.
Observations
Using Excel:-
Using Code:-
Error is 0.1403%
2. For 100,000 simulations Value is 3.14528
Error is 0.1174%
Results
The estimated value of pi after running the simulation is :-
Conclusion
The Monte Carlo method provides a simple yet effective way to estimate the value of pi. As the
number of random points increases, the estimated value converges towards the actual value of pi.
This experiment demonstrates the power of random sampling techniques in numerical
computation.
Experiment 2
Objective
To estimate the area under the curve y = x^3 over a given interval [x1, x2] using the Monte Carlo
method by generating random numbers.
Theory
The Monte Carlo method is a statistical technique that estimates the area under a curve by
randomly generating points within a bounding rectangle that encapsulates the region under the
curve. The method works by calculating the ratio of points under the curve to the total points
within the rectangular region and scaling it according to the area of the rectangle.
1. Define the region under the curve y = x^3 over the interval [x1, x2].
2. Draw a bounding rectangle around this region, where the width of the rectangle is x2 - x1, and
the height is max(x1^3, x2^3).
3. Generate random points within the bounding rectangle.
4. Count how many points fall below the curve y = x^3.
5. The ratio of the points below the curve to the total points inside the rectangle will estimate the
fraction of the rectangle's area that lies under the curve.
The area under the curve can be estimated using the formula:
Estimated Area ≈ (Number of points below the curve / Total number of points) * Area of the
rectangle.
Apparatus/Software Used
- Computer with Python
- Random number generator function
- Function for y = x^3
Procedure
1. Input: Obtain the interval [x1, x2] from the user.
2. Bounding Rectangle: The width of the rectangle is x2 - x1, and the height is max(x1^3, x2^3).
3. Generate a large number of random points within the bounding rectangle. For each point:
a. Generate a random x-coordinate between x1 and x2.
b. Generate a random y-coordinate between 0 and max(x1^3, x2^3).
4. For each random point, evaluate whether the point lies below the curve by checking if y ≤ x^3.
5. Count the number of points that lie below the curve.
6. Estimate the area under the curve using the formula: Estimated Area ≈ (Number of points
below the curve / Total number of points) * Area of the rectangle.
7. Compare the estimated area to the analytical value (if known).
Observations
Using Python:-
Conclusion
The Monte Carlo method effectively estimates the area under a curve through random sampling.
As the number of points increases, the estimated area becomes more accurate. This experiment
demonstrates how randomness and statistical methods can be applied to solve numerical
integration problems.
Experiment 3
Objective
To compare two methods of bearing replacement on a machine with three bearings, and
determine which method is more efficient in terms of minimizing downtime and maximizing
bearing lifespan:
Theory
Machines with multiple bearings experience wear and tear over time. When a bearing fails, it can
cause downtime and may lead to further machine damage. The current maintenance practice is to
replace only the failed bearing. The proposed method suggests replacing all three bearings
whenever one fails, assuming that if one fails, the others are likely to fail soon. The goal of this
experiment is to determine which method is more efficient in terms of total machine uptime and
bearing replacement frequency over a given period.
The total cost in terms of both downtime and bearing replacement can be modeled and compared
over multiple iterations. The proposed method should theoretically reduce long-term maintenance
costs and downtime by preemptively replacing all bearings.
Procedure
1. Set Parameters:
4. Simulations:
Run the simulation multiple times (e.g., 1000 iterations) for both methods to gather
sufficient data on replacement frequency, total downtime, and maintenance cost.
Use random lifespans for the bearings to introduce variability in the simulations.
5. Evaluation Metrics:
Observations
Current Method:
- Individual bearings are replaced when they fail, leading to less immediate cost
but potentially more frequent machine downtime.
- Record how often the machine needs to be stopped and restarted after each
failure.
Proposed Method:
- Replacing all three bearings at once results in a higher immediate cost for each
failure, but it reduces the overall frequency of failures.
- Track the longer periods between machine stoppages due to bearing failure.
Results
The results will be illustrated through simulation screenshots for both methods, showing key data
such as:
Through Python:
Screenshots of these simulations will visually compare the effectiveness of each method in
reducing downtime and improving overall machine performance.
Conclusion
From the simulated data, the screenshots will indicate the trends for the proposed method, which
is expected to show:
This will visually confirm that the proposed method is more efficient in maintaining machine
performance over the long term.
Experiment 4
Objective
To determine the optimal number of newspapers to order each day in order to maximize profits
while minimizing losses due to unsold copies using the Monte Carlo simulation.
Theory
The Newspaper Inventory Problem is a classic example of inventory management under
uncertainty. The newspaper vendor must decide how many newspapers to order daily, given that
unsold newspapers will result in losses and unmet demand leads to lost sales opportunities.
The goal is to find the optimal order quantity that maximizes the vendor’s expected profit while
accounting for uncertain demand.
Apparatus/Software Used
• Computer with Python/Excel/Java/C++ (or any programming language supporting random
number generation).
• Random number generator function to simulate demand.
• Spreadsheet or visualization software for recording and analyzing results.
Procedure
1. Define Parameters: Set the cost per newspaper (C), selling price (S), and salvage value (V).
Define a demand probability distribution (e.g., uniform, normal, or based on historical data).
2. Simulate Random Demand: Generate random demand values for each day using the defined
probability distribution.
3. Calculate Profit for Each Order Quantity: For each order quantity Q, calculate:
• Revenue = min(Q, Demand) × S
• Cost = Q × C
• Salvage = max(0, Q - Demand) × V
• Profit = Revenue - Cost + Salvage
4. Repeat Simulation: Repeat the process for several days (e.g., 1,000 or 10,000 iterations) for
various order quantities Q.
5. Determine Optimal Order Quantity: Identify the order quantity that yields the highest average
profit.
Observations
• For order quantity = 50 newspapers, simulated average profit is $X with X% of demand met.
• For order quantity = 75 newspapers, simulated average profit is $Y with Y% of demand met.
• For order quantity = 100 newspapers, simulated average profit is $Z with Z% of demand met.
Code:
Results
1. Optimal order quantity: Based on simulations, the optimal number of newspapers to order each
day is 70.
2. Profit and demand match: The best order quantity resulted in an average profit of $X with Y%
of demand satisfied.
Conclusion
The Monte Carlo method allows for effective simulation of uncertain demand in inventory
management problems. By running simulations over different order quantities, we can determine
the optimal order size that maximizes profits while accounting for demand variability. This
experiment highlights the power of Monte Carlo simulations in solving real-world inventory
management problems under uncertainty.
Experiment 5
Objective
Analysis of Transportation problems using excel solver
Theory
The transportation problem is a type of linear programming model that aims to determine the
most cost-efficient way to distribute goods from multiple suppliers to multiple consumers while
minimizing transportation costs. It ensures that supply and demand constraints are met at each
source and destination.
2. Using Python:
Apparatus/Software Used
• MS Excel and Python interpreter
Procedure
Using Excel
Balanced Problem:
Cost Table
Solver
Optimal Solution
Results
From Factory 1 100 Units will be shipped to Customer 2.
From Factory 2 100 Units will be shipped to Customer 2 and 100 units to Customer 3
From Factory 3 200 Units will be shipped to Customer 1 and 100 units to Cystomer 3
Total Cost is 26000Rs.
Unbalanced Problem:
Cost Table
Cost table with Dummy
Shipment Table
Solving Parameters
Results
From O 1 15 Units will be shipped to D 2.
From O 2 13 Units will be shipped to D 1 and 12 units to D 3
From O 3 17 Units will be shipped to D 1, 5 units to D 2 and 20 units to D 5
From O 4 3 Units will be shipped to D 3 and 10 units to D 4 and also 22 Units to Dummy
Total Cost is $374
Using Python:
• Import numpy.
• Define the cost matrix using np.array.
• Formulate the supply and demand, also ensure total supply equals total demand for a
balanced problem.
• Create constraints matrix, now using for loop, for each supplier i, the loop creates a
row in that matrix that ensures the total amount shipped from that source equals the
source’s supply value.
• In second loop for each destination j, it creates a row in constraint matrix that ensures
total amount received at destination must fulfil destinations demand.
• We define non negativity constraints.
• Using numpy and giving cost and all constraints within the function we solve the
transportation problem.
• We resize the solution as shipment matrix and print the output.
Suppliers: A, B
Destinations: X, Y, Z
Python Code:
# Install PuLP if you haven't already
import pulp
# Define data
suppliers = ['A', 'B']
supply = {
'A': 20,
'B': 30
demand = {
'X': 10,
'Y': 25,
'Z': 15
costs = {
('A', 'X'): 8,
('A', 'Y'): 6,
('B', 'X'): 9,
('B', 'Z'): 5
# Decision variables: how much to transport from each supplier to each destination
# Supply constraints: Total shipped from each supplier should not exceed their supply
for s in suppliers:
# Demand constraints: Total received by each destination should meet its demand
for d in destinations:
problem.solve()
print(f"Status: {pulp.LpStatus[problem.status]}")
for s in suppliers:
for d in destinations:
Output:
Initial allocation:
[[ 0. 0. 10. 2.]
[ 0. 10. 0. 7.]
[10. 0. 0. 1.]]
Objective
To analyze a selected plant layout by modeling and simulating bottleneck and line balancing over
a 48-hour (2 days) period using FlexSim software, and to evaluate performance metrics such as
total parts processed, average time for dispatch, and work in progress (WIP). Bottleneck analysis
will be performed, and solutions will be suggested if bottlenecks are identified.
Theory
Simulation: Simulation is a powerful tool for analyzing and optimizing complex
production systems. It enables users to model real-world processes and predict the
performance of different configurations. In this experiment, we simulate a manufacturing
plant layout in FlexSim to identify bottlenecks and improve line balancing.
Key factors involved in this simulation are machine capacities, processing times, and
queue lengths. These factors determine the efficiency of the production line and directly
affect the overall system performance. When a machine in the production line has a
significantly longer processing time than others, it can cause a bottleneck, slowing down
the entire system and reducing throughput.
Line Balancing: Line balancing aims to distribute tasks evenly across all workstations to
minimize idle times and ensure smooth workflow. Each workstation should have similar
workloads to avoid overburdening any particular station. Proper line balancing helps
prevent bottlenecks and ensures maximum utilization of resources.
Bottleneck Analysis: A bottleneck is a point in the production process where the
workflow slows down due to limited capacity or longer task duration. Identifying and
addressing bottlenecks is critical for increasing the efficiency of the entire production
line. In FlexSim, bottleneck analysis is performed by running simulations that track each
workstation's performance. By adjusting parameters such as machine processing times
and capacities, we can reduce idle times and eliminate bottlenecks.
The aim of this experiment is to simulate the production system for 48 hours and determine
which workstations are causing delays, and how to optimize the line for better performance.
Apparatus/Software Used
FlexSim Simulation Software
Procedure
1. Assign Operators: Each machine (lathe, drill, CNC machine, mill) is assigned an operator
for efficient processing.
2. Define the Plant Layout: Using FlexSim, model the production system as per the task
executors and parameters listed above.
3. Run the Simulation: Simulate the model for 48 hours (2880 minutes) and gather data on:
4. Check for Bottlenecks: Analyze the data to identify if any station is causing a delay in the
workflow.
Observations
By setting up and connecting the components properly and following the bottleneck identification
steps, you can effectively manage and optimize the system in FlexSim.
Bottleneck identification at Mill Machine.
Conclusion
Through simulation in FlexSim, key performance metrics were successfully measured, and
bottlenecks in the production process were identified and addressed. The mill was identified as
the main bottleneck due to its longer processing time. By reducing the processing time of the
mill, the system achieved better throughput and reduced queue lengths, demonstrating the
importance of bottleneck analysis and optimization in manufacturing systems.
Experiment 7
Objective
Analysis and simulation for routing and scheduling for a duration of 8hours(1 shift) of selected
plant layout in Flexsim software.
Apparatus/Software Used
FlexSim Simulation Software
Procedure
1. Drag and Drop Components:
Open the Library panel on the left and drag the Source, Processor, and
Sink objects onto the workspace.
3. Connect Components:
Link the Source to Processors and then the Processors to the Sink using
the Connector Tool (right-click on each component and select
“Connect”).
4. Configure Components:
o Double-click on each object to adjust its settings:
Source: Set the arrival rate and input type.
Processor: Configure the processing time and capacity.
Sink: No configuration is needed unless specific outputs are
required.
Routing and scheduling procedure:
Problem statement
1. Routing is the process of path selection in any network. Scheduling is the process of
arranging, controlling and optimizing work and workloads in a production process or
manufacturing process.
2. We have to perform the simulation for routing and scheduling for the plant layout having
3 HMC machines and 2 VMC machines and having a source, queue and sink.
3. We drag and release all objects from panel to the workplace, then we connect them using
connect objects function make sure that there is 1 queue connected to all machines and
having source at first and sink at last.
4. Open the source and keep arrival time at 2.5 and all machines are having the process time
10 minutes.
5. We are calculating simulation for 8 hours which we take in 480 minutes and keep this as
stop time.
6. Now we go to source and select triggers in that we select on creation and there we select”
set label by percentage” and “ set colour by case” functions.
7. Then we select the machines and select the flow function and there we have HMC
machine as type 1 and VMC machine as type 2 in pull requirement.
8. Now reset the process and run the process then we get the below output and input from
source and sink.
9. Then have the total arrived and dispatched.
10. Now go to the dashboard function and open blank dashboard there double click and select
the average work content then select and all 5 machines and execute.
Results
By using Flexsim we have calculated the routing and scheduling of plant having 8 hours working
time. The results are productive and more efficient.
Experiment 8
Objective
Analysis of Linear Programming Problem using Excel Solver
Apparatus/Software Used
MS Excel
Procedure
Using MS EXCEL:
This should give you the optimal solution within your defined constraints!
Conclusion:
We successfully solved both maximization and minimization type linear programming problems
and verified successfully using Excel solver.
Experiment 9
Objective
Simulation of material handling using task executer and conveyor belt in flexsim.
Apparatus/Software Used
Flexsim Software
Procedure
2. Model Setup: Create a digital representation of the material handling system, including
all relevant objects like conveyors, storage units, and Task Executers.
3. Task Sequences: Develop task sequences for Task Executers, specifying actions like
loading, unloading, and transporting items.
5. Run Simulation: Execute the simulation to observe the behavior of the system under
various conditions.
6. Data Collection: Gather data on key performance indicators like throughput, cycle
time, and resource utilization.
7. Analysis: Analyze the collected data to identify bottlenecks, inefficiencies, and areas
for improvement.
8.Taking a problem on plant layout for material handling having 8 hours of shift duration
with double shift for 3 days
9.we setup model using source, sink, queue and task executer as shown in figure.
10.we setup the AGV which is automatic guided vehicles for this operation and give the
specifications.
11.we then run the model and take average content from the dashboards
Material handling simulation using conveyor belt
1. Define Objectives:
Identify the goals of the simulation, such as improving throughput, reducing
bottlenecks, or enhancing safety.
2. Model Setup:
Create Environment: Build the digital layout of the facility, including all relevant
components like conveyors, sensors, and stations.
Add Conveyor Belts: Place conveyor belts in the model, specifying their length, width,
speed, and other parameters.
Configure Task Executers: If applicable, set up any task executers (e.g., robotic arms,
workers) that interact with the conveyor system.
Define Work Stations: Position workstations along the conveyor where tasks like
assembly, inspection, or packaging occur.
3. Define Flow Logic:
Product Flow: Determine the flow logic for products on the conveyor, including entry
points, routing, and exit points.
Task Sequences: Develop task sequences for task executers or operators interacting
with the conveyor.
Control Mechanisms: Set up sensors and control mechanisms to manage conveyor
operations (e.g., start/stop triggers, diverting mechanisms).
4. Set Parameters:
Speed and Timing: Define the speed of conveyor belts and timing for various
processes.
Capacity and Load: Set the capacity of each conveyor belt and the load it can handle.
5. Run Simulation:
Execute the simulation to observe the behavior of the conveyor system under different
scenarios.
6. Data Collection:
Collect data on key performance indicators like throughput, cycle time, and resource
utilization.
Track the movement and processing times of products on the conveyor.
7. Analysis:
Analyze the collected data to identify bottlenecks, inefficiencies, and areas for
improvement.
Use the analysis to adjust the model and re-run simulations as needed.
Using Task executer
Using conveyor belt
Result : material handling is simulated using flexsim and outputs are 957 for 959 input
in taskexecuter and 153 for 157 input which are optimal.
Conclusion:
Summary for task executer model: Summarize the outcomes of the simulation,
highlighting any improvements or issues identified.
Summary For conveyor belt model:
Present the outcomes of the simulation, highlighting any improvements in throughput,
cycle time, or resource utilization.
Bottlenecks and Issues:
Identify any bottlenecks or inefficiencies discovered during the simulation.
Experiment 10
Objective
Optimizing Shipment Location Using GRG Nonlinear Solver in MS Excel
Apparatus/Software Used
Flexsim software.
Procedure
OBSERVATIONS :
1.Location 1:
2. Location 2
Conclusion:
The optimum locations are in Rechhera, Madhya Pradesh and Gowdahalli, Karnataka
Experiment 11
Objective
To generate various probability distributions using random variates and plot their histograms to
understand the behavior of these distributions.
Apparatus/Software Used
MS Excel
Procedure
1. Setup in MS Excel:
a. Open a new Excel worksheet.
b. Generate a column of 500 random numbers using the Excel function
=RAND(). This column will serve as the base uniform distribution
(U(0,1)U(0, 1)U(0,1)).
2. Transforming Uniform Distribution into Desired Distributions:
Using the random variates generated, apply the following transformations to create
specific probability distributions:
a) Exponential Distribution:
b) Weibull Distribution:
c) Hyperexponential Distribution:
1. Weibull distribution
2. Uniform Distribution
3.Normal Distribtuion
4. Exponential Distribution
Conclusion:
The experiment demonstrated how to generate and analyze different probability distributions
using random variates in MS Excel.
3. Weibull Distribution: Modeled various real-world scenarios like reliability and failure
times through adjustable parameters.
This experiment highlights the versatility of Excel for simulating and visualizing probability
distributions, aiding in understanding their applications in real-world modeling.