4 Simple Steps to Create a Monte Carlo Simulation
Время обновления: 2022-08-08 17:46:56
In the 1940s, scientists working on the atomic bomb applied Monte Carlo simulations to calculate the probability of one fissioned uranium atom causing another fission reaction, the first simulation application, and much progress has been made since then. Today we will describe how to use Minitab to create Monte Carlo simulations for known engineering and DOE equations.
Because uranium was in short supply at the time and there was little room for trial and error in testing, Monte Carlo simulations have been focused on calculating reliable probabilities based on simulated data. Today, simulation data is often used in many scenarios, from materials engineering to medical device packaging sealing to steelmaking, such as those with limited resources or where collecting real data is too expensive or impractical. Using Engage or Workspace's Monte Carlo simulation tools can.
(1) Simulate a range of possible outcomes to help make decisions
(2) Predict financial outcomes or estimate project timelines
(3) Understand the variability in a process or system
(4) Identify problems in a process or system
(5) Manage risk by understanding the cost/benefit relationship
4 Steps to get started with any Monte Carlo simulation
Simulations can be very complex, depending on the number of factors involved. However, all Monte Carlo simulations essentially have four simple steps.
- Determine the transport equations
To create a Monte Carlo simulation, you need a quantitative model that contains the business activity, plan, or process to be explored. The mathematical expression for the process is called the "transport equation." This can be known as an engineering or business equation or based on a model created from a design of experiments (DOE) or regression analysis. With software such as Minitab Engage and Minitab Workspace, you can create complex, even equations with multiple, potentially interdependent responses.
- Define input parameters
For each factor in the transport equation, determine how its data will be distributed. Some inputs may follow a normal distribution, while others follow a triangular or uniform distribution. It would help if you then determined the distribution parameters for each input. For example, you need to specify the mean and standard deviation for the inputs that follow a normal distribution. If you are not sure which distribution the data follows, you can use the tools provided by Engage and Workspace to determine it.
- Setting Up Simulations
To run a valid simulation, you must create a large random data set (containing approximately 100,000 instances) for each input. These random data points simulate the values you will see for each input over a long time. Although it sounds like a lot of work, this is where Engage and Workspace shine. Once we submit the inputs and the model, everything is processed.
- Analyzing Process Output
You can use the transport equations to calculate the simulation results with the simulation data. Running enough simulated input data through the model will reliably indicate what the process will output over time, given the expected variation in the input.
4 Steps for Monte Carlo Using a Known Engineering Equation
A manufacturing company needs to evaluate the design of a proposed product, a small piston pump that must pump 12 ml of fluid per minute. Given the natural variation in piston diameter (D), stroke length (L), and strokes per minute (RPM), you want to estimate the potential performance of thousands of pumps. Ideally, thousands of pumps will have a flow rate with a standard deviation of no greater than 0.2 ccs.
- Determining the Transfer Equation
The first step in performing a Monte Carlo simulation is determining the transport equation. In this example, you use the known engineering equation for pump flow.
The flow rate in milliliters = π(D/2)2 ∗ L ∗ RPM
- Defining the input parameters
The distribution and parameters for each input in the transfer equation must be defined. The pump piston diameter and stroke length are known, but the number of strokes per minute (RPM) required to reach the desired 12 ml/min flow rate must be calculated. The volume pumped per stroke is calculated by the following equation: π(D/2)2 * L
If D = 0.8 and L = 2.5, then 1.256 ml of fluid is discharged per stroke. Therefore, to achieve a flow rate of 12 ml/min, the RPM is 9.549.
Based on the performance of other pumps manufactured, you can assume a normal distribution of piston diameters with a mean of 0.8 cm and a standard deviation of 0.003 cm. The stroke length is normally distributed with a mean of 2.5 cm and a standard deviation of 0.15 cm. Finally, the number of strokes per minute is normally distributed with a mean of 9.549 RPM and a standard deviation of 0.17 RPM.
- To set up the simulation in Engage or Workspace
Click the Insert tab in the top ribbon and select Monte Carlo Simulation.
We've made it very simple - you provide a name for each variable, select a distribution from the drop-down menu, and enter the parameters. We will follow what is described above. If you are unsure which distribution the data follows, you can use Data Determination. This will prompt you to upload a .csv file of the data, which can be selected from the following options.
- Simulation and analysis process output
The next step is to give the equations. Here, the operation is very simple, provide the name for your output (the name we provided is Flow) and type in the correct transfer equation we identified above. You can also add upper and lower limits to see how the simulation compares.
Then, in the ribbon, select the number of simulations (100,000 is a good baseline) and click the button used to run the simulation.
For the random data generated to write this paper, the average flow rate based on 100,000 samples is 11.996. in terms of the average, we reach our target, but the minimum value is 8.7817, and the maximum value is 15.7057. this is a fairly large range. （The transfer variation (of all components) results in a standard deviation of 0.756 ml, which is well above the target value of 0.2 ml.
This pump appears to have too much design variation and needs further refinement before it can be put into production. Here, we see the benefit of simulation. If we had gone into production, we would probably have produced too many returned pumps. With the Monte Carlo simulation, we solved all these problems without the expense of building and testing thousands of prototypes or going into production too early.
You might want to see if these simulations hold up, so try it yourself! Running different simulations will result in slight variations, but the final results (with an unacceptable amount of flow rate variation) will remain consistent each time. This is what makes the Monte Carlo method so powerful.
Another optional step: parameter optimization
Knowing that the standard deviation is too high is valuable, but where Engage and Workspace stand out is their ability to help improve the situation. This is where parametric optimization comes into play.
Let's look at the first input: the piston diameter. With a mean value of 0.8, most data will be close to that value or within one or two standard deviations of the mean. But what if the smaller the piston diameter, the more efficient the Flow? Parameter optimization helps us to answer this question.
We need to specify a search range for each input to perform parameter optimization. In this case, for simplicity, I specify a search range of +/- 3 standard deviations for the algorithm. Engage or Workspace will help us find the best settings for each input to achieve our goal (in this case, reducing the standard deviation). Choosing the right range is critical; make sure that the entire range of your inputs is operational; it is useless if the best solution found cannot be replicated in a production environment.
The principle is similar if you have used the Response Optimizer in Minitab Statistical Software. Here are our results.
Based on these results, if you want to reduce the standard deviation, you should reduce the stroke length and the number of strokes per minute. The piston diameter can be kept similar in size. Remember, the key to Monte Carlo simulations is finding all of these results without building a new prototype or conducting a new experiment.
Monte Carlo Uses Design of Experiments (DOE) Response Equations
What if you don't know what equations to use or are trying to simulate the results of a unique process? In this case, we can combine Minitab Statistical Software's design-by-experiment capabilities with Engage or Workspace's simulation capabilities.
An electronics manufacturer has assigned you to improve its electrode cleaning operation, which prepares metal parts for plating. The manufacturer coats the raw material with a different layer of metal by plating to achieve the desired properties. The plating does not adhere to dirty surfaces, so the company has a continuous flow electrode cleaning system connected to an automatic plating machine. A conveyor belt immerses each part in a tank, and the voltage in the tank is transmitted through the part so that it is cleaned. Inadequate cleaning can result in high root mean square (RMS) values and poor surface finish. A properly cleaned part has a smooth surface and a low RMS.
Two key inputs can be adjusted to optimize this process: voltage (Vdc) and current density (ASF). For the electrode cleaning method, typical engineering limits for Vdc are 3 to 12 volts. Current density limits are 10 to 150 amps per square foot (ASF).
- Determining the Transfer Equation
You cannot use known formulas from the textbook for this process, but you can set up a response surface DOE in Minitab to determine the transfer equation. The response surface DOE is typically used to optimize the response by finding the best settings for a "critical few" controllable factors.
In this example, the response will be the surface quality of the part after cleaning.
Choose Statistics > DOE > Response Surface > Create Response Surface Design to create a response surface experiment in Minitab. Since we have two factors (voltage (Vdc) and current density (ASF)), we will choose a two-factor central composite design with a trial count of 13.
After Minitab creates a design experiment, you need to perform 13 trials, collect data, and record the surface roughness of 13 cleaned parts. With Minitab, you can easily analyze DOE results, simplify the model, and check assumptions using residual plots. Using the final model and Minitab's Response Optimizer, you can find the best settings for the variables. In this example, you set the voltage to 7.74 and the ASF to 77.8, resulting in a roughness value of 39.4.
The response surface DOE generates the following transport equation for the Monte Carlo simulation.
Roughness = 957.8 - 189.4(Vdc) - 4.81(ASF) + 12.26(Vdc2) + 0.0309(ASF2)
- Defining the input parameters
You can now set up parameter definitions for the Monte Carlo simulation inputs and bring them into Engage or Workspace.
Note that the standard deviation must be known or estimated based on existing process knowledge. This applies to all Monte Carlo inputs. Voltage is normally distributed with a mean of 7.74 Vdc and a standard deviation of 0.14 Vdc. Amps per square foot (ASF) is normally distributed with a mean of 77.8 ASF and a standard deviation of 3 ASF.
- Setting up the simulation in Engage or Workspace
This is the same as step 3. Click Insert > Monte Carlo Simulation in the ribbon, add your input, define its parameters, and then enter your model. In this example, if you have the latest version of Minitab, you can right-click and click Send to Engage or Send to Minitab Workspace. If you don't, you can copy it manually from the Minitab output and paste it into the Model field in Engage or Workspace.
- Simulation and analysis process output
The summary shows that the distribution of RMS roughness is not normal, even though the underlying inputs are normally distributed. The summary also shows that the transport variance for all components results in a standard deviation of 0.521, which is a good process result based on your knowledge of the process. We can determine what we will see in this process based on a DOE of only 13 trials. Again, since this is based on simulated data, your answer will be slightly different, but generally speaking, the answer should be correct. We can look at parameter optimization to fine-tune our answer and find the best solution if necessary.
Следующий: Top 10 Embedded Algorithms
IC TELECOM INTERFACE 16QFN >
Ethernet ICs Dual Media Octal Phy >
USB Interface IC USB 2.0 High Speed Auto >
Low Speed/Full Speed/High Speed Hub Cont >
ARCNET 5 Port HUB Controller,Interface - >
LDO Regulator, 500mA, 3.3 V, ±0.5%, 2.7 >
Flash Serial-SPI 3.3V 16M-bit 2M x 8 6ns >
WiFi / 802.11 Modules RS232 to WiFi Ser >
MCU 32-bit MIPS M4K RISC 512KB Flash 2.5 >
USB, CAN and Ethernet 32-bit Flash Micro >
8 Bit MCU, Flash, PIC18 Family PIC18F K2 >
INDUCTOR, AXIAL, 15UH; Inductor type:Cho >
28 PIN, 3.5KB ENH FLASH, 128 RAM, 25 I/O >
18/20-Pin Enhanced Flash Microcontroller >
8 Bit MCU, Flash, PIC16 Family PIC16F19X >