private string FindTestBenchParameter(Tonka.SPICEModelParameter parameter, FCO element) { Tonka.ValueFlow srcConnection = null; if (element is Tonka.Parameter) { srcConnection = ((Tonka.Parameter)element).SrcConnections.ValueFlowCollection.FirstOrDefault(); } else if (element is Tonka.Property) { srcConnection = ((Tonka.Property)element).SrcConnections.ValueFlowCollection.FirstOrDefault(); } else { CodeGenerator.Logger.WriteWarning("Encountered unsupported element <a href=\"mga:{1}\">{0}</a> while attempting to trace ValueFlow network from {4} Parameter <a href=\"mga:{3}\">{2}</a> back to a Test Bench Parameter. If you intend for {4} Parameter <a href=\"mga:{3}\">{2}</a> to update dynamically from one or more Test Bench Parameters, include only Parameters and/or Properties in the ValueFlow Network.", element.Name, traceability.GetID(element.Impl), parameter.Name, traceability.GetID(parameter.Impl), parameter.ParentContainer.ParentContainer.Name); return(null); } if (srcConnection == null) { if (element.ParentContainer is Tonka.TestBench) { CodeGenerator.Logger.WriteDebug("Mapped Test Bench Parameter <a href=\"mga:{1}\">{0}</a> to {4} Parameter <a href=\"mga:{3}\">{2}</a> from ValueFlow network.", element.Name, traceability.GetID(element.Impl), parameter.Name, traceability.GetID(parameter.Impl), parameter.ParentContainer.ParentContainer.Name); return("${" + element.Name + "}"); } else { return(null); } } return(FindTestBenchParameter(parameter, srcConnection.SrcEnd)); }
private static string TryGetTestbenchParamName(FCO fco, ISet <FCO> visited) { if (fco.ParentContainer.Kind == "TestBench") //Note: We're not guaranteed to be working with domain-specific objects here { SimulinkGenerator.GMEConsole.Info.WriteLine("Testbench parameter found: {0}", fco.Name); return(fco.Name); } visited.Add(fco); foreach (var connection in fco.AllDstConnections) { var adjacent = (FCO)connection.GenericDstEnd; //Cast to abstract FCO class, rather than interface (hopefully this always works?) if ((adjacent.Kind == "Parameter" || adjacent.Kind == "Property") && !visited.Contains(adjacent)) //Note: GenericDstEnd doesn't give domain-specific objects { // (these are instances of FCO) var result = TryGetTestbenchParamName(adjacent, visited); if (result != null) { return(result); } } } foreach (var connection in fco.AllSrcConnections) { var adjacent = (FCO)connection.GenericSrcEnd; //Cast to abstract FCO class, rather than interface (hopefully this always works?) if ((adjacent.Kind == "Parameter" || adjacent.Kind == "Property") && !visited.Contains(adjacent)) { var result = TryGetTestbenchParamName(adjacent, visited); if (result != null) { return(result); } } } return(null); }
public void SaveTestBenchManifest(string designName, string configurationName, string testBenchName, FCO expandedTestBenchType, string outputDir, DateTime analysisStartTime) { if (outputDir == null) { throw new ArgumentNullException("outputDirectory"); } AVM.DDP.MetaTBManifest manifest = new AVM.DDP.MetaTBManifest(); manifest.MakeManifest(expandedTestBenchType, outputDir); // design name fixture manifest.DesignName = designName; // test bench name fixture manifest.TestBench = testBenchName; manifest.CfgID = configurationName; manifest.Serialize(outputDir); this.UpdateResultsJson(expandedTestBenchType.Impl as MgaFCO, outputDir, analysisStartTime); }
private static void ProcessParadigmSheet(GME.MGA.IMgaFCO fco) { Debug.Assert(fco.Meta.Name == "ParadigmSheet"); GME.MGA.IMgaModel model = fco as GME.MGA.IMgaModel; foreach (GME.MGA.IMgaObject obj in model.ChildObjects) { DSM.Generators.Object object1; if (obj is GME.MGA.IMgaAtom) { GME.MGA.IMgaAtom o = obj as GME.MGA.IMgaAtom; switch (o.Meta.Name) { case "Folder": object1 = new Folder(o); break; case "Model": object1 = new Model(o); break; case "FCO": object1 = new FCO(o); break; case "Atom": object1 = new Atom(o); break; case "Reference": object1 = new Reference(o); break; case "Set": object1 = new Set(o); break; case "Connection": object1 = new Connection(o); break; default: //not supported break; } } else { if (obj.MetaBase.Name.Contains("Proxy")) { GME.MGA.IMgaReference proxy = obj as GME.MGA.IMgaReference; string referred = proxy.Referred.Name; if (DSM.Generators.Object.ProxyCache.ContainsKey(proxy.Name) && DSM.Generators.Object.ProxyCache[proxy.Name] != referred) { Errors.Add(string.Format("Proxies with name '{0}' refer different objects", proxy.Name)); } else { DSM.Generators.Object.ProxyCache[proxy.Name] = referred; DSM.Generators.Object.ProxyObjects[proxy.Name] = proxy; } } } } }