private void Visit(CyPhyInterfaces.Component component) { var rfModel = component.Children.RFModelCollection.FirstOrDefault(); if (rfModel != null) { string resourcePath = ""; // Get all resources foreach (var resource in rfModel.SrcConnections.UsesResourceCollection.Select(c => c.SrcEnds.Resource).Union( rfModel.DstConnections.UsesResourceCollection.Select(c => c.DstEnds.Resource))) { if (resource != null && resource.Attributes.Path != String.Empty) { rfModel.TryGetResourcePath(out resourcePath, ComponentLibraryManager.PathConvention.ABSOLUTE); } break; // max. one CSXCAD file supported } if (resourcePath.Length == 0) { Logger.WriteError("No resource file specified for component {0}.", component.Name); return; } if (!System.IO.File.Exists(resourcePath)) { Logger.WriteError("Resource file {0} not found for component {1}.", resourcePath, component.Name); return; } var araModule = m_endo.GetModule(m_slotIndex); if (araModule == null) { if (m_endo.Slots[m_slotIndex].Size[0] == 2 && m_endo.Slots[m_slotIndex].Size[1] == 2) { araModule = new CSXCAD.Ara.Module_2x2(component.Name); } else { araModule = new CSXCAD.Ara.Module_1x2(component.Name); } } m_antenna = new CSXCAD.XmlCompound( null, component.Name, new Vector3D(rfModel.Attributes.X, rfModel.Attributes.Y, araModule.PCB.Thickness), (double)rfModel.Attributes.Rotation * Math.PI / 2 ); m_antenna.Parse(XElement.Load(resourcePath)); araModule.PCB.Add(m_antenna); m_endo.AddModule(m_slotIndex, araModule); } }
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); }