public void When_ParallelBiasingLoadTransient_Expect_Reference(IWorkDistributor workDistributor) { var ckt = new Circuit( new VoltageSource("V1", "in", "0", 1.0), new Parallel("PC1", new Resistor("R1", "in", "out", 1e3), new Capacitor("C1", "out", "0", 1e-6)) .SetParameter("workdistributor", new KeyValuePair <Type, IWorkDistributor>(typeof(IBiasingBehavior), workDistributor))); var tran = new Transient("tran", 1e-7, 10e-6); var exports = new IExport <double>[] { new RealVoltageExport(tran, "out") }; var references = new Func <double, double>[] { time => 1.0 }; AnalyzeTransient(tran, ckt, exports, references); DestroyExports(exports); }
public void When_ParallelConvergenceOp_Expect_Reference(IWorkDistributor <bool> workDistributor) { var ckt = new Circuit( new VoltageSource("V1", "in", "0", 1.0), new Parallel("PC1", new Resistor("R1", "in", "out", 1e3), new Resistor("R2", "out", "0", 1e3)) .SetParameter("workdistributor", new KeyValuePair <Type, IWorkDistributor>(typeof(IConvergenceBehavior), workDistributor))); var op = new OP("op"); var exports = new IExport <double>[] { new RealVoltageExport(op, "out") }; var references = new double[] { 0.5 }; AnalyzeOp(op, ckt, exports, references); DestroyExports(exports); }
public void When_ParallelAcLoadAc_Expect_Reference(IWorkDistributor workDistributor) { var ckt = new Circuit( new VoltageSource("V1", "in", "0", 1.0).SetParameter("acmag", 1.0), new Parallel("PC1", new Resistor("R1", "in", "out", 1e3), new Capacitor("C1", "out", "0", 1e-6)) .SetParameter("workdistributor", new KeyValuePair <Type, IWorkDistributor>(typeof(IFrequencyBehavior), workDistributor)) ); var ac = new AC("ac", new DecadeSweep(1, 1e6, 2)); var exports = new IExport <Complex>[] { new ComplexVoltageExport(ac, "out") }; var references = new Func <double, Complex>[] { f => 1.0 / (1.0 + new Complex(0.0, f * 2e-3 * Math.PI)) }; AnalyzeAC(ac, ckt, exports, references); DestroyExports(exports); }
/// <summary> /// Initializes a new instance of the <see cref="Workload"/> class. /// </summary> /// <param name="distributor">The distributor.</param> /// <param name="capacity">The initial capacity.</param> public Workload(IWorkDistributor distributor, int capacity) { _distributor = distributor.ThrowIfNull(nameof(distributor)); Actions = new List <Action>(capacity); }
public static IPreparedFeature New(IRepository <AppData, string> apps, IDirectory files, RepositoryApi repository, DataTransferManager dataTransfer, IRepository <ToDeleteRevision, string> toDelete, IWorkDistributor <BuildRequest> workDistributor, IActorRef changeTracker) => Feature.Create(() => new AppCommandProcessor(), _ => new AppCommandProcessorState(apps, files, repository, dataTransfer, toDelete, workDistributor, changeTracker));