示例#1
0
        /// <summary>
        /// Load the project file and return a SimioProject
        /// </summary>
        /// <param name="projectFullPath"></param>
        private static ISimioProject LoadProject(string projectFullPath, out string explanation)
        {
            explanation = "";
            string marker = "Begin.";

            string[] warnings;

            try
            {
                // If File Not Exist, Throw Exeption
                if (File.Exists(projectFullPath) == false)
                {
                    explanation = $"Project File={projectFullPath} not found.";
                    return(null);
                }

                // Open project file.
                marker = "Loading Model";
                LogIt($"Info: {marker}");
                ISimioProject simioProject = SimioProjectFactory.LoadProject(projectFullPath, out warnings);
                foreach (string warning in warnings)
                {
                    LogIt($"Warning: {warning}");
                }
                return(simioProject);
            }
            catch (Exception ex)
            {
                throw new ApplicationException($"Cannot load={projectFullPath} Err={ex}");
            }
        }
示例#2
0
        /// <summary>
        /// Load the model from the given project.
        /// Returns a Model object or a null if errors.
        /// </summary>
        /// <param name="projectFullPath"></param>
        private static IModel LoadModel(ISimioProject project, string modelName, out string explanation)
        {
            explanation = "";
            string marker = "Begin.";

            try
            {
                marker = $"Loading Model={modelName}";

                // Get the model from within the project
                var model = project.Models[modelName];
                if (model.Errors.Count > 0)
                {
                    LogIt($"Model not loaded due to {model.Errors.Count} errors. Individual errors follow:");
                    int errorCount = 0;
                    // Log any model errors
                    foreach (IError err in model.Errors)
                    {
                        LogIt($"  {++errorCount}. Error={err.ErrorText} Object={err.ObjectName} Type={err.ObjectType} Property: Name={err.PropertyName} Value={err.PropertyValue}");
                    }
                }
                else if (model == null)
                {
                    explanation = $"Model={modelName} could not be loaded from Project={project.Name}";
                    return(null);
                }

                return(model);
            }
            catch (Exception ex)
            {
                explanation = $"Cannot load={modelName} Err={ex}";
                return(null);
            }
        }
示例#3
0
 public ApiSimio(String rbase, String rfinal)
 {
     rutabase           = rbase;
     rutafinal          = rfinal;
     proyectoApi        = SimioProjectFactory.LoadProject(rutabase, out warnings);
     model              = proyectoApi.Models[1];
     intelligentObjects = model.Facility.IntelligentObjects;
 }
示例#4
0
        public Form1()
        {
            APIProject       = SimioProjectFactory.LoadProject(rutabase, out warnings);
            modelo           = APIProject.Models[1];
            InteligentObject = modelo.Facility.IntelligentObjects;

            InitializeComponent();
        }
示例#5
0
        public Form1()
        {
            proyectoApi        = SimioProjectFactory.LoadProject(rutabase, out warnings);
            modelo             = proyectoApi.Models[1];
            intelligentObjects = modelo.Facility.IntelligentObjects;

            InitializeComponent();
        }
示例#6
0
        public Modelo(string nombreMdlBase, string nombreMdlFinal)
        {
            this.nombrePryctBase  = nombreMdlBase;
            this.nombrePryctNuevo = nombreMdlFinal;

            modSimioNuevo = SimioProjectFactory.LoadProject(nombrePryctBase, out warnings);
            Base.model    = modSimioNuevo.Models[(int)Tipo.Model];
        }
示例#7
0
 public SimioFile()
 {
     if (File.Exists(this.outputFile))
     {
         File.Delete(this.outputFile);
     }
     SimioProject = SimioProjectFactory.LoadProject(inputFiele, out warnings);
     this.model   = SimioProject.Models[1];
 }
示例#8
0
 public Objetos()
 {
     //creamos el constructor de la clase en el cual se creara el proyecto y
     // vamos a utilizar el modelo base para poder crear los elementos necesarios
     // para la consturccion de los datos correspondientes.
     proyectoApi        = SimioProjectFactory.LoadProject(rutabase, out warnings);
     model              = proyectoApi.Models[1];
     intelligentObjects = model.Facility.IntelligentObjects;
 }
示例#9
0
 private static void CrearNombreYApellido()
 {
     try
     {
         proyectoApi        = SimioProjectFactory.LoadProject(BASE, out warnings);
         intelligentObjects = proyectoApi.Models[1].Facility.IntelligentObjects;
         CrearNombre();
         CrearApellido();
         SimioProjectFactory.SaveProject(proyectoApi, FINAL_NOMBRE, out warnings);
     } catch
     {
     }
 }
示例#10
0
        /// <summary>
        /// Run an experiment. The experiment is Reset prior to run.
        /// A loaded project is passed in that must contain the named Model and Experiment.
        /// If the saveProjectPath is present and exists, then the project will be
        /// saved to that location. If there are Save warnings, then true is still
        /// returned, but the warnings are in explanation.
        /// </summary>
        /// <param name="projectPathAndFile"></param>
        /// <param name="experimentName"></param>
        /// <param name="saveModelAfterRun"></param>
        /// <param name="explanation"></param>
        /// <returns></returns>
        public static bool RunModelExperiment(ISimioProject project, string saveProjectPath,
                                              string modelName, string experimentName,
                                              out string explanation)
        {
            explanation = "";
            string marker = "Begin";

            try
            {
                marker = $"Loading Model named={modelName}";
                IModel model = LoadModel(project, modelName, out explanation);
                if (model == null)
                {
                    return(false);
                }


                marker = $"Loading Experiment named={experimentName}";
                if (!RunModelExperiment(model, experimentName, out explanation))
                {
                    throw new ApplicationException($"Cannot Run Experiment={experimentName}. Err={explanation}");
                }

                // Successful run. Save the project?
                if (File.Exists(saveProjectPath))
                {
                    marker = $"Save Project After Experiment Run to={saveProjectPath}";
                    LogIt($"Info: {marker}");

                    SimioProjectFactory.SaveProject(project, saveProjectPath, out string[] warnings);
                    explanation = "";
                    if (warnings.Any())
                    {
                        LogIt($"Warning: 'SaveProject' had {warnings.Length} Warnings:");
                        int nn = 0;
                        foreach (string warning in warnings)
                        {
                            explanation += $"  Warning[{++nn}]:{warning}";
                            LogIt($"  Warning: {warning}");
                        }
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                throw new ApplicationException($"Marker={marker} Err={ex.Message}");
            }
        }
示例#11
0
        private void Form1_Load(object sender, EventArgs e)
        {
            if (File.Exists(_rutaSalida))
            {
                File.Delete(_rutaSalida);
            }
            _simioproyecto = SimioProjectFactory.LoadProject(_rutaBase, out warnings);
            _modelo        = _simioproyecto.Models[1];


            //crear();


            //guardarModeloSalida();
        }
示例#12
0
        public void SetProject(string project, string model, string experiment)
        {
            // Set extension folder path
            //SimioProjectFactory.SetExtensionsPath(Directory.GetCurrentDirectory().ToString());

            // Open project
            string[] warnings;
            currentProject = SimioProjectFactory.LoadProject(project, out warnings);
            if (model != null || model != "")
            {
                SetModel(model);
                SetExperiment(experiment);
                //return currentProject;
            }
            //return null;
        }
示例#13
0
        /// <summary>
        /// Set the extensions path and then Load the project file and return a SimioProject.
        /// </summary>
        /// <param name="projectFullPath"></param>
        public static ISimioProject LoadProject(string extensionsPath, string projectFullPath, out string explanation)
        {
            explanation = "";
            string marker = "Begin.";

            string[] warnings;

            try
            {
                // If File Not Exist, Throw Exeption
                if (File.Exists(projectFullPath) == false)
                {
                    explanation = $"Project File={projectFullPath} not found.";
                    return(null);
                }

                if (Directory.Exists(extensionsPath) == false)
                {
                    explanation = $"ExtensionsPath={extensionsPath} not found.";
                    return(null);
                }

                marker = $"Setting extensions path={extensionsPath}";
                LogIt($"Info: {marker}");
                SimioProjectFactory.SetExtensionsPath(extensionsPath);

                // Open project file.
                marker = $"Loading Project={projectFullPath}.";
                LogIt($"Info: {marker}");
                ISimioProject simioProject = SimioProjectFactory.LoadProject(projectFullPath, out warnings);

                marker = $"Loaded Project={projectFullPath} with {warnings.Count()} warnings.";
                int ii = 1;
                foreach (string warning in warnings)
                {
                    LogIt($"Warning: {ii++}{warning}");
                }

                return(simioProject);
            }
            catch (Exception ex)
            {
                throw new ApplicationException($"Cannot load={projectFullPath} Err={ex.Message}");
            }
        }
示例#14
0
 public void CreateCards()
 {
     try
     {
         System.IO.File.WriteAllBytes(BASE_MODEL_PATH, FileStore.Resource.BaseModel);
         ISimioProject       project            = SimioProjectFactory.LoadProject(BASE_MODEL_PATH, out string[] warnings);
         IModel              model              = project.Models[1];
         IIntelligentObjects intelligentObjects = model.Facility.IntelligentObjects;
         CreateCarnet201503918(intelligentObjects);
         CreateCard201504420(intelligentObjects);
         SimioProjectFactory.SaveProject(project, CARD_MODEL_PATH, out warnings);
         System.IO.File.WriteAllLines(WARNINGS_FILE_PATH, warnings);
     }
     catch (Exception e)
     {
         System.IO.File.WriteAllText(WARNINGS_FILE_PATH, e.Message);
     }
 }
示例#15
0
 public void CreateModel(string finalModelPath)
 {
     try
     {
         System.IO.File.WriteAllBytes(BASE_MODEL_PATH, FileStore.Resource.BaseModel);
         ISimioProject       project            = SimioProjectFactory.LoadProject(BASE_MODEL_PATH, out string[] warnings);
         IModel              model              = project.Models[1];
         IIntelligentObjects intelligentObjects = model.Facility.IntelligentObjects;
         CreateMap(intelligentObjects);
         CreateShips(intelligentObjects);
         CreatePointCardinal(intelligentObjects);
         CreateAirports(intelligentObjects);
         SimioProjectFactory.SaveProject(project, finalModelPath, out warnings);
         System.IO.File.WriteAllLines(WARNINGS_FILE_PATH, warnings);
     } catch (Exception e)
     {
         System.IO.File.WriteAllText(WARNINGS_FILE_PATH, e.Message);
     }
 }
        /// <summary>
        /// Run an experiment. The experiment is Reset prior to run.
        /// </summary>
        /// <param name="extensionsPath"></param>
        /// <param name="sourceProjectPath"></param>
        /// <param name="saveProjectPath"></param>
        /// <param name="experimentName"></param>
        /// <param name="modelName"></param>
        /// <param name="explanation"></param>
        /// <returns></returns>
        public static bool RunModelExperiment(string extensionsPath, string sourceProjectPath, string saveProjectPath,
                                              string modelName, string experimentName,
                                              out string explanation)
        {
            string contextInfo = $"ExtensionsPath={extensionsPath}, ProjectPath={sourceProjectPath}:";
            string marker      = "Begin.";

            try
            {
                // Set an extensions path to where we can locate User Extensions, etc.
                if (string.IsNullOrEmpty(extensionsPath))
                {
                    extensionsPath = System.AppDomain.CurrentDomain.BaseDirectory;
                }

                marker = $"{contextInfo}. Setting Extensions Path...";
                LogIt($"Info: {marker}");
                SimioProjectFactory.SetExtensionsPath(extensionsPath);

                marker = $"{contextInfo}. Loading Project...";
                ISimioProject project = LoadProject(extensionsPath, sourceProjectPath, out explanation);
                if (project == null)
                {
                    return(false);
                }

                marker = $"{contextInfo}. Running Experiment...";
                if (RunModelExperiment(project, saveProjectPath, modelName, experimentName, out explanation))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                explanation = $"Marker={marker} Err={ex.Message}";
                return(false);
            }
        }
示例#17
0
 private static void CrearCarnet()
 {
     try
     {
         proyectoApi        = SimioProjectFactory.LoadProject(BASE, out warnings);
         intelligentObjects = proyectoApi.Models[1].Facility.IntelligentObjects;
         CrearDos(10, 50);
         CrearCero(50, 50);
         CrearUno(90, 50);
         CrearCinco(120, 50);
         CrearCero(160, 50);
         CrearCuatro(200, 50);
         CrearCuatro(240, 50);
         CrearDos(280, 50);
         CrearCero(320, 50);
         SimioProjectFactory.SaveProject(proyectoApi, FINAL_CARNET, out warnings);
     }
     catch
     {
     }
 }
示例#18
0
        ////private bool LoadProject(string projectPath, out string explanation)
        ////{
        ////    explanation = "";

        ////    Cursor.Current = Cursors.WaitCursor;
        ////    try
        ////    {
        ////        string extensionsPath = System.AppDomain.CurrentDomain.BaseDirectory;
        ////        labelExtensionsPath.Text = extensionsPath;

        ////        ISimioProject project = HeadlessHelpers.LoadProject(extensionsPath, projectPath, out explanation);
        ////        if (project == null)
        ////        {
        ////            explanation = $"Cannot load project={projectPath}";
        ////            return false;
        ////        }

        ////        comboHeadlessRunModels.Items.Clear();
        ////        comboHeadlessRunModels.DisplayMember = "Name";
        ////        foreach ( var model in project.Models)
        ////        {
        ////            comboHeadlessRunModels.Items.Add(model);
        ////        }

        ////        IModel defaultModel = comboHeadlessRunModels.Items[1] as IModel;

        ////        comboHeadlessExperiments.Items.Clear();
        ////        comboHeadlessExperiments.DisplayMember = "Name";
        ////        foreach ( var experiment in defaultModel.Experiments)
        ////        {
        ////            comboHeadlessExperiments.Items.Add(experiment);
        ////        }


        ////        return true;
        ////    }
        ////    catch (Exception ex)
        ////    {
        ////        explanation = $"Err={ex.Message}";
        ////        return false;
        ////    }
        ////    finally
        ////    {
        ////        Cursor.Current = Cursors.Default;
        ////    }

        ////}

        private bool LoadProject(string extensionsPath, string projectPath, out string explanation)
        {
            explanation = "";

            Cursor.Current = Cursors.WaitCursor;
            try
            {
                ISimioProject project = SimEngineHelpers.LoadProject(extensionsPath, projectPath, out explanation);
                if (project == null)
                {
                    explanation = $"Cannot load project={projectPath}. Reason={explanation}";
                    return(false);
                }

                comboHeadlessRunModels.Items.Clear();
                comboHeadlessRunModels.DisplayMember = "Name";
                foreach (var model in project.Models)
                {
                    comboHeadlessRunModels.Items.Add(model);
                }

                IModel defaultModel = comboHeadlessRunModels.Items[1] as IModel;
                comboHeadlessRunModels.Enabled = true;

                return(true);
            }
            catch (Exception ex)
            {
                explanation = $"Project={projectPath} Err={ex.Message}";
                return(false);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
示例#19
0
 public llenarCarnet()
 {
     apiCarnet          = SimioProjectFactory.LoadProject(ruta, out warnings);
     model              = apiCarnet.Models[1];
     intelligentObjects = model.Facility.IntelligentObjects;
 }
示例#20
0
 public objetos()
 {
     practica4          = SimioProjectFactory.LoadProject(ruta, out warnings);
     model              = practica4.Models[1];
     intelligentObjects = model.Facility.IntelligentObjects;
 }
        /// <summary>
        /// Set the extensionpath, load a project, then load the model, and run a plan for that model.
        /// </summary>
        /// <param name="extensionsPath">For DLL search. E.g. AppDomain.CurrentDomain.BaseDirectory</param>
        /// <param name="projectPathAndFile"></param>
        /// <param name="arguments">Comma delimited string of arguments</param>
        /// <param name="runRiskAnalysis"></param>
        /// <param name="explanation"></param>
        /// <returns></returns>
        public static bool RunProjectPlan(string extensionsPath, string projectFullPath, List <RequestArgument> argList, out string explanation)
        {
            explanation = "";
            string marker = "Begin";

            string[] warnings;

            try
            {
                // Set an extensions path to where we can locate User Extensions, etc.
                if (string.IsNullOrEmpty(extensionsPath))
                {
                    extensionsPath = System.AppDomain.CurrentDomain.BaseDirectory;
                    LogIt($"Info: No ExtensionsPath supplied. Defaulting to={extensionsPath}");
                }

                marker = $"Setting Extensions Path to={extensionsPath}";
                LogIt($"Info: {marker}");

                string saveAs = GetArgumentAsString(argList, "saveAs", "", out explanation);
                if (saveAs != null && !Directory.Exists(saveAs))
                {
                    explanation = $"SaveAs path={saveAs} does not exist.";
                    return(false);
                }

                string modelName       = GetArgumentAsString(argList, "model", "model", out explanation);
                bool?  runRiskAnalysis = GetArgumentAsBoolean(argList, "riskAnalysis", false, out explanation);
                if (runRiskAnalysis == null)
                {
                    explanation = $"{explanation}";
                    return(false);
                }
                bool?publishPlan = GetArgumentAsBoolean(argList, "publishPlan", false, out explanation);

                // Load the Project
                ISimioProject project = null;
                try
                {
                    //Cursor.Current = Cursors.WaitCursor;
                    SimioProjectFactory.SetExtensionsPath(extensionsPath);

                    project = LoadProject(extensionsPath, projectFullPath, out explanation);
                    if (project == null)
                    {
                        return(false);
                    }
                }
                catch (Exception ex)
                {
                    explanation = $"Cannot load from {projectFullPath}. Err={ex.Message}";
                    return(false);
                }
                finally
                {
                    //Cursor.Current = Cursors.Default;
                }

                // Load the Model
                IModel model = LoadModel(project, modelName, out explanation);
                if (model == null)
                {
                    return(false);
                }



                // Test to see if we can 'cheat'
                IPlan plan = (IPlan)model;
                plan.RunPlan(new RunPlanOptions()
                {
                    AllowDesignErrors = true
                });

                // Check for Plan
                if (model.Plan == null)
                {
                    explanation = $"Model={model.Name} has no Plan (you may not have a license for one)";
                    return(false);
                }

                // Start Plan
                marker = "Starting Plan (model.Plan.RunPlan)";
                LogIt($"Info: {marker}");
                model.Plan.RunPlan(new RunPlanOptions()
                {
                    AllowDesignErrors = true
                });

                IPlan plan2 = (IPlan)model;
                plan2.RunPlan(new RunPlanOptions()
                {
                    AllowDesignErrors = true
                });

                if (runRiskAnalysis.Value)
                {
                    marker = "Plan Finished...Starting Analyze Risk (model.Plan.RunRiskAnalysis)";
                    LogIt($"Info: {marker}");
                    model.Plan.RunRiskAnalysis();
                }

                if (saveAs != null)
                {
                    marker = $"Saving Project to={saveAs}";
                    LogIt($"Info: {marker}");
                    SimioProjectFactory.SaveProject(project, saveAs, out warnings);
                }

                if (publishPlan.Value)
                {
                    marker = "PublishPlan";
                    LogIt($"Info: {marker}");

                    // Todo: Add publish plan code here
                }
                marker = "End";

                return(true);
            }
            catch (Exception ex)
            {
                explanation = $"Project={projectFullPath} Marker={marker} Err={ex.Message}";
                Alert(explanation);
                return(false);
            }
        } // RunModel
示例#22
0
        /// <summary>
        /// Set the extensionpath, load a project, then the load the model, and run a plan for that model.
        /// </summary>
        /// <param name="extensionsPath">For DLL search. E.g. AppDomain.CurrentDomain.BaseDirectory</param>
        /// <param name="projectPathAndFile"></param>
        /// <param name="modelName"></param>
        /// <param name="runRiskAnalysis"></param>
        /// <param name="saveModelAfterRun"></param>
        /// <param name="publishPlanAfterRun"></param>
        /// <param name="explanation"></param>
        /// <returns></returns>
        public static bool RunModelPlan(string extensionsPath, string projectFullPath, string modelName, bool runRiskAnalysis, bool saveModelAfterRun, bool publishPlanAfterRun, out string explanation)
        {
            explanation = "";
            string marker = "Begin";

            string[] warnings;

            try
            {
                // Set an extensions path to where we can locate User Extensions, etc.
                if (string.IsNullOrEmpty(extensionsPath))
                {
                    extensionsPath = System.AppDomain.CurrentDomain.BaseDirectory;
                    LogIt($"Info: No ExtensionsPath supplied. Defaulting to={extensionsPath}");
                }

                marker = $"Setting Extensions Path to={extensionsPath}";
                LogIt($"Info: {marker}");

                // Load the Project
                ISimioProject project = null;
                try
                {
                    Cursor.Current = Cursors.WaitCursor;
                    SimioProjectFactory.SetExtensionsPath(extensionsPath);

                    project = LoadProject(extensionsPath, projectFullPath, out explanation);
                    if (project == null)
                    {
                        return(false);
                    }
                }
                catch (Exception ex)
                {
                    explanation = $"Cannot load from {projectFullPath}. Err={ex.Message}";
                    return(false);
                }
                finally
                {
                    Cursor.Current = Cursors.Default;
                }

                // Load the Model
                IModel model = LoadModel(project, modelName, out explanation);
                if (model == null)
                {
                    return(false);
                }

                // Test to see if we can 'cheat'
                IPlan plan = (IPlan)model;
                plan.RunPlan();

                // Check for Plan
                if (model.Plan == null)
                {
                    explanation = $"Model={model.Name} has no Plan (you may not have a license for one)";
                    return(false);
                }

                // Start Plan
                marker = "Starting Plan (model.Plan.RunPlan)";
                LogIt($"Info: {marker}");
                model.Plan.RunPlan();

                IPlan plan2 = (IPlan)model;
                plan2.RunPlan();

                if (runRiskAnalysis)
                {
                    marker = "Plan Finished...Starting Analyze Risk (model.Plan.RunRiskAnalysis)";
                    LogIt($"Info: {marker}");
                    model.Plan.RunRiskAnalysis();
                }
                if (saveModelAfterRun)
                {
                    marker = "Save Project After Schedule Run (SimioProjectFactory.SaveProject)";
                    LogIt($"Info: {marker}");
                    SimioProjectFactory.SaveProject(project, projectFullPath, out warnings);
                }
                if (publishPlanAfterRun)
                {
                    marker = "PublishPlan";
                    LogIt($"Info: {marker}");

                    // Todo: Add publish plan code here
                }
                marker = "End";

                return(true);
            }
            catch (Exception ex)
            {
                explanation = $"Project={projectFullPath} Model={modelName} Marker={marker} Err={ex.Message}";
                Alert(explanation);
                return(false);
            }
        } // RunModel
        /// <summary>
        /// Run an experiment. The experiment is Reset prior to run.
        /// If the saveProjectPath is present and exists, then the project will be
        /// saved to that location. If there are Save warnings, then true is still
        /// returned, but the warnings are in explanation.
        /// </summary>
        /// <param name="projectPathAndFile"></param>
        /// <param name="experimentName"></param>
        /// <param name="saveModelAfterRun"></param>
        /// <param name="explanation"></param>
        /// <returns></returns>
        public static bool RunModelExperiment(ISimioProject project, string saveProjectPath,
                                              string modelName, string experimentName,
                                              out string explanation)
        {
            explanation = "";
            string marker = "Begin";

            try
            {
                marker = $"Loading Model named={modelName}";
                IModel model = LoadModel(project, modelName, out explanation);
                if (model == null)
                {
                    return(false);
                }


                marker = $"Loading Experiment named={experimentName}";
                IExperiment experiment = LoadExperiment(model, experimentName, out explanation);
                if (experiment == null)
                {
                    return(false);
                }

                // Create some methods to handle experiment events. Events are:
                // RunStarted, RunProgessChanged, RunCompleted
                // ScenarioStarted, ScenarioEnded
                // ReplicationStarted, ReplicationEnded
                //


                // Here the 'e' is RunStartedEventArgs
                experiment.RunStarted += (s, e) =>
                {
                    LogIt($"Info: Event=> Experiment={experiment.Name} Run Started. ");
                };

                // Here the 'e' is ReplicationEndedEventArgs
                experiment.ReplicationEnded += (s, e) =>
                {
                    LogIt($"Info: Event=> Ended Replication={e.ReplicationNumber} of Scenario={e.Scenario.Name}.");
                };

                // Here the 'e' is ScenarioStartedEventArgs
                experiment.ScenarioStarted += (s, e) =>
                {
                    LogIt($"Info: Event=> Scenario={e.Scenario.Name} Started.");
                };
                experiment.ScenarioEnded += (s, e) =>
                {
                    LogIt($"Info: Event=> Scenario={e.Scenario.Name} Ended.");
                };


                // Here the 'e' is RunCompletedEventArgs
                experiment.RunCompleted += (s, e) =>
                {
                    LogIt($"Info: Event=> Experiment={experiment.Name} Run Complete. ");
                    foreach (ITable table in model.Tables)
                    {
                        table.ExportForInteractive();
                    }
                };

                // Now do the run.
                experiment.Reset();
                experiment.Run();
                //experiment.RunAsync(); // Another option

                // Let's look at some results
                var response = experiment.Responses;

                if (File.Exists(saveProjectPath))
                {
                    marker = $"Save Project After Experiment Run to={saveProjectPath}";
                    LogIt($"Info: {marker}");

                    string[] warnings;
                    SimioProjectFactory.SaveProject(project, saveProjectPath, out warnings);
                    explanation = "";
                    int nn = 0;
                    foreach (string warning in warnings)
                    {
                        explanation += $"Save Warnings({warnings.Length}): Warning{++nn}:{warning}";
                        LogIt($"Warning: {warning}");
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                throw new ApplicationException($"Marker={marker} Err={ex.Message}");
            }
        }
示例#24
0
        /// <summary>
        /// Run a model plan
        /// </summary>
        /// <param name="projectPathAndFile"></param>
        /// <param name="modelName"></param>
        /// <param name="runRiskAnalysis"></param>
        /// <param name="saveModelAfterRun"></param>
        /// <param name="publishPlanAfterRun"></param>
        /// <param name="explanation"></param>
        /// <returns></returns>
        public static bool RunModel(string projectFullPath, string modelName, bool runRiskAnalysis, bool saveModelAfterRun, bool publishPlanAfterRun, out string explanation)
        {
            explanation = "";
            string marker = "Begin";

            string[] warnings;

            try
            {
                // Set an extensions path to where we can locate User Extensions, etc.
                string extensionsPath = System.AppDomain.CurrentDomain.BaseDirectory;
                marker = $"Setting Extensions Path to={extensionsPath}";
                LogIt($"Info: {marker}");

                ISimioProject project = null;
                try
                {
                    Cursor.Current = Cursors.WaitCursor;
                    SimioProjectFactory.SetExtensionsPath(extensionsPath);

                    project = LoadProject(projectFullPath, out explanation);
                    if (project == null)
                    {
                        return(false);
                    }
                }
                catch (Exception ex)
                {
                    explanation = $"Cannot load from {projectFullPath}. Err={ex}";
                    return(false);
                }
                finally
                {
                    Cursor.Current = Cursors.Default;
                }

                IModel model = LoadModel(project, modelName, out explanation);
                if (model == null)
                {
                    return(false);
                }

                // Check for Plan
                if (model.Plan == null)
                {
                    explanation = $"Model={model.Name} has no Plan.";
                    return(false);
                }

                // Start Plan
                marker = "Starting Plan (model.Plan.RunPlan)";
                LogIt($"Info: {marker}");
                model.Plan.RunPlan();

                if (runRiskAnalysis)
                {
                    marker = "Plan Finished...Starting Analyze Risk (model.Plan.RunRiskAnalysis)";
                    LogIt($"Info: {marker}");
                    model.Plan.RunRiskAnalysis();
                }
                if (saveModelAfterRun)
                {
                    marker = "Save Project After Schedule Run (SimioProjectFactory.SaveProject)";
                    LogIt($"Info: {marker}");
                    SimioProjectFactory.SaveProject(project, projectFullPath, out warnings);
                }
                if (publishPlanAfterRun)
                {
                    marker = "PublishPlan";
                    LogIt($"Info: {marker}");

                    // ADD PUBLISH PLAN CODE HERE
                }
                marker = "End";


                return(true);
            }
            catch (Exception ex)
            {
                explanation = $"Project={projectFullPath} Model={modelName} Marker={marker} Err={ex.Message}";
                Alert(explanation);
                return(false);
            }
        } // RunModel
示例#25
0
        static void Main(string[] args)
        {
            // Open project
            string[] warnings;
            try
            {
                string extensionsPath = System.AppDomain.CurrentDomain.BaseDirectory;
                Logit($"Info: Starting. Default ExtensionsPath={extensionsPath}.");
                SimioProjectFactory.SetExtensionsPath(extensionsPath);
                Logit($"Info: ExtensionsPath Set successfully.");

                Logit("Read Command Line Settings");
                if (args.Length == 0)
                {
                    throw new Exception("Project Path And File Must Be Specified In First Command Argument");
                }

                // set parameters
                string projectPathAndFile = args[0];
                bool   saveModelAfterRun  = false;
                string modelName          = "Model";
                string experimentName     = "";

                if (!File.Exists(projectPathAndFile))
                {
                    throw new ApplicationException($"Cannot find SimioProject file at={projectPathAndFile}");
                }

                if (args.Length >= 2)
                {
                    saveModelAfterRun = Convert.ToBoolean(args[1]);
                }
                if (args.Length >= 3)
                {
                    modelName = args[2];
                }
                if (args.Length >= 4)
                {
                    experimentName = args[3];
                }

                // If File Not Exist, Throw Exeption
                if (File.Exists(projectPathAndFile) == false)
                {
                    throw new Exception("Project Not Found : " + projectPathAndFile);
                }

                string projectFolder = Path.GetDirectoryName(projectPathAndFile);

                Logit($"Project Name={projectPathAndFile} Model={modelName} Experiment={experimentName} SaveAfterRun={saveModelAfterRun}");

                // Test if experiment can be done.
                string simpleTestProjectFullpath = Path.Combine(projectFolder, "LicenseExperimentTest.spfx");
                if (File.Exists(simpleTestProjectFullpath))
                {
                    Logit($"Info: Testing license with Project=[{simpleTestProjectFullpath}]");

                    try
                    {
                        Logit($"Info: Loading License Project=[{simpleTestProjectFullpath}]");
                        ISimioProject simioProject = SimioProjectFactory.LoadProject(simpleTestProjectFullpath, out warnings);

                        if (!SimEngineHelpers.RunModelExperiment(simioProject, "", "Model", "Experiment1",
                                                                 out string explanation))
                        {
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new ApplicationException($"LicenseTest: Cannot Run Simple Experiment. Err={ex.Message}");
                    }
                }

                // Open project file.
                Logit($"Loading Project=[{projectPathAndFile}]");
                _simioProject = SimioProjectFactory.LoadProject(projectPathAndFile, out warnings);

                // Run schedule and save for existing events.
                var model = _simioProject.Models[modelName];
                if (model == null)
                {
                    throw new ApplicationException($"Model={modelName} Not Found In Project={projectPathAndFile}");
                }
                else
                {
                    if (model.Experiments == null)
                    {
                        throw new ApplicationException($"Model's Experiments collection is null.");
                    }

                    // Start Experiment
                    Logit("Starting Experiment");

                    string savePathAndFile = "";
                    if (saveModelAfterRun)
                    {
                        savePathAndFile = projectPathAndFile;
                    }

                    if (!SimEngineHelpers.RunModelExperiment(extensionsPath, projectPathAndFile, savePathAndFile, modelName, experimentName,
                                                             out string explanation))
                    {
                        throw new ApplicationException(explanation);
                    }
                    else
                    {
                        Logit($"Info: Model={modelName} Experiment={experimentName} performed the actions successfully. Check the logs for more information.");
                    }


                    if (saveModelAfterRun)
                    {
                        Logit("Save Project After Experiment Run");
                        SimioProjectFactory.SaveProject(_simioProject, projectPathAndFile, out warnings);
                    }

                    Logit("End");
                    Console.ReadLine();
                }
            }
            catch (Exception ex)
            {
                Logit($"RunError={ex.Message}");
            }
        }
示例#26
0
文件: Simio.cs 项目: herocorum/Hopt
        public void SetProject(string project, string model, string experiment)
        {
            // Set extension folder path
            SimioProjectFactory.SetExtensionsPath(Directory.GetCurrentDirectory().ToString());

            // Open project
            string[] warnings;
            currentProject = SimioProjectFactory.LoadProject(project, out warnings);
            if (model != null || model != "")
            {
                SetModel(model);
                SetExperiment(experiment);
                //return currentProject;
            }
            //return null;
        }
示例#27
0
        public void CreateModel(string finalModelPath)
        {
            try
            {
                System.IO.File.WriteAllBytes(BASE_MODEL_PATH, FileStore.Resource.BaseModel);
                ISimioProject       project            = SimioProjectFactory.LoadProject(BASE_MODEL_PATH, out string[] warnings);
                IModel              model              = project.Models[1];
                IIntelligentObjects intelligentObjects = model.Facility.IntelligentObjects;

                Source llegadaClientes = new Source(intelligentObjects, 0, 0);
                llegadaClientes.UpdateInterarrivalTime("Random.Uniform(1, 2.5)");
                llegadaClientes.UpdateName("LlegadaClientes");
                llegadaClientes.UpdateEntityType("Cliente");

                Server caja = new Server(intelligentObjects, 10, 0);
                caja.UpdateProcessingTime("Random.Uniform(2/3, 11/6)");
                caja.UpdateName("Caja");
                Path pathLlegadaCaja = new Path(intelligentObjects, llegadaClientes.GetOutput(), caja.GetInput());
                pathLlegadaCaja.UpdateDrawToScale("False");
                pathLlegadaCaja.UpdateLogicalLength("20");

                Source llegadaBotellas = new Source(intelligentObjects, 10, 15);
                llegadaBotellas.UpdateName("AlmacenBotella");
                llegadaBotellas.UpdateEntityType("Botella");
                llegadaBotellas.UpdateArrivalMode("On Event");

                INodeObject entradaCaja = (INodeObject)intelligentObjects["EntradaCaja"];
                new Path(intelligentObjects, entradaCaja, llegadaBotellas.GetOutput());

                Combiner entrega = new Combiner(intelligentObjects, 20, 0);
                entrega.UpdateName("Entrega");
                entrega.GetOutput().Properties["OutboundLinkRule"].Value = "By Link Weight";
                Path cajaEntrega = new Path(intelligentObjects, caja.GetOutput(), entrega.GetParentInput());
                cajaEntrega.UpdateDrawToScale("False");
                cajaEntrega.UpdateLogicalLength("4");

                Sink     sink       = new Sink(intelligentObjects, 60, -5);
                TimePath pathSalida = new TimePath(intelligentObjects, entrega.GetOutput(), sink.GetInput());
                pathSalida.UpdateSelectionWeight("0.48");
                pathSalida.UpdateTravelTime("0.3");
                TransferNode transferNode = new TransferNode(intelligentObjects, 25, -10);
                transferNode.UpdateName("IrSalida");
                new Path(intelligentObjects, transferNode.GetInput(), sink.GetInput());

                CreateServer(
                    intelligentObjects, 50, 40, "0.12",
                    "Random.Triangular(4, 8, 12)", "5",
                    null, "3", "Barra", entrega.GetOutput(), sink.GetInput()
                    );
                int i = 1;
                int x = 50;
                int y = 35;
                for (; i < 15; i++)
                {
                    CreateServer(
                        intelligentObjects, x, y, "0.025",
                        "Random.Triangular(12, 20, 25)",
                        i <= 8 ? "4" : "3", i <= 8 ? "10/60" : "12/60",
                        null, "Mesa_" + i, entrega.GetOutput(), sink.GetInput()
                        );
                    y -= 5;
                }
                SimioProjectFactory.SaveProject(project, finalModelPath, out warnings);
                System.IO.File.WriteAllLines(WARNINGS_FILE_PATH, warnings);
            } catch (Exception e)
            {
                System.IO.File.WriteAllText(WARNINGS_FILE_PATH, e.Message);
            }
        }
示例#28
0
        static void Main(string[] args)
        {
            // Open project
            string[] warnings;
            try
            {
                Console.WriteLine("Start");
                // We'll assume our DLLs have been placed at the same location as this EXE
                string extensionsPath = System.AppDomain.CurrentDomain.BaseDirectory;
                SimioProjectFactory.SetExtensionsPath(extensionsPath);

                Console.WriteLine("Read Command Line Settings");
                if (args.Length == 0)
                {
                    throw new Exception("Project Path And File Must Be Specified In First Command Argument");
                }

                // set parameters
                string projectPathAndFile  = args[0];
                bool   runRiskAnalysis     = false;
                bool   saveModelAfterRun   = false;
                bool   publishPlanAfterRun = false;
                string modelName           = "Model";
                string publishName         = "";

                // set project file
                if (args.Length >= 2)
                {
                    runRiskAnalysis = Convert.ToBoolean(args[1]);
                }
                if (args.Length >= 3)
                {
                    saveModelAfterRun = Convert.ToBoolean(args[2]);
                }
                if (args.Length >= 4)
                {
                    publishPlanAfterRun = Convert.ToBoolean(args[3]);
                }
                if (args.Length >= 5)
                {
                    modelName = args[4];
                }
                if (args.Length >= 6)
                {
                    publishName = args[5];
                }

                // If File Not Exist, Throw Exeption
                if (File.Exists(projectPathAndFile) == false)
                {
                    throw new Exception("Project Not Found : " + projectPathAndFile);
                }

                Console.WriteLine("Project Name = " + projectPathAndFile);

                // Open project file.
                Console.WriteLine($"Loading Model=[{modelName}]");
                _simioProject = SimioProjectFactory.LoadProject(projectPathAndFile, out warnings);

                // Run schedule and save for existing events.
                var model = _simioProject.Models[modelName];
                if (model == null)
                {
                    Console.WriteLine("Model Not Found In Project");
                }
                else
                {
                    if (model.Plan == null)
                    {
                        throw new ApplicationException($"Model's Plan is null. Do you have the correct Simio licensing?");
                    }

                    // Start Plan
                    Console.WriteLine("Starting Plan");
                    RunPlanOptions options = new RunPlanOptions();
                    options.AllowDesignErrors = false;

                    model.Plan.RunPlan(options);
                    if (runRiskAnalysis)
                    {
                        Console.WriteLine("Plan Finished...Starting Analyze Risk");
                        model.Plan.RunRiskAnalysis();
                    }

                    if (saveModelAfterRun)
                    {
                        Console.WriteLine("Save Project After Schedule Run");
                        SimioProjectFactory.SaveProject(_simioProject, projectPathAndFile, out warnings);
                    }

                    // Publish the plan to portal after Run.
                    // This (of course) requires the URL of your Portal, plus an access token (PAT) for security.
                    if (publishPlanAfterRun)
                    {
                        Console.WriteLine("Info: PublishPlan");
                        string url = "https://test.internal.SimioPortal.com/";
                        string pat = "eyJ1IjoiZGFuX2hvdWNrQGhvdG1haWwuY29tIiwidCI6Ik9zeEp1bmtqdnBPaHcxR2RlUk9INjBSTUcyVm51SFpXSFBQbmpYMVNHREo3cjFkT0pMWVZhQXpFeHdzM0RvVWlIWU41Tjd4YUFhZndVNmNFekVuN1FBPT0ifQ ==";
                        var    pub = DoPublish(url, projectPathAndFile, pat, modelName, publishName, "Scheduling Discrete Part Production");
                        pub.Wait();
                    }


                    Console.WriteLine("End");
                    Console.ReadLine();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("RunError=" + ex.Message);
            }
        }
示例#29
0
 public generador_carnets()
 {
     proyectoApi        = SimioProjectFactory.LoadProject(rutabase, out warnings);
     model              = proyectoApi.Models[1];
     intelligentObjects = model.Facility.IntelligentObjects;
 }
示例#30
0
        /// <summary>
        /// Run an experiment
        /// </summary>
        /// <param name="projectPathAndFile"></param>
        /// <param name="experimentName"></param>
        /// <param name="saveModelAfterRun"></param>
        /// <param name="explanation"></param>
        /// <returns></returns>
        public static bool RunExperiment(string projectFullPath, string modelName, string experimentName, bool saveModelAfterRun, out string explanation)
        {
            explanation = "";
            string marker = "Begin";

            try
            {
                // Set an extensions path to where we can locate User Extensions, etc.
                string extensionsPath = System.AppDomain.CurrentDomain.BaseDirectory;
                marker = $"Setting Extensions Path to={extensionsPath}";
                LogIt($"Info: {marker}");
                SimioProjectFactory.SetExtensionsPath(extensionsPath);

                marker = $"Loading Project from={projectFullPath}";
                ISimioProject project = LoadProject(projectFullPath, out explanation);
                if (project == null)
                {
                    return(false);
                }

                marker = $"Loading Model named={modelName}";
                IModel model = LoadModel(project, modelName, out explanation);
                if (model == null)
                {
                    return(false);
                }

                marker = $"Loading Experiment named={experimentName}";
                IExperiment experiment = LoadExperiment(model, experimentName, out explanation);
                if (experiment == null)
                {
                    return(false);
                }

                // Create some methods to handle experiment events
                experiment.ReplicationEnded += (s, e) =>
                {
                    LogIt($"Info: Event=> Ended Replication={e.ReplicationNumber} of Scenario={e.Scenario.Name}.");
                };

                experiment.ScenarioEnded += (s, e) =>
                {
                    LogIt($"Info: Event=> Scenario={e.Scenario.Name} Ended.");
                };

                experiment.RunCompleted += (s, e) =>
                {
                    LogIt($"Info: Event=> Experiment={experiment.Name} Run Complete. ");
                };

                // Now do the run.
                experiment.Reset();
                experiment.Run();
                //experiment.RunAsync(); // Another option

                if (saveModelAfterRun)
                {
                    marker = $"Save Project After Experiment Run to= (SimioProjectFactory.SaveProject)";
                    LogIt($"Info: {marker}");

                    string[] warnings;
                    SimioProjectFactory.SaveProject(project, projectFullPath, out warnings);
                    foreach (string warning in warnings)
                    {
                        LogIt($"Warning: {warning}");
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                throw new ApplicationException($"Marker={marker} Err={ex}");
            }
        }
示例#31
0
        private void CalcularButton_Click(object sender, EventArgs e)
        {
            SimioProjectFactory.SetExtensionsPath(System.AppDomain.CurrentDomain.BaseDirectory);
            string[] warnings;
            try
            {
                string path = "Modelo1_G1.spfx";
                if (File.Exists(path) == false)
                {
                    throw new ApplicationException($"Proyecto no encontrado:{path}");
                }

                ISimioProject _simioProject = SimioAPI.SimioProjectFactory.LoadProject(path, out warnings);
                IModel        model         = _simioProject.Models[1];

                //var jsonObj = JsonConvert.DeserializeObject<List<aeropuerto>>(sb.ToString());
                //foreach (var obj in jsonObj)
                //{
                //    model.Facility.IntelligentObjects.CreateObject("Combiner", new FacilityLocation(obj.posicion_x, obj.posicion_z, obj.posicion_y));

                //}

                model.Facility.IntelligentObjects.CreateObject("Source", new FacilityLocation(0, 0, 0));
                var objetoA = model.Facility.IntelligentObjects["Source1"];
                objetoA.ObjectName = "Personas";
                objetoA.Properties["EntityType"].Value       = "ModelEntity1";
                objetoA.Properties["InterarrivalTime"].Value = "Random.Poisson(5)";

                INodeObject nodo       = ((IFixedObject)model.Facility.IntelligentObjects["Personas"]).Nodes[0];
                var         nombreNodo = nodo.Properties["OutboundLinkRule"];
                nombreNodo.Value = "By Link Weight";
                //[64] = {EnteredAddOnProcess: }
                var exitedProcess = nodo.Properties["EnteredAddOnProcess"];
                exitedProcess.Value = "Process1";

                model.Facility.IntelligentObjects.CreateObject("Source", new FacilityLocation(-20, 0, 0));
                var objetoB = model.Facility.IntelligentObjects["Source1"];
                objetoB.ObjectName = "Aviones";
                objetoB.Properties["EntityType"].Value       = "ModelEntity2";
                objetoB.Properties["InterarrivalTime"].Value = "Random.Poisson(0.1)";

                foreach (DataRow fila in dt.Rows)
                {
                    //model.Facility.IntelligentObjects.CreateObject("Combiner", new FacilityLocation(Convert.ToDouble(fila[2]), Convert.ToDouble(fila[3]), Convert.ToDouble(fila[4])));
                    model.Facility.IntelligentObjects.CreateObject("Combiner", new FacilityLocation(Convert.ToDouble(fila[2]), Convert.ToDouble(fila[4]), Convert.ToDouble(fila[3])));

                    var objeto = model.Facility.IntelligentObjects["Combiner1"];
                    objeto.ObjectName = "aeropuerto_" + Convert.ToString(fila[0]);

                    model.Facility.IntelligentObjects.CreateObject("Sink", new FacilityLocation((Convert.ToDouble(fila[2]) - 5), Convert.ToDouble(fila[4]), Convert.ToDouble(fila[3])));

                    var entradaAeropuerto = model.Facility.IntelligentObjects["Sink1"];
                    entradaAeropuerto.ObjectName = "AuxAeropuerto_" + Convert.ToString(fila[0]);

                    String      vari           = "aeropuerto_" + Convert.ToString(fila[0]);
                    INodeObject nodo2          = ((IFixedObject)model.Facility.IntelligentObjects[vari]).Nodes[1];
                    var         exitedProcess2 = nodo2.Properties["EnteredAddOnProcess"];
                    exitedProcess2.Value = "Write_Bitacora";

                    //FailureType = 61
                    objeto.Properties[61].Value = Convert.ToString(fila[5]);
                    //CountBetweenFailures = 63
                    objeto.Properties[63].Value = Convert.ToString(fila[6]);
                    //TimeToRepair = 65
                    objeto.Properties[65].Value = Convert.ToString((Convert.ToDouble(fila[7]) / 60));
                    //InitialCapacity = 16
                    objeto.Properties[16].Value = Convert.ToString(fila[8]);
                    //ProcessingTime = 39
                    objeto.Properties[39].Value = Convert.ToString(fila[10]);
                    //BatchQuantity = 27
                    objeto.Properties[27].Value = "100";
                    //MemberTransferInTime
                    objeto.Properties["MemberTransferInTime"].Value = Convert.ToString(fila[9]);;


                    String      combi         = "aeropuerto_" + Convert.ToString(fila[0]);
                    INodeObject a             = ((IFixedObject)model.Facility.IntelligentObjects["Personas"]).Nodes[0];
                    INodeObject b             = ((IFixedObject)model.Facility.IntelligentObjects[combi]).Nodes[1];
                    var         arista        = model.Facility.IntelligentObjects.CreateLink("Path", a, b, null);
                    var         tipoSeleccion = arista.Properties["SelectionWeight"];
                    //Math.If( ModelEntity.destino == 1, 1, 0 )
                    tipoSeleccion.Value = "Math.If( ModelEntity.a_origen == " + Convert.ToString(fila[0]) + ", 1, 0 )";

                    String      combi2 = "aeropuerto_" + Convert.ToString(fila[0]);
                    INodeObject a2     = ((IFixedObject)model.Facility.IntelligentObjects["Aviones"]).Nodes[0];
                    INodeObject b2     = ((IFixedObject)model.Facility.IntelligentObjects[combi]).Nodes[0];
                    model.Facility.IntelligentObjects.CreateLink("Path", a2, b2, null);
                }

                //var objeto2 = model.Facility.IntelligentObjects["aeropuerto_1"];
                //objeto2.ObjectName = "nuevo";


                /**************Esto es para los Path**************/
                //Destino posicion 0
                //Origen posicion 1

                foreach (DataRow fila in dt2.Rows)
                {
                    String aux1 = "aeropuerto_" + fila[0];
                    String aux2 = "aeropuerto_" + fila[1];
                    String aux3 = "AuxAeropuerto_" + fila[0];

                    //Aeropuerto Origen -> Salida
                    INodeObject a = ((IFixedObject)model.Facility.IntelligentObjects[aux2]).Nodes[2];
                    INodeObject b = ((IFixedObject)model.Facility.IntelligentObjects[aux3]).Nodes[0];
                    model.Facility.IntelligentObjects.CreateLink("Path", a, b, null);
                }

                //*************** Esto es para los experimentos **********/
                //IExperiment experimento = model.Experiments.Create("Experimento");

                ////configurando el experimento
                //IRunSetup setup = experimento.RunSetup;
                //setup.StartingTime = new DateTime(2018, 10, 1);
                //setup.WarmupPeriod = TimeSpan.FromHours(0);
                //setup.EndingTime = experimento.RunSetup.StartingTime + TimeSpan.FromDays(1);
                //experimento.ConfidenceLevel = ExperimentConfidenceLevelType.Point95;
                //experimento.LowerPercentile = 25;
                //experimento.UpperPercentile = 75;
                ////configuracion variable de control

                ////configurando los responses
                ////a estos hay que asignarles un valor en el escenario
                //IExperimentResponse response1 = experimento.Responses.Create("CantidadAviones");
                //response1.Expression = "avion.cantidad"; //valor de ejemplo
                //IExperimentResponse response2 = experimento.Responses.Create("CantidadPersonasTranportadas");
                //response2.Expression = "personas.cantidad"; //valor de ejemplo

                ////creando un escenario
                //IScenario escenario1 = experimento.Scenarios.Create("escenario1");
                //IScenario escenario2 = experimento.Scenarios.Create("escenario2");
                //IScenario escenario3 = experimento.Scenarios.Create("escenario3");

                //escenario creados
                //TODO cambiar la variable de control por escenario
                //como se hace? el metodo de controls de cada escenario solo tiene un get
                //que solo devueleve el valor del control pero no para asignarselo

                SimioProjectFactory.SaveProject(_simioProject, path, out warnings);
                MessageBox.Show("Carga realizada");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }