示例#1
0
        public void Init()
        {
            controller = new IterationController();
            Quantity Q = new Quantity("Q");
            Quantity H = new Quantity("H");

            modelA   = new TestComponent();
            modelB   = new TestComponent();
            deployer = new TestComponent();
            ElementSet point = new ElementSet("point", "point", ElementType.IDBased,
                                              new SpatialReference());
            ElementSet slot1 = new ElementSet("1", "1", ElementType.IDBased, new SpatialReference());
            ElementSet slot2 = new ElementSet("2", "2", ElementType.IDBased, new SpatialReference());

            link1 = new Link(controller, slot1, Q, modelA, point, Q, "link1");
            controller.AddLink(link1);
            modelA.AddLink(link1);
            link2 = new Link(modelA, point, H, controller, slot2, H, "link2");
            controller.AddLink(link2);
            modelA.AddLink(link2);
            link3 = new Link(controller, slot2, H, modelB, point, H, "link3");
            controller.AddLink(link3);
            modelB.AddLink(link3);
            link4 = new Link(modelB, point, Q, controller, slot1, Q, "link4");
            controller.AddLink(link4);
            modelB.AddLink(link4);
            link5 = new Link(controller, slot1, Q, deployer, point, Q, "link5");
            deployer.AddLink(link5);
            controller.AddLink(link5);
            link6 = new Link(controller, slot2, H, deployer, point, H, "link6");
            deployer.AddLink(link6);
            controller.AddLink(link6);
        }
        public void Init()
        {
            controller = new OptimizationController(1);
            IArgument[] properties = new Argument[1];
            properties[0] = new Argument("Parameter", "P0,-100,100,3.5", true, "Parameter 1");
            controller.Initialize(properties);
            modelA   = new TestFunction();
            deployer = new TestComponent();
            ElementSet slot1 = new ElementSet("P0", "P0", ElementType.IDBased, null);

            link1 = new Link(controller, slot1, null, deployer, slot1, null, "link1");
            deployer.AddLink(link1);
            controller.AddLink(link1);

            link2 = new Link(modelA, slot1, null, controller, slot1, null, "link2");
            controller.AddLink(link2);
            modelA.AddLink(link2);

            link3 = new Link(controller, slot1, null, modelA, slot1, null, "link3");
            controller.AddLink(link3);
            modelA.AddLink(link3);
        }
示例#3
0
        public void GetValues()

        {
            Oatc.OpenMI.Examples.ModelComponents.SpatialModels.DummyLC.DumLC dummyLC = new Oatc.OpenMI.Examples.ModelComponents.SpatialModels.DummyLC.DumLC();
            Oatc.OpenMI.Sdk.Backbone.Link link = new Link();
            link.SourceComponent = gwModelLC;
            link.TargetComponent = dummyLC;
            link.ID = "linkID";
            link.TargetElementSet = new Oatc.OpenMI.Sdk.Backbone.ElementSet("dd", "dd", ElementType.IDBased, new SpatialReference());
            link.TargetQuantity   = new Oatc.OpenMI.Sdk.Backbone.Quantity(new Oatc.OpenMI.Sdk.Backbone.Unit("dd", 1, 0, "kk"), "Kk", "kk", global::OpenMI.Standard.ValueType.Scalar, new Dimension());
            link.SourceElementSet = gwModelLC.GetOutputExchangeItem(1).ElementSet;
            link.SourceQuantity   = gwModelLC.GetOutputExchangeItem(1).Quantity;
            gwModelLC.AddLink(link);
            gwModelLC.Prepare();
            double julianTime = Oatc.OpenMI.Sdk.DevelopmentSupport.CalendarConverter.Gregorian2ModifiedJulian(new DateTime(1990, 1, 3, 0, 0, 0));

            Assert.AreEqual(1.0, ((IScalarSet)gwModelLC.GetValues(new Oatc.OpenMI.Sdk.Backbone.TimeStamp(julianTime), "linkID")).GetScalar(0));
        }