-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #259 from upb-lea/update_gem_controllers
Update gem controllers
- Loading branch information
Showing
3 changed files
with
42 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import gym_electric_motor as gem | ||
import gem_controllers as gc | ||
from gym_electric_motor.physical_system_wrappers import FluxObserver | ||
|
||
|
||
|
||
if __name__ == '__main__': | ||
|
||
# choose the action space | ||
action_space = 'Cont' # 'Cont' or 'Finite' | ||
|
||
# choose the control task | ||
control_task = 'CC' # 'SC' (speed control), 'TC' (torque control) or 'CC' (current control) | ||
|
||
# chosse the motor type | ||
motor_type = 'PMSM' # 'PermExDc', 'ExtExDc', 'SeriesDc', 'ShuntDc', 'PMSM', 'EESM', 'SynRM' or 'SCIM' | ||
|
||
env_id = action_space + '-' + control_task + '-' + motor_type + '-v0' | ||
|
||
# using a flux observer for the SCIM | ||
physical_system_wrappers = (FluxObserver(),) if motor_type == 'SCIM' else () | ||
|
||
# Initilize the environment | ||
env = gem.make(env_id, physical_system_wrappers=physical_system_wrappers) | ||
|
||
# Initialize the controller | ||
c = gc.GemController.make( | ||
env, | ||
env_id, | ||
a=8, | ||
block_diagram=True, | ||
current_safety_margin=0.25, | ||
save_block_diagram_as=(), | ||
) | ||
|
||
# Control the environment | ||
c.control_environment(env, n_steps=30000, render_env=True, max_episode_length=10000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters