Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EESM rotor parameters can be defined untransformed or transformed to stator side #243

Open
wants to merge 5 commits into
base: nightly
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion src/gym_electric_motor/envs/gym_eesm/cont_cc_eesm_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def __init__(
ps.ContFourQuadrantConverter(),
)
physical_system = ExternallyExcitedSynchronousMotorSystem(
supply=initialize(ps.VoltageSupply, supply, ps.IdealVoltageSupply, dict(u_nominal=300.0)),
supply=initialize(ps.VoltageSupply, supply, ps.IdealVoltageSupply, dict(u_nominal=200.0)),
converter=initialize(
ps.PowerElectronicConverter,
converter,
Expand Down
2 changes: 1 addition & 1 deletion src/gym_electric_motor/envs/gym_eesm/cont_sc_eesm_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def __init__(
ps.ContFourQuadrantConverter(),
)
physical_system = ExternallyExcitedSynchronousMotorSystem(
supply=initialize(ps.VoltageSupply, supply, ps.IdealVoltageSupply, dict(u_nominal=420.0)),
supply=initialize(ps.VoltageSupply, supply, ps.IdealVoltageSupply, dict(u_nominal=200.0)),
converter=initialize(
ps.PowerElectronicConverter,
converter,
Expand Down
2 changes: 1 addition & 1 deletion src/gym_electric_motor/envs/gym_eesm/cont_tc_eesm_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def __init__(
ps.ContFourQuadrantConverter(),
)
physical_system = ExternallyExcitedSynchronousMotorSystem(
supply=initialize(ps.VoltageSupply, supply, ps.IdealVoltageSupply, dict(u_nominal=420.0)),
supply=initialize(ps.VoltageSupply, supply, ps.IdealVoltageSupply, dict(u_nominal=200.0)),
converter=initialize(
ps.PowerElectronicConverter,
converter,
Expand Down
2 changes: 1 addition & 1 deletion src/gym_electric_motor/envs/gym_eesm/finite_cc_eesm_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def __init__(
ps.FiniteFourQuadrantConverter(),
)
physical_system = ExternallyExcitedSynchronousMotorSystem(
supply=initialize(ps.VoltageSupply, supply, ps.IdealVoltageSupply, dict(u_nominal=420.0)),
supply=initialize(ps.VoltageSupply, supply, ps.IdealVoltageSupply, dict(u_nominal=200.0)),
converter=initialize(
ps.PowerElectronicConverter,
converter,
Expand Down
2 changes: 1 addition & 1 deletion src/gym_electric_motor/envs/gym_eesm/finite_sc_eesm_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def __init__(
ps.FiniteFourQuadrantConverter(),
)
physical_system = ExternallyExcitedSynchronousMotorSystem(
supply=initialize(ps.VoltageSupply, supply, ps.IdealVoltageSupply, dict(u_nominal=420.0)),
supply=initialize(ps.VoltageSupply, supply, ps.IdealVoltageSupply, dict(u_nominal=200.0)),
converter=initialize(
ps.PowerElectronicConverter,
converter,
Expand Down
2 changes: 1 addition & 1 deletion src/gym_electric_motor/envs/gym_eesm/finite_tc_eesm_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def __init__(
ps.FiniteFourQuadrantConverter(),
)
physical_system = ExternallyExcitedSynchronousMotorSystem(
supply=initialize(ps.VoltageSupply, supply, ps.IdealVoltageSupply, dict(u_nominal=420.0)),
supply=initialize(ps.VoltageSupply, supply, ps.IdealVoltageSupply, dict(u_nominal=200.0)),
converter=initialize(
ps.PowerElectronicConverter,
converter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,21 +97,21 @@ class ExternallyExcitedSynchronousMotor(SynchronousMotor):
CURRENTS = ["i_sd", "i_sq", "i_e"]
VOLTAGES = ["u_sd", "u_sq", "u_e"]

#### Parameters taken from DOI: 10.1109/ICELMACH.2014.6960287 (C. D. Nguyen; W. Hofmann)
#### Parameters derived from DOI: 10.1109/ICPE.2015.7168165 (Q. K. Nguyen; J. Schuster; J. Roth-Stielow)
_default_motor_parameter = {
'p': 3,
'l_d': 1.66e-3,
'l_q': 0.35e-3,
'l_m': 1.589e-3,
'l_e': 1.74e-3,
'p': 2,
'l_d': 3.78e-3,
'l_q': 1.21e-3,
'l_m': 40e-3,
'l_e': 870e-3,
'j_rotor': 0.3883,
'r_s': 15.55e-3,
'r_e': 7.2e-3,
'k': 65.21,
'r_s': 123e-3,
'r_e': 15.6,
'k': 0.057,
}
HAS_JACOBIAN = True
_default_limits = dict(omega=12e3 * np.pi / 30, torque=0.0, i=150, i_e=150, epsilon=math.pi, u=320)
_default_nominal_values = dict(omega=4.3e3 * np.pi / 30, torque=0.0, i=120, i_e=150, epsilon=math.pi, u=320)
_default_limits = dict(omega=12e3 * np.pi / 30, torque=0.0, i=25, i_e=25, epsilon=math.pi, u=200, u_e=200)
_default_nominal_values = dict(omega=4.3e3 * np.pi / 30, torque=0.0, i=25, i_e=25, epsilon=math.pi, u=200, u_e=200)
_default_initializer = {
"states": {"i_sq": 0.0, "i_sd": 0.0, "i_e": 0.0, "epsilon": 0.0},
"interval": None,
Expand All @@ -126,18 +126,38 @@ def _update_model(self):
# Docstring of superclass
mp = self._motor_parameter

# Transform rotor quantities to stator side (uppercase index denotes transformation to stator side)
mp['r_E'] = mp['k'] ** 2 * 3/2 * mp['r_e']
mp['l_M'] = mp['k'] * 3/2 * mp['l_m']
mp['l_E'] = mp['k'] ** 2 * 3/2 * mp['l_e']
if all(key in mp for key in ['r_e', 'l_m', 'l_e']):
print("Transforming r_e, l_m and l_e to stator side.")
print("To specify stator-side quantities, make use of keys r_E, l_M and l_E instead.")

# Transform rotor quantities to stator side (uppercase index denotes transformation to stator side)
mp['r_E'] = 3 / 2 * mp['k'] ** 2 * mp['r_e']
mp['l_M'] = 3 / 2 * mp['k'] * mp['l_m']
mp['l_E'] = 3 / 2 * mp['k'] ** 2 * mp['l_e']

elif all(key in mp for key in ['r_E', 'l_M', 'l_E']):

if mp != self._default_motor_parameter:
print("Assuming r_E, l_M and l_E are already transformed to stator side.")
print("To specify rotor-side quantities, make use of keys r_e, l_m and l_e instead.")

# Transform rotor quantities to rotor side (only for completing the mp dict, not needed for calculation)
mp['r_e'] = 2 / 3 * mp['r_E'] / (mp['k'] ** 2)
mp['l_m'] = 2 / 3 * mp['l_M'] / mp['k']
mp['l_e'] = 2 / 3 * mp['l_E'] / (mp['k'] ** 2)

else:
raise KeyError("Rotor quantities are not specified in a consistent frame or are incomplete."
"Specify either r_e, l_m and l_e (rotor-side) or r_E, l_M and l_E (stator-side).")


mp['i_k_rs'] = 2 / 3 / mp['k'] # ratio (i_E / i_e)
mp['sigma'] = 1 - mp['l_M'] ** 2 / (mp['l_d'] * mp['l_E'])

# fmt: off

self._model_constants = np.array([
# omega, i_d, i_q, i_e, u_d, u_q, u_e, omega * i_d, omega * i_q, omega * i_e
# omega, i_d, i_q, i_e, u_d, u_q, u_e, omega * i_d, omega * i_q, omega * i_e
[ 0, -mp["r_s"] / mp["sigma"], 0, mp["l_M"] * mp["r_E"] / (mp["sigma"] * mp["l_E"]) * mp["i_k_rs"], 1 / mp["sigma"], 0, -mp["l_M"] * mp["k"] / (mp["sigma"] * mp["l_E"]), 0, mp["l_q"] * mp["p"] / mp["sigma"], 0],
[ 0, 0, -mp["r_s"], 0, 0, 1, 0, -mp["l_d"] * mp["p"], 0, -mp["p"] * mp["l_M"] * mp["i_k_rs"]],
[ 0, mp["l_M"] * mp["r_s"] / (mp["sigma"] * mp["l_d"]), 0, -mp["r_E"] / mp["sigma"] * mp["i_k_rs"], -mp["l_M"] / (mp["sigma"] * mp["l_d"]), 0, mp["k"] / mp["sigma"], 0, -mp["p"] * mp["l_M"] * mp["l_q"] / (mp["sigma"] * mp["l_d"]), 0],
Expand Down
Loading