State Plot

class gym_electric_motor.visualization.motor_dashboard_plots.StatePlot(state)[source]

Bases: TimePlot

Plot to display the environments states and their references.

Parameters:

state (str) – Name of the state to plot

initialize(axis)[source]

Initialization of the plot.

It is called by the MotorDashboard. Set labels, legends… when overriding this method.

Parameters:

axis (matplotlib.pyplot.axis) – Axis to plot in

on_close()

Gets called at the beginning of a close

on_reset_begin()

Gets called at the beginning of each reset

on_reset_end(state, reference)

Gets called at the end of each reset

on_step_begin(k, action)

Gets called at the beginning of each step

on_step_end(k, state, reference, reward, terminated)[source]

Gets called at the end of each step

render()

Update of the plots axis.

The current x and y-data are written onto the respective lines in this methods. Furthermore the x- and y-axes are scaled dynamically.

reset_data()[source]

Called by the dashboard, when the figures are reset to generate a new figure.

set_env(env)[source]

Sets the environment of the motor.

set_width(width)

Sets the width of the plot in data points.

Parameters:

width (int > 0) – The width of the plot

property data_idx

Returns the current index to access the time and data arrays.

property state
state_labels = {'epsilon': '$\\epsilon$/rad', 'i': '$i$/A', 'i_a': '$i_{\\mathrm{a}}$/A', 'i_b': '$i_{\\mathrm{b}}$/A', 'i_c': '$i_{\\mathrm{c}}$/A', 'i_e': '$i_{\\mathrm{e}}$/A', 'i_sd': '$i_{\\mathrm{sd}}$/A', 'i_sq': '$i_{\\mathrm{sq}}$/A', 'omega': '$\\omega$/(1/s)', 'torque': '$T$/Nm', 'u': '$u$/V', 'u_a': '$u_{\\mathrm{a}}$/V', 'u_b': '$u_{\\mathrm{b}}$/V', 'u_c': '$u_{\\mathrm{c}}$/V', 'u_e': '$u_{\\mathrm{e}}$/V', 'u_sd': '$u_{\\mathrm{sd}}$/V', 'u_sq': '$u_{\\mathrm{sq}}$/V', 'u_sup': '$u_{\\mathrm{sup}}$/V'}