# -*- coding: utf-8 -*-
"""
Created on Thu Feb 23 19:17:48 2023

@author: yt
"""


from __future__ import division

# import sys

# sys.path.append('C:/Users/yt/Documents/GitHub/hycohanz/hycohanz')
import hycohanz as hfss

import numpy as np
import time

from pathlib import Path

# path on laptop
data_folder = Path('C:/Users/yt/OneDrive - Cambridge Consultants/Projects/P3651 Batman/PCB Transformer')

hfssfile_to_open = data_folder/'PCB Transformer Final Tolerance.aedt'

[oAnsoftApp, oDesktop]=hfss.setup_interface()

oProject=hfss.open_project(oDesktop,hfssfile_to_open)

designname="shield above transformer"
oDesign=hfss.set_active_design(oProject, designname)

oEditor=hfss.set_active_editor(oDesign, editorname="3D Modeler")

OutFile=data_folder/'ss.s2p'

oModule=hfss.get_module(oDesign, "Solutions")

hfss.export_network_data(oModule,OutFile,"",["Auto1:Sweep1"] ,DataType="S")


# T1 = np.arange(-0.1, 0.11, 0.1)
# T2 = np.arange(-0.1, 0.11, 0.1)
# T3 = np.arange(-0.1, 0.11, 0.1)
# n=0
# start_time = time.time()
# # hfss.analyze(oDesign, "Auto1: Sweep1")
# for i in T1:
#     for j in T2:
#         for k in T3:
#             if abs(i + j + k) > 0.1:
#                 break
#             dH1 = f"{round(i, 2)}mm"
#             dH2 = f"{round(j, 2)}mm"
#             dH3 = f"{round(k, 2)}mm"
#             n=n+1
#             print(dH1,dH2,dH3, n)
#             hfss.set_variable(oProject, "dH1", dH1)
#             hfss.set_variable(oProject, "dH2", dH2)
#             hfss.set_variable(oProject, "dH3", dH3)
#             start_time_once = time.time()
#             hfss.analyze(oDesign, "Auto1")
#             oProject.Save()
#             end_time_once = time.time()
#             elapsed_time = end_time_once - start_time_once
#             print("the time for one simulation is ",elapsed_time)
            
# end_time = time.time()
# elapsed_time=end_time-start_time
# print("the total simulation time is ",elapsed_time)




input('Press Enter to exit HFSS')
hfss.close_current_project(oDesktop)
hfss.quit_application(oDesktop)

del oDesktop
del oAnsoftApp
261c9c19cd7d3246b66741b6e5aa3dd968ed8f07
<mask token>

<mask token>
hfss.export_network_data(oModule, OutFile, '', ['Auto1:Sweep1'], DataType='S')
input('Press Enter to exit HFSS')
hfss.close_current_project(oDesktop)
hfss.quit_application(oDesktop)
del oDesktop
del oAnsoftApp

<mask token>
data_folder = Path(
    'C:/Users/yt/OneDrive - Cambridge Consultants/Projects/P3651 Batman/PCB Transformer'
    )
hfssfile_to_open = data_folder / 'PCB Transformer Final Tolerance.aedt'
[oAnsoftApp, oDesktop] = hfss.setup_interface()
oProject = hfss.open_project(oDesktop, hfssfile_to_open)
designname = 'shield above transformer'
oDesign = hfss.set_active_design(oProject, designname)
oEditor = hfss.set_active_editor(oDesign, editorname='3D Modeler')
OutFile = data_folder / 'ss.s2p'
oModule = hfss.get_module(oDesign, 'Solutions')
hfss.export_network_data(oModule, OutFile, '', ['Auto1:Sweep1'], DataType='S')
input('Press Enter to exit HFSS')
hfss.close_current_project(oDesktop)
hfss.quit_application(oDesktop)
del oDesktop
del oAnsoftApp

<mask token>
from __future__ import division
import hycohanz as hfss
import numpy as np
import time
from pathlib import Path
data_folder = Path(
    'C:/Users/yt/OneDrive - Cambridge Consultants/Projects/P3651 Batman/PCB Transformer'
    )
hfssfile_to_open = data_folder / 'PCB Transformer Final Tolerance.aedt'
[oAnsoftApp, oDesktop] = hfss.setup_interface()
oProject = hfss.open_project(oDesktop, hfssfile_to_open)
designname = 'shield above transformer'
oDesign = hfss.set_active_design(oProject, designname)
oEditor = hfss.set_active_editor(oDesign, editorname='3D Modeler')
OutFile = data_folder / 'ss.s2p'
oModule = hfss.get_module(oDesign, 'Solutions')
hfss.export_network_data(oModule, OutFile, '', ['Auto1:Sweep1'], DataType='S')
input('Press Enter to exit HFSS')
hfss.close_current_project(oDesktop)
hfss.quit_application(oDesktop)
del oDesktop
del oAnsoftApp

# -*- coding: utf-8 -*-
"""
Created on Thu Feb 23 19:17:48 2023

@author: yt
"""


from __future__ import division

# import sys

# sys.path.append('C:/Users/yt/Documents/GitHub/hycohanz/hycohanz')
import hycohanz as hfss

import numpy as np
import time

from pathlib import Path

# path on laptop
data_folder = Path('C:/Users/yt/OneDrive - Cambridge Consultants/Projects/P3651 Batman/PCB Transformer')

hfssfile_to_open = data_folder/'PCB Transformer Final Tolerance.aedt'

[oAnsoftApp, oDesktop]=hfss.setup_interface()

oProject=hfss.open_project(oDesktop,hfssfile_to_open)

designname="shield above transformer"
oDesign=hfss.set_active_design(oProject, designname)

oEditor=hfss.set_active_editor(oDesign, editorname="3D Modeler")

OutFile=data_folder/'ss.s2p'

oModule=hfss.get_module(oDesign, "Solutions")

hfss.export_network_data(oModule,OutFile,"",["Auto1:Sweep1"] ,DataType="S")


# T1 = np.arange(-0.1, 0.11, 0.1)
# T2 = np.arange(-0.1, 0.11, 0.1)
# T3 = np.arange(-0.1, 0.11, 0.1)
# n=0
# start_time = time.time()
# # hfss.analyze(oDesign, "Auto1: Sweep1")
# for i in T1:
#     for j in T2:
#         for k in T3:
#             if abs(i + j + k) > 0.1:
#                 break
#             dH1 = f"{round(i, 2)}mm"
#             dH2 = f"{round(j, 2)}mm"
#             dH3 = f"{round(k, 2)}mm"
#             n=n+1
#             print(dH1,dH2,dH3, n)
#             hfss.set_variable(oProject, "dH1", dH1)
#             hfss.set_variable(oProject, "dH2", dH2)
#             hfss.set_variable(oProject, "dH3", dH3)
#             start_time_once = time.time()
#             hfss.analyze(oDesign, "Auto1")
#             oProject.Save()
#             end_time_once = time.time()
#             elapsed_time = end_time_once - start_time_once
#             print("the time for one simulation is ",elapsed_time)
            
# end_time = time.time()
# elapsed_time=end_time-start_time
# print("the total simulation time is ",elapsed_time)




input('Press Enter to exit HFSS')
hfss.close_current_project(oDesktop)
hfss.quit_application(oDesktop)

del oDesktop
del oAnsoftApp