public static IEnumerable <RuleFeedbackBase> UniqueTestBenchRefNames(CyPhy.ParametricExploration pet) { var components = pet.Children.TestBenchRefCollection .Concat <ISIS.GME.Common.Interfaces.FCO>(pet.Children.ParametricTestBenchCollection) .Concat(pet.Children.ConstantsCollection) .Concat(pet.Children.ProblemInputCollection) .Concat(pet.Children.ProblemOutputCollection) .Concat(pet.Children.DriverCollection) .Concat(pet.Children.ParametricExplorationCollection); return(UniqueNames(components)); }
public override void Expand(CyPhy.ComponentAssembly configuration) { this.Configuration = configuration; // FIXME: this test should be repaired. It does not work correctly if TBs have different SUTs. Be safe and make a copy always // if (this.OriginalSystemUnderTest.Referred.DesignEntity.ID == configuration.ID) if (false) { this.expandedParametricExploration = this.parametricExploration; } else { // create temp folder for parametric exploration CyPhy.ParametricExplorationFolder testing = CyPhyClasses.ParametricExplorationFolder.Cast(this.parametricExploration.ParentContainer.Impl); var tempFolderName = AnalysisModelProcessor.GetTemporaryFolderName(this.parametricExploration.Impl); CyPhy.ParametricExplorationFolder tempFolder = testing.Children.ParametricExplorationFolderCollection.FirstOrDefault(x => x.Name == tempFolderName); if (tempFolder == null) { tempFolder = CyPhyClasses.ParametricExplorationFolder.Create(testing); tempFolder.Name = tempFolderName; this.AddToTraceabilityAndTemporary(tempFolder.Impl, testing.Impl, recursive: false); } // copy parametric exploration var tempCopy = (tempFolder.Impl as MgaFolder).CopyFCODisp(this.parametricExploration.Impl as MgaFCO); // fix name tempCopy.Name = AnalysisModelProcessor.GetTemporaryObjectName(this.parametricExploration.Impl, configuration.Impl); this.AddToTraceabilityAndTemporary(tempCopy, this.parametricExploration.Impl); // set expanded property to the expanded element this.expandedParametricExploration = CyPhyClasses.ParametricExploration.Cast(tempCopy); } // expand all test benches foreach (var testBenchRef in this.expandedParametricExploration.Children.TestBenchRefCollection) { var testBenchTypeExpander = new TestBenchTypeProcessor(testBenchRef.Referred.TestBenchType); testBenchTypeExpander.Expand(configuration); // switch references var switcher = new ReferenceSwitcher.ReferenceSwitcherInterpreter(); // TODO: handle failures for this switcher.SwitchReference(testBenchTypeExpander.expandedTestBenchType.Impl as MgaFCO, testBenchRef.Impl as IMgaReference); this.InnerExpanders.Push(testBenchTypeExpander); } }
public override void Expand(CyPhy.ComponentAssembly configuration) { this.Configuration = configuration; if (this.OriginalSystemUnderTest.Referred.DesignEntity.ID == configuration.ID) { this.expandedParametricExploration = this.parametricExploration; } else { // create temp folder for parametric exploration CyPhy.ParametricExplorationFolder testing = CyPhyClasses.ParametricExplorationFolder.Cast(this.parametricExploration.ParentContainer.Impl); var tempFolderName = AnalysisModelProcessor.GetTemporaryFolderName(this.parametricExploration.Impl); CyPhy.ParametricExplorationFolder tempFolder = testing.Children.ParametricExplorationFolderCollection.FirstOrDefault(x => x.Name == tempFolderName); if (tempFolder == null) { tempFolder = CyPhyClasses.ParametricExplorationFolder.Create(testing); tempFolder.Name = tempFolderName; this.AddToTraceabilityAndTemporary(tempFolder.Impl, testing.Impl, recursive: false); } // copy parametric exploration var tempCopy = (tempFolder.Impl as MgaFolder).CopyFCODisp(this.parametricExploration.Impl as MgaFCO); // fix name tempCopy.Name = AnalysisModelProcessor.GetTemporaryObjectName(this.parametricExploration.Impl, configuration.Impl); this.AddToTraceabilityAndTemporary(tempCopy, this.parametricExploration.Impl); // set expanded property to the expanded element this.expandedParametricExploration = CyPhyClasses.ParametricExploration.Cast(tempCopy); } // expand all test benches foreach (var testBenchRef in this.expandedParametricExploration.Children.TestBenchRefCollection) { var testBenchTypeExpander = new TestBenchTypeProcessor(testBenchRef.Referred.TestBenchType); testBenchTypeExpander.Expand(configuration); // switch references var switcher = new ReferenceSwitcher.ReferenceSwitcherInterpreter(); // TODO: handle failures for this switcher.SwitchReference(testBenchTypeExpander.expandedTestBenchType.Impl as MgaFCO, testBenchRef.Impl as IMgaReference); this.InnerExpanders.Push(testBenchTypeExpander); } }
public ParametricExplorationProcessor(CyPhy.ParametricExploration parametricExploration) { this.parametricExploration = parametricExploration; var tbRef = parametricExploration .Children .TestBenchRefCollection .FirstOrDefault(); if (tbRef != null) { this.OriginalSystemUnderTest = tbRef .Referred .TestBenchType .Children .TopLevelSystemUnderTestCollection .FirstOrDefault(); } }
public PET(CyPhyGUIs.IInterpreterMainParameters parameters, CyPhyGUIs.GMELogger logger) { this.Logger = logger; this.pet = CyPhyClasses.ParametricExploration.Cast(parameters.CurrentFCO); this.outputDirectory = parameters.OutputDirectory; this.testBench = pet.Children.TestBenchRefCollection.FirstOrDefault().Referred.TestBenchType; 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"; } else if (this.pet.Children.ParameterStudyCollection.Count() == 1) { this.theDriver = DriverType.ParameterStudy; this.driverName = "ParameterStudy"; } }
public virtual void Expand(CyPhy.ParametricExploration parametricExploration) { throw new NotImplementedException(); }
public override void Expand(CyPhy.ParametricExploration parametricExploration) { this.expandedParametricExploration = this.parametricExploration; }
public ParametricExplorationChecker(CyPhy.ParametricExploration parametricExploration) { this.parametricExploration = parametricExploration; }
public static IEnumerable <CyPhy.ParametricExploration> getParametricExplorationsRecursively(CyPhy.ParametricExploration exp) { Queue <CyPhy.ParametricExploration> exps = new Queue <ISIS.GME.Dsml.CyPhyML.Interfaces.ParametricExploration>(); exps.Enqueue(exp); while (exps.Count > 0) { exp = exps.Dequeue(); yield return(exp); foreach (var sub in exp.Children.ParametricExplorationCollection) { exps.Enqueue(sub); } } }
public ParametricExplorationChecker(CyPhy.ParametricExploration parametricExploration) { this.parametricExploration = parametricExploration; }
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"; } }