Electronics

Electronics

Topics related to HFSS, Maxwell, SIwave, Icepak, Electronics Enterprise and more.

How to get FloquetPort Mode settings with IronPython script?

    • kaleor
      Subscriber

      I am working with simulations that are set up with Floquet ports and Lattice boundaries. I would like to automate the process of exporting the simulation data with scripting via IronPython. Is there a way to programmatically get the Floquet port properties (such as the m and n mode numbers)? The methods/commands that I have found so far which may be helpful include:

      oProject = oDesktop.GetActiveProject()

      oDesign = oProject.GetActiveDesign()

      oModule = oDesign.GetModule("BoundarySetup")

      oModule.GetExcitations()


      Thank you :)

    • Praneeth
      Forum Moderator

      Please go through "AssignFloquet" section of the HFSS scripting guide.
      All the very best.
    • kaleor
      Subscriber
      Thank you for the quick response pmunaga!
      I took some time and went through the "AssignFloquet" function in the HFSS scripting guide. It looks like that function allows you to create a Floquet port and programmatically fill out all the different settings.
      However, I am looking to see if there is a function that will tell me what settings are already in place for a Floquet port. The "AssignFloquet" function is on the right topic, but does not really have the functionality I am looking for. After looking through the scripting guide, it does not seem like there is a function that does what I am looking for. My guess, then, is that perhaps this functionality does not exist yet?
      Thank you again for the help!
    • jdmac
      Subscriber
      I think what you want can be found in the Solutions module:
      oSolutions = oDesign.GetModule("Solutions")
      >>> oSolutions.GetAllSources ['FloquetPort1', 'SL_X', 'SL_Y']
      >>> oSolutions.GetAllSourceMagnitudes ['0W', '0W', '1W', '0W']
      >>> oSolutions.GetAllSourcePhases ['0deg', '0deg', '0deg', '0deg']
      It may be helpful to you to get the number of modes for each floquet port. Not sure if you can get that from oSolutions, but you can query the design property:
      >>> oDesign.GetProperties('HfssTab','BoundarySetup:FloquetPort1')
      ['Name', 'Type', 'Num Modes', 'Deembed', 'Deembed Dist']
      >>> oDesign.GetPropertyValue('HfssTab','BoundarySetup:FloquetPort1','Num Modes')
      '2'
      From doing this, your export script can know that where it encounters 'FloquetPort1' in the oSolutions.GetAllSources() list, the next 2 corresponding entries in the oSolutions.GetAllSourceMagnitudes() list will be for its 2 modes!
      Best regards.
    • jdmac
      Subscriber
      Adding tag:
    • kaleor
      Subscriber
      Thank you for the comment jdmac!
      The functions you suggested using in the Solutions module are actually very interesting. I went ahead and tried out those functions in HFSS's Python command line, and they did give me the information that you indicated. This was pretty cool because those functions are not listed in the scripting documentation that I have access to, but I can find them when I use the command
      >>> dir(oSolutions)
      I guess the information that I really want to get from HFSS programmatically are the definitions of each Floquet mode for a Floquet port. For instance, if I have a Floquet port A, then the information that I would like is that mode 1 of A is a TE mode with m = 0 and n = 0, mode 2 is a TM mode with m = 0 and n = 0, mode 3 is a TE mode with m = 1 and n = 0, etc. Does that make sense?
      Thank you so much!
    • jdmac
      Subscriber
      Ah, you want the contents of the Floquet Port Modes Setup panel. You are fresh out of luck in that case! Outside of the floquet port setup dialog window, the modes are just called 1, 2, 3 etc. No way to see what modes 1, 2, 3... actually are. If you're really dedicated, you could measure each mode using the fields calculator commands, though I shudder to think how difficult that would be.
      I can offer you a hack instead. When all else fails, you can read the .aedt file directly with Python. You can get the path to the project file using the oProject module. Then you can load the file text of the open project, which is mixed binary/ASCII:
      with open(projectfile,'rb') as stream:
      txt = stream.read Then you can search for the boundary setup block for your floquet port, which looks like this (notice that my text editor has replaced tabs with spaces, the real file uses the tab character):
      I didn't highlight it, but TM and TE are also there in the 'PolarizationState' property. There you go. All you have to do is search for the opening and closing tags, and then read out M and N:
      i = txt.find('$begin \'BoundarySetup\'')
      j = txt.find('$end \'BoundarySetup\'', i)
      port_start_line = txt.find('$begin \'FloquetPort1\'', i, j)
      And so forth. In no time you'll have the M and N indices, and the PolarizationState. Of course, this doesn't work if your project is encrypted.
    • kaleor
      Subscriber
      I shudder with you in thinking about how to divine the mode harmonics with the fields calculator.
      That is a cool hack though. I have never bothered to look inside the .aedt files, and so I didn't know that a fair portion of it is readable text. I think this will work for me. Thank you so much this answer jdmac!
Viewing 7 reply threads
  • The topic ‘How to get FloquetPort Mode settings with IronPython script?’ is closed to new replies.