This is a simulator of a line of manufacture of an article.
The production line has a process of arrival, painting and assembly, it also has a timeline in minutes.
In the arrival process, I generate a random number and assign a probability that, equal to the line of time, print the top or bottom cover respectively.
When leaving the two covers, lower and upper, you must go to the painting process where it performs the same procedure as the previous process.
When the two lower and upper covers are painted, they go to the assembly process, where they are joined with an inner part to later have the article ready. or if the two covers do not come out in the first process, do not move on from there.
To move from one process to another, the two lower and upper covers must exit at least once. Try validating that the upper cover (Tsup) and the lower cover (Tinf) arrived,
The model I propose is the following:
LLEGADA PINTURA ESNAMB
1 -- -- --
2 -- -- --
3 -- -- --
4 Tinf -- --
5 -- -- --
6 -- -- --
7 Tsup -- --
8 -- -- --
9 -- -- --
10 -- -- --
11 -- Tinf --
12 -- -- --
13 -- -- --
14 -- -- --
15 -- -- --
16 -- Tinf --
17 -- -- --
18 -- -- --
19 -- -- --
20 -- Tinf --
21 -- -- --
22 -- Tsup --
23 -- -- PInter
24 -- -- --
25 -- -- --
Initially I thought about validating with a if
if you find a Tinf
and a Tsup
in the iterations so that it would jump to the next process, but it did not turn out.
The code that I have so far in the following:
from random import random, choices
tapa_probs = [0.5,1]
poisson_probs = [.006,.029,.081,.172,.300,.449,.598,.728,.830,.901,.946,.972,.986,.993,.997]
#triangular_probs = [.008,.031,.083,.174,.302,.451,.600,.730,.832,.903,.948,.974,.988,.995,.999]
i = 0
print("\tLLEGADA\t\tPINTURA\t\tDESEMP\tESNAMB")
while i <=60:
minuto_pintura = choices([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15], cum_weights = poisson_probs)[0]
tapa_inf_sup = choices(["Tinf","Tsup"], cum_weights = tapa_probs)[0]
minuto_desmpacado = choices([16,17,18,19,20,21,22,23,24,25,26,27,28,39,30], cum_weights = poisson_probs)[0]
#minuto_trian = 80 + math.sqrt(500 * var_alea_trian) if var_alea_trian < 0.2 else 25 * var_alea_trian + 85
print("{}\t{}\t\t{}\t\t".format(i, tapa_inf_sup if minuto_pintura == i else "--", tapa_inf_sup if minuto_desmpacado == i else "--" ))
#if "Tinf" in i and "Tsup" in i:
#print("{}\t{}\t\t{}\t\t".format(i, "--", tapa_inf_sup if minuto_desmpacado == i else "--"))
i += 1
The output I have at the moment is:
LLEGADA PINTURA ESNAMB
0 -- --
1 -- --
2 -- --
3 -- --
4 -- --
5 -- --
6 Tinf --
7 -- --
8 -- --
9 -- --
10 -- --
11 -- --
12 -- --
13 -- --
14 -- --
15 -- --
16 -- --
17 -- --
18 -- Tsup
19 -- --
20 -- Tsup
21 -- --
22 -- --
23 -- Tinf
24 -- Tinf
Does anyone have any idea to validate that part? or if someone raised it in a more simple way