Esempio n. 1
0
def assign_lumpedport(oDesign, name, start, end, obj_arr, z0="50ohm"):
    """
    Create a lumped port
    :param oDesign: pywin32 COMObject
    :param start: Array
        Integration Line start
    :param end: Array
        Integration Line End
    :param obj_arr: Array
        The objects to assign to this lumped port
    :param z0:
        Characteristic impendance
    :param name:
        Name of lumped port
    :return:
        None
    """
    oBoundarySetupModule = get_module(oDesign, "BoundarySetup")
    params = ["NAME:" + name]
    params += ["Objects:=", obj_arr]
    params += [
        "RenormalizeAllTerminals:=", True, "DoDeembed:=", False,
        [
            "NAME:Modes",
            [
                "NAME:Mode1", "ModeNum:=", 1, "UseIntLine:=", True,
                ["NAME:IntLine", "Start:=", start, "End:=", end], "CharImp:=",
                "Zpi", "AlignmentGroup:=", 0, "RenormImp:=", "50ohm"
            ]
        ], "ShowReporterFilter:=", False, "ReporterFilter:=", [True],
        "FullResistance:=", "50ohm", "FullReactance:=", "0ohm"
    ]
    oBoundarySetupModule.AssignLumpedPort(params)
Esempio n. 2
0
def assign_radiation(oDesign, 
                     faceidlist, 
                     IsIncidentField=False, 
                     IsEnforcedField=False, 
                     IsFssReference=False, 
                     IsForPML=False,
                     UseAdaptiveIE=False,
                     IncludeInPostproc=True,
                     Name='Rad1'):
    """
    Assign a radiation boundary on the given faces.
    
    Parameters
    ----------
    oDesign : pywin32 COMObject
        The HFSS design to which this function is applied.
    faceidlist : list of ints
        The faces to assign to this boundary condition.
    IsIncidentField : bool
        If True, same as checking the "Incident Field" radio button in the 
        Radiation Boundary setup dialog.  Mutually-exclusive with 
        IsEnforcedField
    IsEnforcedField : bool
        If True, same as checking the "Enforced Field" radio button in the 
        Radiation Boundary setup dialog.  Mutually-exclusive with 
        IsIncidentField
    IsFssReference : bool
        If IsEnforcedField is False, is equivalent to checking the 
        "Reference for FSS" check box i the Radiation Boundary setup dialog.
    IsForPML : bool
        Not explored at this time.  Likely use case is when defining a 
        radiation boundary in conjuction with PMLs where the boundary lies on 
        the surface between the PML and the PML base object.
    UseAdaptiveIE : bool
        Not explored at this time.  It is likely that setting this to True is 
        equivalent to selecting the "Model exterior as HFSS-IE domain" check 
        box in the Radiation Boundary setup dialog.
    IncludeInPostproc : bool
        Not explored at this time.  Likely use case is to remove certain 
        boundaries from consideration during certain postprocessing 
        operations, such as when computing the radiation pattern.
    Name : str
        The name to assign the boundary.
    Returns
    -------
    None
    """
    oBoundarySetupModule = get_module(oDesign, "BoundarySetup")
    arg = ["NAME:{0}".format(Name), 
           "Faces:=", faceidlist, 
           "IsIncidentField:=", IsIncidentField, 
           "IsEnforcedField:=", IsEnforcedField, 
           "IsFssReference:=", IsFssReference, 
           "IsForPML:=", IsForPML, 
           "UseAdaptiveIE:=", UseAdaptiveIE, 
           "IncludeInPostproc:=", IncludeInPostproc]
    
    oBoundarySetupModule.AssignRadiation(arg)
Esempio n. 3
0
def assign_radiation(oDesign,
                     faceidlist,
                     IsIncidentField=False,
                     IsEnforcedField=False,
                     IsFssReference=False,
                     IsForPML=False,
                     UseAdaptiveIE=False,
                     IncludeInPostproc=True,
                     Name='Rad1'):
    """
    Assign a radiation boundary on the given faces.
    
    Parameters
    ----------
    oDesign : pywin32 COMObject
        The HFSS design to which this function is applied.
    faceidlist : list of ints
        The faces to assign to this boundary condition.
    IsIncidentField : bool
        If True, same as checking the "Incident Field" radio button in the 
        Radiation Boundary setup dialog.  Mutually-exclusive with 
        IsEnforcedField
    IsEnforcedField : bool
        If True, same as checking the "Enforced Field" radio button in the 
        Radiation Boundary setup dialog.  Mutually-exclusive with 
        IsIncidentField
    IsFssReference : bool
        If IsEnforcedField is False, is equivalent to checking the 
        "Reference for FSS" check box i the Radiation Boundary setup dialog.
    IsForPML : bool
        Not explored at this time.  Likely use case is when defining a 
        radiation boundary in conjuction with PMLs where the boundary lies on 
        the surface between the PML and the PML base object.
    UseAdaptiveIE : bool
        Not explored at this time.  It is likely that setting this to True is 
        equivalent to selecting the "Model exterior as HFSS-IE domain" check 
        box in the Radiation Boundary setup dialog.
    IncludeInPostproc : bool
        Not explored at this time.  Likely use case is to remove certain 
        boundaries from consideration during certain postprocessing 
        operations, such as when computing the radiation pattern.
    Name : str
        The name to assign the boundary.
    Returns
    -------
    None
    """
    oBoundarySetupModule = get_module(oDesign, "BoundarySetup")
    arg = [
        "NAME:{0}".format(Name), "Faces:=", faceidlist, "IsIncidentField:=",
        IsIncidentField, "IsEnforcedField:=", IsEnforcedField,
        "IsFssReference:=", IsFssReference, "IsForPML:=", IsForPML,
        "UseAdaptiveIE:=", UseAdaptiveIE, "IncludeInPostproc:=",
        IncludeInPostproc
    ]

    oBoundarySetupModule.AssignRadiation(arg)
Esempio n. 4
0
def insert_analysis_setup(oDesign, 
                          Frequency,
                          PortsOnly=True,
                          MaxDeltaS=0.02,                       
                          Name='Setup1',
                          UseMatrixConv=False,
                          MaximumPasses=20,
                          MinimumPasses=2,
                          MinimumConvergedPasses=2,
                          PercentRefinement=30,
                          IsEnabled=True,
                          BasisOrder=2,
                          UseIterativeSolver=False,
                          DoLambdaRefine=True,
                          DoMaterialLambda=True,
                          SetLambdaTarget=True,
                          Target=0.6667,
                          UseMaxTetIncrease=False,
                          PortAccuracy=2,
                          UseABCOnPort=False,
                          SetPortMinMaxTri=False,
                          EnableSolverDomains=False,
                          ThermalFeedback=False,
                          NoAdditionalRefinementOnImport=False):
    """
    Insert an HFSS analysis setup.
    """
    oAnalysisSetup = get_module(oDesign, "AnalysisSetup")
    oAnalysisSetup.InsertSetup( "HfssDriven", 
                               ["NAME:" + Name, 
                                "Frequency:=", str(Frequency) +"Hz", 
                                "PortsOnly:=", PortsOnly, 
                                "MaxDeltaS:=", MaxDeltaS, 
                                "UseMatrixConv:=", UseMatrixConv, 
                                "MaximumPasses:=", MaximumPasses, 
                                "MinimumPasses:=", MinimumPasses, 
                                "MinimumConvergedPasses:=", MinimumConvergedPasses, 
                                "PercentRefinement:=", PercentRefinement, 
                                "IsEnabled:=", IsEnabled, 
                                "BasisOrder:=", BasisOrder, 
                                "UseIterativeSolver:=", UseIterativeSolver, 
                                "DoLambdaRefine:=", DoLambdaRefine, 
                                "DoMaterialLambda:=", DoMaterialLambda, 
                                "SetLambdaTarget:=", SetLambdaTarget, 
                                "Target:=", Target, 
                                "UseMaxTetIncrease:=", UseMaxTetIncrease, 
                                "PortAccuracy:=", PortAccuracy, 
                                "UseABCOnPort:=", UseABCOnPort, 
                                "SetPortMinMaxTri:=", SetPortMinMaxTri, 
                                "EnableSolverDomains:=", EnableSolverDomains, 
                                "ThermalFeedback:=", ThermalFeedback, 
                                "NoAdditionalRefinementOnImport:=", NoAdditionalRefinementOnImport])
                                
    return Name
Esempio n. 5
0
def assign_waveport_multimode(oDesign, 
                              portname, 
                              faceidlist, 
                              Nmodes=1,
                              RenormalizeAllTerminals=True,
                              UseLineAlignment=False,
                              DoDeembed=False,
                              ShowReporterFilter=False,
                              ReporterFilter=[True],
                              UseAnalyticAlignment=False):
    """
    Assign a waveport excitation using multiple modes.
    
    Parameters
    ----------
    oDesign : pywin32 COMObject
        The HFSS design to which this function is applied.
    portname : str
        Name of the port to create.
    faceidlist : list
        List of face id integers.
    Nmodes : int
        Number of modes with which to excite the port.
        
    Returns
    -------
    None
    """
    oBoundarySetupModule = get_module(oDesign, "BoundarySetup")
    modesarray = ["NAME:Modes"]
    for n in range(0, Nmodes):
        modesarray.append(["NAME:Mode" + str(n + 1),
                           "ModeNum:=", n + 1,
                           "UseIntLine:=", False])

    waveportarray = ["NAME:" + portname, 
                     "Faces:=", faceidlist, 
                     "NumModes:=", Nmodes, 
                     "RenormalizeAllTerminals:=", RenormalizeAllTerminals, 
                     "UseLineAlignment:=", UseLineAlignment, 
                     "DoDeembed:=", DoDeembed, 
                     modesarray, 
                     "ShowReporterFilter:=", ShowReporterFilter, 
                     "ReporterFilter:=", ReporterFilter, 
                     "UseAnalyticAlignment:=", UseAnalyticAlignment]

    oBoundarySetupModule.AssignWavePort(waveportarray)
Esempio n. 6
0
def insert_analysis_setup(oDesign,
                          Frequency,
                          PortsOnly=False,
                          MaxDeltaS=0.02,
                          Name='Setup1',
                          UseMatrixConv=False,
                          MaximumPasses=15,
                          MinimumPasses=1,
                          MinimumConvergedPasses=1,
                          PercentRefinement=30,
                          IsEnabled=True,
                          BasisOrder=1,
                          UseIterativeSolver=False,
                          DoLambdaRefine=True,
                          DoMaterialLambda=True,
                          SetLambdaTarget=False,
                          Target=0.3333,
                          UseMaxTetIncrease=False,
                          PortAccuracy=2,
                          UseABCOnPort=False,
                          SetPortMinMaxTri=False,
                          EnableSolverDomains=False,
                          ThermalFeedback=False,
                          NoAdditionalRefinementOnImport=False):
    """
    Insert an HFSS analysis setup.
    """
    oAnalysisSetup = get_module(oDesign, "AnalysisSetup")
    oAnalysisSetup.InsertSetup("HfssDriven", [
        "NAME:" + Name, "Frequency:=",
        str(Frequency) + "GHz", "PortsOnly:=", PortsOnly, "MaxDeltaS:=",
        MaxDeltaS, "UseMatrixConv:=", UseMatrixConv, "MaximumPasses:=",
        MaximumPasses, "MinimumPasses:=", MinimumPasses,
        "MinimumConvergedPasses:=", MinimumConvergedPasses,
        "PercentRefinement:=", PercentRefinement, "IsEnabled:=", IsEnabled,
        "BasisOrder:=", BasisOrder, "UseIterativeSolver:=", UseIterativeSolver,
        "DoLambdaRefine:=", DoLambdaRefine, "DoMaterialLambda:=",
        DoMaterialLambda, "SetLambdaTarget:=", SetLambdaTarget, "Target:=",
        Target, "UseMaxTetIncrease:=", UseMaxTetIncrease, "PortAccuracy:=",
        PortAccuracy, "UseABCOnPort:=", UseABCOnPort, "SetPortMinMaxTri:=",
        SetPortMinMaxTri, "EnableSolverDomains:=", EnableSolverDomains,
        "ThermalFeedback:=", ThermalFeedback,
        "NoAdditionalRefinementOnImport:=", NoAdditionalRefinementOnImport
    ])

    return Name
Esempio n. 7
0
def assign_waveport_multimode(oDesign,
                              portname,
                              faceidlist,
                              Nmodes=1,
                              RenormalizeAllTerminals=True,
                              UseLineAlignment=False,
                              DoDeembed=False,
                              ShowReporterFilter=False,
                              ReporterFilter=[True],
                              UseAnalyticAlignment=False):
    """
    Assign a waveport excitation using multiple modes.
    
    Parameters
    ----------
    oDesign : pywin32 COMObject
        The HFSS design to which this function is applied.
    portname : str
        Name of the port to create.
    faceidlist : list
        List of face id integers.
    Nmodes : int
        Number of modes with which to excite the port.
        
    Returns
    -------
    None
    """
    oBoundarySetupModule = get_module(oDesign, "BoundarySetup")
    modesarray = ["NAME:Modes"]
    for n in range(0, Nmodes):
        modesarray.append([
            "NAME:Mode" + str(n + 1), "ModeNum:=", n + 1, "UseIntLine:=", False
        ])

    waveportarray = [
        "NAME:" + portname, "Faces:=", faceidlist, "NumModes:=", Nmodes,
        "RenormalizeAllTerminals:=", RenormalizeAllTerminals,
        "UseLineAlignment:=", UseLineAlignment, "DoDeembed:=", DoDeembed,
        modesarray, "ShowReporterFilter:=", ShowReporterFilter,
        "ReporterFilter:=", ReporterFilter, "UseAnalyticAlignment:=",
        UseAnalyticAlignment
    ]

    oBoundarySetupModule.AssignWavePort(waveportarray)
Esempio n. 8
0
def assign_perfect_h(oDesign, boundaryname, facelist):
    """
    Create a perfect H boundary.
    
    Parameters
    ----------
    oDesign : pywin32 COMObject
        The HFSS design to which this function is applied.
    boundaryname : str
        The name to give this boundary in the Boundaries tree.
    facelist : list of ints
        The faces to assign to this boundary condition.
    
    Returns
    -------
    None
    """
    oBoundarySetupModule = get_module(oDesign, "BoundarySetup")
    oBoundarySetupModule.AssignPerfectH(["Name:" + boundaryname, "Faces:=", facelist])
Esempio n. 9
0
def assign_perfect_h(oDesign, boundaryname, facelist):
    """
    Create a perfect H boundary.
    
    Parameters
    ----------
    oDesign : pywin32 COMObject
        The HFSS design to which this function is applied.
    boundaryname : str
        The name to give this boundary in the Boundaries tree.
    facelist : list of ints
        The faces to assign to this boundary condition.
    
    Returns
    -------
    None
    """
    oBoundarySetupModule = get_module(oDesign, "BoundarySetup")
    oBoundarySetupModule.AssignPerfectH(
        ["Name:" + boundaryname, "Faces:=", facelist])
Esempio n. 10
0
def insert_optimetrics_setup(oDesign,
                             Name,
                             Sweepname,
                             variable,
                             startvalue,
                             stopvalue,
                             count=None,
                             stepsize=None,
                             SaveFields=False,
                             OffsetF1=False,
                             ):
    if (count is None) == (stepsize is None):
        raise ValueError("Exactly one of 'points' and 'delta' must be specified")

    oOptimetricsSetup=get_module(oDesign, "Optimetrics")

    if stepsize is not None:
        SweepData="LIN "+str(startvalue)+"mm "+str(stopvalue)+"mm "+str(stepsize) + "mm"
    else:
        SweepData = "LINC " + str(startvalue) + "mm " + str(stopvalue) + "mm " + str(count)
    oOptimetricsSetup.InsertSetup("OptiParametric",
                                  ["NAME:"+Name,
                                   "IsEnabled:=", True,
                                   "SaveFields:=", SaveFields,
                                   ["NAME:StartingPoint"],
                                   "Sim. Setups:=",
                                   [Sweepname],
                                   [
                                       "NAME:Sweeps",
                                        ["NAME:SweepDefinition",
                                         "Variable:=",variable,
                                         "Data:=", SweepData,
                                         "OffsetF1:=",OffsetF1,
                                         "Synchronize:=",0
                                         ]
                                   ],
                                   ["NAME:Sweep Operations"],
                                   ["NAME:Goals"]
                                   ])
    return Name
Esempio n. 11
0
def assign_perfect_e(oDesign, boundaryname, objectlist, InfGroundPlane=False):
    """
    Create a perfect E boundary.
    
    Parameters
    ----------
    oDesign : pywin32 COMObject
        The HFSS design to which this function is applied.
    boundaryname : str
        The name to give this boundary in the Boundaries tree.
    facelist : list of ints
        The faces to assign to this boundary condition.
    
    Returns
    -------
    None
    """
    oBoundarySetupModule = get_module(oDesign, "BoundarySetup")
    oBoundarySetupModule.AssignPerfectE([
        "Name:" + boundaryname, "Objects:=", objectlist, "InfGroundPlane:=",
        InfGroundPlane
    ])
Esempio n. 12
0
 def __enter__(self):
     self.oModule = get_module(self.oDesign, self.ModuleName)
     
     return self
Esempio n. 13
0
    def __enter__(self):
        self.oModule = get_module(self.oDesign, self.ModuleName)

        return self
Esempio n. 14
0
def insert_optioptimization_setup(oDesign,
                                  name,
                                  goals,
                                  startvalue,stopvalue,
                                  value,
                                  variable,
                                  minvalue,maxvalue,
                                  minstep,maxstep,
                                  SaveFields=False,
                                  ):
    oOptimetricsSetup = get_module(oDesign, "Optimetrics")
    DiscreteValues = ""
    for i in range(startvalue,stopvalue+1):
        DiscreteValues = DiscreteValues + str(i) + "GHz" + ','
    oDesign.ChangeProperty(
        [
            "NAME:AllTabs",
            [
                "NAME:LocalVariableTab",
                [
                    "NAME:PropServers",
                    "LocalVariables"
                ],
                [
                    "NAME:ChangedProps",
                    [
                        "NAME:"+variable,
                        [
                            "NAME:Optimization",
                            "Included:="	, True
                        ]
                    ]
                ]
            ]
        ])
    oOptimetricsSetup.InsertSetup("OptiOptimization",
                                  ["NAME:"+name,
                                   "IsEnabled:=",True,
                                   [
                                       "NAME:ProdOptiSetupDataV2",
                                       "Savefields:=",SaveFields,
                                       "CopyMesh:=",False,
                                       "SolveWithCopiedMeshOnly:=", True
                                   ],
                                   [
                                       "NAME:StartingPoint"
                                   ],
                                   "Optimizer:=","Quasi Newton",
                                   [
                                       "NAME:AnalysisStopOptions",
                                       "StopForNumIteration:=", True,
                                       "StopForElapsTime:=", False,
                                       "StopForSlowImprovement:=", False,
                                       "StopForGrdTolerance:=", False,
                                       "MaxNumIteration:=", 1000,
                                       "MaxSolTimeInSec:=", 3600,
                                       "RelGradientTolerance:=", 0,
                                       "MinNumIteration:=", 10
                                   ],
                                   "CostFuncNormType:=", "L2",
                                   "PriorPSetup:="	, "",
                                   "PreSolvePSetup:="	, True,
                                   [
                                       "NAME:Variables",
                                       variable+":=",
                                       ["i:=", True,
                                        "Min:=", minvalue,
                                        "Max:=", maxvalue,
                                        "MinStep:=", minstep,
                                        "MaxStep:=", maxstep]
                                   ],
                                   [
                                       "NAME:LCS"
                                   ],
                                   [
                                       "NAME:Goals",
                                       [
                                           "NAME:Goal",
                                           "ReportType:="	, "Modal Solution Data",
                                           "Solution:="		, "Setup1 : Sweep1",
                                           [
                                               "NAME:SimValueContext",
                                               "Domain:="		, "Sweep"
                                           ],
                                           "Calculation:="		, goals,
                                           "Name:="		, goals,
                                           [
                                               "NAME:Ranges",
                                               "Range:="		, ["Var:=", "Freq",
                                                                   "Type:="	, "rd",
                                                                   "Start:=", str(startvalue)+"GHz",
                                                                   "Stop:="	, str(stopvalue)+"GHz",
                                                                   "DiscreteValues:=", DiscreteValues
                                                                   ]
                                           ],
                                           "Condition:=", "==",
                                           [
                                               "NAME:GoalValue",
                                               "GoalValueType:=", "Independent",
                                               "Format:=", "Real/Imag",
                                               "bG:=", ["v:=", "[2.813;]"]
                                           ],
                                           "Weight:=", "[1;]"
                                       ]
                                   ],
                                   "Acceptable_Cost:=", 0,
                                   "Noise:="	, 0.0001,
                                   "UpdateDesign:="	, False,
                                   "UpdateIteration:="	, 5,
                                   "KeepReportAxis:="	, True,
                                   "UpdateDesignWhenDone:=", True
                                   ])
    return name
Esempio n. 15
0
def param_setup(oDesign,name):
    oOptimetricsSetup = get_module(oDesign, "Optimetrics")
    oOptimetricsSetup.SolveSetup(name)