public void Polygon2PointAdaptedOutputValues2Consumers() { Output adaptee = new Output(xyPolygon.Caption + ".Flow") { SpatialDefinition = xyPolygon, ValueDefinition = waterLevelQuantity }; ITimeSpaceInput consumer = new Input(xyPointA.Caption + ".Flow") { SpatialDefinition = xyPointA, ValueDefinition = waterLevelQuantity }; //ITimeSpaceInput consumer = new Input(xyPointB.Caption + ".Flow") { ElementSet = xyPointB, ValueDefinition = waterLevelQuantity }; IIdentifiable selectedAvailableAdaptedOutputId = adaptedOutputFactory.GetAvailableAdaptedOutputIds(adaptee, consumer)[1]; IBaseAdaptedOutput adaptedOutput = adaptedOutputFactory.CreateAdaptedOutput(selectedAvailableAdaptedOutputId, adaptee, consumer); adaptedOutput.AddConsumer(consumer); IList <IList> values2D = new List <IList>(); values2D.Add(new List <double> { 0.444 }); adaptee.Values = new ValueSet(values2D); Assert.AreEqual(1, ValueSet.GetTimesCount((ITimeSpaceValueSet)adaptedOutput.Values), "adaptedOutput.Values TimesCount"); Assert.AreEqual(4, ValueSet.GetElementCount((ITimeSpaceValueSet)adaptedOutput.Values), "adaptedOutput.Values ElementCount == 0"); }
public void RemoveAdaptedOutput(IBaseAdaptedOutput adaptedOutput) { if (!_adaptedOutputs.Contains(adaptedOutput)) { throw new Exception("Consumer was never registered"); } }
public void AddAdaptedOutput(IBaseAdaptedOutput adaptedOutput) { if (_adaptedOutputs.Contains(adaptedOutput)) { throw new Exception("Consumer has already been registered"); } _adaptedOutputs.Add(adaptedOutput); }
public virtual void RemoveAdaptedOutput(IBaseAdaptedOutput adaptedOutput) { if (_adaptedOutputs == null) { return; } _adaptedOutputs.Remove(adaptedOutput); }
public override void RemoveAdaptedOutput(IBaseAdaptedOutput adaptedOutput) { base.RemoveAdaptedOutput(adaptedOutput); if (_consumers.Count == 0 && _adaptedOutputs.Count == 0) { _linkableEngine.ActiveOutputItems.Remove(this); } }
public virtual void AddAdaptedOutput(IBaseAdaptedOutput adaptedOutput) { if (_adaptedOutputs == null) { _adaptedOutputs = new List <IBaseAdaptedOutput>(); } _adaptedOutputs.Add(adaptedOutput); }
public override void AddAdaptedOutput(IBaseAdaptedOutput adaptedOutput) { if (adaptedOutput == null) { throw new ArgumentNullException("adaptedOutput", "Can not be null"); } base.AddAdaptedOutput(adaptedOutput); // Add it to list of active output items _linkableEngine.ActiveOutputItems.Add(this); }
private static void ConnectItemsWithTimeInterpolator(ITimeSpaceComponent sourceComponentInstance, string outputItemId, ITimeSpaceComponent targetComponentInstance, string inputItemId) { ITimeSpaceOutput output = FindOutputItem(sourceComponentInstance, outputItemId); ITimeSpaceInput input = FindInputItem(targetComponentInstance, inputItemId); IAdaptedOutputFactory derivedOutputFactory = sourceComponentInstance.AdaptedOutputFactories[0]; IIdentifiable[] derivedOutputIdentifiers = derivedOutputFactory.GetAvailableAdaptedOutputIds(output, input); IBaseAdaptedOutput timeInterpolator = derivedOutputFactory.CreateAdaptedOutput(derivedOutputIdentifiers[0], output, input); }
public IBaseAdaptedOutput CreateAdaptedOutput(IIdentifiable adaptedOutputIdentifier, IBaseOutput adaptee, IBaseInput target) { IBaseAdaptedOutput adaptor = adaptedOutputIdentifier as IBaseAdaptedOutput; if (adaptor == null) { throw new ArgumentException("Unknown adaptedOutput type - it does not originate from this factory"); } // Connect the adaptor and the adaptee if (!adaptee.AdaptedOutputs.Contains(adaptor)) { adaptee.AddAdaptedOutput(adaptor); } return(adaptor); }
public UIAdaptedOutputItem NewAdaptedUIOutputItem(string decoratorId, UIOutputItem parent, ITimeSpaceInput target) { IIdentifiable[] ids = _factory.GetAvailableAdaptedOutputIds(parent.TimeSpaceOutput, target); IIdentifiable found = (from n in ids where n.Id == decoratorId select n).FirstOrDefault(); IBaseAdaptedOutput iAdapted = _factory.CreateAdaptedOutput(found, parent.TimeSpaceOutput, target); UIAdaptedOutputItem item = new UIAdaptedOutputItem(this, found, (ITimeSpaceAdaptedOutput)iAdapted, parent); parent.AddAdaptedOutput(item.TimeSpaceAdaptedOutput); return(item); }
public IBaseAdaptedOutput CreateAdaptedOutput(IIdentifiable adaptedOutputIdentifier, IBaseOutput adaptee, IBaseInput target) { IBaseAdaptedOutput adaptor = (from n in outputsCreatedSoFar where n.Id == adaptedOutputIdentifier.Id && n.Adaptee == adaptee select n).FirstOrDefault(); if (adaptor == null) { throw new ArgumentException("Unknown adaptedOutput type - it does not originate from this factory"); } // Connect the adaptor and the adaptee if (!adaptee.AdaptedOutputs.Contains(adaptor)) { adaptee.AddAdaptedOutput(adaptor); } return(adaptor); }
/// <summary> /// Find the adaptor with the provided id. /// </summary> /// <param name="component">Component to find adaptor in</param> /// <param name="adaptorId">Id of adaptor to search for</param> /// <param name="output">Output item to find adaptor for.</param> /// <param name="input">Input item to find adaptor for. Can be null</param> /// <returns>Returns adaptor with id, or null if not found</returns> public static ITimeSpaceAdaptedOutput FindAdaptor(this ITimeSpaceComponent component, string adaptorId, ITimeSpaceOutput output, ITimeSpaceInput input) { foreach (IAdaptedOutputFactory adaptorFactory in component.AdaptedOutputFactories) { foreach (IIdentifiable availId in adaptorFactory.GetAvailableAdaptedOutputIds(output, input)) { if (string.Equals(availId.Id, adaptorId, StringComparison.OrdinalIgnoreCase)) { IBaseAdaptedOutput adaptor = adaptorFactory.CreateAdaptedOutput(availId, output, input); return(adaptor as ITimeSpaceAdaptedOutput); } } } return(null); //throw new Exception("Could not find adaptor with id = '" + id + "'"); }
public static IBaseAdaptedOutput ConnectItemsUsingAdaptedOutput(ITimeSpaceComponent sourceComponentInstance, ITimeSpaceOutput output, ITimeSpaceInput input, string adaptedOutputId) { IAdaptedOutputFactory adaptedOutputFactory = sourceComponentInstance.AdaptedOutputFactories[0]; IIdentifiable[] adaptedOutputIds = adaptedOutputFactory.GetAvailableAdaptedOutputIds(output, input); IIdentifiable adaptedOutputIdentifier = null; foreach (IIdentifiable identifier in adaptedOutputIds) { if (identifier.Id.StartsWith(adaptedOutputId)) { adaptedOutputIdentifier = identifier; } } if (adaptedOutputIdentifier == null) { throw new Exception("AdaptedOutput with name \"" + adaptedOutputId + "\" not found"); } IBaseAdaptedOutput timeExtrapolator = adaptedOutputFactory.CreateAdaptedOutput(adaptedOutputIdentifier, output, input); return(timeExtrapolator); }
public IBaseAdaptedOutput CreateAdaptedOutput(IIdentifiable adaptedOutputId, IBaseOutput adaptee, IBaseInput target) { // TODO: Some usefull criteria here if (true) { // If a MultiInputAdaptor already exists for the target, get that one, otherwise create a new. MultiInputAdaptor multiInputAdaptor; if (!ExistingMultiInputAdaptors.TryGetValue(target, out multiInputAdaptor)) { multiInputAdaptor = new MultiInputAdaptor("SomeId") { SpatialDefinition = ((ITimeSpaceInput)target).SpatialDefinition }; multiInputAdaptor.AddConsumer(target); ExistingMultiInputAdaptors.Add(target, multiInputAdaptor); } if (adaptedOutputId == _identityAdaptor) { // Identity adaptor IBaseAdaptedOutput adaptedOutput = multiInputAdaptor.CreateChildAdaptor(adaptee); return(adaptedOutput); } else { // ElementMapping adaptor IBaseAdaptedOutput adaptedOutput = _spatialAdaptorFactory.CreateAdaptedOutput(adaptedOutputId, adaptee, target); if (adaptedOutput != null) { multiInputAdaptor.Adaptees.Add((ITimeSpaceOutputAdder)adaptedOutput); return(adaptedOutput); } } } return(null); }
public IIdentifiable[] GetAvailableAdaptedOutputIds(IBaseOutput adaptee, IBaseInput target) { // The time methods in this factory only works on an ITimeSpaceOutput ITimeSpaceOutput tsAdaptee = adaptee as ITimeSpaceOutput; if (tsAdaptee == null) { return(new IIdentifiable[0]); } IIdentifiable[] ids = new IBaseAdaptedOutput[] { new TimeInterpolator(tsAdaptee), new TimeExtrapolator(tsAdaptee), new LinearOperationAdaptedOutput(tsAdaptee) }; for (int i = 0; i < ids.Length; i++) { IBaseAdaptedOutput searchItem = ids[i] as IBaseAdaptedOutput; IBaseAdaptedOutput temp = (from n in outputsCreatedSoFar where searchItem.Id == n.Id && n.Adaptee == searchItem.Adaptee select n).FirstOrDefault(); if (temp == null) { outputsCreatedSoFar.Add(searchItem); } else { ids[i] = temp; } } return(ids); }
public IBaseAdaptedOutput CreateAdaptedOutput(IIdentifiable adaptedOutputIdentifier, IBaseOutput parentOutput, IBaseInput target) { IBaseAdaptedOutput adaptedOutput = null; if (adaptedOutputIdentifier.Id.Equals(TimeInterpolatorId)) { adaptedOutput = new MeasurementsInterpolator((ITimeSpaceOutput)parentOutput); } else if (adaptedOutputIdentifier.Id.Equals(TimeExtrapolatorId)) { adaptedOutput = new TimeExtrapolator((ITimeSpaceOutput)parentOutput); } if (adaptedOutput == null) { throw new Exception("AdaptedOutput id: " + adaptedOutputIdentifier.Id); } // connect adaptor and adaptee if (!parentOutput.AdaptedOutputs.Contains(adaptedOutput)) { parentOutput.AddAdaptedOutput(adaptedOutput); } return(adaptedOutput); }
public ValidationAdapter(IBaseAdaptedOutput adapter) : base(adapter) { _adapter = adapter; }
public void AddAdaptedOutput(IBaseAdaptedOutput adaptedOutput) { AdaptedOutputs.Add(adaptedOutput); }
public void RemoveAdaptedOutput(IBaseAdaptedOutput adaptedOutput) { AdaptedOutputs.Remove(adaptedOutput); }
public virtual void RemoveAdaptedOutput(IBaseAdaptedOutput adaptedOutput) { if (_adaptedOutputs == null) { return; } _adaptedOutputs.Remove(adaptedOutput); }
public void RemoveAdaptedOutput(IBaseAdaptedOutput adaptedOutput) { _decorators.Remove(adaptedOutput); }
public void RemoveAdaptedOutput(IBaseAdaptedOutput adaptedOutput) { throw new NotImplementedException(); }
public virtual void AddAdaptedOutput(IBaseAdaptedOutput adaptedOutput) { if (_adaptedOutputs == null) { _adaptedOutputs = new List<IBaseAdaptedOutput>(); } _adaptedOutputs.Add(adaptedOutput); }
public void CouplingGwRiver2() { /// runNumber 0: Using MultiInput /// runNumber 1: Using MultiInputAdaptor /// runNumber 2: Using MultiInputAdaptorFactory for (int runNumber = 0; runNumber < 3; runNumber++) { Console.Out.WriteLine("runNumber: " + runNumber); // Create trigger inputs Input queryDischargeItem = CreateDischargeInput(); Input queryVolume = CreateVolumeInput(); // Create models LinkableEngine riverModel = CreateRiverModel(); LinkableEngine riverModel2 = CreateRiverModel(); ITimeSpaceComponent gwModel = CreateGwModel(); // Add arguments and initialize IDictionary <string, IArgument> gwArgs = gwModel.Arguments.Dictionary(); // Increasing model grid size (otherwise GW model runs full too fast) gwArgs.UpdateValue("dx", 50.0); gwArgs.UpdateValue("dy", 50.0); gwArgs.UpdateValue("x0", 0.0); gwArgs.UpdateValue("y0", 200.0); gwArgs.UpdateValue("XCount", 24); gwArgs.UpdateValue("ycount", 16); if (runNumber == 0) { gwArgs.UpdateValue("UseMultiInput", true); } gwModel.Initialize(); int gwGridSize = 24 * 16; IDictionary <string, IArgument> riverArgs = riverModel.Arguments.Dictionary(); // Increasing model grid size (otherwise GW model runs full too fast) riverArgs.UpdateValue("xyscale", 100.0); riverModel.Initialize(); IDictionary <string, IArgument> river2Args = riverModel2.Arguments.Dictionary(); // Increasing model grid size (otherwise GW model runs full too fast) river2Args.UpdateValue("xyscale", 100.0); // Move river2 sligthly away from river1 river2Args.UpdateValue("xoffset", -220.0); river2Args.UpdateValue("yoffset", 180.0); riverModel2.Initialize(); // Connect triggering inputs ITimeSpaceOutput flowOnBranch = UTHelper.FindOutputItem(riverModel, "Branch:2:Flow"); TimeInterpolator flowOnBranch2 = new TimeInterpolator(flowOnBranch); flowOnBranch.AddAdaptedOutput(flowOnBranch2); flowOnBranch2.AddConsumer(queryDischargeItem); ITimeSpaceOutput storageInGw = UTHelper.FindOutputItem(gwModel, "Grid.Storage"); TimeInterpolator storageInGw2 = new TimeInterpolator(storageInGw); storageInGw.AddAdaptedOutput(storageInGw2); storageInGw2.AddConsumer(queryVolume); //========== Couple leakage items ========== ITimeSpaceInput gwInflowInput = UTHelper.FindInputItem(gwModel, "Grid.Inflow"); //========== IBaseMultiInput linking ========== if (runNumber == 0) { /// Example of adding up two outputs into one input, by the use of /// an IBaseMultiInput implementation Assert.IsTrue(gwInflowInput is IBaseMultiInput); Assert.IsTrue(gwInflowInput is ITimeSpaceMultiInput); // put leakage from river1 into ground water model { ITimeSpaceOutput riverLeakageOutput = UTHelper.FindOutputItem(riverModel, "WholeRiver:Leakage"); // Two adaptors are added: Time buffer and line-to-grid adaptor // they can be added in any order (though time buffer first will use less memory) // Time interpolator TimeInterpolator riverLeakageOutput2 = new TimeInterpolator(riverLeakageOutput); riverLeakageOutput.AddAdaptedOutput(riverLeakageOutput2); // Element mapper from polyline to polygon, weighted sum version ElementMapperAdaptedOutput riverLeakageOutputGrid = new ElementMapperAdaptedOutput(new Identifier("ElementMapper501"), riverLeakageOutput2, gwInflowInput.ElementSet()); riverLeakageOutput2.AddAdaptedOutput(riverLeakageOutputGrid); // Note !!!: No special action riverLeakageOutputGrid.AddConsumer(gwInflowInput); } // put leakage from river2 into ground water model { ITimeSpaceOutput riverLeakageOutput = UTHelper.FindOutputItem(riverModel2, "WholeRiver:Leakage"); // Two adaptors are added: Time buffer and line-to-grid adaptor // they can be added in any order (though time buffer first will use less memory) // Time interpolator TimeInterpolator riverLeakageOutput2 = new TimeInterpolator(riverLeakageOutput); riverLeakageOutput.AddAdaptedOutput(riverLeakageOutput2); // Element mapper from polyline to polygon, weighted sum version ElementMapperAdaptedOutput riverLeakageOutputGrid = new ElementMapperAdaptedOutput(new Identifier("ElementMapper501"), riverLeakageOutput2, gwInflowInput.ElementSet()); riverLeakageOutput2.AddAdaptedOutput(riverLeakageOutputGrid); // Note !!!: No special action riverLeakageOutputGrid.AddConsumer(gwInflowInput); } } //========== MultiInputAdaptor linking ========== if (runNumber == 1) { /// Example of adding up two outputs into one input, by the use of /// a MultiInputAdaptor class // Note !!!: Creating a MultiInputAdaptor MultiInputAdaptor sourceAdder = new MultiInputAdaptor("SomeId") { SpatialDefinition = gwInflowInput.SpatialDefinition }; // put leakage from river1 into ground water model // Two adaptors are added: Time buffer and line-to-grid adaptor { ITimeSpaceOutput riverLeakageOutput = UTHelper.FindOutputItem(riverModel, "WholeRiver:Leakage"); // Time interpolator TimeInterpolator riverLeakageOutput2 = new TimeInterpolator(riverLeakageOutput); riverLeakageOutput.AddAdaptedOutput(riverLeakageOutput2); // Element mapper from polyline to polygon, weighted sum version ElementMapperAdaptedOutput riverLeakageOutputGrid = new ElementMapperAdaptedOutput(new Identifier("ElementMapper501"), riverLeakageOutput2, gwInflowInput.ElementSet()); riverLeakageOutput2.AddAdaptedOutput(riverLeakageOutputGrid); // Note !!!: Adding to the list of adaptees sourceAdder.Adaptees.Add(riverLeakageOutputGrid); riverLeakageOutputGrid.AddAdaptedOutput(sourceAdder); } // put leakage from river2 into ground water model // Two adaptors are added: Time buffer and line-to-grid adaptor { ITimeSpaceOutput riverLeakageOutput = UTHelper.FindOutputItem(riverModel2, "WholeRiver:Leakage"); // Time interpolator TimeInterpolator riverLeakageOutput2 = new TimeInterpolator(riverLeakageOutput); riverLeakageOutput.AddAdaptedOutput(riverLeakageOutput2); // Element mapper from polyline to polygon, weighted sum version ElementMapperAdaptedOutput riverLeakageOutputGrid = new ElementMapperAdaptedOutput(new Identifier("ElementMapper501"), riverLeakageOutput2, gwInflowInput.ElementSet()); riverLeakageOutput2.AddAdaptedOutput(riverLeakageOutputGrid); // Note !!!: Adding to the list of adaptees sourceAdder.Adaptees.Add(riverLeakageOutputGrid); riverLeakageOutputGrid.AddAdaptedOutput(sourceAdder); } // Note !!!: Connect the gwInflowInput and the multiInputAdaptor sourceAdder.AddConsumer(gwInflowInput); } //========== MultiInputAdaptorFactory linking ========== if (runNumber == 2) { /// Example of adding up two outputs into one input, by the use of /// an MultiInputAdaptorFactory implementation var factory = new MultiInputAdaptorFactory(gwModel); // put leakage from river1 into ground water model // Two adaptors are added: Time buffer and line-to-grid adaptor { ITimeSpaceOutput riverLeakageOutput = UTHelper.FindOutputItem(riverModel, "WholeRiver:Leakage"); // Time interpolator TimeInterpolator riverLeakageOutput2 = new TimeInterpolator(riverLeakageOutput); riverLeakageOutput.AddAdaptedOutput(riverLeakageOutput2); // Element mapper from polyline to polygon, weighted sum version ElementMapperAdaptedOutput riverLeakageOutputGrid = new ElementMapperAdaptedOutput(new Identifier("ElementMapper501"), riverLeakageOutput2, gwInflowInput.ElementSet()); riverLeakageOutput2.AddAdaptedOutput(riverLeakageOutputGrid); // Note !!!: Creating a new AdaptedOutput and adding it IIdentifiable[] identifiables = factory.GetAvailableAdaptedOutputIds(riverLeakageOutputGrid, gwInflowInput); IBaseAdaptedOutput myOutput = factory.CreateAdaptedOutput(identifiables[0], riverLeakageOutputGrid, gwInflowInput); myOutput.AddConsumer(gwInflowInput); } // put leakage from river2 into ground water model // Two adaptors are added: Time buffer and line-to-grid adaptor { ITimeSpaceOutput riverLeakageOutput = UTHelper.FindOutputItem(riverModel2, "WholeRiver:Leakage"); // Time interpolator TimeInterpolator riverLeakageOutput2 = new TimeInterpolator(riverLeakageOutput); riverLeakageOutput.AddAdaptedOutput(riverLeakageOutput2); // Element mapper from polyline to polygon, weighted sum version ElementMapperAdaptedOutput riverLeakageOutputGrid = new ElementMapperAdaptedOutput(new Identifier("ElementMapper501"), riverLeakageOutput2, gwInflowInput.ElementSet()); riverLeakageOutput2.AddAdaptedOutput(riverLeakageOutputGrid); // Note !!!: Creating a new AdaptedOutput and adding it IIdentifiable[] identifiables = factory.GetAvailableAdaptedOutputIds(riverLeakageOutputGrid, gwInflowInput); IBaseAdaptedOutput myOutput = factory.CreateAdaptedOutput(identifiables[0], riverLeakageOutputGrid, gwInflowInput); myOutput.AddConsumer(gwInflowInput); } } //========== Run ========== // Validate riverModel.Validate(); Assert.IsTrue(riverModel.Status == LinkableComponentStatus.Valid); riverModel2.Validate(); Assert.IsTrue(riverModel2.Status == LinkableComponentStatus.Valid); gwModel.Validate(); Assert.IsTrue(gwModel.Status == LinkableComponentStatus.Valid); // Prepare riverModel.Prepare(); Assert.IsTrue(riverModel.Status == LinkableComponentStatus.Updated); riverModel2.Prepare(); Assert.IsTrue(riverModel2.Status == LinkableComponentStatus.Updated); gwModel.Prepare(); Assert.IsTrue(gwModel.Status == LinkableComponentStatus.Updated); // specify query times double triggerTime0 = riverModel.CurrentTime.StampAsModifiedJulianDay; double triggerTime1 = triggerTime0 + 1; double triggerTime2 = triggerTime0 + 2; double triggerTime3 = triggerTime0 + 12.1; double triggerTime4 = triggerTime0 + 16.7; /// Properties of the river, without gw-level input /// Inflow into each node from rainfall runoff is 10 L/s /// Inflow to node 1: 10 L/s - leaking 5 L/s on branch 1 /// Inflow to node 2: 10 + 5 L/s - leaking 15/2 L/s on branch 2 /// Inflow to node 3: 10 + 15/2 L/s - leaking 35/4 L/s on branch 3 /// Total leakage 5+15/2+35/4 = (20+30+35)/4 = 85/4 L/s /// /// Number of seconds in a day: 60*60*24 = 86400 // check initial values Assert.AreEqual(1, ValueSet.GetElementCount(flowOnBranch.Values), "#values for " + flowOnBranch.Id); Assert.AreEqual(7.0, (double)flowOnBranch.Values.GetValue(0, 0), "Value[0] as property"); Assert.AreEqual(gwGridSize, ValueSet.GetElementCount(storageInGw.Values), "#values for " + storageInGw.Id); Assert.AreEqual(0, SumTimeStep(storageInGw.Values, 0)); // get values for specified query times, 1 days // Totally leaking: 86400 * 85/4 = 1.836e6 // For the bi-directional coupling: // the entire first day the river uses extrapolated values from the // gwModel, which gives a gwLevel of -10, hence same value as for the uni-directional queryDischargeItem.TimeSet.SetSingleTimeStamp(triggerTime1); ITimeSpaceValueSet valuesV = storageInGw2.GetValues(queryDischargeItem); ITimeSpaceValueSet valuesQ = flowOnBranch2.GetValues(queryDischargeItem); Assert.AreEqual(35.0 / 4.0, (double)valuesQ.GetValue(0, 0)); Assert.AreEqual(2 * 1.836e6, SumTimeStep(valuesV, 0), 1e-4); // Print out, to load in a plotting program for verification StringBuilder b = new StringBuilder(); IList valV = valuesV.GetElementValuesForTime(0); int ivalvV = 0; for (int i = 0; i < 16; i++) { for (int j = 0; j < 24; j++) { b.Append(((double)valV[ivalvV++]).ToString(NumberFormatInfo.InvariantInfo)); b.Append(" "); } b.AppendLine(); } //Console.Out.WriteLine(b.ToString()); // get values for specified query times, 2 days // 2 * 86400 * 85/4 = 3.672e6 queryDischargeItem.TimeSet.SetSingleTimeStamp(triggerTime2); valuesV = storageInGw2.GetValues(queryDischargeItem); valuesQ = flowOnBranch2.GetValues(queryDischargeItem); Assert.AreEqual(35.0 / 4.0, (double)valuesQ.GetValue(0, 0)); Assert.AreEqual(2 * 3.672e6, SumTimeStep(valuesV, 0), 1e-4); // get values for specified query times, 12.1 days // 12.1 * 86400 * 85/4 = 2.22156e7 queryDischargeItem.TimeSet.SetSingleTimeStamp(triggerTime3); valuesV = storageInGw2.GetValues(queryDischargeItem); valuesQ = flowOnBranch2.GetValues(queryDischargeItem); Assert.AreEqual(35.0 / 4.0, (double)valuesQ.GetValue(0, 0)); Assert.AreEqual(2 * 2.22156e7, SumTimeStep(valuesV, 0), 1e-4); // get values for specified query times, 16.7 days // 16.7 * 86400 * 85/4 = 3.06612e7 queryDischargeItem.TimeSet.SetSingleTimeStamp(triggerTime4); valuesV = storageInGw2.GetValues(queryDischargeItem); valuesQ = flowOnBranch2.GetValues(queryDischargeItem); Assert.AreEqual(35.0 / 4.0, (double)valuesQ.GetValue(0, 0)); Assert.AreEqual(2 * 3.06612e7, SumTimeStep(valuesV, 0), 1e-4); } }
public void AddAdaptedOutput(IBaseAdaptedOutput adaptedOutput) { _decorators.Add(adaptedOutput); }
public void RemoveAdaptedOutput(IBaseAdaptedOutput adaptedOutput) { throw new NotSupportedException(); }
public void RemoveAdaptedOutput(IBaseAdaptedOutput adaptedOutput) { throw new NotImplementedException(); }
public void AddAdaptedOutput(IBaseAdaptedOutput adaptedOutput) { ((IBaseOutput)_item).AddAdaptedOutput(adaptedOutput); }
public void RemoveAdaptedOutput(IBaseAdaptedOutput adaptedOutput) { ((IBaseOutput)_item).RemoveAdaptedOutput(adaptedOutput); }
public void RemoveAdaptedOutput(IBaseAdaptedOutput adaptedOutput) { throw new NotSupportedException(); }