public PET(CyPhyGUIs.IInterpreterMainParameters parameters, CyPhyGUIs.GMELogger logger) { this.Logger = logger; this.pet = CyPhyClasses.ParametricExploration.Cast(parameters.CurrentFCO); this.outputDirectory = parameters.OutputDirectory; config.MgaFilename = parameters.CurrentFCO.Project.ProjectConnStr.Substring("MGA=".Length); if (parameters.SelectedConfig != null) { config.SelectedConfigurations = new string[] { parameters.SelectedConfig }.ToList(); } else { config.SelectedConfigurations = new string[] { parameters.OriginalCurrentFCOName }.ToList(); } config.GeneratedConfigurationModel = parameters.GeneratedConfigurationModel; config.PETName = "/" + string.Join("/", getAncestors(parameters.CurrentFCO, stopAt: parameters.CurrentFCO.Project.RootFolder).Skip(1) // HACK: MI inserts a "Temporary" folder .getTracedObjectOrSelf(parameters.GetTraceability()).Select(obj => obj.Name).Reverse()) + "/" + parameters.OriginalCurrentFCOName; this.PCCPropertyInputDistributions = new Dictionary<string, string>(); // Determine type of driver of the Parametric Exploration if (this.pet.Children.PCCDriverCollection.Count() == 1) { this.theDriver = DriverType.PCC; this.driverName = "PCCDriver"; } else if (this.pet.Children.OptimizerCollection.Count() == 1) { this.theDriver = DriverType.Optimizer; this.driverName = "Optimizer"; var optimizer = this.pet.Children.OptimizerCollection.FirstOrDefault(); var config = AddConfigurationForMDAODriver(optimizer); config.type = "optimizer"; foreach (var intermediateVar in optimizer.Children.IntermediateVariableCollection) { var sourcePath = GetSourcePath(null, (MgaFCO)intermediateVar.Impl); if (sourcePath != null) { var intermVar = new PETConfig.Parameter(); intermVar.source = sourcePath; config.intermediateVariables.Add(intermediateVar.Name, intermVar); } } foreach (var constraint in optimizer.Children.OptimizerConstraintCollection) { var sourcePath = GetSourcePath(null, (MgaFCO)constraint.Impl); if (sourcePath != null) { var cons = new PETConfig.Constraint(); cons.source = sourcePath; if (!string.IsNullOrWhiteSpace(constraint.Attributes.MinValue)) { double minValue; if (double.TryParse(constraint.Attributes.MinValue, NumberStyles.Float | NumberStyles.AllowThousands, CultureInfo.InvariantCulture, out minValue)) { cons.RangeMin = minValue; } else { throw new ApplicationException(String.Format("Cannot parse Constraint MinValue '{0}'", constraint.Attributes.MinValue)); } } else { cons.RangeMin = null; } if (!string.IsNullOrWhiteSpace(constraint.Attributes.MaxValue)) { double maxValue; if (double.TryParse(constraint.Attributes.MaxValue, NumberStyles.Float | NumberStyles.AllowThousands, CultureInfo.InvariantCulture, out maxValue)) { cons.RangeMax = maxValue; } else { throw new ApplicationException(String.Format("Cannot parse Constraint MaxValue '{0}'", constraint.Attributes.MaxValue)); } } else { cons.RangeMax = null; } config.constraints.Add(constraint.Name, cons); } } } else if (this.pet.Children.ParameterStudyCollection.Count() == 1) { this.theDriver = DriverType.ParameterStudy; this.driverName = "ParameterStudy"; var parameterStudy = this.pet.Children.ParameterStudyCollection.FirstOrDefault(); var config = AddConfigurationForMDAODriver(parameterStudy); config.type = "parameterStudy"; } }