Example #1
0
 # This  script creates a dummy environment that just wait for incomming components
from t100.simtool.distributed_env import Environment
import sys 

if __name__=='__main__':
    ip = sys.argv[1]
    port = int(sys.argv[2])
    env = Environment(ip,port)
    env.loop()
Example #2
0
from t100.simtool.distributed_env import Environment

import random
import time
import sys


def creation_expression(timestamp):
    return 1.0 / 1000


def execution_expression(timestamp):
    return 10 + random.randint(-5, +5)


ip, port = "192.168.0.11", 11111


if __name__ == "__main__":

    process = QueuedProcess()
    source = Source(
        output=process, creation_tax_expression=creation_expression, execution_time_expression=execution_expression
    )

    cfg = open("distributed_01.json").read()
    env = Environment(ip, port, cfg, verbose=True)
    env.populate([source, process])
    time.sleep(2)
    env.start_simulation(untill=1000)