public void Initialize() { // Ara Endo endo = new CSXCAD.Ara.Endo(); CSXCAD.Ara.Module araModule = null; switch (moduleSize) { case "1x2": araModule = new CSXCAD.Ara.Module_1x2("dut-module"); break; case "2x2": araModule = new CSXCAD.Ara.Module_2x2("dut-module"); break; default: break; } endo.AddModule(slotIndex, araModule); antenna = new CSXCAD.XmlCompound(null, "dut-antenna", new Vector3D(x, y, thickness), rot); antenna.Parse(XElement.Load(inputFile)); araModule.PCB.Add(antenna); // Excitation CSXCAD.Compound excitation = new Compound(null, "Excitation", new Vector3D(x, y, thickness), rot); excitation.Add(new LumpedPort(100, 1, impedance, new Vector3D(0, 0, -araModule.PCB.Thickness), new Vector3D(0, 0, 0), ENormDir.Z, true)); araModule.PCB.Add(excitation); }
public void GenerateCode() { // Map the root testbench object var testbench = CyPhyClasses.TestBench.Cast(this.mainParameters.CurrentFCO); if (testbench == null) { Logger.WriteError("Invalid context of invocation <{0}>, invoke the interpreter from a Testbench model", this.mainParameters.CurrentFCO.Name); return; } // Parameters var slotParameter = testbench.Children.ParameterCollection.FirstOrDefault(x => x.Name == "Slot"); if (slotParameter == null) { throw new ApplicationException("Missing required Testbench Parameter 'Slot'"); } if (UInt32.TryParse(slotParameter.Attributes.Value, out m_slotIndex) == false) { throw new ApplicationException("Testbench Parameter 'Slot' must be an integer"); } var resolutionParameter = testbench.Children.ParameterCollection.FirstOrDefault(x => x.Name == "Resolution"); if (resolutionParameter == null) { throw new ApplicationException("Missing required Testbench Parameter 'Resolution'"); } if (Double.TryParse(resolutionParameter.Attributes.Value, NumberStyles.Float | NumberStyles.AllowThousands, CultureInfo.InvariantCulture, out m_dutResolution) == false) { throw new ApplicationException("Testbench Parameter 'Resolution' must be a real number"); } var frequencyParameter = testbench.Children.ParameterCollection.FirstOrDefault(x => x.Name == "Frequency"); if (frequencyParameter == null) { throw new ApplicationException("Missing required Testbench Parameter 'Frequency'"); } if (Double.TryParse(frequencyParameter.Attributes.Value, NumberStyles.Float | NumberStyles.AllowThousands, CultureInfo.InvariantCulture, out m_f0) == false) { throw new ApplicationException("Testbench Parameter 'Frequency' must be a real number"); } // Set up simulation space Logger.WriteInfo("Constructing Ara Phone model..."); m_endo = new CSXCAD.Ara.Endo(); Visit(testbench); switch (mode) { case Mode.DIRECTIVITY: GenerateDirectivitySimulationInput(); break; case Mode.SAR: GenerateSarSimulationInput(); break; } ; }
public void GenerateCode() { // Map the root testbench object var testbench = CyPhyClasses.TestBench.Cast(this.mainParameters.CurrentFCO); if (testbench == null) { Logger.WriteError("Invalid context of invocation <{0}>, invoke the interpreter from a Testbench model", this.mainParameters.CurrentFCO.Name); return; } // Parameters var slotParameter = testbench.Children.ParameterCollection.FirstOrDefault(x => x.Name == "Slot"); if (slotParameter == null) { throw new ApplicationException("Missing required Testbench Parameter 'Slot'"); } if (UInt32.TryParse(slotParameter.Attributes.Value, out m_slotIndex) == false) { throw new ApplicationException("Testbench Parameter 'Slot' must be an integer"); } var resolutionParameter = testbench.Children.ParameterCollection.FirstOrDefault(x => x.Name == "Resolution"); if (resolutionParameter == null) { throw new ApplicationException("Missing required Testbench Parameter 'Resolution'"); } if (Double.TryParse(resolutionParameter.Attributes.Value, out m_dutResolution) == false) { throw new ApplicationException("Testbench Parameter 'Resolution' must be a real number"); } var frequencyParameter = testbench.Children.ParameterCollection.FirstOrDefault(x => x.Name == "Frequency"); if (frequencyParameter == null) { throw new ApplicationException("Missing required Testbench Parameter 'Frequency'"); } if (Double.TryParse(frequencyParameter.Attributes.Value, out m_f0) == false) { throw new ApplicationException("Testbench Parameter 'Frequency' must be a real number"); } // Set up simulation space Logger.WriteInfo("Constructing Ara Phone model..."); m_endo = new CSXCAD.Ara.Endo(); Visit(testbench); switch (mode) { case Mode.DIRECTIVITY: GenerateDirectivitySimulationInput(); break; case Mode.SAR: GenerateSarSimulationInput(); break; }; }