Question: Problem 2. In the TTF example from the first class we simulated the system until the time of first failure. Modify the simulation model to

Problem 2.

In the TTF example from the first class we simulated the system until the time of first failure. Modify the simulation model to simulate the system for a given number of days denoted by T. Assume that all other inputs and assumptions are the same as in the original example. (a) What is the average number of functional components until time T = 1000 based on one replication of the simulation? (b) What is the average number of functional components until time T = 2000 based on one replication of the simulation? Compare the results from part (a) and (b) and summarize your observation in one sentence. HINT: To get the simulation to stop at time T use the functional version of the code and create a new event called EndSimulation, with a variable NextEndSimulation as part of the event calendar. Note that you also need to modify the logic of the model in the failure and repair event functions.Problem 2. In the TTF example from the first class we simulated

the system until the time of first failure. Modify the simulation model

0.0.3 Functional version import numpy as np def Failure (: global S global Slast global Tlast global Area global NextFailure global NextRepair S S-1 NextRepair- clock +2.5 NextFailure clock +np.ceil(6 np.random.randomO) # Update the area under the sample path and the # time and state at the last event Area Area (clock - Tlast) Slast Tlast clock Slast S def Repair) global S global Slast global Tlast global Area global NextFailure global NextRepair S S+1 NextRepair float(inf) Area Area Slast(clock - Tlast) Slast S Tlast clock def Timer() global clock global NextRepair global NextFailure if NextFailure 0: # While system is functional NextEvent Timer) if NextEvent"Repair": Repair() else Failure() # odd samples to the lists TTF_list.append(clock) Ave_list.append(Area/clock) # print sample averages print( Estimated expected TTF:', np.mean(TTF_list)) print('Estimated expected ave. # of func. comp, till failure:", np.mean(Ave-list)) 0.0.3 Functional version import numpy as np def Failure (: global S global Slast global Tlast global Area global NextFailure global NextRepair S S-1 NextRepair- clock +2.5 NextFailure clock +np.ceil(6 np.random.randomO) # Update the area under the sample path and the # time and state at the last event Area Area (clock - Tlast) Slast Tlast clock Slast S def Repair) global S global Slast global Tlast global Area global NextFailure global NextRepair S S+1 NextRepair float(inf) Area Area Slast(clock - Tlast) Slast S Tlast clock def Timer() global clock global NextRepair global NextFailure if NextFailure 0: # While system is functional NextEvent Timer) if NextEvent"Repair": Repair() else Failure() # odd samples to the lists TTF_list.append(clock) Ave_list.append(Area/clock) # print sample averages print( Estimated expected TTF:', np.mean(TTF_list)) print('Estimated expected ave. # of func. comp, till failure:", np.mean(Ave-list))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!