Skip to content

Resolve "Create Port class"

Lucas POLO-LOPEZ requested to merge 16-create-ports-class into develop

Closes #16 (closed)

Methods to implement

addDiscretePort(xMin: Union[float, str], xMax: Union[float, str], yMin: Union[float, str], yMax: Union[float, str], zMin: Union[float, str], zMax: Union[float, str], type: str="impedance", impedance: float=50.0, voltage: float=1.0, current: float=1.0, radius: float=0.0)

vba = (
    'With DiscretePort\n' +
    '.Reset\n' +
    '.Type "{}"\n'.format(type) +
    '.PortNumber "{:d}"\n'.format(portNumber) +
    '.SetP1 "False", "{}", "{}", "{}"\n'.format(portParams["xMin"], portParams["yMin"], portParams["zMin"]) +
    '.SetP2 "False", "{}", "{}", "{}"\n'.format(portParams["xMax"], portParams["yMax"], portParams["zMax"]) +
    '.Impedance "{}"\n'.format(impedance) +
    '.Voltage "{}"\n'.format(voltage) +
    '.Current "{}"\n'.format(current) +
    '.Radius "{}"\n'.format(radius) +
    '.Create\n' +
    'End With'
    )

addWaveguidePort(xMin: Union[float, str], xMax: Union[float, str], yMin: Union[float, str], yMax: Union[float, str], zMin: Union[float, str], zMax: Union[float, str], orientation: str, nModes: int=1, enforcePolar: bool = False, polarAngle: float = 0.0, refPlaneDist: float = 0.0)

nModes must be obtained by using the StartPortNumberIteration method of the MWS object.

orientation must be checked at the beginning of the method. If it is either "xmin" or "xmax", then it is important to make xMax=xMin. For the other orientations the code should proceed analogously.

vba = (
    'With Port\n' +
    '.Reset\n' +
    '.PortNumber "{:d}"\n'.format(portNumber) +
    '.Label ""\n' +
    '.Folder ""\n' +
    '.NumberOfModes "{:d}"\n'.format(nModes) +
    '.AdjustPolarization {}\n'.format(enforcePolar) +
    '.PolarizationAngle "{}"\n'.format(portParams["polarAngle"]) +
    '.ReferencePlaneDistance "{}"\n'.format(portParams["refPlaneDist"]) +
    '.TextSize "50"\n' +
    '.TextMaxLimit "1"\n' +
    '.Coordinates "Free"\n' +
    '.Orientation "{}"\n'.format(orientation) +
    '.PortOnBound "False"\n' +
    '.ClipPickedPortToBound "False"\n' +
    '.Xrange "{}", "{}"\n'.format(portParams["xMin"], portParams["xMax"]) +
    '.Yrange "{}", "{}"\n'.format(portParams["yMin"], portParams["yMax"]) +
    '.Zrange "{}", "{}"\n'.format(portParams["zMin"], portParams["zMax"]) +
    '.XrangeAdd "0.0", "0.0"\n' +
    '.YrangeAdd "0.0", "0.0"\n' +
    '.ZrangeAdd "0.0", "0.0"\n' +
    '.SingleEnded "False"\n' +
    '.WaveguideMonitor "False"\n' +
    '.Create\n' +
    'End With'
    )
Edited by Lucas POLO-LOPEZ

Merge request reports

Loading