Ejemplo n.º 1
0
        public void Update(DateTime time, M1DSimulatorRtc m1Dmodel)
        {
            var outflows = m1Dmodel.ReadReaches(Selection["Link"], Quantity, atFromNode: true);

            Value = outflows.Sum();
            Time  = time;
        }
Ejemplo n.º 2
0
 public void Update(DateTime time, M1DSimulatorRtc m1DSimulator)
 {
     foreach (var actuator in ActionIds)
     {
         m1DSimulator.SetSetpoint(actuator, Value);
     }
 }
Ejemplo n.º 3
0
        public void Update(DateTime time, M1DSimulatorRtc m1Dmodel)
        {
            var inflows = m1Dmodel.ReadReaches(Selection["Link"], Quantity, atFromNode: false);

            Values = Selection["Link"].Zip(inflows, (k, v) => new { k, v }).ToDictionary(x => x.k, x => x.v);
            Time   = time;
        }
Ejemplo n.º 4
0
        public void Update(DateTime time, M1DSimulatorRtc m1Dmodel)
        {
            var overflowReaches = Selection["Link"].Union(Selection["Weir", "Weir:"]).ToArray();
            var overflows       = m1Dmodel.ReadReaches(overflowReaches, Quantity, atFromNode: false);

            Value = overflows.Sum();
            Time  = time;
        }
Ejemplo n.º 5
0
        public void Update(DateTime time, M1DSimulatorRtc m1Dmodel)
        {
            var linkVolumes = m1Dmodel.ReadReaches(Selection["Link"], Quantity);
            var nodeVolumes = m1Dmodel.ReadNodes(Selection["Node"], Quantity);

            Value = linkVolumes.Sum() + nodeVolumes.Sum();
            Time  = time;
        }
Ejemplo n.º 6
0
        public void Update(DateTime time, M1DSimulatorRtc m1Dmodel)
        {
            var inflows              = m1Dmodel.ReadReaches(Selection["Link"], Quantity, atFromNode: false);
            var inflowsCatchments    = m1Dmodel.ReadCatchmentsRes1D(Selection["Catchment"]);
            var inflowsCatchmentsDWF = m1Dmodel.ReadCatchmentsRes1D(Selection["Catchment"], "CatchmentDischarge");

            Value = inflows.Sum() + inflowsCatchments.Sum() + inflowsCatchmentsDWF.Sum();
            Time  = time;
        }
        public static void M1DSimulatorExample1()
        {
            const string modelFilePath = @"C:\MIKEUrban_M1D_model.m1dx";

            var simulator = new M1DSimulatorRtc(modelFilePath)
            {
                // Change input files if different than model default
                RainfallRunoffResultDataFilePath     = @"C:\RainEvent.res1d",
                CatchmentDischargeResultDataFilePath = @"C:\CatchmentDischarge.res1d",
                ResultBaseFilePath = @"C:\M1DSimulatorExample1.res1d"
                                     // HotStartFilePath = @""
            };

            // Add watervolume to default result file
            simulator.SetQuantitiesOfResultSpecification(new[] { "WaterVolume", "Discharge" });

            var allAvailableQuantities = M1DSimulatorRunner.GetAllQuantities;

            // Set simulation start and end
            var from = new DateTime(2014, 7, 12, 10, 45, 0);
            var to   = new DateTime(2014, 7, 12, 10, 55, 0);

            simulator.PrepareSimulation(from, to);

            var actionNames = simulator.PidActionIds; // Get action names

            // Setup PIDs (before running simulation)
            simulator.PrepareSetpointPID("action_PID_onActuatorName");
            simulator.SetSetpoint("action_PID_onActuatorName", 0.1);

            // Start simulation
            simulator.RunUntil(new DateTime(2014, 7, 12, 10, 50, 0));
            var nodeVolume      = simulator.ReadNode("nodeName");
            var reachTBHBsensor = simulator.ReadSensor("flowsensor");

            simulator.SetSetpoint("action_PID_onActuatorName", 0.2);

            simulator.RunUntil(to);

            // Stop simulation and write results
            simulator.Finish();
        }
Ejemplo n.º 8
0
 public void Update(DateTime time, M1DSimulatorRtc m1Dmodel)
 {
     Value = m1Dmodel.ReadSensor(Id);
 }
Ejemplo n.º 9
0
 public void Prepare(M1DSimulatorRtc m1DSimulator)
 {
     m1DSimulator.PrepareSetpointsPID(ActionIds, DefaultValue);
 }