@@ -164,8 +164,8 @@ def plot(sim, base=None, plot_pcc_voltage=True, plot_w=False, t_span=None):
164
164
ax3 .set_xlabel ("Time (s)" )
165
165
166
166
fig .align_ylabels ()
167
- plt .tight_layout ()
168
- plt .grid ()
167
+ # plt.tight_layout()
168
+ # plt.grid()
169
169
ax3 .grid ()
170
170
#plt.show()
171
171
@@ -270,9 +270,54 @@ def plot(sim, base=None, plot_pcc_voltage=True, plot_w=False, t_span=None):
270
270
ax3 .set_xlabel ("Time (s)" )
271
271
272
272
fig .align_ylabels ()
273
+ ax3 .grid ()
274
+
275
+ # %%
276
+ # Third figure (only if three-level converter is used)
277
+ try :
278
+ i_o = mdl .converter .data .i_o
279
+
280
+ fig , (ax1 , ax2 ) = plt .subplots (2 , 1 )
281
+
282
+ # Subplot 1: Capacitor voltages
283
+ ax1 .plot (
284
+ mdl .converter .data .t ,
285
+ mdl .converter .data .u_dc1 / base .u ,
286
+ label = r"$u_\mathrm{dc1}$" )
287
+ ax1 .plot (
288
+ mdl .converter .data .t ,
289
+ mdl .converter .data .u_dc2 / base .u ,
290
+ label = r"$u_\mathrm{dc2}$" )
291
+ ax1 .legend ()
292
+ ax1 .set_xlim (t_span )
293
+ ax1 .set_xticklabels ([])
294
+
295
+ # Subplot 2: Converter dc-side currents
296
+ ax2 .plot (
297
+ mdl .converter .data .t ,
298
+ mdl .converter .data .i_P / base .i ,
299
+ label = r"$i_\mathrm{P}$" )
300
+ ax2 .plot (mdl .converter .data .t , i_o / base .i , label = r"$i_\mathrm{o}$" )
301
+ ax2 .legend ()
302
+ ax2 .set_xlim (t_span )
303
+
304
+ # Add axis labels
305
+ if pu_vals :
306
+ ax1 .set_ylabel ("Voltage (p.u.)" )
307
+ ax2 .set_ylabel ("Current (p.u.)" )
308
+ else :
309
+ ax1 .set_ylabel ("Voltage (V)" )
310
+ ax2 .set_ylabel ("Current (A)" )
311
+ ax2 .set_xlabel ("Time (s)" )
312
+
313
+ fig .align_ylabels ()
314
+ ax2 .grid ()
315
+
316
+ except AttributeError :
317
+ pass
318
+
273
319
plt .tight_layout ()
274
320
plt .grid ()
275
- ax3 .grid ()
276
321
plt .show ()
277
322
278
323
0 commit comments