示例#1
0
        static void Main(string[] args)
        {
            SimulationParameter parameters = new SimulationParameter();

            parameters.Seed = 46;

            //1-Specify the xml files
            parameters.LayoutPath             = "flow_layout.xml";
            parameters.JobPath                = "flow_jobmix.xml";
            parameters.Configuration.ToolPath = "flow_binloading.xml";
            //parameters.Configuration.TracePath = Directory.GetCurrentDirectory() +  "\\Trace Files\\" + parameters.Seed + ".xml";
            // parameters.Configuration.TracePath = Directory.GetCurrentDirectory() + "\\Trace Files\\A100.xml";   //IE486f18
            parameters.Configuration.TracePath = Directory.GetCurrentDirectory() + "\\Trace Files\\Trace-B.xml";   //IE486f18
            // parameters.Configuration.TracePath = Directory.GetCurrentDirectory() + "\\Trace Files\\B100.xml";   //IE486f18
            //parameters.Configuration.TracePath = Directory.GetCurrentDirectory() + "\\Trace Files\\A1B1.xml";   //IE486f18
            //parameters.Configuration.TracePath = Directory.GetCurrentDirectory() + "\\Trace Files\\A10B10.xml";   //IE486f18
            //parameters.Configuration.TracePath = Directory.GetCurrentDirectory() + "\\Trace Files\\A50B50.xml";   //IE486f18

            //2-Specify the simulation run time parameters
            parameters.Configuration.SimulationPeriodTime = 75600;
            parameters.Configuration.WarmupPeriodTime     = 18000; //  486update 25.12.2018
            parameters.Configuration.FinalArrivalTime     = 75600;
            parameters.Configuration.PlanningPeriodTime   = 75600;

            //Below are the set of algorithms that will be used during the simulation
            //3-Modify the algorithms as you desire
            parameters.Algorithms.PartSequencingForProcessorAlgorithm = "FirstComeMustGo";
            parameters.Algorithms.StationControllerAlgorithm          = "MixedProcessorConfiguration";
            parameters.Algorithms.OrderControllerAlgorithm            = "ByPassReplenish";
            parameters.Algorithms.OrderReleaseAlgorithm       = "CyclicalImmediate";
            parameters.Algorithms.StationSelectionAlgorithm   = "SelectionOfFirstStation";
            parameters.Algorithms.PullAlgorithm               = "FirstBlockedFirstServed";
            parameters.Algorithms.PushAlgorithm               = "AlwaysPush";
            parameters.Algorithms.ProcessorSelectionAlgorithm = "NonDelaySPT";


            parameters.Configuration.JobArrivalType = JobArrivalType.TraceBased;
            //parameters.Configuration.JobArrivalType = JobArrivalType.DistributionBased; //IE486f18
            parameters.Configuration.SimulationPeriodType = SimulationPeriodType.TimeBased;
            parameters.Configuration.PlanningPeriodType   = PlanningPeriodType.TimeBased;
            parameters.Configuration.LoadingPeriodType    = LoadingPeriodType.TimeBased;

            parameters.Configuration.PeriodState = new FileOutput(true, "periodstate.xml");

            //4-Prepare the environment and run the simulation
            SimulationManager simulationManager = new SimulationManager();
            string            path = "Seed-" + parameters.Seed + "OnhandInventory.txt";

            simulationManager.path      = path;
            simulationManager.Parameter = parameters;
            simulationManager.ConstructSystem();
            simulationManager.PrepareSimulation();
            simulationManager.PerformSimulation();

            //5-Reporting. Note that the report xml file will be generated in the Wrapper\bin\Debug folder with a random name i.e. c2ed605b-088d-474a-98c6-f939765683cd.xml
            Reporter reporter = new Reporter();

            path = "Seed-" + parameters.Seed + "Report";
            reporter.BuildStatisticsReport(simulationManager, path);
        }
 public SimulationSettings(double modelSimTime, double stableStartTime, double startDiff, double respClose, SimulationParameter desired, SimulationParameter actual, SimulationParameter disturbance, ModelRegressionSettings regressionSettings)
 {
     this.ModelSimulationTime = modelSimTime;
     this.StableStartTime = stableStartTime;
     this.SmoothnessStartDifference = startDiff;
     this.ResponsivenessClose = respClose;
     this.DesiredVariable = desired;
     this.ActualVariable = actual;
     this.DisturbanceVariable = disturbance;
     this.RegressionSettings = regressionSettings;
 }
            public MyForm()
            {
                //ClientSize = new Eto.Drawing.Size(400, 300);
                Title = "Eto.Forms";
                Width = 400;
                var md = new Model("id", new ModelProperties(ModelEnergyProperties.Default, ModelRadianceProperties.Default));

                var panel = new DynamicLayout();

                var ltn        = new LightingAbridged("lnt", 12, "Always On");
                var ltn2       = new LightingAbridged("lnt", 15, "Always On");
                var dlightCtrl = new DaylightingControl(new List <double>()
                {
                    0.5, 0.1, 0.5
                }, offAtMinimum: true);
                var ppl             = new PeopleAbridged("ppl", 0.1, "Always On", "Always On", latentFraction: new Autocalculate());
                var RoomPropertybtn = new Button()
                {
                    Text = "2 Rooms Property"
                };
                var rm1 = new Room($"Room1_{Guid.NewGuid()}_01021odjs", new List <Face>(), new RoomPropertiesAbridged(new RoomEnergyPropertiesAbridged("aaa", lighting: ltn)), "name1", multiplier: 1, story: "11");
                var rm2 = new Room($"Room2_{Guid.NewGuid()}_01021odjs", new List <Face>(), new RoomPropertiesAbridged(new RoomEnergyPropertiesAbridged("bbb", lighting: ltn2, people: ppl, daylightingControl: dlightCtrl)), "name2", multiplier: 2, story: "22");

                rm2.UserData = new { RhinoLayer = "layer 01", Color = "Red" };
                rm2          = rm2.DuplicateRoom();

                var rms = new List <Room>()
                {
                    rm1, rm2
                };

                RoomPropertybtn.Click += (s, e) =>
                {
                    var dialog = new Honeybee.UI.Dialog_RoomProperty(md.Properties, rms);
                    //dialog.SetSensorPositionPicker(() => { return new List<double>(); });
                    var dialog_rc = dialog.ShowModal(this);
                    if (dialog_rc != null)
                    {
                        foreach (var item in dialog_rc)
                        {
                            Console.WriteLine(item.ToJson(true));
                        }
                        rms = dialog_rc;
                    }
                };


                var RoomPropertybtn2 = new Button()
                {
                    Text = "1 Room Property"
                };

                RoomPropertybtn2.Click += (s, e) =>
                {
                    //md.Properties.Energy?.Hvacs = null;
                    var dialog = new Honeybee.UI.Dialog_RoomProperty(md.Properties, new List <Room>()
                    {
                        rm2
                    });
                    //dialog.SetSensorPositionPicker(() => { return new List<double>(); });
                    dialog.SetInternalMassPicker(() => 22);
                    var dialog_rc = dialog.ShowModal(this);
                    if (dialog_rc != null)
                    {
                        rm2 = dialog_rc.FirstOrDefault();
                        Console.WriteLine(rm2.ToJson(true));
                    }
                };

                var facePropertybtn = new Button()
                {
                    Text = "2 Faces Property"
                };
                var face  = new Face($"faceId_{Guid.NewGuid()}_01021odjs", new Face3D(new List <List <double> >()), FaceType.Floor, new Ground(), new FacePropertiesAbridged(new FaceEnergyPropertiesAbridged("aa"), new FaceRadiancePropertiesAbridged("bb", "cc")));
                var face2 = new Face($"Face_{Guid.NewGuid()}_01021odjs", new Face3D(new List <List <double> >()), FaceType.Wall, new Outdoors(), new FacePropertiesAbridged(new FaceEnergyPropertiesAbridged("Generic Exterior Wall")), "Face name");

                facePropertybtn.Click += (s, e) =>
                {
                    var dialog = new Honeybee.UI.Dialog_FaceProperty(md.Properties, new List <Face>()
                    {
                        face, face2
                    });
                    var dialog_rc = dialog.ShowModal(this);
                    if (dialog_rc != null)
                    {
                        foreach (var item in dialog_rc)
                        {
                            Console.WriteLine(item.ToJson(true));
                        }
                    }
                };

                var facePropertybtn2 = new Button()
                {
                    Text = "1 Face Property"
                };

                facePropertybtn2.Click += (s, e) =>
                {
                    var dialog = new Honeybee.UI.Dialog_FaceProperty(md.Properties, new List <Face>()
                    {
                        face2
                    });
                    var dialog_rc = dialog.ShowModal(this);
                    if (dialog_rc != null)
                    {
                        foreach (var item in dialog_rc)
                        {
                            Console.WriteLine(item.ToJson(true));
                        }
                    }
                };


                var aptPropertybtn = new Button()
                {
                    Text = "1 Apt Property"
                };
                var apt  = new Aperture($"aptId_{Guid.NewGuid()}_01021odjs", new Face3D(new List <List <double> >()), new Outdoors(), new AperturePropertiesAbridged(new ApertureEnergyPropertiesAbridged("aa"), new ApertureRadiancePropertiesAbridged("bb", "cc")));
                var apt2 = new Aperture($"Aperture_{Guid.NewGuid()}_01021odjs", new Face3D(new List <List <double> >()), new Outdoors(), new AperturePropertiesAbridged(new ApertureEnergyPropertiesAbridged("Generic Exterior Wall")), "apt name", isOperable: true);

                aptPropertybtn.Click += (s, e) =>
                {
                    var dialog = new Honeybee.UI.Dialog_ApertureProperty(md.Properties, new List <Aperture>()
                    {
                        apt2
                    });
                    var dialog_rc = dialog.ShowModal(this);
                    if (dialog_rc != null)
                    {
                        apt2 = dialog_rc.First();
                        foreach (var item in dialog_rc)
                        {
                            Console.WriteLine(item.ToJson(true));
                        }
                    }
                };
                var aptPropertybtn2 = new Button()
                {
                    Text = "2 Apts Property"
                };

                aptPropertybtn2.Click += (s, e) =>
                {
                    var dialog = new Honeybee.UI.Dialog_ApertureProperty(md.Properties, new List <Aperture>()
                    {
                        apt, apt2
                    });
                    var dialog_rc = dialog.ShowModal(this);
                    if (dialog_rc != null)
                    {
                        foreach (var item in dialog_rc)
                        {
                            Console.WriteLine(item.ToJson(true));
                        }
                    }
                };

                var doorPropertybtn = new Button()
                {
                    Text = "1 Door Property"
                };
                var door = new Door($"aptId_{Guid.NewGuid()}_01021odjs", new Face3D(new List <List <double> >()), new Outdoors(), new DoorPropertiesAbridged());

                doorPropertybtn.Click += (s, e) =>
                {
                    var dialog = new Honeybee.UI.Dialog_DoorProperty(md.Properties, new List <Door>()
                    {
                        door
                    });
                    var dialog_rc = dialog.ShowModal(this);
                    if (dialog_rc != null)
                    {
                        foreach (var item in dialog_rc)
                        {
                            Console.WriteLine(item.ToJson(true));
                        }
                    }
                };

                var shdPropertybtn = new Button()
                {
                    Text = "1 Shade Property"
                };
                var shd  = new Shade($"shdId_{Guid.NewGuid()}_01021odjs", new Face3D(new List <List <double> >()), new ShadePropertiesAbridged(new ShadeEnergyPropertiesAbridged("aa"), new ShadeRadiancePropertiesAbridged("bb", "cc")));
                var shd2 = new Shade($"Shade_{Guid.NewGuid()}_01021odjs", new Face3D(new List <List <double> >()), new ShadePropertiesAbridged(new ShadeEnergyPropertiesAbridged("Generic Exterior Wall")), "shd name", isDetached: true);

                shdPropertybtn.Click += (s, e) =>
                {
                    var dialog = new Honeybee.UI.Dialog_ShadeProperty(md.Properties, new List <Shade>()
                    {
                        shd2
                    });
                    var dialog_rc = dialog.ShowModal(this);
                    if (dialog_rc != null)
                    {
                        shd2 = dialog_rc.FirstOrDefault();
                        foreach (var item in dialog_rc)
                        {
                            Console.WriteLine(item.ToJson(true));
                        }
                    }
                };
                var shdPropertybtn2 = new Button()
                {
                    Text = "2 Shade Property"
                };

                shdPropertybtn2.Click += (s, e) =>
                {
                    var dialog = new Honeybee.UI.Dialog_ShadeProperty(md.Properties, new List <Shade>()
                    {
                        shd, shd2
                    });
                    var dialog_rc = dialog.ShowModal(this);
                    if (dialog_rc != null)
                    {
                        foreach (var item in dialog_rc)
                        {
                            Console.WriteLine(item.ToJson(true));
                        }
                    }
                };

                var view = new HoneybeeSchema.View("id", new List <double>()
                {
                    1, 1, 1
                }, new List <double>()
                {
                    2, 2, 2
                }, new List <double>()
                {
                    0, 0, 1
                }, viewType: ViewType.c);
                var view2 = new HoneybeeSchema.View("id2", new List <double>()
                {
                    1, 1, 1
                }, new List <double>()
                {
                    2, 2, 2
                }, new List <double>()
                {
                    0, 0, 1
                }, hSize: 120, vSize: 120);

                var viewPropertybtn = new Button()
                {
                    Text = "1 view Property"
                };

                viewPropertybtn.Click += (s, e) =>
                {
                    var dialog = new Honeybee.UI.Dialog_ViewProperty(new List <HoneybeeSchema.View>()
                    {
                        view
                    });
                    var dialog_rc = dialog.ShowModal(this);
                    if (dialog_rc != null)
                    {
                        foreach (var item in dialog_rc)
                        {
                            Console.WriteLine(item.ToJson(true));
                        }
                    }
                };
                var viewPropertybtn2 = new Button()
                {
                    Text = "2 view Property"
                };

                viewPropertybtn2.Click += (s, e) =>
                {
                    var dialog = new Honeybee.UI.Dialog_ViewProperty(new List <HoneybeeSchema.View>()
                    {
                        view, view2
                    });
                    var dialog_rc = dialog.ShowModal(this);
                    if (dialog_rc != null)
                    {
                        foreach (var item in dialog_rc)
                        {
                            Console.WriteLine(item.ToJson(true));
                        }
                    }
                };

                var sensorGrid  = new SensorGrid("id", new List <Sensor>());
                var sensorGrid2 = new SensorGrid("id2", new List <Sensor>(), groupIdentifier: "sdfd");

                var sensorGridPropertybtn = new Button()
                {
                    Text = "1 sensor grid Property"
                };

                sensorGridPropertybtn.Click += (s, e) =>
                {
                    var dialog = new Honeybee.UI.Dialog_SensorGridProperty(new List <SensorGrid>()
                    {
                        sensorGrid2
                    });
                    var dialog_rc = dialog.ShowModal(this);
                    if (dialog_rc != null)
                    {
                        foreach (var item in dialog_rc)
                        {
                            Console.WriteLine(item.ToJson(true));
                        }
                    }
                };
                var sensorGridPropertybtn2 = new Button()
                {
                    Text = "2 sensor grid Property"
                };

                sensorGridPropertybtn2.Click += (s, e) =>
                {
                    var dialog = new Honeybee.UI.Dialog_SensorGridProperty(new List <SensorGrid>()
                    {
                        sensorGrid, sensorGrid2
                    });
                    var dialog_rc = dialog.ShowModal(this);
                    if (dialog_rc != null)
                    {
                        foreach (var item in dialog_rc)
                        {
                            Console.WriteLine(item.ToJson(true));
                        }
                    }
                };

                var Messagebtn = new Button()
                {
                    Text = "message text"
                };

                Messagebtn.Click += (s, e) =>
                {
                    var energyProp = new HoneybeeSchema.RoomEnergyPropertiesAbridged();
                    Dialog_Message.Show(this, energyProp.ToJson());
                };

                var cSetbtn = new Button()
                {
                    Text = "ConstructionSet"
                };

                cSetbtn.Click += (s, e) =>
                {
                    var lib    = md.Properties.Energy;
                    var cSet   = new HoneybeeSchema.ConstructionSetAbridged(identifier: Guid.NewGuid().ToString());
                    var dialog = new Honeybee.UI.Dialog_ConstructionSet(ref lib, cSet);
                    var rs     = dialog.ShowModal(this);
                    if (rs != null)
                    {
                        Dialog_Message.Show(this, rs.ToJson());
                    }
                };

                var pTypebtn = new Button()
                {
                    Text = "ProgramType"
                };

                pTypebtn.Click += (s, e) =>
                {
                    var pType  = new HoneybeeSchema.ProgramTypeAbridged(identifier: Guid.NewGuid().ToString());
                    var lib    = md.Properties;
                    var dialog = new Honeybee.UI.Dialog_ProgramType(ref lib, pType);
                    dialog.ShowModal(this);
                };

                var pTypeMngbtn = new Button()
                {
                    Text = "ProgramTypeManager"
                };

                pTypeMngbtn.Click += (s, e) =>
                {
                    var lib       = md.Properties;
                    var dialog    = new Honeybee.UI.Dialog_ProgramTypeManager(ref lib);
                    var dialog_rc = dialog.ShowModal(this);
                };

                var schbtn = new Button()
                {
                    Text = "ScheduleRulesetManager"
                };

                schbtn.Click += (s, e) =>
                {
                    var lib       = md.Properties.Energy;
                    var dialog    = new Honeybee.UI.Dialog_ScheduleRulesetManager(ref lib);
                    var dialog_rc = dialog.ShowModal(this);
                };

                var conbtn = new Button()
                {
                    Text = "ConstructionManager"
                };

                conbtn.Click += (s, e) =>
                {
                    var lib    = md.Properties.Energy;
                    var dialog = new Honeybee.UI.Dialog_ConstructionManager(ref lib);
                    dialog.ShowModal(this);
                };

                var cSetManager = new Button()
                {
                    Text = "ConstructionSet Manager"
                };

                cSetManager.Click += (s, e) =>
                {
                    var lib    = md.Properties.Energy;
                    var dialog = new Dialog_ConstructionSetManager(ref lib);
                    dialog.ShowModal(this);
                };

                var simuParam = new Button()
                {
                    Text = "Simulation Parameter"
                };

                simuParam.Click += (s, e) =>
                {
                    var sP     = new SimulationParameter();
                    var dialog = new Honeybee.UI.Dialog_SimulationParameter(sP);
                    dialog.ShowModal(this);
                };

                var modelManager = new Button()
                {
                    Text = "Model Resource"
                };

                modelManager.Click += (s, e) =>
                {
                    var dialog = new Honeybee.UI.Dialog_ModelResources(md);
                    dialog.ShowModal(this);
                };

                var materialBtn = new Button()
                {
                    Text = "Material Manager"
                };

                materialBtn.Click += (s, e) =>
                {
                    var lib          = md.Properties.Energy;
                    var dialog       = new Honeybee.UI.Dialog_MaterialManager(ref lib);
                    var newMaterials = dialog.ShowModal(this);
                    if (newMaterials != null)
                    {
                        md.Properties.Energy.Materials.Clear();
                        md.AddMaterials(newMaterials);
                    }
                };


                var modifierBtn = new Button()
                {
                    Text = "Modifier Manager"
                };

                modifierBtn.Click += (s, e) =>
                {
                    var lib    = md.Properties.Radiance;
                    var dialog = new Honeybee.UI.Dialog_ModifierManager(ref lib);

                    var dialog_rc = dialog.ShowModal(this);
                    if (dialog_rc != null)
                    {
                        md.Properties.Radiance.Modifiers.Clear();
                        md.AddModifiers(dialog_rc);
                    }
                };

                var modifierSetMngBtn = new Button()
                {
                    Text = "ModifierSet Manager"
                };

                modifierSetMngBtn.Click += (s, e) =>
                {
                    var lib    = md.Properties.Radiance;
                    var dialog = new Honeybee.UI.Dialog_ModifierSetManager(ref lib);

                    var dialog_rc = dialog.ShowModal(this);
                    if (dialog_rc != null)
                    {
                        md.Properties.Radiance.ModifierSets.Clear();
                        md.AddModifierSets(dialog_rc);
                    }
                };

                var modifierSetBtn = new Button()
                {
                    Text = "ModifierSet Editor"
                };

                modifierSetBtn.Click += (s, e) =>
                {
                    var dup    = new ModifierSetAbridged("NewModifierSet");
                    var lib    = md.Properties.Radiance;
                    var dialog = new Honeybee.UI.Dialog_ModifierSet(ref lib, dup);

                    var dialog_rc = dialog.ShowModal(this);
                };


                var shwMngBtn = new Button()
                {
                    Text = "SHW Manager"
                };

                shwMngBtn.Click += (s, e) =>
                {
                    var lib    = md.Properties.Energy;
                    var dialog = new Honeybee.UI.Dialog_SHWManager(ref lib);

                    var dialog_rc = dialog.ShowModal(this);
                };

                var shwBtn = new Button()
                {
                    Text = "SHW Editor"
                };

                shwBtn.Click += (s, e) =>
                {
                    var dialog    = new Honeybee.UI.Dialog_SHW();
                    var dialog_rc = dialog.ShowModal(this);
                };

                var outputs = new Button()
                {
                    Text = "EPOutputs"
                };

                outputs.Click += (s, e) =>
                {
                    var epoutput = new SimulationOutput();
                    var dialog   = new Honeybee.UI.Dialog_EPOutputs(epoutput);
                    dialog.ShowModal(this);
                };


                var opsHVACs = new Button()
                {
                    Text = "OpenStudioHVACs"
                };

                opsHVACs.Click += (s, e) =>
                {
                    var lib    = md.Properties.Energy;
                    var dialog = new Honeybee.UI.Dialog_OpsHVACs(ref lib);
                    dialog.ShowModal(this);
                };

                var HVACManager = new Button()
                {
                    Text = "HVACsManager"
                };

                HVACManager.Click += (s, e) =>
                {
                    var lib    = md.Properties.Energy;
                    var dialog = new Honeybee.UI.Dialog_HVACManager(ref lib);
                    dialog.ShowModal(this);
                };

                var cSetSel_btn = new Button()
                {
                    Text = "CSetSelector"
                };

                cSetSel_btn.Click += (s, e) =>
                {
                    var lib        = md.Properties.Energy;
                    var cSetSel    = new Dialog_ConstructionSetManager(ref lib, true);
                    var cSetSel_rc = cSetSel.ShowModal(Config.Owner);
                    if (cSetSel_rc != null)
                    {
                        foreach (var item in md.Properties.Energy.ConstructionSets)
                        {
                            Console.WriteLine(item.Obj);
                        }
                    }
                };

                var cIntSetSel_btn = new Button()
                {
                    Text = "ConstructionSet Interior"
                };
                var cInt = new InteriorSet();

                cIntSetSel_btn.Click += (s, e) =>
                {
                    var lib        = md.Properties.Energy;
                    var cSetSel    = new Dialog_ConstructionSet_Interior(ref lib, cInt);
                    var cSetSel_rc = cSetSel.ShowModal(Config.Owner);
                    if (cSetSel_rc != null)
                    {
                        cInt = cSetSel_rc;
                        Console.WriteLine(cSetSel_rc);
                    }
                };

                var mIntSetSel_btn = new Button()
                {
                    Text = "ModifierSet Interior"
                };
                var mInt = new InteriorSet();

                mIntSetSel_btn.Click += (s, e) =>
                {
                    var lib        = md.Properties.Radiance;
                    var cSetSel    = new Dialog_ModifierSet_Interior(ref lib, mInt);
                    var cSetSel_rc = cSetSel.ShowModal(Config.Owner);
                    if (cSetSel_rc != null)
                    {
                        mInt = cSetSel_rc;
                        Console.WriteLine(cSetSel_rc);
                    }
                };


                var matchRooms_btn = new Button()
                {
                    Text = "MatchRooms"
                };

                matchRooms_btn.Click += (s, e) =>
                {
                    var source = new Room("id", new List <Face>(), new RoomPropertiesAbridged(energy: new RoomEnergyPropertiesAbridged("my construction")), displayName: "SourceName");
                    var target = new Room("id", new List <Face>(), new RoomPropertiesAbridged());
                    var dia    = new Dialog_MatchRoomProperties(source, new List <Room>()
                    {
                        target
                    });
                    var rc = dia.ShowModal(Config.Owner);
                    if (rc != null)
                    {
                        foreach (var item in rc)
                        {
                            Console.WriteLine(item.ToJson());
                        }
                    }
                };

                var lockedUnits = new Dictionary <Honeybee.UI.Units.UnitType, System.Enum>()
                {
                    { Honeybee.UI.Units.UnitType.Length, Units.LengthUnit.Millimeter }
                };
                var unit_btn = new Button()
                {
                    Text = "Unit setting"
                };

                unit_btn.Click += (s, e) =>
                {
                    var dia = new Dialog_UnitSetting(lockedUnits);
                    dia.ShowModal(Config.Owner);
                };


                var legend_btn = new Button()
                {
                    Text = "Legend"
                };

                legend_btn.Click += (s, e) =>
                {
                    var dia = new Dialog_Legend(null);
                    dia.ShowModal(Config.Owner);
                };

                var errors_btn = new Button()
                {
                    Text = "Errors"
                };
                //var validationReport = new ValidationReport()
                //var path = @"D:\Dev\Pollination\rhino-plugin\error.json";
                //var json = System.IO.File.ReadAllText(path);
                var report = new ValidationReport("1.1.0", "1.2.0", false, "Error");

                errors_btn.Click += (s, e) =>
                {
                    var dia = Dialog_Error.Instance;
                    dia.Update(report);
                    dia.Show();
                };

                panel.AddSeparateRow(RoomPropertybtn, RoomPropertybtn2, null);
                panel.AddSeparateRow(facePropertybtn, facePropertybtn2, null);
                panel.AddSeparateRow(aptPropertybtn, aptPropertybtn2, null);
                panel.AddSeparateRow(doorPropertybtn, null);
                panel.AddSeparateRow(shdPropertybtn, shdPropertybtn2, null);
                panel.AddSeparateRow(viewPropertybtn, viewPropertybtn2, null);
                panel.AddSeparateRow(sensorGridPropertybtn, sensorGridPropertybtn2, null);
                panel.AddSeparateRow(Messagebtn);
                panel.AddSeparateRow(conbtn, cSetbtn, cIntSetSel_btn, cSetManager, cSetSel_btn, null);
                panel.AddSeparateRow(pTypebtn, pTypeMngbtn, null);
                panel.AddSeparateRow(schbtn);
                panel.AddSeparateRow(simuParam);
                panel.AddSeparateRow(modelManager);
                panel.AddSeparateRow(materialBtn);
                panel.AddSeparateRow(modifierBtn, modifierSetMngBtn, modifierBtn, mIntSetSel_btn, null);
                panel.AddSeparateRow(shwMngBtn, shwBtn);
                panel.AddSeparateRow(outputs);
                panel.AddSeparateRow(opsHVACs);
                panel.AddSeparateRow(HVACManager);
                panel.AddSeparateRow(matchRooms_btn);
                panel.AddSeparateRow(unit_btn, legend_btn);
                panel.AddSeparateRow(errors_btn);
                panel.AddSeparateRow(null);
                Content = panel;
            }
示例#4
0
        public void BuildStatisticsReport(SimulationManager simulationManager, string reporterPath)
        {
            StringWriter writer = new StringWriter();

            writer.WriteLine("<Report>");

            #region Basic Parameters
            SimulationParameter parameter = simulationManager.Parameter;
            writer.WriteLine("<JobPath>{0}</JobPath>", parameter.JobPath);
            writer.WriteLine("<LayoutPath>{0}</LayoutPath>", parameter.LayoutPath);
            writer.WriteLine("<Seed>{0}</Seed>", parameter.Seed);
            #endregion

            #region Algorithm Names
            AlgorithmParameter algorithms = parameter.Algorithms;
            writer.WriteLine(String.Format("<OperationSelection>{0}</OperationSelection>", algorithms.OperationSelectionAlgorithm));
            writer.WriteLine(String.Format("<OrderRelease>{0}</OrderRelease>", algorithms.OrderReleaseAlgorithm));
            writer.WriteLine(String.Format("<StationController>{0}</StationController>", algorithms.StationControllerAlgorithm));
            writer.WriteLine(String.Format("<OrderController>{0}</OrderController>", algorithms.OrderControllerAlgorithm));
            writer.WriteLine(String.Format("<PartSequencingForProcessor>{0}</PartSequencingForProcessor>", algorithms.PartSequencingForProcessorAlgorithm));
            //writer.WriteLine(String.Format("<PartSequencingForOutQueue>{0}</PartSequencingForOutQueue>", algorithms.PartSequencingForOutQueueAlgorithm));
            #endregion

            #region Configuration Parameters
            ConfigurationParameter configuration = parameter.Configuration;
            writer.WriteLine(String.Format("<FinalArrivalTime>{0}</FinalArrivalTime>", configuration.FinalArrivalTime));
            writer.WriteLine(String.Format("<JobRelease>{0}</JobRelease>", configuration.JobRelease));
            writer.WriteLine(String.Format("<JobArrivalType>{0}</JobArrivalType>", configuration.JobArrivalType));
            writer.WriteLine(String.Format("<LoadingPeriodTime>{0}</LoadingPeriodTime>", configuration.LoadingPeriodTime));
            writer.WriteLine(String.Format("<LoadingPeriodType>{0}</LoadingPeriodType>", configuration.LoadingPeriodType));
            writer.WriteLine(String.Format("<PeriodState>{0}</PeriodState>", configuration.PeriodState));
            writer.WriteLine(String.Format("<PlanningPeriodTime>{0}</PlanningPeriodTime>", configuration.PlanningPeriodTime));
            writer.WriteLine(String.Format("<PlanningPeriodType>{0}</PlanningPeriodType>", configuration.PlanningPeriodType));
            writer.WriteLine(String.Format("<SimulationPeriodTime>{0}</SimulationPeriodTime>", configuration.SimulationPeriodTime));
            writer.WriteLine(String.Format("<SimulationPeriodType>{0}</SimulationPeriodType>", configuration.SimulationPeriodType));
            writer.WriteLine(String.Format("<ToolPath>{0}</ToolPath>", configuration.ToolPath));
            writer.WriteLine(String.Format("<TracePath>{0}</TracePath>", configuration.TracePath));
            writer.WriteLine(String.Format("<WarmupPeriodTime>{0}</WarmupPeriodTime>", configuration.WarmupPeriodTime));
            #endregion

            #region Transporter Statistics
            writer.WriteLine("<Transporter>");
            Transporter transporter = simulationManager.LayoutManager.Layout.Transporter;
            writer.WriteLine("<Name>{0}</Name>", transporter.Name);

            writer.WriteLine("<Statistics>");

            Statistics load = (Statistics)transporter.Statistics["Load"];
            writer.WriteLine(ReportUtilizationBasedStatistics("Load", load, simulationManager));

            Statistics busy = (Statistics)transporter.Statistics["Busy"];
            writer.WriteLine(ReportUtilizationBasedStatistics("Busy", busy, simulationManager));

            writer.WriteLine("</Statistics>");
            writer.WriteLine("</Transporter>");
            #endregion

            #region Cell Statistics
            writer.WriteLine("<Cells>");
            foreach (Station cell in simulationManager.LayoutManager.Layout.Stations)
            {
                writer.WriteLine("<Cell>");
                writer.WriteLine("<Name>{0}</Name>", cell.Name);

                writer.WriteLine("<Statistics>");

                if (cell.GetType().Name == "Station")
                {
                    Statistics blocked = (Statistics)cell.Statistics["Blocked"];
                    writer.WriteLine(ReportUtilizationBasedStatistics("Blocked", blocked, simulationManager));
                }

                if (cell.GetType().Name == "Station")
                {
                    Statistics starved = (Statistics)cell.Statistics["Starved"];
                    writer.WriteLine(ReportUtilizationBasedStatistics("Starved", starved, simulationManager));
                }

                Statistics inqueueLength = (Statistics)cell.InQueue.Statistics["Length"];
                writer.WriteLine(ReportTimeBasedStatistics("InqueueLength", inqueueLength, simulationManager));

                Statistics inqueueTime = (Statistics)cell.InQueue.Statistics["Time"];
                writer.WriteLine(ReportAverageBasedStatistics("InqueueTime", inqueueTime));

                writer.WriteLine("</Statistics>");

                if (cell.GetType().Name == "Station")
                {
                    Station processCell = (Station)cell;
                    writer.WriteLine("<Processors>");
                    foreach (Processor processor in processCell.Processors)
                    {
                        writer.WriteLine("<Processor>");
                        writer.WriteLine("<Name>{0}</Name>", processor.Name);

                        writer.WriteLine("<Statistics>");

                        Statistics usage = (Statistics)processor.Statistics["Usage"];
                        writer.WriteLine(ReportUtilizationBasedStatistics("Usage", usage, simulationManager));

                        Statistics blocked = (Statistics)processor.Statistics["Blocked"];
                        writer.WriteLine(ReportUtilizationBasedStatistics("Blocked", blocked, simulationManager));

                        Statistics starved = (Statistics)processor.Statistics["Starved"];
                        writer.WriteLine(ReportUtilizationBasedStatistics("Starved", starved, simulationManager));

                        writer.WriteLine("</Statistics>");


                        writer.WriteLine("</Processor>");
                    }
                    writer.WriteLine("</Processors>");
                }
                writer.WriteLine("</Cell>");
            }
            writer.WriteLine("</Cells>");
            #endregion

            #region JobType Statistics
            writer.WriteLine("<JobTypes>");
            foreach (JobType jobType in simulationManager.JobManager.JobMix.JobTypes)
            {
                writer.WriteLine("<JobType>");
                writer.WriteLine("<Name>{0}</Name>", jobType.Name);

                writer.WriteLine("<Statistics>");
                Statistics submitted = (Statistics)jobType.Statistics["Submitted"];
                writer.WriteLine(ReportCountBasedStatistics("Submitted", submitted));

                Statistics completed = (Statistics)jobType.Statistics["Completed"];
                writer.WriteLine(ReportCountBasedStatistics("Completed", completed));

                Statistics shopTime = (Statistics)jobType.Statistics["ShopTime"];
                writer.WriteLine(ReportAverageBasedStatistics("ShopTime", shopTime));

                Statistics totalTime = (Statistics)jobType.Statistics["TotalTime"];
                writer.WriteLine(ReportAverageBasedStatistics("TotalTime", totalTime));

                Statistics lateness = (Statistics)jobType.Statistics["Lateness"];
                writer.WriteLine(ReportAverageBasedStatistics("Lateness", lateness));

                Statistics earliness = (Statistics)jobType.Statistics["Earliness"];
                writer.WriteLine(ReportAverageBasedStatistics("Earliness", earliness));

                Statistics tardiness = (Statistics)jobType.Statistics["Tardiness"];
                writer.WriteLine(ReportAverageBasedStatistics("Tardiness", tardiness));

                Statistics numberofTardyJobs = (Statistics)jobType.Statistics["NumberofTardyJobs"];
                writer.WriteLine(ReportCountBasedStatistics("NumberofTardyJobs", numberofTardyJobs));

                writer.WriteLine("</Statistics>");

                writer.WriteLine("<Alternates>");
                foreach (JobRoute alternate in jobType.Alternates)
                {
                    writer.WriteLine("<Alternate>");
                    writer.WriteLine("<Name>" + alternate.Name + "</Name>");
                    Statistics usage = (Statistics)alternate.Usage;
                    writer.WriteLine(ReportCountBasedStatistics("UsageCount", usage));
                    writer.WriteLine("</Alternate>");
                }
                writer.WriteLine("</Alternates>");

                writer.WriteLine("</JobType>");
            }
            writer.WriteLine("</JobTypes>");
            #endregion


            #region BinMagazine Statistics
            writer.WriteLine("<BinMagazines>");
            foreach (Station station in simulationManager.LayoutManager.Layout.Stations)
            {
                if (!(simulationManager.LayoutManager.Layout.InputStations.Contains(station) || simulationManager.LayoutManager.Layout.OutputStations.Contains(station)))
                {
                    writer.WriteLine("<BinMagazine>");
                    writer.WriteLine("<Name>{0}</Name>", station.BinMagazine.Name);
                    writer.WriteLine("<Statistics>");
                    Statistics leadtime = (Statistics)station.BinMagazine.Statistics["OrderLeadTime"];
                    writer.WriteLine(ReportAverageBasedStatistics("OrderLeadTime", leadtime));

                    Statistics outstanding = (Statistics)station.BinMagazine.Statistics["OutstandingOrderCount"];
                    writer.WriteLine(ReportUtilizationBasedStatistics("OutstandingOrderCount", outstanding, simulationManager));


                    foreach (ComponentType ct in station.BinMagazine.ComponentTypes)
                    {
                        Statistics componentcount = (Statistics)station.BinMagazine.Statistics["ComponentTypeCount-" + ct.Name];
                        writer.WriteLine(ReportUtilizationBasedStatistics("ComponentTypeCount-" + ct.Name, componentcount, simulationManager));

                        Statistics bintime = (Statistics)station.BinMagazine.Statistics["BinTime-" + ct.Name];
                        writer.WriteLine(ReportAverageBasedStatistics("BinTime-" + ct.Name, bintime));
                    }
                    writer.WriteLine("</Statistics>");
                    writer.WriteLine("</BinMagazine>");
                }
            }
            writer.WriteLine("</BinMagazines>");

            #endregion



            writer.WriteLine("</Report>");

            XmlDocument document = new XmlDocument();
            string      s        = writer.ToString().Trim();
            document.LoadXml(s);

            document.Save(String.Format(reporterPath + "{0}.xml", Guid.NewGuid()));
        }
示例#5
0
        //c'tors:

        //-


        //public methods:

        public void MainLoop(string[] args)
        {
            Console.SetBufferSize(2 * Console.LargestWindowWidth, 10 * Console.LargestWindowHeight);
            //not really sure about this line (we may still need double buffering and/or custom-flush)

            do
            {
                if (conf == null && sim == null)
                {
                    conf = CreateCliConfig();
                    sim  = CreateCellSimulation();
                    FillWithRandoms(rand);
                    conf.App = this;
                    SetWindowSize();
                    Rerender();
                }

                if (conf == null)
                {
                    conf     = CreateCliConfig();
                    conf.App = this;
                    SetWindowSize();
                    Rerender();
                }

                if (sim == null)
                {
                    sim = CreateCellSimulation();
                    FillWithRandoms(rand);
                    SetWindowSize();
                    Rerender();
                }

                //Console.WriteLine();
                Console.ForegroundColor = conf.PromptColor;
                Console.Write(conf.PromptText);
                Console.ForegroundColor = conf.UserColor;
                Console.CursorVisible   = true;
                command = Console.ReadLine();
                Console.CursorVisible = false;

                if (command.Equals("default"))
                {
                    conf = null;
                    sim  = null;
                }
                else
                if (command.Equals("conf"))
                {
                    conf.SuppressRebuildReformat = true; //we may have several changes, will react later
                    ItemsChanger <CliConfig> changer = new ItemsChanger <CliConfig>(conf, conf);
                    changer.MainLoop();
                    SetWindowSize();
                    confStr1 = null;                      //AlifeText may have changed
                    confStr2 = null;                      //HalfAlifeText may have changed
                    confStr3 = null;                      //DeadText may have changed
                    conf.SuppressRebuildReformat = false; //now let the console app react to all changes
                    feedback     = "Left configuration management.";
                    feedbackType = FeedbackType.OKAY;
                }
                else
                if (command.Equals("settings"))
                {
                    sim.Settings.SuppressUpdates = true; //we may have several changes, will react later
                    ItemsChanger <SimulationSettings> changer = new ItemsChanger <SimulationSettings>(sim.Settings, conf);
                    changer.MainLoop();
                    SetWindowSize();
                    sim.Settings.SuppressUpdates = false; //now let the sim react to all our changes
                    feedback     = "Left settings management.";
                    feedbackType = FeedbackType.OKAY;
                }
                else
                if (command.Equals("sim"))
                {
                    //TODO
                    //display a list with all our simulation types
                    //let user start a new simulation of any of those types
                }
                else
                if (command.StartsWith("save conf"))
                {
                    //TODO
                }
                else
                if (command.StartsWith("save sim"))
                {
                    //TODO
                }
                else
                if (command.StartsWith("load conf"))
                {
                    //TODO
                }
                else
                if (command.StartsWith("load sim"))
                {
                    //TODO
                }
                else
                if (command.StartsWith("random"))
                {
                    string[] split = command.Split(sep);
                    Random   r;
                    bool     success;
                    int      seed;
                    if (split.Length < 2)
                    {
                        r       = rand;
                        success = true;
                    }
                    else
                    {
                        success = int.TryParse(split[1], out seed);
                        r       = new Random(seed);
                    }
                    if (success)
                    {
                        FillWithRandoms(r);
                        feedback     = "Filled cells with random numbers.";
                        feedbackType = FeedbackType.OKAY;
                    }
                    else
                    {
                        feedback     = "Could not parse seed value: " + split[1];
                        feedbackType = FeedbackType.ERROR;
                    }
                }
                else
                if (command.Equals("run"))
                {
                    Rerender();
                    feedback     = "Started automatic run of simulations.";
                    feedbackType = FeedbackType.OKAY;
                    AutoSimLoop();
                    feedback     = "Completed automatic run of simulations.";
                    feedbackType = FeedbackType.OKAY;
                }
                else
                if (command.StartsWith("size"))
                {
                    string[] split = command.Split(sep);
                    if (split.Length > 2)
                    {
                        int  newX, newY = -1;
                        bool success = int.TryParse(split[2], out newX);
                        if (split.Length > 3)
                        {
                            success = success && int.TryParse(split[3], out newY);
                        }
                        if (success && newX > 0 && split.Length < 4 || newY > 0)
                        {
                            sim.Settings.SuppressUpdates = true;
                            sim.Settings.SizeX           = newX;
                            sim.Settings.SizeY           = split.Length > 3 ? newY : newX;
                            sim.Settings.SuppressUpdates = false;
                            feedback     = "Set x and y to desired values.";
                            feedbackType = FeedbackType.OKAY;
                        }
                        else
                        {
                            feedback     = "Could not set to new size.";
                            feedbackType = FeedbackType.ERROR;
                        }
                    }
                }
                else
                if (command.StartsWith("param"))
                {
                    string[] split = command.Split(sep);
                    if (split.Length > 3)
                    {
                        int     n       = -1;
                        decimal v       = -1m;
                        bool    success = int.TryParse(split[2], out n);
                        success = success && decimal.TryParse(split[3], out v);
                        if (success)
                        {
                            SimulationParameter param = null;

                            if (n == 1)
                            {
                                param = sim.Param1;
                            }
                            if (n == 2)
                            {
                                param = sim.Param2;
                            }
                            //TODO: param = sim.GetParam(n);
                            //TODO: int maxN = sim.GetNumParams();

                            if (param != null)
                            {
                                if (v >= param.Min && v <= param.Max)
                                {
                                    param.Current = v;
                                    feedback      = $"Set param {n} to value {v}.";
                                    feedbackType  = FeedbackType.OKAY;
                                }
                                else
                                {
                                    feedback     = $"Value {v} not in allowed interval [{param.Min}..{param.Max}]!";
                                    feedbackType = FeedbackType.ERROR;
                                }
                            }
                            else
                            {
                                feedback     = $"Unknown param [{n}] (try a different index!).";
                                feedbackType = FeedbackType.ERROR;
                            }
                        }
                        else
                        {
                            feedback     = "Could not set param (incorrect number?).";
                            feedbackType = FeedbackType.ERROR;
                        }
                    }
                }
                else
                if (command.StartsWith("set"))
                {
                    int      x, y = -1;
                    decimal  val   = 1m;
                    string[] split = command.Split(sep);
                    if (split.Length > 2)
                    {
                        bool success = int.TryParse(split[1], out x);
                        success = success && int.TryParse(split[2], out y);
                        if (split.Length > 3)
                        {
                            success = decimal.TryParse(split[3], out val);
                        }
                        if (success && BoundsCheck(x, y))
                        {
                            sim.SetCellValue(x, y, val);
                            feedback     = "Set value for cell.";
                            feedbackType = FeedbackType.OKAY;
                        }
                        else
                        {
                            feedback     = "Could not set to new value.";
                            feedbackType = FeedbackType.ERROR;
                        }
                    }
                }
                else
                if (command.Equals("fill"))
                {
                    FillWith(1m);
                    feedback     = "Set every cell to 1 (100%).";
                    feedbackType = FeedbackType.OKAY;
                }
                else
                if (command.Equals("clear"))
                {
                    FillWith(0m);
                    feedback     = "Set every cell to 0 (0%).";
                    feedbackType = FeedbackType.OKAY;
                }
                else
                if (command.StartsWith("clear"))
                {
                    int      x, y = -1;
                    string[] split = command.Split(sep);
                    if (split.Length > 2)
                    {
                        bool success = int.TryParse(split[1], out x);
                        success = success && int.TryParse(split[2], out y);
                        if (success && BoundsCheck(x, y))
                        {
                            sim.SetCellValue(x, y, 0m);
                            feedback     = "Set cell value to 0 (0%).";
                            feedbackType = FeedbackType.OKAY;
                        }
                        else
                        {
                            feedback     = "Could not set cell value to 0 (0%).";
                            feedbackType = FeedbackType.ERROR;
                        }
                    }
                }
                else
                if (command.Equals("next"))
                {
                    sim.CalculateNextGen();
                    feedback     = "Calculated next generation.";
                    feedbackType = FeedbackType.OKAY;
                }
                else
                if (command.Equals("current?"))
                {
                    feedback     = "Current generation is " + sim.CurrentGen + ".";
                    feedbackType = FeedbackType.OKAY;
                }
                else
                if (command.Equals("oldest?"))
                {
                    feedback     = "Oldest generation is " + sim.OldestGen + ".";
                    feedbackType = FeedbackType.OKAY;
                }
                else
                if (command.Equals("num?"))
                {
                    feedback     = "Number of generations: " + sim.NumGens + ".";
                    feedbackType = FeedbackType.OKAY;
                }
                else
                if (command.Equals("oldest"))
                {
                    sim.GoToOldestGen();
                    feedback     = "Went to oldest generation.";
                    feedbackType = FeedbackType.OKAY;
                }
                else
                if (command.Equals("back"))
                {
                    sim.GoBackOneGen();
                    feedback     = "Went back one generation.";
                    feedbackType = FeedbackType.OKAY;
                }
                else
                if (command.Equals("zero"))
                {
                    sim.RelabelCurrentAsZero();
                    feedback     = "Relabled current generation as zero, deleted others.";
                    feedbackType = FeedbackType.OKAY;
                }
                else
                if (command.StartsWith("go to"))
                {
                    string[] split = command.Split(sep);
                    if (split.Length > 2)
                    {
                        int  n;
                        bool success = int.TryParse(split[2], out n);
                        if (success && n >= 0)
                        {
                            bool okay = sim.GoToGen(n, this);
                            if (okay)
                            {
                                feedback     = "Went to generation " + n + ".";
                                feedbackType = FeedbackType.OKAY;
                            }
                            else
                            {
                                feedback     = "Tried to go to generation " + n + " but failed.";
                                feedbackType = FeedbackType.ERROR;
                            }
                        }
                        else
                        {
                            feedback     = "Could not go to that generation.";
                            feedbackType = FeedbackType.ERROR;
                        }
                    }
                }
                else
                if (command.Equals("info"))
                {
                    ShowSimInfo();
                }
                else
                if (command.Equals("help") || command.Equals("?"))
                {
                    ShowHelp();
                }
                else
                if (command.Equals("max"))
                {
                    feedback     = "max size: " + GetMaxSimSize();
                    feedbackType = FeedbackType.OKAY;
                }
                else
                {
                    feedback     = "Unknown command: \"" + command + "\"";
                    feedbackType = FeedbackType.ERROR;
                }

                Rerender();
            }while (!command.Equals("exit"));
        }
 public SimulationSettings()
 {
     DisturbanceVariable = new SimulationParameter("",SimulationParameterType.Disturbance, 0, 0);
     RegressionSettings = new ModelRegressionSettings();
 }
        private async void Validate_Click(object sender, RoutedEventArgs e)
        {
            double modelSimulationTime = (double)this.ModelSimulationTimeNumUpDown.Value;
            double desiredValueReachedTime = (double)this.DesiredValueReachedNumUpDown.Value;
            double desiredFrom = (double)this.DesiredValueFromNumUpDown.Value;
            double desiredTo = (double)this.DesiredValueToNumUpDown.Value;
            double actualFrom = (double)this.ActualValueFromNumUpDown.Value;
            double actualTo = (double)this.ActualValueToNumUpDown.Value;
            double disturbanceAmplitude = (double)this.DisturbanceValueToNumUpDown.Value;
            double smoothnessDiff = (double)this.SmoothnessStartDifferenceNumUpDown.Value;
            double responsivenessClose = (double)this.ResponsivenessCloseNumUpDown.Value;

            if (desiredValueReachedTime >= modelSimulationTime)
            {
                MessageBox.Show("Invalid desired value reached time. The desired value reached time cannot be greater or equal to the model simulation time.", "Invalid setting", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            if (desiredFrom >= desiredTo)
            {
                MessageBox.Show("Invalid desired value range", "Invalid setting", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            if (actualFrom >= actualTo)
            {
                MessageBox.Show("Invalid actual value range", "Invalid setting", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            if (actualFrom > desiredFrom)
            {
                MessageBox.Show("Invalid actual value range", "Invalid setting", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            if (smoothnessDiff > (Math.Abs(actualFrom - actualTo)/10))
            {
                MessageBox.Show("The value after which the smoothness measurement begins cannot be more than a tenth of the actual value range.", "Invalid setting", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            if (responsivenessClose > (Math.Abs(actualFrom - actualTo) / 20))
            {
                MessageBox.Show("The absolute difference between the actual and the desired value at which the responsiveness measurement ends cannot be more than a fifth of the actual value range.", "Invalid setting", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            if (String.IsNullOrWhiteSpace(this.DesiredValueNameTextBox.Text))
            {
                MessageBox.Show("Please specify the name of the desired variable.", "Invalid setting", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            if (String.IsNullOrWhiteSpace(this.ActualValueNameTextBox.Text))
            {
                MessageBox.Show("Please specify the name of the actual variable.", "Invalid setting", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            if (this.RefinedCandidatePointsNumUpDown.Value > 10)
            {
                MessageBox.Show("A maximum of 10 candidate points are allowed.", "Invalid setting", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            SimulationParameter desired = new SimulationParameter(this.DesiredValueNameTextBox.Text, SimulationParameterType.Desired, new decimal(desiredFrom), new decimal(desiredTo));
            SimulationParameter actual = new SimulationParameter(this.ActualValueNameTextBox.Text, SimulationParameterType.Actual, new decimal(actualFrom), new decimal(actualTo));
            SimulationParameter disturbance = new SimulationParameter(this.DisturbanceValueNameTextBox.Text, SimulationParameterType.Disturbance, new decimal(0), new decimal(disturbanceAmplitude));

            ModelRegressionSettings regressionSettings = new ModelRegressionSettings() { ModelQuality = (double)this.ModelQualityNumUpDown.Value, RefinedCandidatePoints = (int)this.RefinedCandidatePointsNumUpDown.Value, RefinementPoints = (int)this.RefinementSizeNumUpDown.Value, ValidationSetSize = (int)this.ValidationSetRandomPointsNumUpDown.Value, TrainingSetSizeEqualDistance = (int)this.TrainingSetPointsNumUpDown.Value, TrainingSetSizeRandom = (int)this.TrainingSetRandomPointsNumUpDown.Value };

            ModelSimulationSettings = new SimulationSettings(modelSimulationTime, desiredValueReachedTime, smoothnessDiff, responsivenessClose, desired, actual, disturbance, regressionSettings);

            progressController = await containingWindow.ShowProgressAsync("Please wait...", "Model compilation and simulation running");
            progressController.SetIndeterminate();
            
            TestFunctionality();
        }