public void LinkedToTestComponent()
        {
            CreateHydroNetInputfile();

            HydroNumerics.OpenMI.Sdk.Backbone.OmiFileParser omiFileParser = new HydroNumerics.OpenMI.Sdk.Backbone.OmiFileParser();
            omiFileParser.ReadOmiFile(filename + ".omi");

            IArgument[] arguments = omiFileParser.GetArgumentsAsIArgumentArray();

            // Create the HydroNet linkableComponent
            LinkableComponent hydroNetLC = new LinkableComponent();

            hydroNetLC.Initialize(arguments);
            Assert.AreEqual("Lake model", hydroNetLC.ModelID);

            // Create the TestLinkableComponent
            TestLinkableComponent testLC = new TestLinkableComponent();

            testLC.Initialize(new HydroNumerics.OpenMI.Sdk.Backbone.Argument[0] {
            });

            // Link (hydroNet to TestLC) (leakage --> infiltration)
            IOutputExchangeItem leakageOutputExchangeItem = hydroNetLC.GetOutputExchangeItem(0);

            HydroNumerics.OpenMI.Sdk.Backbone.Link hydroNetLC2testLC = new HydroNumerics.OpenMI.Sdk.Backbone.Link();
            hydroNetLC2testLC.ID = "HydroNet2TestLC";
            hydroNetLC2testLC.SourceComponent  = hydroNetLC;
            hydroNetLC2testLC.TargetComponent  = testLC;
            hydroNetLC2testLC.SourceElementSet = hydroNetLC.GetOutputExchangeItem(0).ElementSet;
            hydroNetLC2testLC.SourceQuantity   = hydroNetLC.GetOutputExchangeItem(0).Quantity;
            Assert.AreEqual("Leakage", hydroNetLC2testLC.SourceQuantity.ID);
            hydroNetLC2testLC.TargetElementSet = testLC.GetOutputExchangeItem(0).ElementSet;
            hydroNetLC2testLC.TargetQuantity   = testLC.GetInputExchangeItem(0).Quantity;
            hydroNetLC2testLC.AddDataOperation(hydroNetLC.GetOutputExchangeItem(0).GetDataOperation(3));

            // Link (TestLC to hydroNet) (groundwaterhead --> groundwaterhead)
            HydroNumerics.OpenMI.Sdk.Backbone.Link testLC2HydroNetLC = new HydroNumerics.OpenMI.Sdk.Backbone.Link();
            testLC2HydroNetLC.ID = "testLC2HydroNetLc";
            testLC2HydroNetLC.SourceComponent  = testLC;
            testLC2HydroNetLC.TargetComponent  = hydroNetLC;
            testLC2HydroNetLC.SourceQuantity   = testLC.GetOutputExchangeItem(0).Quantity;
            testLC2HydroNetLC.SourceElementSet = testLC.GetOutputExchangeItem(0).ElementSet;
            testLC2HydroNetLC.TargetQuantity   = hydroNetLC.GetInputExchangeItem(0).Quantity;
            Assert.AreEqual("Head", testLC2HydroNetLC.TargetQuantity.ID); //check to see if this is the right quantity
            testLC2HydroNetLC.TargetElementSet = hydroNetLC.GetInputExchangeItem(0).ElementSet;
            testLC2HydroNetLC.AddDataOperation(testLC.GetOutputExchangeItem(0).GetDataOperation(3));
            testLC.AddLink(testLC2HydroNetLC);
            hydroNetLC.AddLink(testLC2HydroNetLC);

            hydroNetLC.AddLink(hydroNetLC2testLC);
            testLC.AddLink(hydroNetLC2testLC);

            // triggerlink
            HydroNumerics.OpenMI.Sdk.DevelopmentSupport.Trigger trigger = new HydroNumerics.OpenMI.Sdk.DevelopmentSupport.Trigger();
            trigger.Initialize(new HydroNumerics.OpenMI.Sdk.Backbone.Argument[0] {
            });
            HydroNumerics.OpenMI.Sdk.Backbone.Link triggerLink = new HydroNumerics.OpenMI.Sdk.Backbone.Link();
            triggerLink.ID = "TriggerLink";
            triggerLink.SourceComponent  = testLC;
            triggerLink.TargetComponent  = trigger;
            triggerLink.SourceQuantity   = testLC.GetOutputExchangeItem(0).Quantity;
            triggerLink.SourceElementSet = testLC.GetOutputExchangeItem(0).ElementSet;
            triggerLink.TargetQuantity   = trigger.GetInputExchangeItem(0).Quantity;
            triggerLink.TargetElementSet = trigger.GetInputExchangeItem(0).ElementSet;

            testLC.AddLink(triggerLink);
            trigger.AddLink(triggerLink);

            // prepare
            trigger.Prepare();
            hydroNetLC.Prepare();
            testLC.Prepare();

            ScalarSet scalarSet = (ScalarSet)hydroNetLC.GetValues(new TimeStamp(new DateTime(2001, 6, 1)), hydroNetLC2testLC.ID);
            double    expected  = -0.0000065836086956521805 * 2.0;

            Assert.AreEqual(0, scalarSet.data[0], 0.000000000001);
            Assert.AreEqual(0, scalarSet.data[1], 0.000000000001);
            Assert.AreEqual(expected, scalarSet.data[2], 0.000000000001);
            Assert.AreEqual(0, scalarSet.data[3], 0.000000000001);

            // Run
            //trigger.Run(testLC.TimeHorizon.End);

            //TimestampSeries infiltTSS = ((TimestampSeries) testLC.TestEngine.Infiltrations.Items[0]);


            trigger.Finish();
            hydroNetLC.Finish();
            testLC.Finish();

            trigger.Dispose();
            hydroNetLC.Dispose();
            testLC.Dispose();
        }
        public void LinkedToTestComponent()
        {

            CreateHydroNetInputfile();

            HydroNumerics.OpenMI.Sdk.Backbone.OmiFileParser omiFileParser = new HydroNumerics.OpenMI.Sdk.Backbone.OmiFileParser();
            omiFileParser.ReadOmiFile(filename + ".omi");

            IArgument[] arguments = omiFileParser.GetArgumentsAsIArgumentArray();

            // Create the HydroNet linkableComponent
            LinkableComponent hydroNetLC = new LinkableComponent();
            hydroNetLC.Initialize(arguments);
            Assert.AreEqual("Lake model", hydroNetLC.ModelID);

            // Create the TestLinkableComponent
            TestLinkableComponent testLC = new TestLinkableComponent();
            testLC.Initialize(new HydroNumerics.OpenMI.Sdk.Backbone.Argument[0] { });

            // Link (hydroNet to TestLC) (leakage --> infiltration)
            IOutputExchangeItem leakageOutputExchangeItem = hydroNetLC.GetOutputExchangeItem(0);
            HydroNumerics.OpenMI.Sdk.Backbone.Link hydroNetLC2testLC = new HydroNumerics.OpenMI.Sdk.Backbone.Link();
            hydroNetLC2testLC.ID = "HydroNet2TestLC";
            hydroNetLC2testLC.SourceComponent = hydroNetLC;
            hydroNetLC2testLC.TargetComponent = testLC;
            hydroNetLC2testLC.SourceElementSet = hydroNetLC.GetOutputExchangeItem(0).ElementSet;
            hydroNetLC2testLC.SourceQuantity = hydroNetLC.GetOutputExchangeItem(0).Quantity;
            Assert.AreEqual("Leakage", hydroNetLC2testLC.SourceQuantity.ID);
            hydroNetLC2testLC.TargetElementSet = testLC.GetOutputExchangeItem(0).ElementSet;
            hydroNetLC2testLC.TargetQuantity = testLC.GetInputExchangeItem(0).Quantity;
            hydroNetLC2testLC.AddDataOperation(hydroNetLC.GetOutputExchangeItem(0).GetDataOperation(3));

            // Link (TestLC to hydroNet) (groundwaterhead --> groundwaterhead)
            HydroNumerics.OpenMI.Sdk.Backbone.Link testLC2HydroNetLC = new HydroNumerics.OpenMI.Sdk.Backbone.Link();
            testLC2HydroNetLC.ID = "testLC2HydroNetLc";
            testLC2HydroNetLC.SourceComponent = testLC;
            testLC2HydroNetLC.TargetComponent = hydroNetLC;
            testLC2HydroNetLC.SourceQuantity = testLC.GetOutputExchangeItem(0).Quantity;
            testLC2HydroNetLC.SourceElementSet = testLC.GetOutputExchangeItem(0).ElementSet;
            testLC2HydroNetLC.TargetQuantity = hydroNetLC.GetInputExchangeItem(0).Quantity;
            Assert.AreEqual("Head", testLC2HydroNetLC.TargetQuantity.ID); //check to see if this is the right quantity
            testLC2HydroNetLC.TargetElementSet = hydroNetLC.GetInputExchangeItem(0).ElementSet;
            testLC2HydroNetLC.AddDataOperation(testLC.GetOutputExchangeItem(0).GetDataOperation(3));
            testLC.AddLink(testLC2HydroNetLC);
            hydroNetLC.AddLink(testLC2HydroNetLC);

            hydroNetLC.AddLink(hydroNetLC2testLC);
            testLC.AddLink(hydroNetLC2testLC);

            // triggerlink
            HydroNumerics.OpenMI.Sdk.DevelopmentSupport.Trigger trigger = new HydroNumerics.OpenMI.Sdk.DevelopmentSupport.Trigger();
            trigger.Initialize(new HydroNumerics.OpenMI.Sdk.Backbone.Argument[0] { });
            HydroNumerics.OpenMI.Sdk.Backbone.Link triggerLink = new HydroNumerics.OpenMI.Sdk.Backbone.Link();
            triggerLink.ID = "TriggerLink";
            triggerLink.SourceComponent = testLC;
            triggerLink.TargetComponent = trigger;
            triggerLink.SourceQuantity = testLC.GetOutputExchangeItem(0).Quantity;
            triggerLink.SourceElementSet = testLC.GetOutputExchangeItem(0).ElementSet;
            triggerLink.TargetQuantity = trigger.GetInputExchangeItem(0).Quantity;
            triggerLink.TargetElementSet = trigger.GetInputExchangeItem(0).ElementSet;

            testLC.AddLink(triggerLink);
            trigger.AddLink(triggerLink);

            // prepare
            trigger.Prepare();
            hydroNetLC.Prepare();
            testLC.Prepare();

            ScalarSet scalarSet =  (ScalarSet) hydroNetLC.GetValues(new TimeStamp(new DateTime(2001, 6, 1)), hydroNetLC2testLC.ID);
            double expected = -0.0000065836086956521805 * 2.0;
            Assert.AreEqual(0, scalarSet.data[0], 0.000000000001);
            Assert.AreEqual(0, scalarSet.data[1], 0.000000000001);
            Assert.AreEqual(expected, scalarSet.data[2], 0.000000000001);
            Assert.AreEqual(0, scalarSet.data[3], 0.000000000001);

            // Run
            //trigger.Run(testLC.TimeHorizon.End);

            //TimestampSeries infiltTSS = ((TimestampSeries) testLC.TestEngine.Infiltrations.Items[0]);

           
            trigger.Finish();
            hydroNetLC.Finish();
            testLC.Finish();

            trigger.Dispose();
            hydroNetLC.Dispose();
            testLC.Dispose();
        }
        public void WriteTestLinkableComponentOMIFile()
        {
            TestLinkableComponent testLinkableComponent = new TestLinkableComponent();

            testLinkableComponent.WriteOmiFile();
        }
 public void WriteTestLinkableComponentOMIFile()
 {
     TestLinkableComponent testLinkableComponent = new TestLinkableComponent();
     testLinkableComponent.WriteOmiFile();
 }