Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Added
- Automated testing of the existing examples
- Automated testing of the electric motors
- 2x3 phase PMSM environment with tests and documentation
## Changed
- Changed minimal required gymnasium version to 0.29.1.
- updated the code of gem-control to be compatible with gymnasium v1.0.0
Expand Down
12 changes: 11 additions & 1 deletion docs/parts/environments/environment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ In general, all environment-ids are structured as follows:

- The ``ControlType`` is in ``{Finite / Cont}`` for finite control set and continuous control set action spaces
- The ``ControlTask`` is in ``{TC / SC / CC}`` (Torque / Speed / Current Control)
- The ``MotorType`` is in ``{PermExDc / ExtExDc / SeriesDc / ShuntDc / PMSM / SynRM / / EESM / DFIM / SCIM }``
- The ``MotorType`` is in ``{PermExDc / ExtExDc / SeriesDc / ShuntDc / PMSM / SynRM / / EESM / DFIM / SCIM / SIXPMSM }``


=================================================================== ==============================
Expand Down Expand Up @@ -96,6 +96,15 @@ Speed Control DFIM Environment ``'Cont-SC-
Finite Current Control DFIM Environment ``'Finite-CC-DFIM-v0'``
Current Control DFIM Environment ``'Cont-CC-DFIM-v0'``

**Six Phase Permanent Magnet Synchronous Motor (SIXPMSM) Environments**

Finite Torque Control SIXPMSM Environment ``'Finite-TC-SIXPMSM-v0'``
Torque Control SIXPMSM Environment ``'Cont-TC-SIXPMSM-v0'``
Finite Speed Control SIXPMSM Environment ``'Finite-SC-SIXPMSM-v0'``
Speed Control SIXPMSM Environment ``'Cont-SC-SIXPMSM-v0'``
Finite Current Control SIXPMSM Environment ``'Finite-CC-SIXPMSM-v0'``
Current Control SIXPMSM Environment ``'Cont-CC-SIXPMSM-v0'``

=================================================================== ==============================

.. toctree::
Expand All @@ -112,6 +121,7 @@ Current Control DFIM Environment ``'Cont-CC-
synrm/synrm_envs
scim/scim_envs
dfim/dfim_envs
sixpmsm/sixpmsm_envs


Electric Motor Base Environment
Expand Down
4 changes: 4 additions & 0 deletions docs/parts/environments/sixpmsm/cont_cc_sixpmsm.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Current Control Six Phase Permanent Magnet Synchronous Motor Environment
*****************************************************************************
.. autoclass:: gym_electric_motor.envs.ContCurrentControlSixPhasePermanentMagnetSynchronousMotorEnv
:members:
4 changes: 4 additions & 0 deletions docs/parts/environments/sixpmsm/cont_sc_sixpmsm.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Speed Control Six Phase Permanent Magnet Synchronous Motor Environment
****************************************************************************
.. autoclass:: gym_electric_motor.envs.ContSpeedControlSixPhasePermanentMagnetSynchronousMotorEnv
:members:
4 changes: 4 additions & 0 deletions docs/parts/environments/sixpmsm/cont_tc_sixpmsm.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Torque Control Six Phase Permanent Magnet Synchronous Motor Environment
******************************************************************************
.. autoclass:: gym_electric_motor.envs.ContTorqueControlSixPhasePermanentMagnetSynchronousMotorEnv
:members:
4 changes: 4 additions & 0 deletions docs/parts/environments/sixpmsm/finite_cc_sixpmsm.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Finite Control Set Current Control Six Phase Permanent Magnet Synchronous Motor Environment
**********************************************************************************
.. autoclass:: gym_electric_motor.envs.FiniteCurrentControlSixPhasePermanentMagnetSynchronousMotorEnv
:members:
4 changes: 4 additions & 0 deletions docs/parts/environments/sixpmsm/finite_sc_sixpmsm.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Finite Control Set Speed Control Six Phase Permanent Magnet Synchronous Motor Environment
********************************************************************************
.. autoclass:: gym_electric_motor.envs.FiniteSpeedControlSixPhasePermanentMagnetSynchronousMotorEnv
:members:
4 changes: 4 additions & 0 deletions docs/parts/environments/sixpmsm/finite_tc_sixpmsm.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Finite Control Set Torque Control Six Phase Permanent Magnet Synchronous Motor Environment
*********************************************************************************
.. autoclass:: gym_electric_motor.envs.FiniteTorqueControlSixPhasePermanentMagnetSynchronousMotorEnv
:members:
12 changes: 12 additions & 0 deletions docs/parts/environments/sixpmsm/sixpmsm_envs.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Six Phase Permanent Magnet Synchronous Motor Environments
************************************************


.. toctree::
:maxdepth: 2
:caption: Environments:
:glob:

*


Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Electric Motors
three_phase_base
synchronous_base
induction_base
sixphase_base
sixphase_pmsm

Electric Motor Base Class
*************************************
Expand Down
11 changes: 11 additions & 0 deletions docs/parts/physical_systems/electric_motors/sixphase_base.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Base Six Phase Motor
############################



Code Documentation
******************

.. autoclass:: gym_electric_motor.physical_systems.electric_motors.SixPhaseMotor
:members:
:inherited-members:
26 changes: 26 additions & 0 deletions docs/parts/physical_systems/electric_motors/sixphase_pmsm.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Six Phase Permanent Magnet Synchronous Motor
##################################


Electrical ODE
**************

.. math::
\frac{\mathrm{d} i_\mathrm{d}}{\mathrm{d} t}&= \frac{u_\mathrm{d} + \omega_\mathrm{el} L_\mathrm{q} i_\mathrm{q} - R_\mathrm{s} i_\mathrm{d}}{L_\mathrm{d}} \\
\frac{\mathrm{d} i_\mathrm{q}}{\mathrm{d} t}&= \frac{u_\mathrm{q} - \omega_\mathrm{el} L_\mathrm{d} i_\mathrm{d} - R_\mathrm{s} i_\mathrm{q} - \omega_\mathrm{el} \psi_\mathrm{PM}}{L_\mathrm{q}} \\
\frac{\mathrm{d} i_\mathrm{x}}{\mathrm{d} t}&= \frac{u_\mathrm{x} - \omega_\mathrm{el} L_\mathrm{y} i_\mathrm{y} - R_\mathrm{s} i_\mathrm{x}}{L_\mathrm{x}} \\
\frac{\mathrm{d} i_\mathrm{y}}{\mathrm{d} t}&= \frac{u_\mathrm{y} + \omega_\mathrm{el} L_\mathrm{x} i_\mathrm{x} - R_\mathrm{s} i_\mathrm{y}}{L_\mathrm{y}} \\



Torque Equation
***************

.. math:: T=\frac{3}{2} p (\mathit{\Psi}_\mathrm{p} +(L_\mathrm{d}-L_\mathrm{q})i_\mathrm{sd}) i_\mathrm{sq}

Code Documentation
******************

.. autoclass:: gym_electric_motor.physical_systems.electric_motors.SixPhasePMSM
:members:
:inherited-members:
41 changes: 41 additions & 0 deletions examples/classic_controllers/demoSixPhasePMSM.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import gym_electric_motor as gem
from gym_electric_motor.envs.motors import ActionType, ControlType, Motor, MotorType
from gym_electric_motor.reference_generators import LaplaceProcessReferenceGenerator
from gym_electric_motor.visualization import MotorDashboard
from gym_electric_motor.visualization.render_modes import RenderMode
from gym_electric_motor.visualization.console_printer import ConsolePrinter
from gym_electric_motor.physical_systems import ConstantSpeedLoad


my_changed_voltage_supply_args = {'u_nominal': 200.0}
motor_dashboard = MotorDashboard(state_plots=("i_a1","i_a2"),render_mode=RenderMode.Figure)
load = ConstantSpeedLoad(omega_fixed=200)
motor = Motor(
MotorType.SixPhasePMSM,
ControlType.CurrentControl,
ActionType.Continuous,
)
env = gem.make(
motor.env_id(),
supply = my_changed_voltage_supply_args,
load = load,
visualization = motor_dashboard)
terminated = True
for _ in range(1000):
if terminated:
state, reference = env.reset()
(state, reference), reward, terminated, truncated, _ = env.step(0 * env.action_space.sample())

motor_dashboard.initialize()
fig = motor_dashboard.figure()
fig.gca().set_ylim([-20,+20])
fig.gca().set_xlim([0,0.02])
fig.get_axes()[0].set_ylim([-20,+20])
fig.gca().legend(loc='upper right')
fig.get_axes()[0].legend(loc='upper right')
fig.savefig("test")
motor_dashboard.save_to_file()


#console.render()
env.close()
20 changes: 20 additions & 0 deletions src/gym_electric_motor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,3 +281,23 @@
register(
id="Cont-SC-DFIM-v0", entry_point=envs_path + "ContSpeedControlDoublyFedInductionMotorEnv", **registration_kwargs
)

#sixphase machines
register(
id="Cont-CC-SIXPMSM-v0", entry_point=envs_path + "ContCurrentControlSixPhasePermanentMagnetSynchronousMotorEnv", **registration_kwargs
)
register(
id="Cont-SC-SIXPMSM-v0", entry_point=envs_path + "ContSpeedControlSixPhasePermanentMagnetSynchronousMotorEnv", **registration_kwargs
)
register(
id="Cont-TC-SIXPMSM-v0", entry_point=envs_path + "ContTorqueControlSixPhasePermanentMagnetSynchronousMotorEnv", **registration_kwargs
)
register(
id="Finite-CC-SIXPMSM-v0", entry_point=envs_path + "FiniteCurrentControlSixPhasePermanentMagnetSynchronousMotorEnv", **registration_kwargs
)
register(
id="Finite-SC-SIXPMSM-v0", entry_point=envs_path + "FiniteSpeedControlSixPhasePermanentMagnetSynchronousMotorEnv", **registration_kwargs
)
register(
id="Finite-TC-SIXPMSM-v0", entry_point=envs_path + "FiniteTorqueControlSixPhasePermanentMagnetSynchronousMotorEnv", **registration_kwargs
)
20 changes: 20 additions & 0 deletions src/gym_electric_motor/envs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,26 @@
from .gym_eesm.finite_tc_eesm_env import (
FiniteTorqueControlExternallyExcitedSynchronousMotorEnv,
)
from .gym_sixphase_pmsm.cont_cc_sixpmsm_env import (
ContCurrentControlSixPhasePermanentMagnetSynchronousMotorEnv,

)
from .gym_sixphase_pmsm.cont_sc_sixpmsm_env import (
ContSpeedControlSixPhasePermanentMagnetSynchronousMotorEnv,
)
from .gym_sixphase_pmsm.cont_tc_sixpmsm_env import (
ContTorqueControlSixPhasePermanentMagnetSynchronousMotorEnv,
)
from .gym_sixphase_pmsm.finite_cc_sixpmsm_env import (
FiniteCurrentControlSixPhasePermanentMagnetSynchronousMotorEnv,
)
from .gym_sixphase_pmsm.finite_sc_sixpmsm_env import (
FiniteSpeedControlSixPhasePermanentMagnetSynchronousMotorEnv,
)
from .gym_sixphase_pmsm.finite_tc_sixpmsm_env import (
FiniteTorqueControlSixPhasePermanentMagnetSynchronousMotorEnv,
)

from .gym_im import (
ContCurrentControlDoublyFedInductionMotorEnv,
ContCurrentControlSquirrelCageInductionMotorEnv,
Expand Down
6 changes: 6 additions & 0 deletions src/gym_electric_motor/envs/gym_sixphase_pmsm/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from .cont_cc_sixpmsm_env import ContCurrentControlSixPhasePermanentMagnetSynchronousMotorEnv
from .cont_sc_sixpmsm_env import ContSpeedControlSixPhasePermanentMagnetSynchronousMotorEnv
from .cont_tc_sixpmsm_env import ContTorqueControlSixPhasePermanentMagnetSynchronousMotorEnv
from .finite_cc_sixpmsm_env import FiniteCurrentControlSixPhasePermanentMagnetSynchronousMotorEnv
from .finite_sc_sixpmsm_env import FiniteSpeedControlSixPhasePermanentMagnetSynchronousMotorEnv
from .finite_tc_sixpmsm_env import FiniteTorqueControlSixPhasePermanentMagnetSynchronousMotorEnv
Loading
Loading