Aalto-Electric-Drives / motulator

Motor Drive and Grid Converter Simulator in Python
https://aalto-electric-drives.github.io/motulator/
MIT License
139 stars 53 forks source link

Trying to use the function plot_extra() #108

Closed jmaravin closed 7 months ago

jmaravin commented 7 months ago

Hello, I am trying to use the function which I see on your documentation. See below.

sphinx_gallery_thumbnail_number = 2

plot(sim, base) plot_extra(sim, t_span=(1.1, 1.125), base=base)

What I did is to copy this function into one of the existing examples (2.2kW PMSM) which didnt´ have it. For some reason, that function is not found. Could you please give me some guidance on how to use this function?

Kind regards, Jaime

mhinkkan commented 7 months ago

@jmaravin , thank you for the comment and trying motulator!

In PR #109, you can now find an example of using the method plot_extra with a PMSM drive here:

https://aalto-electric-drives.github.io/motulator/auto_examples/vector/plot_vector_ctrl_pmsm_2kw.html

This method plots a zoomed view of stator voltage and current waveforms. Notice that both plot and plot_extra methods should be considered only as examples how the variables can be plotted, i.e., they only plot a few preselected waveforms. In addition to these variables, a user can access, plot, and post-process all continuous-time system states and most of discrete-time control states.

The DC-bus quantities are not plotted in the above-mentioned PMSM example, since that system model does not include the DC-bus dynamics, unlike the induction machine example:

https://aalto-electric-drives.github.io/motulator/auto_examples/vhz/plot_vhz_ctrl_im_2kw.html

If you are interested in including the DC-bus dynamics in the PMSM drive model, that could be done analogously with the induction motor drive case:

https://aalto-electric-drives.github.io/motulator/autoapi/motulator/model/im/index.html#motulator.model.im.DriveWithDiodeBridge

Currently, we do not have such a drive model (PMSM + DC-bus dynamics) readily available in the repository in order to limit the code base to be maintained. However, if you are interested in this kind of a system model, we will consider adding it there.