public void Run() { var env = new SimRuntime(this) { MaxSteps = MaxSteps, MaxTime = MaxTime }; if (MaxInactive.HasValue) { env.MaxInactive = MaxInactive.Value; } env.Run(Plan); }
public void Run(Func <SimControl, Task> plan = null) { var env = new SimRuntime(this) { MaxSteps = MaxSteps, MaxTime = MaxTime }; if (MaxInactive.HasValue) { env.MaxInactive = MaxInactive.Value; } env.Run(plan ?? Plan); }
public SimCluster(ClusterDef cluster, SimRuntime runtime) { Runtime = runtime; Rand = Runtime.Rand; // we register each link as a network service foreach (var(id, def) in cluster.Routes) { var service = new ServiceId($"network:{id.Source}->{id.Destinaton}"); var scheduler = new SimScheduler(Runtime, service); Routes.Add(id, new SimRoute(scheduler, this, id, def)); } foreach (var machine in cluster.Services.GroupBy(i => i.Key.Machine)) { var m = new SimMachine(machine.Key, runtime, this); foreach (var pair in machine) { m.Install(pair.Key, pair.Value); } Machines.Add(machine.Key, m); } }
public SimScheduler(SimRuntime runtime, ServiceId name) { _runtime = runtime; _name = name; }
public SimMachine(string name, SimRuntime runtime, SimCluster cluster) { Name = name; Runtime = runtime; Cluster = cluster; }
public SimControl(SimCluster cluster, SimRuntime runtime) { Cluster = cluster; _runtime = runtime; }