Post Processing in PyAEDT doesn't work

Dear community,

I am working with PyAEDT to automatically create a 2D-model of a PMSM. But I have encountered an issue while trying to write a script that is supposed to plot the induced voltage.

output_vars = {
    "Ui_A": "InducedVoltage(Phase_1)",
}

for k, v in output_vars.items():
    M2D.create_output_variable(k, v)

post_params = {
    "Moving1.Torque": "TorquePlots"
}

post_params_multiplot = {  # reports
    "Ui_A": "InducedVoltage",
}

plt.figure(figsize=(18.5,10.5))
ind_voltage = np.zeros(0,dtype=float)
for i in range(0,n_slices):
    M2D.set_active_design("Slice"+str(i+1))
    for k, v in post_params_multiplot.items():
        M2D.post.create_report(expressions=list(k), setup_sweep_name="",
                                domain="Sweep", variations=None,
                                primary_sweep_variable="Time", secondary_sweep_variable=None,
                                report_category=None, plot_type="Rectangular Plot",
                                context=None, subdesign_id=None,
                                polyline_points=1001, plot_name=v)

    M2D.analyze_setup(sName, use_auto_settings=False,cores=16)

    solutions = M2D.post.get_solution_data(expressions="Ui_A", 
    primary_sweep_variable="Time")
    mag = [x/1000 for x in solutions.data_real()]
    if i>0:
        ind_voltage = np.array(ind_voltage) + np.array(mag)
    else:
        ind_voltage = mag
    plt.plot(mag,label='Slice'+str(i+1))
ind_voltage_all_slices = [x/n_slices for x in ind_voltage]
plt.plot(ind_voltage_all_slices,label='all Slices')
plt.xlabel("Time") 
plt.ylabel("Induced Voltage in V") 
plt.title("Induced Voltage") 
plt.grid()
plt.legend()
plt.show()

n_slices is the number of how many different models are created which is necessary to simulate the skewing within the machine. While n_slices = 1, everything works fine, but with any number greater than 1, it will not work, not even for the first slice. I really have no idea why it wouldn't work. If I try the same code but change induced voltage for torque, it works just fine. I would be really thankful if someone is able to help me out here.

Tagged: