Created
May 31, 2021 11:26
-
-
Save sjoelund/62f72bd49e4e2b0cbc0da55e1d3ecdcc to your computer and use it in GitHub Desktop.
eFMI Testcase: PlantForInversion
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
/* | |
* Converted Flat Modelica equation code to SCODE Congra format for: | |
* 'EMPHYSIS_TestCases.M04_DrivetrainTorqueControl.PlantModels.PlantForInversion' | |
* Generation Date: 2020-12-04T19:14:42.082449900 | |
*/ | |
package PlantForInversion; | |
@flows(F_Inverted_PlantForInversion) | |
system sys_PlantForInversion (@ description("(42): public input Real 'M_m';") @ geo(146, 504) | |
M_m, M_l_port, @ geo(1140, 554) | |
M_l_port_dot, @ geo(1224, 216) | |
w_rel_out) { | |
/* | |
* variable declaration | |
*/ | |
// (4): public final parameter Boolean 'for_inversion' = true; | |
// 'for_inversion' is not used in any equations, just ignore it | |
// (5): public parameter Real 'gearRatio' = 10.0; | |
// 'gearRatio' is not used in any equations, just ignore it | |
// (6): public parameter Real 'J_M'(unit = "kg.m2", quantity = "MomentOfInertia") = 0.01; | |
// 'J_M' is not used in any equations, just ignore it | |
// (7): public parameter Real 'd_res'(unit = "N.m.s/rad", quantity = "RotationalDampingConstant") = 1.57; | |
// 'd_res' is not used in any equations, just ignore it | |
// (8): public parameter Real 'k_accCor' = -0.0101615216387814; | |
// 'k_accCor' is not used in any equations, just ignore it | |
// (9): public parameter Real 'c_res' = 4710.0; | |
// 'c_res' is not used in any equations, just ignore it | |
// 'inertiaDrivelineIn.flange_a.phi' is aliased by 'inertiaDrivelineIn.phi' | |
@description("(11): public Real 'inertiaDrivelineIn.flange_a.tau'(unit = \"N.m\", quantity = \"Torque\");") | |
@geo(288, 619) | |
var inertiaDrivelineIn_flange_a_tau; | |
// 'inertiaDrivelineIn.flange_b.phi' is aliased by 'inertiaDrivelineIn.phi' | |
@description("(13): public Real 'inertiaDrivelineIn.flange_b.tau'(unit = \"N.m\", quantity = \"Torque\");") | |
@geo(564, 619) | |
var inertiaDrivelineIn_flange_b_tau; | |
@description("(14): public parameter Real 'inertiaDrivelineIn.J'(start = 1.0, min = 0.0, unit = \"kg.m2\", quantity = \"MomentOfInertia\") = 'J_M';") | |
@geo(420, 564) | |
param inertiaDrivelineIn_J is >= 0.0 = 0.01; | |
// (15): public parameter 'StateSelect' 'inertiaDrivelineIn.stateSelect' = 'StateSelect'.default; | |
// 'inertiaDrivelineIn.stateSelect' is not used in any equations, just ignore it | |
@description("(16): public Real 'inertiaDrivelineIn.phi'(stateSelect = 'StateSelect'.default, fixed = false, start = 0.0, displayUnit = \"deg\", unit = \"rad\", quantity = \"Angle\"); | |
(90): 'inertiaDrivelineIn.w' = der('inertiaDrivelineIn.phi')") | |
@geo(492, 336) | |
var inertiaDrivelineIn_phi ; | |
// aliasing: ['inertiaDrivelineIn.flange_a.phi', 'inertiaDrivelineIn.flange_b.phi', 'relSpeedSensor.flange_a.phi', 'springDamper.flange_a.phi', 'torqueDrive.flange.phi'] | |
@description("(17): public Real 'inertiaDrivelineIn.w'(stateSelect = 'StateSelect'.default, fixed = false, start = 0.0, unit = \"rad/s\", quantity = \"AngularVelocity\"); | |
(91): 'inertiaDrivelineIn.a' = der('inertiaDrivelineIn.w')") | |
@geo(492, 420) | |
var inertiaDrivelineIn_w = integrate(inertiaDrivelineIn_a); | |
@description("(18): public Real 'inertiaDrivelineIn.a'(unit = \"rad/s2\", quantity = \"AngularAcceleration\");") | |
@geo(492, 504) | |
var inertiaDrivelineIn_a; | |
@description("(19): public parameter Real 'springDamper.c'(start = 100000.0, min = 0.0, unit = \"N.m/rad\", quantity = \"RotationalSpringConstant\") = 'c_res';") | |
@geo(593, 168) | |
param springDamper_c is >= 0.0 = 4710.0; | |
@description("(20): public parameter Real 'springDamper.d'(start = 0.0, min = 0.0, unit = \"N.m.s/rad\", quantity = \"RotationalDampingConstant\") = 'd_res';") | |
@geo(660, 96) | |
param springDamper_d is >= 0.0 = 1.57; | |
@description("(21): public parameter Real 'springDamper.phi_rel0'(displayUnit = \"rad\", unit = \"rad\", quantity = \"Angle\") = 0.0;") | |
@geo(552, 144) | |
param springDamper_phi_rel0 = 0.0; | |
@description("(22): public Real 'springDamper.phi_rel'(stateSelect = 'StateSelect'.prefer, nominal = if 'springDamper.phi_nominal' >= 1e-015 then 'springDamper.phi_nominal' else 1.0, fixed = true, start = 0.0, displayUnit = \"deg\", unit = \"rad\", quantity = \"Angle\"); | |
(98): 'springDamper.w_rel' = der('springDamper.phi_rel')") | |
@geo(492, 216) | |
var springDamper_phi_rel ; | |
@description("(23): public Real 'springDamper.w_rel'(stateSelect = 'StateSelect'.prefer, start = 0.0, unit = \"rad/s\", quantity = \"AngularVelocity\"); | |
(99): 'springDamper.a_rel' = der('springDamper.w_rel')") | |
@geo(492, 84) | |
var springDamper_w_rel ; | |
// 'springDamper.tau' is aliased by 'springDamper.flange_b.tau' | |
// 'springDamper.flange_a.phi' is aliased by 'inertiaDrivelineIn.phi' | |
@description("(27): public Real 'springDamper.flange_a.tau'(unit = \"N.m\", quantity = \"Torque\");") | |
@geo(660, 504) | |
var springDamper_flange_a_tau; | |
// 'springDamper.flange_b.phi' is aliased by 'relSpeedSensor.flange_b.phi' | |
@description("(29): public Real 'springDamper.flange_b.tau'(unit = \"N.m\", quantity = \"Torque\");") | |
@geo(660, 420) | |
var springDamper_flange_b_tau; | |
// aliasing: ['springDamper.tau'] | |
// (30): public parameter Real 'springDamper.phi_nominal'(min = 0.0, displayUnit = "rad", unit = "rad", quantity = "Angle") = 0.0001; | |
// 'springDamper.phi_nominal' is not used in any equations, just ignore it | |
// (31): public parameter 'StateSelect' 'springDamper.stateSelect' = 'StateSelect'.prefer; | |
// 'springDamper.stateSelect' is not used in any equations, just ignore it | |
// (32): public parameter Boolean 'springDamper.useHeatPort' = false; | |
// 'springDamper.useHeatPort' is not used in any equations, just ignore it | |
@description("(34): protected Real 'springDamper.tau_c'(unit = \"N.m\", quantity = \"Torque\");") | |
@geo(660, 216) | |
var springDamper_tau_c; | |
@description("(35): protected Real 'springDamper.tau_d'(unit = \"N.m\", quantity = \"Torque\");") | |
@geo(792, 216) | |
var springDamper_tau_d; | |
// (36): public parameter Boolean 'torqueDrive.useSupport' = false; | |
// 'torqueDrive.useSupport' is not used in any equations, just ignore it | |
// 'torqueDrive.flange.phi' is aliased by 'inertiaDrivelineIn.phi' | |
@description("(38): public Real 'torqueDrive.flange.tau'(unit = \"N.m\", quantity = \"Torque\");") | |
@geo(288, 564) | |
var torqueDrive_flange_tau; | |
// 'torqueDrive.tau' is aliased by 'gear.y' | |
@description("(41): public output Real 'M_l';") | |
@geo(1116, 504) | |
var M_l; | |
// aliasing: ['gainAcc.u', 'loadTorque.flange_a.tau', 'loadTorque.tau'] | |
// aliasing: ['gear.u'] | |
// 'loadTorque.flange_a.phi' is aliased by 'relSpeedSensor.flange_b.phi' | |
// 'loadTorque.flange_a.tau' is aliased by 'M_l' | |
// 'loadTorque.flange_b.phi' is aliased by 'relSpeedSensor.flange_b.phi' | |
// 'loadTorque.tau' is aliased by 'M_l' | |
// 'fixed.phi0' is aliased by 'relSpeedSensor.flange_b.phi' | |
// 'fixed.flange.phi' is aliased by 'relSpeedSensor.flange_b.phi' | |
@description("(51): public output Real 'w_rel';") | |
@geo(1116, 216) | |
var w_rel; | |
// aliasing: ['relSpeedSensor.w_rel'] | |
// (52): public parameter Boolean 'torqueDist.useSupport' = false; | |
// 'torqueDist.useSupport' is not used in any equations, just ignore it | |
// 'torqueDist.flange.phi' is aliased by 'relSpeedSensor.flange_b.phi' | |
@description("(54): public Real 'torqueDist.flange.tau'(unit = \"N.m\", quantity = \"Torque\");") | |
@geo(833, 420) | |
var torqueDist_flange_tau; | |
@description("(56): public Real 'torqueDist.tau'(unit = \"N.m\");") | |
@geo(900, 468) | |
var torqueDist_tau; | |
// aliasing: ['gainAcc.y'] | |
@description("(57): public parameter Real 'gainAcc.k'(start = 1.0, unit = \"1\") = 'k_accCor';") | |
@geo(996, 384) | |
param gainAcc_k = -0.0101615216387814; | |
// 'gainAcc.u' is aliased by 'M_l' | |
// 'gainAcc.y' is aliased by 'torqueDist.tau' | |
// 'relSpeedSensor.flange_a.phi' is aliased by 'inertiaDrivelineIn.phi' | |
@description("(61): public Real 'relSpeedSensor.flange_a.tau'(unit = \"N.m\", quantity = \"Torque\");") | |
@geo(660, 564) | |
param relSpeedSensor_flange_a_tau = 0.0; | |
//bug fix using other alias: @description("(62): public Real 'relSpeedSensor.flange_b.phi'(displayUnit = \"deg\", unit = \"rad\", quantity = \"Angle\");") | |
@description("(62): public Real 'fixed.phi0'(displayUnit = \"deg\", unit = \"rad\", quantity = \"Angle\");") | |
@geo(660, 298) | |
param fixed_phi0 = 0.0; | |
//bug fix using other alias: var relSpeedSensor_flange_b_phi; | |
// aliasing: ['fixed.flange.phi', 'fixed.phi0', 'loadTorque.flange_a.phi', 'loadTorque.flange_b.phi', 'springDamper.flange_b.phi', 'torqueDist.flange.phi'] | |
@description("(63): public Real 'relSpeedSensor.flange_b.tau'(unit = \"N.m\", quantity = \"Torque\");") | |
@geo(833, 619) | |
var relSpeedSensor_flange_b_tau; | |
@description("(64): public Real 'relSpeedSensor.phi_rel'(displayUnit = \"deg\", unit = \"rad\", quantity = \"Angle\"); | |
(112): 'relSpeedSensor.w_rel' = der('relSpeedSensor.phi_rel')") | |
@geo(1008, 216) | |
var relSpeedSensor_phi_rel ; | |
// 'relSpeedSensor.w_rel' is aliased by 'w_rel' | |
@description("(66): public parameter Real 'gear.k'(start = 1.0, unit = \"1\") = 'gearRatio';") | |
@geo(218, 432) | |
param gear_k = 10.0; | |
// 'gear.u' is aliased by 'M_m' | |
@description("(68): public Real 'gear.y';") | |
@geo(288, 504) | |
var gear_y; | |
@geo(660, 471) | |
var springDamper_flange_b_tau_dot; | |
@geo(660, 267) | |
var springDamper_tau_c_dot; | |
@geo(792, 267) | |
var springDamper_tau_d_dot; | |
@geo(828, 674) | |
var relSpeedSensor_flange_b_tau_dot; | |
@geo(492, 135) | |
var springDamper_w_rel_dot; | |
@geo(828, 471) | |
var torqueDist_flange_tau_dot; | |
@geo(900, 519) | |
var torqueDist_tau_dot; | |
@geo(1008, 555) | |
var M_l_dot; | |
// aliasing: ['torqueDrive.tau'] | |
/* | |
* relation and equation declaration | |
*/ | |
// (71): 'relSpeedSensor.flange_a.phi' = 'springDamper.flange_a.phi' | |
// Equation not generated in Congra since it is an alias equation | |
// (72): 'relSpeedSensor.flange_a.phi' = 'inertiaDrivelineIn.flange_b.phi' | |
// Equation not generated in Congra since it is an alias equation | |
// (73): 'torqueDrive.flange.phi' = 'inertiaDrivelineIn.flange_a.phi' | |
// Equation not generated in Congra since it is an alias equation | |
// (74): 'loadTorque.flange_b.phi' = 'fixed.flange.phi' | |
// Equation not generated in Congra since it is an alias equation | |
// (75): 'torqueDist.tau' = 'gainAcc.y' | |
// Equation not generated in Congra since it is an alias equation | |
// (76): 'M_m' = 'gear.u' | |
// Equation not generated in Congra since it is an alias equation | |
// (77): 'gear.y' = 'torqueDrive.tau' | |
// Equation not generated in Congra since it is an alias equation | |
// (78): 'M_l' = 'gainAcc.u' | |
// Equation not generated in Congra since it is an alias equation | |
// (79): 'M_l' = 'loadTorque.tau' | |
// Equation not generated in Congra since it is an alias equation | |
// (80): 'relSpeedSensor.w_rel' = 'w_rel' | |
// Equation not generated in Congra since it is an alias equation | |
// (81): 'relSpeedSensor.flange_b.phi' = 'loadTorque.flange_a.phi' | |
// Equation not generated in Congra since it is an alias equation | |
// (82): 'relSpeedSensor.flange_b.phi' = 'torqueDist.flange.phi' | |
// Equation not generated in Congra since it is an alias equation | |
// (83): 'relSpeedSensor.flange_b.phi' = 'springDamper.flange_b.phi' | |
// Equation not generated in Congra since it is an alias equation | |
@description("(84): 'relSpeedSensor.flange_a.tau' + 'springDamper.flange_a.tau' + 'inertiaDrivelineIn.flange_b.tau' = 0.0") | |
@geo(564, 564, 30, 30) | |
R0(inertiaDrivelineIn_flange_b_tau, in relSpeedSensor_flange_a_tau, springDamper_flange_a_tau) ::= relSpeedSensor_flange_a_tau + springDamper_flange_a_tau + inertiaDrivelineIn_flange_b_tau = 0.0; | |
@description("(85): 'torqueDrive.flange.tau' + 'inertiaDrivelineIn.flange_a.tau' = 0.0") | |
@geo(216, 619, 30, 30) | |
R1(inertiaDrivelineIn_flange_a_tau, torqueDrive_flange_tau) ::= torqueDrive_flange_tau + inertiaDrivelineIn_flange_a_tau = 0.0; | |
@description("(87): 'relSpeedSensor.flange_b.tau' + 'torqueDist.flange.tau' + 'loadTorque.flange_a.tau' + 'springDamper.flange_b.tau' = 0.0") | |
@geo(744, 504, 30, 30) | |
R3(M_l, relSpeedSensor_flange_b_tau, springDamper_flange_b_tau, torqueDist_flange_tau) ::= relSpeedSensor_flange_b_tau + torqueDist_flange_tau + M_l + springDamper_flange_b_tau = 0.0; | |
// (88): 'inertiaDrivelineIn.phi' = 'inertiaDrivelineIn.flange_a.phi' | |
// Equation not generated in Congra since it is an alias equation | |
// (89): 'inertiaDrivelineIn.phi' = 'inertiaDrivelineIn.flange_b.phi' | |
// Equation not generated in Congra since it is an alias equation | |
// (90): 'inertiaDrivelineIn.w' = der('inertiaDrivelineIn.phi') | |
// Equation not generated in Congra since it is an alias equation | |
// (91): 'inertiaDrivelineIn.a' = der('inertiaDrivelineIn.w') | |
// Equation not generated in Congra since it is an alias equation | |
@description("(92): 'inertiaDrivelineIn.J' * 'inertiaDrivelineIn.a' = 'inertiaDrivelineIn.flange_a.tau' + 'inertiaDrivelineIn.flange_b.tau'") | |
@geo(420, 619, 30, 30) | |
R4(in inertiaDrivelineIn_J, inertiaDrivelineIn_a, inertiaDrivelineIn_flange_a_tau, inertiaDrivelineIn_flange_b_tau) ::= inertiaDrivelineIn_J * inertiaDrivelineIn_a = inertiaDrivelineIn_flange_a_tau + inertiaDrivelineIn_flange_b_tau; | |
@description("(93): 'springDamper.tau_c' = 'springDamper.c' * ('springDamper.phi_rel' - 'springDamper.phi_rel0')") | |
@geo(564, 216, 30, 30) | |
R5(in springDamper_c, springDamper_phi_rel, in springDamper_phi_rel0, springDamper_tau_c) ::= springDamper_tau_c = springDamper_c * (springDamper_phi_rel - springDamper_phi_rel0); | |
@description("(94): 'springDamper.tau_d' = 'springDamper.d' * 'springDamper.w_rel'") | |
@geo(660, 168, 30, 30) | |
R6(in springDamper_d, springDamper_tau_d, springDamper_w_rel) ::= springDamper_tau_d = springDamper_d * springDamper_w_rel; | |
@description("(95): 'springDamper.tau' = 'springDamper.tau_c' + 'springDamper.tau_d'") | |
@geo(744, 269, 30, 30) | |
R7(springDamper_flange_b_tau, springDamper_tau_c, springDamper_tau_d) ::= springDamper_flange_b_tau = springDamper_tau_c + springDamper_tau_d; | |
@description("(97): 'springDamper.phi_rel' = 'springDamper.flange_b.phi' - 'springDamper.flange_a.phi'") | |
@geo(564, 276, 30, 30) | |
R9(inertiaDrivelineIn_phi, in fixed_phi0, springDamper_phi_rel) ::= springDamper_phi_rel = fixed_phi0 - inertiaDrivelineIn_phi; | |
// (98): 'springDamper.w_rel' = der('springDamper.phi_rel') | |
// Equation not generated in Congra since it is an alias equation | |
// (99): 'springDamper.a_rel' = der('springDamper.w_rel') | |
// Equation not generated in Congra since it is an alias equation | |
// (100): 'springDamper.flange_b.tau' = 'springDamper.tau' | |
// Equation not generated in Congra since it is an alias equation | |
@description("(101): 'springDamper.flange_a.tau' = -'springDamper.tau'") | |
@geo(564, 504, 30, 30) | |
R10(springDamper_flange_a_tau, springDamper_flange_b_tau) ::= springDamper_flange_a_tau = -springDamper_flange_b_tau; | |
@description("(102): 'torqueDrive.flange.tau' = -'torqueDrive.tau'") | |
@geo(218, 564, 30, 30) | |
R11(gear_y, torqueDrive_flange_tau) ::= torqueDrive_flange_tau = -gear_y; | |
// (104): 'loadTorque.flange_a.phi' = 'loadTorque.flange_b.phi' | |
// Equation not generated in Congra since it is an alias equation | |
// (105): 'loadTorque.flange_a.tau' = 'loadTorque.tau' | |
// Equation not generated in Congra since it is an alias equation | |
// (107): 'fixed.flange.phi' = 'fixed.phi0' | |
// Equation not generated in Congra since it is an alias equation | |
@description("(108): 'torqueDist.flange.tau' = -'torqueDist.tau'") | |
@geo(900, 420, 30, 30) | |
R14(torqueDist_flange_tau, torqueDist_tau) ::= torqueDist_flange_tau = -torqueDist_tau; | |
@description("(110): 'gainAcc.y' = 'gainAcc.k' * 'gainAcc.u'") | |
@geo(996, 444, 30, 30) | |
R16(M_l, in gainAcc_k, torqueDist_tau) ::= torqueDist_tau = gainAcc_k * M_l; | |
@description("(111): 'relSpeedSensor.phi_rel' = 'relSpeedSensor.flange_b.phi' - 'relSpeedSensor.flange_a.phi'") | |
@geo(744, 348, 30, 30) | |
R17(inertiaDrivelineIn_phi, in fixed_phi0, relSpeedSensor_phi_rel) ::= relSpeedSensor_phi_rel = fixed_phi0 - inertiaDrivelineIn_phi; | |
// (112): 'relSpeedSensor.w_rel' = der('relSpeedSensor.phi_rel') | |
// Equation not generated in Congra since it is an alias equation | |
@description("(114): 0.0 = 'relSpeedSensor.flange_a.tau' + 'relSpeedSensor.flange_b.tau'") | |
@geo(744, 619, 30, 30) | |
R19(in relSpeedSensor_flange_a_tau, relSpeedSensor_flange_b_tau) ::= 0.0 = relSpeedSensor_flange_a_tau + relSpeedSensor_flange_b_tau; | |
@description("(115): 'gear.y' = 'gear.k' * 'gear.u'") | |
@geo(218, 504, 30, 30) | |
R20(M_m, in gear_k, gear_y) ::= gear_y = gear_k * M_m; | |
@geo(1164, 216, 30, 30) | |
R2(w_rel, w_rel_out) ::= w_rel=w_rel_out; | |
R8(M_l_port, M_l) ::= M_l = M_l_port; | |
@geo(744, 398, 30, 30) | |
R17_dot(inertiaDrivelineIn_w, w_rel) ::= w_rel = -inertiaDrivelineIn_w; | |
@geo(564, 326, 30, 30) | |
R9_dot(inertiaDrivelineIn_w, springDamper_w_rel) ::= springDamper_w_rel = -inertiaDrivelineIn_w; | |
@geo(744, 314, 30, 30) | |
R7_dot(springDamper_flange_b_tau_dot, springDamper_tau_c_dot, springDamper_tau_d_dot) ::= springDamper_flange_b_tau_dot = springDamper_tau_c_dot + springDamper_tau_d_dot; | |
@geo(564, 376, 30, 30) | |
R9_2dot(inertiaDrivelineIn_a, springDamper_w_rel_dot) ::= springDamper_w_rel_dot = -inertiaDrivelineIn_a; | |
@geo(564, 266, 30, 30) | |
R5_dot(in springDamper_c, springDamper_w_rel, springDamper_tau_c_dot) ::= springDamper_tau_c_dot = springDamper_c * springDamper_w_rel; | |
@geo(660, 218, 30, 30) | |
R6_dot(in springDamper_d, springDamper_tau_d_dot, springDamper_w_rel_dot) ::= springDamper_tau_d_dot = springDamper_d * springDamper_w_rel_dot; | |
@geo(900, 470, 30, 30) | |
R14_dot(torqueDist_flange_tau_dot, torqueDist_tau_dot) ::= torqueDist_flange_tau_dot = -torqueDist_tau_dot; | |
@geo(996, 494, 30, 30) | |
R16_dot(in gainAcc_k, M_l_dot, torqueDist_tau_dot) ::= torqueDist_tau_dot = gainAcc_k * M_l_dot; | |
@geo(744, 554, 30, 30) | |
R3_dot(M_l_dot, relSpeedSensor_flange_b_tau_dot, springDamper_flange_b_tau_dot, torqueDist_flange_tau_dot) ::= relSpeedSensor_flange_b_tau_dot + torqueDist_flange_tau_dot + M_l_dot + springDamper_flange_b_tau_dot = 0.0; | |
@geo(1080, 555, 30, 30) | |
R8_dot(M_l_port_dot, M_l_dot) ::= M_l_dot = M_l_port_dot; | |
@geo(744, 669, 30, 30) | |
R19_dot(relSpeedSensor_flange_b_tau_dot) ::= 0.0 = relSpeedSensor_flange_b_tau_dot; | |
} | |
/* | |
flow F_Forward_PlantForInversion for sys_PlantForInversion { | |
inputs: M_m; | |
outputs: w_rel_out, M_l_port; | |
}*/ | |
/* | |
* Converted Flat Modelica equation code to SCODE Congra format for: | |
* 'EMPHYSIS_TestCases.M04_DrivetrainTorqueControl.PlantModels.PlantForInversion' | |
* Generation Date: 2020-12-04T19:14:42.082449900 | |
*/ | |
flow F_Inverted_PlantForInversion for sys_PlantForInversion { | |
inputs: M_l_port, M_l_port_dot; | |
outputs: w_rel_out, M_m; | |
} |
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
class 'EMPHYSIS_TestCases.M04_DrivetrainTorqueControl.PlantModels.PlantForInversion' | |
type 'StateSelect' = enumeration(never, avoid, default, prefer, always); | |
public final parameter Boolean 'for_inversion' = true; | |
public parameter Real 'gearRatio' = 10.0; | |
public parameter Real 'J_M'(unit = "kg.m2", quantity = "MomentOfInertia") = 0.01; | |
public parameter Real 'd_res'(unit = "N.m.s/rad", quantity = "RotationalDampingConstant") = 1.57; | |
public parameter Real 'k_accCor' = -0.0101615216387814; | |
public parameter Real 'c_res' = 4710.0; | |
public Real 'inertiaDrivelineIn.flange_a.phi'(displayUnit = "deg", unit = "rad", quantity = "Angle"); | |
public Real 'inertiaDrivelineIn.flange_a.tau'(unit = "N.m", quantity = "Torque"); | |
public Real 'inertiaDrivelineIn.flange_b.phi'(displayUnit = "deg", unit = "rad", quantity = "Angle"); | |
public Real 'inertiaDrivelineIn.flange_b.tau'(unit = "N.m", quantity = "Torque"); | |
public parameter Real 'inertiaDrivelineIn.J'(start = 1.0, min = 0.0, unit = "kg.m2", quantity = "MomentOfInertia") = 'J_M'; | |
public parameter 'StateSelect' 'inertiaDrivelineIn.stateSelect' = 'StateSelect'.default; | |
public Real 'inertiaDrivelineIn.phi'(stateSelect = 'StateSelect'.default, fixed = false, start = 0.0, displayUnit = "deg", unit = "rad", quantity = "Angle"); | |
public Real 'inertiaDrivelineIn.w'(stateSelect = 'StateSelect'.default, fixed = false, start = 0.0, unit = "rad/s", quantity = "AngularVelocity"); | |
public Real 'inertiaDrivelineIn.a'(unit = "rad/s2", quantity = "AngularAcceleration"); | |
public parameter Real 'springDamper.c'(start = 100000.0, min = 0.0, unit = "N.m/rad", quantity = "RotationalSpringConstant") = 'c_res'; | |
public parameter Real 'springDamper.d'(start = 0.0, min = 0.0, unit = "N.m.s/rad", quantity = "RotationalDampingConstant") = 'd_res'; | |
public parameter Real 'springDamper.phi_rel0'(displayUnit = "rad", unit = "rad", quantity = "Angle") = 0.0; | |
public Real 'springDamper.phi_rel'(stateSelect = 'StateSelect'.prefer, nominal = if 'springDamper.phi_nominal' >= 1e-015 then 'springDamper.phi_nominal' else 1.0, fixed = true, start = 0.0, displayUnit = "deg", unit = "rad", quantity = "Angle"); | |
public Real 'springDamper.w_rel'(stateSelect = 'StateSelect'.prefer, start = 0.0, unit = "rad/s", quantity = "AngularVelocity"); | |
public Real 'springDamper.a_rel'(start = 0.0, unit = "rad/s2", quantity = "AngularAcceleration"); | |
public Real 'springDamper.tau'(unit = "N.m", quantity = "Torque"); | |
public Real 'springDamper.flange_a.phi'(displayUnit = "deg", unit = "rad", quantity = "Angle"); | |
public Real 'springDamper.flange_a.tau'(unit = "N.m", quantity = "Torque"); | |
public Real 'springDamper.flange_b.phi'(displayUnit = "deg", unit = "rad", quantity = "Angle"); | |
public Real 'springDamper.flange_b.tau'(unit = "N.m", quantity = "Torque"); | |
public parameter Real 'springDamper.phi_nominal'(min = 0.0, displayUnit = "rad", unit = "rad", quantity = "Angle") = 0.0001; | |
public parameter 'StateSelect' 'springDamper.stateSelect' = 'StateSelect'.prefer; | |
public parameter Boolean 'springDamper.useHeatPort' = false; | |
public Real 'springDamper.lossPower'(unit = "W", quantity = "Power"); | |
protected Real 'springDamper.tau_c'(unit = "N.m", quantity = "Torque"); | |
protected Real 'springDamper.tau_d'(unit = "N.m", quantity = "Torque"); | |
public parameter Boolean 'torqueDrive.useSupport' = false; | |
public Real 'torqueDrive.flange.phi'(displayUnit = "deg", unit = "rad", quantity = "Angle"); | |
public Real 'torqueDrive.flange.tau'(unit = "N.m", quantity = "Torque"); | |
protected Real 'torqueDrive.phi_support'(displayUnit = "deg", unit = "rad", quantity = "Angle"); | |
public Real 'torqueDrive.tau'(unit = "N.m"); | |
public output Real 'M_l'; | |
public input Real 'M_m'; | |
public Real 'loadTorque.flange_a.phi'(displayUnit = "deg", unit = "rad", quantity = "Angle"); | |
public Real 'loadTorque.flange_a.tau'(unit = "N.m", quantity = "Torque"); | |
public Real 'loadTorque.flange_b.phi'(displayUnit = "deg", unit = "rad", quantity = "Angle"); | |
public Real 'loadTorque.flange_b.tau'(unit = "N.m", quantity = "Torque"); | |
public Real 'loadTorque.tau'(unit = "N.m"); | |
public parameter Real 'fixed.phi0'(displayUnit = "deg", unit = "rad", quantity = "Angle") = 0.0; | |
public Real 'fixed.flange.phi'(displayUnit = "deg", unit = "rad", quantity = "Angle"); | |
public Real 'fixed.flange.tau'(unit = "N.m", quantity = "Torque"); | |
public output Real 'w_rel'; | |
public parameter Boolean 'torqueDist.useSupport' = false; | |
public Real 'torqueDist.flange.phi'(displayUnit = "deg", unit = "rad", quantity = "Angle"); | |
public Real 'torqueDist.flange.tau'(unit = "N.m", quantity = "Torque"); | |
protected Real 'torqueDist.phi_support'(displayUnit = "deg", unit = "rad", quantity = "Angle"); | |
public Real 'torqueDist.tau'(unit = "N.m"); | |
public parameter Real 'gainAcc.k'(start = 1.0, unit = "1") = 'k_accCor'; | |
public Real 'gainAcc.u'; | |
public Real 'gainAcc.y'; | |
public Real 'relSpeedSensor.flange_a.phi'(displayUnit = "deg", unit = "rad", quantity = "Angle"); | |
public Real 'relSpeedSensor.flange_a.tau'(unit = "N.m", quantity = "Torque"); | |
public Real 'relSpeedSensor.flange_b.phi'(displayUnit = "deg", unit = "rad", quantity = "Angle"); | |
public Real 'relSpeedSensor.flange_b.tau'(unit = "N.m", quantity = "Torque"); | |
public Real 'relSpeedSensor.phi_rel'(displayUnit = "deg", unit = "rad", quantity = "Angle"); | |
public Real 'relSpeedSensor.w_rel'(unit = "rad/s"); | |
public parameter Real 'gear.k'(start = 1.0, unit = "1") = 'gearRatio'; | |
public Real 'gear.u'; | |
public Real 'gear.y'; | |
public | |
equation | |
'relSpeedSensor.flange_a.phi' = 'springDamper.flange_a.phi'; | |
'relSpeedSensor.flange_a.phi' = 'inertiaDrivelineIn.flange_b.phi'; | |
'torqueDrive.flange.phi' = 'inertiaDrivelineIn.flange_a.phi'; | |
'loadTorque.flange_b.phi' = 'fixed.flange.phi'; | |
'torqueDist.tau' = 'gainAcc.y'; | |
'M_m' = 'gear.u'; | |
'gear.y' = 'torqueDrive.tau'; | |
'M_l' = 'gainAcc.u'; | |
'M_l' = 'loadTorque.tau'; | |
'relSpeedSensor.w_rel' = 'w_rel'; | |
'relSpeedSensor.flange_b.phi' = 'loadTorque.flange_a.phi'; | |
'relSpeedSensor.flange_b.phi' = 'torqueDist.flange.phi'; | |
'relSpeedSensor.flange_b.phi' = 'springDamper.flange_b.phi'; | |
'relSpeedSensor.flange_a.tau' + 'springDamper.flange_a.tau' + 'inertiaDrivelineIn.flange_b.tau' = 0.0; | |
'torqueDrive.flange.tau' + 'inertiaDrivelineIn.flange_a.tau' = 0.0; | |
'fixed.flange.tau' + 'loadTorque.flange_b.tau' = 0.0; | |
'relSpeedSensor.flange_b.tau' + 'torqueDist.flange.tau' + 'loadTorque.flange_a.tau' + 'springDamper.flange_b.tau' = 0.0; | |
'inertiaDrivelineIn.phi' = 'inertiaDrivelineIn.flange_a.phi'; | |
'inertiaDrivelineIn.phi' = 'inertiaDrivelineIn.flange_b.phi'; | |
'inertiaDrivelineIn.w' = der('inertiaDrivelineIn.phi'); | |
'inertiaDrivelineIn.a' = der('inertiaDrivelineIn.w'); | |
'inertiaDrivelineIn.J' * 'inertiaDrivelineIn.a' = 'inertiaDrivelineIn.flange_a.tau' + 'inertiaDrivelineIn.flange_b.tau'; | |
'springDamper.tau_c' = 'springDamper.c' * ('springDamper.phi_rel' - 'springDamper.phi_rel0'); | |
'springDamper.tau_d' = 'springDamper.d' * 'springDamper.w_rel'; | |
'springDamper.tau' = 'springDamper.tau_c' + 'springDamper.tau_d'; | |
'springDamper.lossPower' = 'springDamper.tau_d' * 'springDamper.w_rel'; | |
'springDamper.phi_rel' = 'springDamper.flange_b.phi' - 'springDamper.flange_a.phi'; | |
'springDamper.w_rel' = der('springDamper.phi_rel'); | |
'springDamper.a_rel' = der('springDamper.w_rel'); | |
'springDamper.flange_b.tau' = 'springDamper.tau'; | |
'springDamper.flange_a.tau' = -'springDamper.tau'; | |
'torqueDrive.flange.tau' = -'torqueDrive.tau'; | |
'torqueDrive.phi_support' = 0.0; | |
'loadTorque.flange_a.phi' = 'loadTorque.flange_b.phi'; | |
'loadTorque.flange_a.tau' = 'loadTorque.tau'; | |
0.0 = 'loadTorque.flange_a.tau' + 'loadTorque.flange_b.tau'; | |
'fixed.flange.phi' = 'fixed.phi0'; | |
'torqueDist.flange.tau' = -'torqueDist.tau'; | |
'torqueDist.phi_support' = 0.0; | |
'gainAcc.y' = 'gainAcc.k' * 'gainAcc.u'; | |
'relSpeedSensor.phi_rel' = 'relSpeedSensor.flange_b.phi' - 'relSpeedSensor.flange_a.phi'; | |
'relSpeedSensor.w_rel' = der('relSpeedSensor.phi_rel'); | |
0.0 = 'relSpeedSensor.flange_a.tau'; | |
0.0 = 'relSpeedSensor.flange_a.tau' + 'relSpeedSensor.flange_b.tau'; | |
'gear.y' = 'gear.k' * 'gear.u'; | |
end 'EMPHYSIS_TestCases.M04_DrivetrainTorqueControl.PlantModels.PlantForInversion'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment