--
You received this message because you are subscribed to the Google Groups "python-simpy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-simpy...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-simpy/b7c159c3-4a35-40a7-9601-b472c5123fc9n%40googlegroups.com.
Hi Ruben,
Below is a simple proof of concept, where 100 samples are treated as a single batch (single unit).
I would advise the use of OOP to create a more complex model whereby the batch can be further split to 100 individual units if found positive, and each unit will have its own processing time and take on other unique attributes.
import simpy
import numpy as np
total_in_append = []
total_out_append = []
def samples(env):
while True:
env.process(test_1(env))
total_in_append.append(100)
yield env.timeout(np.random.uniform(3, 6))
samples_in_system = sum(total_in_append) - sum(total_out_append)
entered_system = sum(total_in_append)
exited_system = sum(total_out_append)
print(entered_system, exited_system, samples_in_system)
def test_1(env):
test_positive = np.random.choice(a=['Y', 'N'], p=[0.2, 0.8])
testers_request = testers.request()
yield testers_request
if test_positive == 'N':
yield env.timeout(5)
total_out_append.append(100)
else:
yield env.timeout(80)
total_in_append.append(100)
testers.release(testers_request)
env = simpy.rt.RealtimeEnvironment(factor=0.02, strict=False)
testers = simpy.Resource(env, capacity=1)
env.process(samples(env))
env.run(until=2000)
To view this discussion on the web visit https://groups.google.com/d/msgid/python-simpy/CAKukkMrvii-rS5iKsQbYjcZx_hmx206ZeqoP%2B-1hG7cPHpv48A%40mail.gmail.com.
You received this message because you are subscribed to a topic in the Google Groups "python-simpy" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python-simpy/iFYaDlL4fq0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python-simpy...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-simpy/314b7ad3-1425-4065-86fc-ae6c957cc44cn%40googlegroups.com.