hello ,
First, I used the schematic file in the QucsStudio interface to run and obtain the S-parameter results. Then I copied the netlist from the interface via <show last netlist>, saved it as netlist.txt, and executed the command qucssim “netlist.txt” “result.dat” in the command line to generate the result.dat data file. On the forum, people have shared methods for decoding .dat files, which I tried, but the results were not correct. Is this a bug?
the result of method for parsing the .dat file in below:
type=5, len=10000, name=frequency, deps=[], pos=58
type=3, len=40000, name=S, deps=[‘frequency’, ‘2’, ‘2’], pos=80058
Variables: dict_keys([‘frequency’, ‘S’])
dependencies: {‘frequency’: [], ‘S’: [‘frequency’, ‘2’, ‘2’]}
get the S parameter from the .dat file:
print(“Variables:”, ds.variables.keys())
print(“dependencies:”, ds.dependencies)freq = ds.variables[‘frequency’] # (10000,)
s_matrix = ds.variables[‘S’] # (10000, 2, 2) complex
# Extract S-parameters
s11 = s_matrix[:, 0, 0]
s21 = s_matrix[:, 1, 0]
# Convert to dB
s11_db = 20 * np.log10(np.abs(s11))
s21_db = 20 * np.log10(np.abs(s21))