public PETConfig.Component GenerateCode(CyPhy.ParametricTestBench excel) { var config = new PETConfig.Component() { parameters = new Dictionary<string, PETConfig.Parameter>(), unknowns = new Dictionary<string, PETConfig.Parameter>(), }; foreach (var parameter in excel.Children.ParameterCollection) { if (parameter.AllSrcConnections.Count() == 0) { continue; } var sourcePath = GetSourcePath(null, (MgaFCO)parameter.Impl); if (sourcePath != null) { config.parameters.Add(parameter.Name, new PETConfig.Parameter() { source = sourcePath }); } } foreach (var metric in excel.Children.MetricCollection) { config.unknowns.Add(metric.Name, new PETConfig.Parameter() { }); } this.config.components.Add(excel.Name, config); return config; }
public void GenerateCode(CyPhy.TestBenchRef testBenchRef, string testBenchOutputDir) { this.testBench = testBenchRef.Referred.TestBenchType; this.testBenchOutputDir = testBenchOutputDir; var config = new PETConfig.Component() { parameters = new Dictionary<string, PETConfig.Parameter>(), unknowns = new Dictionary<string, PETConfig.Parameter>(), details = new Dictionary<string, string>() }; config.details["directory"] = testBenchOutputDir; this.config.components.Add(testBenchRef.Name, config); foreach (var parameter in testBench.Children.ParameterCollection) { var sourcePath = GetSourcePath((MgaReference)testBenchRef.Impl, (MgaFCO)parameter.Impl); if (sourcePath != null) { config.parameters.Add(parameter.Name, new PETConfig.Parameter() { source = sourcePath }); } } foreach (var metric in testBench.Children.MetricCollection) { config.unknowns.Add(metric.Name, new PETConfig.Parameter() { }); } if (this.testBench is CyPhy.TestBench) { var interpreterProgID = Rules.Global.GetInterpreterProgIDFromTestBench(this.testBench as CyPhy.TestBench); if (interpreterProgID == "MGA.Interpreter.CyPhyFormulaEvaluator") { // FIXME: does this still work this.SimpleCalculation(); } } }