Opened 13 years ago
Closed 7 years ago
#1715 closed defect (invalid)
Simulation code for gearbox-model generates divide by zero ( during initialization ?)
Reported by: | perob88 | Owned by: | perob88 |
---|---|---|---|
Priority: | high | Milestone: | Future |
Component: | Simulation Code Generation | Version: | trunk |
Keywords: | Cc: | perob88, Jens Frenkel |
Description (last modified by )
I have made a simple manual gearbox with clutch.
In Dymola I couln't get it to simulate using instantatnious gear shifts because of issues with signals without well defined derivative. As workaround I added a first order system for the speed equation, as follows:
model IdealGearBox extends Modelica.Mechanics.Rotational.Interfaces.PartialElementaryTwoFlangesAndSupport2; parameter Real ratios[:]={1} "Transmission ratios (flange_a.phi/flange_b.phi)"; parameter Real Tg=0.1 "Time constant for change of gear ratio."; Modelica.Blocks.Interfaces.IntegerInput Gear "Gear number"; Modelica.SIunits.Angle phi_a "Angle between left shaft flange and support"; Modelica.SIunits.Angle phi_b "Angle between right shaft flange and support"; Real gearRatio(start=1, fixed=true); equation der(gearRatio) = ((if Gear == 0 then 1 else ratios[Gear]) - gearRatio)/Tg; der(phi_a) = gearRatio*der(phi_b); phi_a = flange_a.phi - phi_support; phi_b = flange_b.phi - phi_support; 0 = gearRatio*flange_a.tau + flange_b.tau; end IdealGearBox;
When simulatig a simple vehicle with this gearbox solution i get the following:
"Following Error has occurred. Unknown error throw | [line] 42 | [file] util/division.c | division by zero"
Running the executable manually gives:
warning | division by zero in partial equation: $DER.simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.phi_a / simplevehicle1.chassis.Wheel.w because simplevehicle1.chassis.Wheel.w == 0 | [line] 1102 | [file] TestModel.c throw | [line] 42 | [file] util/division.c | division by zero
If I remove der(gearRatio) = ((if Gear == 0 then 1 else ratios[Gear]) - gearRatio)/Tg;
and replace with gearRatio = (if Gear == 0 then 1 else ratios[Gear]);
everything is running smoothly but in my opinion this shouln't happen.
An instantiation of the model is:
function Modelica.Math.tempInterpol1 "Temporary function for linear interpolation (will be removed)" input Real u "input value (first column of table)"; input Real[:, :] table "table to be interpolated"; input Integer icol "column of table to be interpolated"; output Real y "interpolated input value (icol column of table)"; protected Integer i; protected Integer n "number of rows of table"; protected Real u1; protected Real u2; protected Real y1; protected Real y2; algorithm n := size(table,1); if n <= 1 then y := table[1,icol]; else if u <= table[1,1] then i := 1; else i := 2; while i < n and u >= table[i,1] loop i := 1 + i; end while; i := i + -1; end if; u1 := table[i,1]; u2 := table[1 + i,1]; y1 := table[i,icol]; y2 := table[1 + i,icol]; assert( u2 > u1, "Table index must be increasing"); y := y1 + (y2 - y1 * (u - u1)) / (u2 - u1); end if; end Modelica.Math.tempInterpol1;
class TestModel input Real simplevehicle1.ThrottlePedal; input Real simplevehicle1.BrakePedal; input Real simplevehicle1.ClutchPedal; input Integer simplevehicle1.Gear; Real simplevehicle1.Wheel.phi(quantity = "Angle", unit = "rad", displayUnit = "deg") "Absolute rotation angle of flange"; Real simplevehicle1.Wheel.tau(quantity = "Torque", unit = "N.m") "Cut torque in the flange"; Real simplevehicle1.Vehicle.s(quantity = "Length", unit = "m") "absolute position of flange"; Real simplevehicle1.Vehicle.f(quantity = "Force", unit = "N") "cut force directed into flange"; parameter Boolean simplevehicle1.chassis.WheelRadius.useSupportR = false "= true, if rotational support flange enabled, otherwise implicitly grounded"; parameter Boolean simplevehicle1.chassis.WheelRadius.useSupportT = false "= true, if translational support flange enabled, otherwise implicitly grounded"; Real simplevehicle1.chassis.WheelRadius.flangeR.phi(quantity = "Angle", unit = "rad", displayUnit = "deg") "Absolute rotation angle of flange"; Real simplevehicle1.chassis.WheelRadius.flangeR.tau(quantity = "Torque", unit = "N.m") "Cut torque in the flange"; Real simplevehicle1.chassis.WheelRadius.flangeT.s(quantity = "Length", unit = "m") "absolute position of flange"; Real simplevehicle1.chassis.WheelRadius.flangeT.f(quantity = "Force", unit = "N") "cut force directed into flange"; input Real simplevehicle1.chassis.WheelRadius.internalSupportR.tau(quantity = "Torque", unit = "N.m") = -simplevehicle1.chassis.WheelRadius.flangeR.tau "External support torque (must be computed via torque balance in model where InternalSupport is used; = flange.tau)"; Real simplevehicle1.chassis.WheelRadius.internalSupportR.phi(quantity = "Angle", unit = "rad", displayUnit = "deg") "External support angle (= flange.phi)"; Real simplevehicle1.chassis.WheelRadius.internalSupportR.flange.phi(quantity = "Angle", unit = "rad", displayUnit = "deg") "Absolute rotation angle of flange"; Real simplevehicle1.chassis.WheelRadius.internalSupportR.flange.tau(quantity = "Torque", unit = "N.m") "Cut torque in the flange"; input Real simplevehicle1.chassis.WheelRadius.internalSupportT.f(quantity = "Force", unit = "N") = -simplevehicle1.chassis.WheelRadius.flangeT.f "External support force (must be computed via force balance in model where InternalSupport is used; = flange.f)"; Real simplevehicle1.chassis.WheelRadius.internalSupportT.s(quantity = "Length", unit = "m") "External support position (= flange.s)"; Real simplevehicle1.chassis.WheelRadius.internalSupportT.flange.s(quantity = "Length", unit = "m") "absolute position of flange"; Real simplevehicle1.chassis.WheelRadius.internalSupportT.flange.f(quantity = "Force", unit = "N") "cut force directed into flange"; parameter Real simplevehicle1.chassis.WheelRadius.ratio(unit = "rad/m", start = 1.0) = 3.3333333333333335 "Transmission ratio (flange_a.phi/flange_b.s)"; parameter Real simplevehicle1.chassis.WheelRadius.fixedR.phi0(quantity = "Angle", unit = "rad", displayUnit = "deg") = 0.0 "Fixed offset angle of housing"; Real simplevehicle1.chassis.WheelRadius.fixedR.flange.phi(quantity = "Angle", unit = "rad", displayUnit = "deg") "Absolute rotation angle of flange"; Real simplevehicle1.chassis.WheelRadius.fixedR.flange.tau(quantity = "Torque", unit = "N.m") "Cut torque in the flange"; parameter Real simplevehicle1.chassis.WheelRadius.fixedT.s0(quantity = "Length", unit = "m") = 0.0 "fixed offset position of housing"; Real simplevehicle1.chassis.WheelRadius.fixedT.flange.s(quantity = "Length", unit = "m") "absolute position of flange"; Real simplevehicle1.chassis.WheelRadius.fixedT.flange.f(quantity = "Force", unit = "N") "cut force directed into flange"; parameter Real simplevehicle1.chassis.VehicleMass.L(quantity = "Length", unit = "m", start = 0.0) = 0.0 "Length of component, from left flange to right flange (= flange_b.s - flange_a.s)"; Real simplevehicle1.chassis.VehicleMass.flange_a.s(quantity = "Length", unit = "m") "absolute position of flange"; Real simplevehicle1.chassis.VehicleMass.flange_a.f(quantity = "Force", unit = "N") "cut force directed into flange"; Real simplevehicle1.chassis.VehicleMass.flange_b.s(quantity = "Length", unit = "m") "absolute position of flange"; Real simplevehicle1.chassis.VehicleMass.flange_b.f(quantity = "Force", unit = "N") "cut force directed into flange"; parameter Real simplevehicle1.chassis.VehicleMass.m(quantity = "Mass", unit = "kg", min = 0.0, start = 1.0) = 1520.0 "mass of the sliding mass"; parameter enumeration(never, avoid, default, prefer, always) simplevehicle1.chassis.VehicleMass.stateSelect = StateSelect.default "Priority to use s and v as states"; Real simplevehicle1.chassis.VehicleMass.a(quantity = "Acceleration", unit = "m/s2", start = 0.0) "absolute acceleration of component"; Real simplevehicle1.chassis.VehicleMass.s(quantity = "Length", unit = "m", start = 0.0, StateSelect = StateSelect.default) "Absolute position of center of component (s = flange_a.s + L/2 = flange_b.s - L/2)"; Real simplevehicle1.chassis.VehicleMass.v(quantity = "Velocity", unit = "m/s", start = 0.0, StateSelect = StateSelect.default) "absolute velocity of component"; Real simplevehicle1.chassis.Wheel.flange_a.phi(quantity = "Angle", unit = "rad", displayUnit = "deg") "Absolute rotation angle of flange"; Real simplevehicle1.chassis.Wheel.flange_a.tau(quantity = "Torque", unit = "N.m") "Cut torque in the flange"; Real simplevehicle1.chassis.Wheel.flange_b.phi(quantity = "Angle", unit = "rad", displayUnit = "deg") "Absolute rotation angle of flange"; Real simplevehicle1.chassis.Wheel.flange_b.tau(quantity = "Torque", unit = "N.m") "Cut torque in the flange"; parameter Real simplevehicle1.chassis.Wheel.J(quantity = "MomentOfInertia", unit = "kg.m2", min = 0.0, start = 1.0) = 0.1 "Moment of inertia"; parameter enumeration(never, avoid, default, prefer, always) simplevehicle1.chassis.Wheel.stateSelect = StateSelect.default "Priority to use phi and w as states"; Real simplevehicle1.chassis.Wheel.a(quantity = "AngularAcceleration", unit = "rad/s2") "Absolute angular acceleration of component (= der(w))"; Real simplevehicle1.chassis.Wheel.phi(quantity = "Angle", unit = "rad", displayUnit = "deg", StateSelect = StateSelect.default) "Absolute rotation angle of component"; Real simplevehicle1.chassis.Wheel.w(quantity = "AngularVelocity", unit = "rad/s", StateSelect = StateSelect.default) "Absolute angular velocity of component (= der(phi))"; parameter Integer simplevehicle1.chassis.speedDependentForce.n = 3; Real simplevehicle1.chassis.speedDependentForce.speedSensor.flange.s(quantity = "Length", unit = "m") "absolute position of flange"; Real simplevehicle1.chassis.speedDependentForce.speedSensor.flange.f(quantity = "Force", unit = "N") "cut force directed into flange"; output Real simplevehicle1.chassis.speedDependentForce.speedSensor.v "Absolute velocity of flange as output signal"; Real simplevehicle1.chassis.speedDependentForce.Flange_b.s(quantity = "Length", unit = "m") "absolute position of flange"; Real simplevehicle1.chassis.speedDependentForce.Flange_b.f(quantity = "Force", unit = "N") "cut force directed into flange"; parameter Boolean simplevehicle1.chassis.speedDependentForce.Force.useSupport = false "= true, if support flange enabled, otherwise implicitly grounded"; Real simplevehicle1.chassis.speedDependentForce.Force.s(quantity = "Length", unit = "m") = simplevehicle1.chassis.speedDependentForce.Force.flange.s - simplevehicle1.chassis.speedDependentForce.Force.s_support "distance between flange and support (= flange.s - support.s)"; Real simplevehicle1.chassis.speedDependentForce.Force.flange.s(quantity = "Length", unit = "m") "absolute position of flange"; Real simplevehicle1.chassis.speedDependentForce.Force.flange.f(quantity = "Force", unit = "N") "cut force directed into flange"; protected Real simplevehicle1.chassis.speedDependentForce.Force.s_support(quantity = "Length", unit = "m") "Absolute position of support flange"; input Real simplevehicle1.chassis.speedDependentForce.Force.f "driving force as input signal"; parameter Real simplevehicle1.chassis.speedDependentForce.Cpol[1] = 0.0; parameter Real simplevehicle1.chassis.speedDependentForce.Cpol[2] = -13.275; parameter Real simplevehicle1.chassis.speedDependentForce.Cpol[3] = -0.23328; input Real simplevehicle1.chassis.speedDependentForce.speedToForce.u "Connector of Real input signal"; output Real simplevehicle1.chassis.speedDependentForce.speedToForce.y "Connector of Real output signal"; parameter Integer simplevehicle1.chassis.speedDependentForce.speedToForce.n = simplevehicle1.chassis.speedDependentForce.n "Polynomial order"; parameter Real simplevehicle1.chassis.speedDependentForce.speedToForce.Cpol[1] = simplevehicle1.chassis.speedDependentForce.Cpol[1] "Polynomial coefficients for c1 + c2*u + ... + cn * u^(n-1)"; parameter Real simplevehicle1.chassis.speedDependentForce.speedToForce.Cpol[2] = simplevehicle1.chassis.speedDependentForce.Cpol[2] "Polynomial coefficients for c1 + c2*u + ... + cn * u^(n-1)"; parameter Real simplevehicle1.chassis.speedDependentForce.speedToForce.Cpol[3] = simplevehicle1.chassis.speedDependentForce.Cpol[3] "Polynomial coefficients for c1 + c2*u + ... + cn * u^(n-1)"; protected Real simplevehicle1.chassis.speedDependentForce.speedToForce.upow[1]; protected Real simplevehicle1.chassis.speedDependentForce.speedToForce.upow[2]; protected Real simplevehicle1.chassis.speedDependentForce.speedToForce.upow[3]; Real simplevehicle1.chassis.DriveShaft.phi(quantity = "Angle", unit = "rad", displayUnit = "deg") "Absolute rotation angle of flange"; Real simplevehicle1.chassis.DriveShaft.tau(quantity = "Torque", unit = "N.m") "Cut torque in the flange"; Real simplevehicle1.chassis.VehicleChassis.s(quantity = "Length", unit = "m") "absolute position of flange"; Real simplevehicle1.chassis.VehicleChassis.f(quantity = "Force", unit = "N") "cut force directed into flange"; parameter Boolean simplevehicle1.chassis.brake.useSupport = false "= true, if support flange enabled, otherwise implicitly grounded"; Real simplevehicle1.chassis.brake.flange_a.phi(quantity = "Angle", unit = "rad", displayUnit = "deg") "Absolute rotation angle of flange"; Real simplevehicle1.chassis.brake.flange_a.tau(quantity = "Torque", unit = "N.m") "Cut torque in the flange"; Real simplevehicle1.chassis.brake.flange_b.phi(quantity = "Angle", unit = "rad", displayUnit = "deg") "Absolute rotation angle of flange"; Real simplevehicle1.chassis.brake.flange_b.tau(quantity = "Torque", unit = "N.m") "Cut torque in the flange"; protected Real simplevehicle1.chassis.brake.phi_support(quantity = "Angle", unit = "rad", displayUnit = "deg") "Absolute angle of support flange"; parameter Real simplevehicle1.chassis.brake.w_small(quantity = "AngularVelocity", unit = "rad/s") = 10000000000.0 "Relative angular velocity near to zero if jumps due to a reinit(..) of the velocity can occur (set to low value only if such impulses can occur)"; Real simplevehicle1.chassis.brake.w_relfric(quantity = "AngularVelocity", unit = "rad/s") "Relative angular velocity between frictional surfaces"; Real simplevehicle1.chassis.brake.a_relfric(quantity = "AngularAcceleration", unit = "rad/s2") "Relative angular acceleration between frictional surfaces"; Real simplevehicle1.chassis.brake.tau0(quantity = "Torque", unit = "N.m") "Friction torque for w=0 and forward sliding"; Real simplevehicle1.chassis.brake.tau0_max(quantity = "Torque", unit = "N.m") "Maximum friction torque for w=0 and locked"; Boolean simplevehicle1.chassis.brake.free "true, if frictional element is not active"; Real simplevehicle1.chassis.brake.sa(unit = "1") "Path parameter of friction characteristic tau = f(a_relfric)"; Boolean simplevehicle1.chassis.brake.startForward(start = false, fixed = true) "true, if w_rel=0 and start of forward sliding"; Boolean simplevehicle1.chassis.brake.startBackward(start = false, fixed = true) "true, if w_rel=0 and start of backward sliding"; Boolean simplevehicle1.chassis.brake.locked(start = false) "true, if w_rel=0 and not sliding"; constant Integer simplevehicle1.chassis.brake.Unknown = 3 "Value of mode is not known"; constant Integer simplevehicle1.chassis.brake.Free = 2 "Element is not active"; constant Integer simplevehicle1.chassis.brake.Forward = 1 "w_rel > 0 (forward sliding)"; constant Integer simplevehicle1.chassis.brake.Stuck = 0 "w_rel = 0 (forward sliding, locked or backward sliding)"; constant Integer simplevehicle1.chassis.brake.Backward = -1 "w_rel < 0 (backward sliding)"; protected constant Real simplevehicle1.chassis.brake.unitAngularAcceleration(quantity = "AngularAcceleration", unit = "rad/s2") = 1.0; protected constant Real simplevehicle1.chassis.brake.unitTorque(quantity = "Torque", unit = "N.m") = 1.0; parameter Real simplevehicle1.chassis.brake.mue_pos[1,1] = 0.0 "[w,mue] positive sliding friction coefficient (w_rel>=0)"; parameter Real simplevehicle1.chassis.brake.mue_pos[1,2] = 0.5 "[w,mue] positive sliding friction coefficient (w_rel>=0)"; parameter Real simplevehicle1.chassis.brake.peak(min = 1.0) = 1.0 "peak*mue_pos[1,2] = maximum value of mue for w_rel==0"; parameter Real simplevehicle1.chassis.brake.cgeo(min = 0.0) = 1.0 "Geometry constant containing friction distribution assumption"; parameter Real simplevehicle1.chassis.brake.fn_max(quantity = "Force", unit = "N", min = 0.0, start = 1.0) = 30000.0 "Maximum normal force"; Real simplevehicle1.chassis.brake.phi(quantity = "Angle", unit = "rad", displayUnit = "deg") "Angle between shaft flanges (flange_a, flange_b) and support"; Real simplevehicle1.chassis.brake.tau(quantity = "Torque", unit = "N.m") "Brake friction torqu"; Real simplevehicle1.chassis.brake.w(quantity = "AngularVelocity", unit = "rad/s") "Absolute angular velocity of flange_a and flange_b"; Real simplevehicle1.chassis.brake.a(quantity = "AngularAcceleration", unit = "rad/s2") "Absolute angular acceleration of flange_a and flange_b"; Real simplevehicle1.chassis.brake.mue0 "Friction coefficient for w=0 and forward sliding"; Real simplevehicle1.chassis.brake.fn(quantity = "Force", unit = "N") "Normal force (=fn_max*f_normalized)"; input Real simplevehicle1.chassis.brake.f_normalized "Normalized force signal 0..1 (normal force = fn_max*f_normalized; brake is active if > 0)"; Integer simplevehicle1.chassis.brake.mode(min = -1, max = 3, start = 3, fixed = true); input Real simplevehicle1.chassis.BrakePedal; parameter Boolean simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.useSupport = false "= true, if support flange enabled, otherwise implicitly grounded"; Real simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.flange_a.phi(quantity = "Angle", unit = "rad", displayUnit = "deg") "Absolute rotation angle of flange"; Real simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.flange_a.tau(quantity = "Torque", unit = "N.m") "Cut torque in the flange"; Real simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.flange_b.phi(quantity = "Angle", unit = "rad", displayUnit = "deg") "Absolute rotation angle of flange"; Real simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.flange_b.tau(quantity = "Torque", unit = "N.m") "Cut torque in the flange"; protected Real simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.phi_support(quantity = "Angle", unit = "rad", displayUnit = "deg") "Absolute angle of support flange"; parameter Real simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.ratios[1] = 16.0 "Transmission ratios (flange_a.phi/flange_b.phi)"; parameter Real simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.ratios[2] = 7.5 "Transmission ratios (flange_a.phi/flange_b.phi)"; parameter Real simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.ratios[3] = 4.5 "Transmission ratios (flange_a.phi/flange_b.phi)"; parameter Real simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.ratios[4] = 3.2 "Transmission ratios (flange_a.phi/flange_b.phi)"; parameter Real simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.ratios[5] = 2.5 "Transmission ratios (flange_a.phi/flange_b.phi)"; parameter Real simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.Tg = 0.1 "Time constant for change of gear ratio."; input Integer simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.Gear "Gear number"; Real simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.phi_a(quantity = "Angle", unit = "rad", displayUnit = "deg") "Angle between left shaft flange and support"; Real simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.phi_b(quantity = "Angle", unit = "rad", displayUnit = "deg") "Angle between right shaft flange and support"; Real simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.gearRatio(start = 1.0, fixed = true); Real simplevehicle1.clutchAndGearbox.clutch.a_rel(quantity = "AngularAcceleration", unit = "rad/s2", start = 0.0) "Relative angular acceleration (= der(w_rel))"; Real simplevehicle1.clutchAndGearbox.clutch.tau(quantity = "Torque", unit = "N.m") "Torque between flanges (= flange_b.tau)"; Real simplevehicle1.clutchAndGearbox.clutch.flange_a.phi(quantity = "Angle", unit = "rad", displayUnit = "deg") "Absolute rotation angle of flange"; Real simplevehicle1.clutchAndGearbox.clutch.flange_a.tau(quantity = "Torque", unit = "N.m") "Cut torque in the flange"; Real simplevehicle1.clutchAndGearbox.clutch.flange_b.phi(quantity = "Angle", unit = "rad", displayUnit = "deg") "Absolute rotation angle of flange"; Real simplevehicle1.clutchAndGearbox.clutch.flange_b.tau(quantity = "Torque", unit = "N.m") "Cut torque in the flange"; parameter Real simplevehicle1.clutchAndGearbox.clutch.phi_nominal(quantity = "Angle", unit = "rad", displayUnit = "rad") = 0.0001 "Nominal value of phi_rel (used for scaling)"; parameter enumeration(never, avoid, default, prefer, always) simplevehicle1.clutchAndGearbox.clutch.stateSelect = StateSelect.prefer "Priority to use phi_rel and w_rel as states"; parameter Real simplevehicle1.clutchAndGearbox.clutch.w_small(quantity = "AngularVelocity", unit = "rad/s") = 10000000000.0 "Relative angular velocity near to zero if jumps due to a reinit(..) of the velocity can occur (set to low value only if such impulses can occur)"; Real simplevehicle1.clutchAndGearbox.clutch.w_relfric(quantity = "AngularVelocity", unit = "rad/s") "Relative angular velocity between frictional surfaces"; Real simplevehicle1.clutchAndGearbox.clutch.a_relfric(quantity = "AngularAcceleration", unit = "rad/s2") "Relative angular acceleration between frictional surfaces"; Real simplevehicle1.clutchAndGearbox.clutch.tau0(quantity = "Torque", unit = "N.m") "Friction torque for w=0 and forward sliding"; Real simplevehicle1.clutchAndGearbox.clutch.tau0_max(quantity = "Torque", unit = "N.m") "Maximum friction torque for w=0 and locked"; Boolean simplevehicle1.clutchAndGearbox.clutch.free "true, if frictional element is not active"; Real simplevehicle1.clutchAndGearbox.clutch.sa(unit = "1") "Path parameter of friction characteristic tau = f(a_relfric)"; Boolean simplevehicle1.clutchAndGearbox.clutch.startForward(start = false, fixed = true) "true, if w_rel=0 and start of forward sliding"; Boolean simplevehicle1.clutchAndGearbox.clutch.startBackward(start = false, fixed = true) "true, if w_rel=0 and start of backward sliding"; Boolean simplevehicle1.clutchAndGearbox.clutch.locked(start = false) "true, if w_rel=0 and not sliding"; constant Integer simplevehicle1.clutchAndGearbox.clutch.Unknown = 3 "Value of mode is not known"; constant Integer simplevehicle1.clutchAndGearbox.clutch.Free = 2 "Element is not active"; constant Integer simplevehicle1.clutchAndGearbox.clutch.Forward = 1 "w_rel > 0 (forward sliding)"; constant Integer simplevehicle1.clutchAndGearbox.clutch.Stuck = 0 "w_rel = 0 (forward sliding, locked or backward sliding)"; constant Integer simplevehicle1.clutchAndGearbox.clutch.Backward = -1 "w_rel < 0 (backward sliding)"; protected constant Real simplevehicle1.clutchAndGearbox.clutch.unitAngularAcceleration(quantity = "AngularAcceleration", unit = "rad/s2") = 1.0; protected constant Real simplevehicle1.clutchAndGearbox.clutch.unitTorque(quantity = "Torque", unit = "N.m") = 1.0; parameter Real simplevehicle1.clutchAndGearbox.clutch.mue_pos[1,1] = 0.0 "[w,mue] positive sliding friction coefficient (w_rel>=0)"; parameter Real simplevehicle1.clutchAndGearbox.clutch.mue_pos[1,2] = 0.5 "[w,mue] positive sliding friction coefficient (w_rel>=0)"; parameter Real simplevehicle1.clutchAndGearbox.clutch.peak(min = 1.0) = 1.0 "peak*mue_pos[1,2] = maximum value of mue for w_rel==0"; parameter Real simplevehicle1.clutchAndGearbox.clutch.cgeo(min = 0.0) = 1.0 "Geometry constant containing friction distribution assumption"; parameter Real simplevehicle1.clutchAndGearbox.clutch.fn_max(quantity = "Force", unit = "N", min = 0.0, start = 1.0) = 1000.0 "Maximum normal force"; Real simplevehicle1.clutchAndGearbox.clutch.mue0 "Friction coefficient for w=0 and forward sliding"; Real simplevehicle1.clutchAndGearbox.clutch.fn(quantity = "Force", unit = "N") "Normal force (fn=fn_max*f_normalized)"; input Real simplevehicle1.clutchAndGearbox.clutch.f_normalized "Normalized force signal 0..1 (normal force = fn_max*f_normalized; clutch is engaged if > 0)"; Real simplevehicle1.clutchAndGearbox.clutch.phi_rel(quantity = "Angle", unit = "rad", displayUnit = "deg", start = 0.0, nominal = simplevehicle1.clutchAndGearbox.clutch.phi_nominal, StateSelect = StateSelect.prefer) "Relative rotation angle (= flange_b.phi - flange_a.phi)"; Real simplevehicle1.clutchAndGearbox.clutch.w_rel(quantity = "AngularVelocity", unit = "rad/s", start = 0.0, StateSelect = StateSelect.prefer) "Relative angular velocity (= der(phi_rel))"; Integer simplevehicle1.clutchAndGearbox.clutch.mode(min = -1, max = 3, start = 3, fixed = true); Real simplevehicle1.clutchAndGearbox.ClutchAxle.phi(quantity = "Angle", unit = "rad", displayUnit = "deg") "Absolute rotation angle of flange"; Real simplevehicle1.clutchAndGearbox.ClutchAxle.tau(quantity = "Torque", unit = "N.m") "Cut torque in the flange"; Real simplevehicle1.clutchAndGearbox.GearboxAxle.phi(quantity = "Angle", unit = "rad", displayUnit = "deg") "Absolute rotation angle of flange"; Real simplevehicle1.clutchAndGearbox.GearboxAxle.tau(quantity = "Torque", unit = "N.m") "Cut torque in the flange"; input Real simplevehicle1.clutchAndGearbox.ClutchPedal; input Integer simplevehicle1.clutchAndGearbox.Gear; parameter Real simplevehicle1.engine.J(quantity = "MomentOfInertia", unit = "kg.m2") = 0.1 "Moment of inertia for the engine"; parameter Boolean simplevehicle1.engine.engineTorque.useSupport = false "= true, if support flange enabled, otherwise implicitly grounded"; Real simplevehicle1.engine.engineTorque.flange.phi(quantity = "Angle", unit = "rad", displayUnit = "deg") "Absolute rotation angle of flange"; Real simplevehicle1.engine.engineTorque.flange.tau(quantity = "Torque", unit = "N.m") "Cut torque in the flange"; protected Real simplevehicle1.engine.engineTorque.phi_support(quantity = "Angle", unit = "rad", displayUnit = "deg") "Absolute angle of support flange"; input Real simplevehicle1.engine.engineTorque.tau "Accelerating torque acting at flange (= -flange.tau)"; input Real simplevehicle1.engine.ThrottleRef; Real simplevehicle1.engine.CrankShaft.phi(quantity = "Angle", unit = "rad", displayUnit = "deg") "Absolute rotation angle of flange"; Real simplevehicle1.engine.CrankShaft.tau(quantity = "Torque", unit = "N.m") "Cut torque in the flange"; parameter Real simplevehicle1.engine.torqueMax.k(start = 1.0) = 350.0 "Gain value multiplied with input signal"; input Real simplevehicle1.engine.torqueMax.u "Input signal connector"; output Real simplevehicle1.engine.torqueMax.y "Output signal connector"; Real simplevehicle1.engine.engineInertia.flange_a.phi(quantity = "Angle", unit = "rad", displayUnit = "deg") "Absolute rotation angle of flange"; Real simplevehicle1.engine.engineInertia.flange_a.tau(quantity = "Torque", unit = "N.m") "Cut torque in the flange"; Real simplevehicle1.engine.engineInertia.flange_b.phi(quantity = "Angle", unit = "rad", displayUnit = "deg") "Absolute rotation angle of flange"; Real simplevehicle1.engine.engineInertia.flange_b.tau(quantity = "Torque", unit = "N.m") "Cut torque in the flange"; parameter Real simplevehicle1.engine.engineInertia.J(quantity = "MomentOfInertia", unit = "kg.m2", min = 0.0, start = 1.0) = simplevehicle1.engine.J "Moment of inertia"; parameter enumeration(never, avoid, default, prefer, always) simplevehicle1.engine.engineInertia.stateSelect = StateSelect.default "Priority to use phi and w as states"; Real simplevehicle1.engine.engineInertia.a(quantity = "AngularAcceleration", unit = "rad/s2") "Absolute angular acceleration of component (= der(w))"; Real simplevehicle1.engine.engineInertia.phi(quantity = "Angle", unit = "rad", displayUnit = "deg", StateSelect = StateSelect.default) "Absolute rotation angle of component"; Real simplevehicle1.engine.engineInertia.w(quantity = "AngularVelocity", unit = "rad/s", StateSelect = StateSelect.default) "Absolute angular velocity of component (= der(phi))"; output Real Throttle.y "Connector of Real output signal"; parameter Real Throttle.k(start = 1.0) = 0.3 "Constant output value"; output Real Clutch.y "Connector of Real output signal"; parameter Real Clutch.k(start = 1.0) = 1.0 "Constant output value"; output Real Break.y "Connector of Real output signal"; parameter Real Break.k(start = 1.0) = 0.0 "Constant output value"; output Integer Gear.y "Connector of Integer output signal"; parameter Integer Gear.offset = 1 "Offset of output signal y"; parameter Real Gear.startTime(quantity = "Time", unit = "s") = 5.0 "Output y = offset for time < startTime"; parameter Integer Gear.height = 1 "Height of step"; equation simplevehicle1.chassis.WheelRadius.internalSupportR.flange.tau = simplevehicle1.chassis.WheelRadius.internalSupportR.tau; simplevehicle1.chassis.WheelRadius.internalSupportR.flange.phi = simplevehicle1.chassis.WheelRadius.internalSupportR.phi; simplevehicle1.chassis.WheelRadius.internalSupportT.flange.f = simplevehicle1.chassis.WheelRadius.internalSupportT.f; simplevehicle1.chassis.WheelRadius.internalSupportT.flange.s = simplevehicle1.chassis.WheelRadius.internalSupportT.s; simplevehicle1.chassis.WheelRadius.fixedR.flange.phi = simplevehicle1.chassis.WheelRadius.fixedR.phi0; simplevehicle1.chassis.WheelRadius.fixedT.flange.s = simplevehicle1.chassis.WheelRadius.fixedT.s0; simplevehicle1.chassis.WheelRadius.flangeR.phi - simplevehicle1.chassis.WheelRadius.internalSupportR.phi = simplevehicle1.chassis.WheelRadius.ratio * (simplevehicle1.chassis.WheelRadius.flangeT.s - simplevehicle1.chassis.WheelRadius.internalSupportT.s); 0.0 = simplevehicle1.chassis.WheelRadius.ratio * simplevehicle1.chassis.WheelRadius.flangeR.tau + simplevehicle1.chassis.WheelRadius.flangeT.f; simplevehicle1.chassis.VehicleMass.v = der(simplevehicle1.chassis.VehicleMass.s); simplevehicle1.chassis.VehicleMass.a = der(simplevehicle1.chassis.VehicleMass.v); simplevehicle1.chassis.VehicleMass.m * simplevehicle1.chassis.VehicleMass.a = simplevehicle1.chassis.VehicleMass.flange_a.f + simplevehicle1.chassis.VehicleMass.flange_b.f; simplevehicle1.chassis.VehicleMass.flange_a.s = simplevehicle1.chassis.VehicleMass.s + (-simplevehicle1.chassis.VehicleMass.L) / 2.0; simplevehicle1.chassis.VehicleMass.flange_b.s = simplevehicle1.chassis.VehicleMass.s + simplevehicle1.chassis.VehicleMass.L / 2.0; simplevehicle1.chassis.Wheel.phi = simplevehicle1.chassis.Wheel.flange_a.phi; simplevehicle1.chassis.Wheel.phi = simplevehicle1.chassis.Wheel.flange_b.phi; simplevehicle1.chassis.Wheel.w = der(simplevehicle1.chassis.Wheel.phi); simplevehicle1.chassis.Wheel.a = der(simplevehicle1.chassis.Wheel.w); simplevehicle1.chassis.Wheel.J * simplevehicle1.chassis.Wheel.a = simplevehicle1.chassis.Wheel.flange_a.tau + simplevehicle1.chassis.Wheel.flange_b.tau; simplevehicle1.chassis.speedDependentForce.speedSensor.v = der(simplevehicle1.chassis.speedDependentForce.speedSensor.flange.s); 0.0 = simplevehicle1.chassis.speedDependentForce.speedSensor.flange.f; simplevehicle1.chassis.speedDependentForce.Force.flange.f = -simplevehicle1.chassis.speedDependentForce.Force.f; simplevehicle1.chassis.speedDependentForce.Force.s_support = 0.0; simplevehicle1.chassis.speedDependentForce.speedToForce.y = simplevehicle1.chassis.speedDependentForce.speedToForce.upow[1] * simplevehicle1.chassis.speedDependentForce.speedToForce.Cpol[1] + (simplevehicle1.chassis.speedDependentForce.speedToForce.upow[2] * simplevehicle1.chassis.speedDependentForce.speedToForce.Cpol[2] + simplevehicle1.chassis.speedDependentForce.speedToForce.upow[3] * simplevehicle1.chassis.speedDependentForce.speedToForce.Cpol[3]); simplevehicle1.chassis.speedDependentForce.speedToForce.upow[1] = 1.0; simplevehicle1.chassis.speedDependentForce.speedToForce.upow[2] = simplevehicle1.chassis.speedDependentForce.speedToForce.upow[1] * simplevehicle1.chassis.speedDependentForce.speedToForce.u; simplevehicle1.chassis.speedDependentForce.speedToForce.upow[3] = simplevehicle1.chassis.speedDependentForce.speedToForce.upow[2] * simplevehicle1.chassis.speedDependentForce.speedToForce.u; simplevehicle1.chassis.brake.mue0 = Modelica.Math.tempInterpol1(0.0,{{simplevehicle1.chassis.brake.mue_pos[1,1],simplevehicle1.chassis.brake.mue_pos[1,2]}},2); simplevehicle1.chassis.brake.phi = simplevehicle1.chassis.brake.flange_a.phi - simplevehicle1.chassis.brake.phi_support; simplevehicle1.chassis.brake.flange_b.phi = simplevehicle1.chassis.brake.flange_a.phi; simplevehicle1.chassis.brake.w = der(simplevehicle1.chassis.brake.phi); simplevehicle1.chassis.brake.a = der(simplevehicle1.chassis.brake.w); simplevehicle1.chassis.brake.w_relfric = simplevehicle1.chassis.brake.w; simplevehicle1.chassis.brake.a_relfric = simplevehicle1.chassis.brake.a; simplevehicle1.chassis.brake.flange_a.tau + (simplevehicle1.chassis.brake.flange_b.tau - simplevehicle1.chassis.brake.tau) = 0.0; simplevehicle1.chassis.brake.fn = simplevehicle1.chassis.brake.fn_max * simplevehicle1.chassis.brake.f_normalized; simplevehicle1.chassis.brake.tau0 = simplevehicle1.chassis.brake.mue0 * (simplevehicle1.chassis.brake.cgeo * simplevehicle1.chassis.brake.fn); simplevehicle1.chassis.brake.tau0_max = simplevehicle1.chassis.brake.peak * simplevehicle1.chassis.brake.tau0; simplevehicle1.chassis.brake.free = simplevehicle1.chassis.brake.fn <= 0.0; simplevehicle1.chassis.brake.tau = if simplevehicle1.chassis.brake.locked then simplevehicle1.chassis.brake.sa else if simplevehicle1.chassis.brake.free then 0.0 else simplevehicle1.chassis.brake.cgeo * (simplevehicle1.chassis.brake.fn * (if simplevehicle1.chassis.brake.startForward then Modelica.Math.tempInterpol1(simplevehicle1.chassis.brake.w,{{simplevehicle1.chassis.brake.mue_pos[1,1],simplevehicle1.chassis.brake.mue_pos[1,2]}},2) else if simplevehicle1.chassis.brake.startBackward then -Modelica.Math.tempInterpol1(-simplevehicle1.chassis.brake.w,{{simplevehicle1.chassis.brake.mue_pos[1,1],simplevehicle1.chassis.brake.mue_pos[1,2]}},2) else if pre(simplevehicle1.chassis.brake.mode) == 1 then Modelica.Math.tempInterpol1(simplevehicle1.chassis.brake.w,{{simplevehicle1.chassis.brake.mue_pos[1,1],simplevehicle1.chassis.brake.mue_pos[1,2]}},2) else -Modelica.Math.tempInterpol1(-simplevehicle1.chassis.brake.w,{{simplevehicle1.chassis.brake.mue_pos[1,1],simplevehicle1.chassis.brake.mue_pos[1,2]}},2))); simplevehicle1.chassis.brake.phi_support = 0.0; simplevehicle1.chassis.brake.startForward = pre(simplevehicle1.chassis.brake.mode) == 0 and (simplevehicle1.chassis.brake.sa > simplevehicle1.chassis.brake.tau0_max or pre(simplevehicle1.chassis.brake.startForward) and simplevehicle1.chassis.brake.sa > simplevehicle1.chassis.brake.tau0) or pre(simplevehicle1.chassis.brake.mode) == -1 and simplevehicle1.chassis.brake.w_relfric > simplevehicle1.chassis.brake.w_small or initial() and simplevehicle1.chassis.brake.w_relfric > 0.0; simplevehicle1.chassis.brake.startBackward = pre(simplevehicle1.chassis.brake.mode) == 0 and (simplevehicle1.chassis.brake.sa < -simplevehicle1.chassis.brake.tau0_max or pre(simplevehicle1.chassis.brake.startBackward) and simplevehicle1.chassis.brake.sa < -simplevehicle1.chassis.brake.tau0) or pre(simplevehicle1.chassis.brake.mode) == 1 and simplevehicle1.chassis.brake.w_relfric < -simplevehicle1.chassis.brake.w_small or initial() and simplevehicle1.chassis.brake.w_relfric < 0.0; simplevehicle1.chassis.brake.locked = not simplevehicle1.chassis.brake.free and not (pre(simplevehicle1.chassis.brake.mode) == 1 or simplevehicle1.chassis.brake.startForward or pre(simplevehicle1.chassis.brake.mode) == -1 or simplevehicle1.chassis.brake.startBackward); simplevehicle1.chassis.brake.a_relfric = if simplevehicle1.chassis.brake.locked then 0.0 else if simplevehicle1.chassis.brake.free then simplevehicle1.chassis.brake.sa else if simplevehicle1.chassis.brake.startForward then simplevehicle1.chassis.brake.sa - simplevehicle1.chassis.brake.tau0_max else if simplevehicle1.chassis.brake.startBackward then simplevehicle1.chassis.brake.sa + simplevehicle1.chassis.brake.tau0_max else if pre(simplevehicle1.chassis.brake.mode) == 1 then simplevehicle1.chassis.brake.sa - simplevehicle1.chassis.brake.tau0_max else simplevehicle1.chassis.brake.sa + simplevehicle1.chassis.brake.tau0_max; simplevehicle1.chassis.brake.mode = if simplevehicle1.chassis.brake.free then 2 else if (pre(simplevehicle1.chassis.brake.mode) == 1 or pre(simplevehicle1.chassis.brake.mode) == 2 or simplevehicle1.chassis.brake.startForward) and simplevehicle1.chassis.brake.w_relfric > 0.0 then 1 else if (pre(simplevehicle1.chassis.brake.mode) == -1 or pre(simplevehicle1.chassis.brake.mode) == 2 or simplevehicle1.chassis.brake.startBackward) and simplevehicle1.chassis.brake.w_relfric < 0.0 then -1 else 0; der(simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.gearRatio) = ((if simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.Gear == 0 then 1.0 else simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.ratios[simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.Gear]) - simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.gearRatio) / simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.Tg; der(simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.phi_a) = simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.gearRatio * der(simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.phi_b); simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.phi_a = simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.flange_a.phi - simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.phi_support; simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.phi_b = simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.flange_b.phi - simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.phi_support; 0.0 = simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.gearRatio * simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.flange_a.tau + simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.flange_b.tau; simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.phi_support = 0.0; simplevehicle1.clutchAndGearbox.clutch.mue0 = Modelica.Math.tempInterpol1(0.0,{{simplevehicle1.clutchAndGearbox.clutch.mue_pos[1,1],simplevehicle1.clutchAndGearbox.clutch.mue_pos[1,2]}},2); simplevehicle1.clutchAndGearbox.clutch.w_relfric = simplevehicle1.clutchAndGearbox.clutch.w_rel; simplevehicle1.clutchAndGearbox.clutch.a_relfric = simplevehicle1.clutchAndGearbox.clutch.a_rel; simplevehicle1.clutchAndGearbox.clutch.fn = simplevehicle1.clutchAndGearbox.clutch.fn_max * simplevehicle1.clutchAndGearbox.clutch.f_normalized; simplevehicle1.clutchAndGearbox.clutch.free = simplevehicle1.clutchAndGearbox.clutch.fn <= 0.0; simplevehicle1.clutchAndGearbox.clutch.tau0 = simplevehicle1.clutchAndGearbox.clutch.mue0 * (simplevehicle1.clutchAndGearbox.clutch.cgeo * simplevehicle1.clutchAndGearbox.clutch.fn); simplevehicle1.clutchAndGearbox.clutch.tau0_max = simplevehicle1.clutchAndGearbox.clutch.peak * simplevehicle1.clutchAndGearbox.clutch.tau0; simplevehicle1.clutchAndGearbox.clutch.tau = if simplevehicle1.clutchAndGearbox.clutch.locked then simplevehicle1.clutchAndGearbox.clutch.sa else if simplevehicle1.clutchAndGearbox.clutch.free then 0.0 else simplevehicle1.clutchAndGearbox.clutch.cgeo * (simplevehicle1.clutchAndGearbox.clutch.fn * (if simplevehicle1.clutchAndGearbox.clutch.startForward then Modelica.Math.tempInterpol1(simplevehicle1.clutchAndGearbox.clutch.w_rel,{{simplevehicle1.clutchAndGearbox.clutch.mue_pos[1,1],simplevehicle1.clutchAndGearbox.clutch.mue_pos[1,2]}},2) else if simplevehicle1.clutchAndGearbox.clutch.startBackward then -Modelica.Math.tempInterpol1(-simplevehicle1.clutchAndGearbox.clutch.w_rel,{{simplevehicle1.clutchAndGearbox.clutch.mue_pos[1,1],simplevehicle1.clutchAndGearbox.clutch.mue_pos[1,2]}},2) else if pre(simplevehicle1.clutchAndGearbox.clutch.mode) == 1 then Modelica.Math.tempInterpol1(simplevehicle1.clutchAndGearbox.clutch.w_rel,{{simplevehicle1.clutchAndGearbox.clutch.mue_pos[1,1],simplevehicle1.clutchAndGearbox.clutch.mue_pos[1,2]}},2) else -Modelica.Math.tempInterpol1(-simplevehicle1.clutchAndGearbox.clutch.w_rel,{{simplevehicle1.clutchAndGearbox.clutch.mue_pos[1,1],simplevehicle1.clutchAndGearbox.clutch.mue_pos[1,2]}},2))); simplevehicle1.clutchAndGearbox.clutch.phi_rel = simplevehicle1.clutchAndGearbox.clutch.flange_b.phi - simplevehicle1.clutchAndGearbox.clutch.flange_a.phi; simplevehicle1.clutchAndGearbox.clutch.w_rel = der(simplevehicle1.clutchAndGearbox.clutch.phi_rel); simplevehicle1.clutchAndGearbox.clutch.a_rel = der(simplevehicle1.clutchAndGearbox.clutch.w_rel); simplevehicle1.clutchAndGearbox.clutch.flange_b.tau = simplevehicle1.clutchAndGearbox.clutch.tau; simplevehicle1.clutchAndGearbox.clutch.flange_a.tau = -simplevehicle1.clutchAndGearbox.clutch.tau; simplevehicle1.clutchAndGearbox.clutch.startForward = pre(simplevehicle1.clutchAndGearbox.clutch.mode) == 0 and (simplevehicle1.clutchAndGearbox.clutch.sa > simplevehicle1.clutchAndGearbox.clutch.tau0_max or pre(simplevehicle1.clutchAndGearbox.clutch.startForward) and simplevehicle1.clutchAndGearbox.clutch.sa > simplevehicle1.clutchAndGearbox.clutch.tau0) or pre(simplevehicle1.clutchAndGearbox.clutch.mode) == -1 and simplevehicle1.clutchAndGearbox.clutch.w_relfric > simplevehicle1.clutchAndGearbox.clutch.w_small or initial() and simplevehicle1.clutchAndGearbox.clutch.w_relfric > 0.0; simplevehicle1.clutchAndGearbox.clutch.startBackward = pre(simplevehicle1.clutchAndGearbox.clutch.mode) == 0 and (simplevehicle1.clutchAndGearbox.clutch.sa < -simplevehicle1.clutchAndGearbox.clutch.tau0_max or pre(simplevehicle1.clutchAndGearbox.clutch.startBackward) and simplevehicle1.clutchAndGearbox.clutch.sa < -simplevehicle1.clutchAndGearbox.clutch.tau0) or pre(simplevehicle1.clutchAndGearbox.clutch.mode) == 1 and simplevehicle1.clutchAndGearbox.clutch.w_relfric < -simplevehicle1.clutchAndGearbox.clutch.w_small or initial() and simplevehicle1.clutchAndGearbox.clutch.w_relfric < 0.0; simplevehicle1.clutchAndGearbox.clutch.locked = not simplevehicle1.clutchAndGearbox.clutch.free and not (pre(simplevehicle1.clutchAndGearbox.clutch.mode) == 1 or simplevehicle1.clutchAndGearbox.clutch.startForward or pre(simplevehicle1.clutchAndGearbox.clutch.mode) == -1 or simplevehicle1.clutchAndGearbox.clutch.startBackward); simplevehicle1.clutchAndGearbox.clutch.a_relfric = if simplevehicle1.clutchAndGearbox.clutch.locked then 0.0 else if simplevehicle1.clutchAndGearbox.clutch.free then simplevehicle1.clutchAndGearbox.clutch.sa else if simplevehicle1.clutchAndGearbox.clutch.startForward then simplevehicle1.clutchAndGearbox.clutch.sa - simplevehicle1.clutchAndGearbox.clutch.tau0_max else if simplevehicle1.clutchAndGearbox.clutch.startBackward then simplevehicle1.clutchAndGearbox.clutch.sa + simplevehicle1.clutchAndGearbox.clutch.tau0_max else if pre(simplevehicle1.clutchAndGearbox.clutch.mode) == 1 then simplevehicle1.clutchAndGearbox.clutch.sa - simplevehicle1.clutchAndGearbox.clutch.tau0_max else simplevehicle1.clutchAndGearbox.clutch.sa + simplevehicle1.clutchAndGearbox.clutch.tau0_max; simplevehicle1.clutchAndGearbox.clutch.mode = if simplevehicle1.clutchAndGearbox.clutch.free then 2 else if (pre(simplevehicle1.clutchAndGearbox.clutch.mode) == 1 or pre(simplevehicle1.clutchAndGearbox.clutch.mode) == 2 or simplevehicle1.clutchAndGearbox.clutch.startForward) and simplevehicle1.clutchAndGearbox.clutch.w_relfric > 0.0 then 1 else if (pre(simplevehicle1.clutchAndGearbox.clutch.mode) == -1 or pre(simplevehicle1.clutchAndGearbox.clutch.mode) == 2 or simplevehicle1.clutchAndGearbox.clutch.startBackward) and simplevehicle1.clutchAndGearbox.clutch.w_relfric < 0.0 then -1 else 0; simplevehicle1.engine.engineTorque.flange.tau = -simplevehicle1.engine.engineTorque.tau; simplevehicle1.engine.engineTorque.phi_support = 0.0; simplevehicle1.engine.torqueMax.y = simplevehicle1.engine.torqueMax.k * simplevehicle1.engine.torqueMax.u; simplevehicle1.engine.engineInertia.phi = simplevehicle1.engine.engineInertia.flange_a.phi; simplevehicle1.engine.engineInertia.phi = simplevehicle1.engine.engineInertia.flange_b.phi; simplevehicle1.engine.engineInertia.w = der(simplevehicle1.engine.engineInertia.phi); simplevehicle1.engine.engineInertia.a = der(simplevehicle1.engine.engineInertia.w); simplevehicle1.engine.engineInertia.J * simplevehicle1.engine.engineInertia.a = simplevehicle1.engine.engineInertia.flange_a.tau + simplevehicle1.engine.engineInertia.flange_b.tau; Throttle.y = Throttle.k; Clutch.y = Clutch.k; Break.y = Break.k; Gear.y = Gear.offset + (if time < Gear.startTime then 0 else Gear.height); simplevehicle1.Wheel.tau = 0.0; simplevehicle1.Vehicle.f = 0.0; simplevehicle1.chassis.WheelRadius.flangeR.tau + simplevehicle1.chassis.brake.flange_b.tau = 0.0; simplevehicle1.chassis.WheelRadius.flangeT.f + simplevehicle1.chassis.VehicleMass.flange_a.f = 0.0; simplevehicle1.chassis.WheelRadius.internalSupportR.flange.tau + simplevehicle1.chassis.WheelRadius.fixedR.flange.tau = 0.0; simplevehicle1.chassis.WheelRadius.internalSupportT.flange.f + simplevehicle1.chassis.WheelRadius.fixedT.flange.f = 0.0; simplevehicle1.chassis.WheelRadius.fixedR.flange.phi = simplevehicle1.chassis.WheelRadius.internalSupportR.flange.phi; simplevehicle1.chassis.WheelRadius.fixedT.flange.s = simplevehicle1.chassis.WheelRadius.internalSupportT.flange.s; simplevehicle1.chassis.VehicleMass.flange_b.f + simplevehicle1.chassis.speedDependentForce.Flange_b.f + -simplevehicle1.chassis.VehicleChassis.f = 0.0; simplevehicle1.chassis.Wheel.flange_a.tau + -simplevehicle1.chassis.DriveShaft.tau = 0.0; simplevehicle1.chassis.Wheel.flange_b.tau + simplevehicle1.chassis.brake.flange_a.tau = 0.0; simplevehicle1.chassis.speedDependentForce.speedSensor.flange.f + -simplevehicle1.chassis.speedDependentForce.Flange_b.f + simplevehicle1.chassis.speedDependentForce.Force.flange.f = 0.0; simplevehicle1.chassis.speedDependentForce.Flange_b.s = simplevehicle1.chassis.speedDependentForce.Force.flange.s; simplevehicle1.chassis.speedDependentForce.Flange_b.s = simplevehicle1.chassis.speedDependentForce.speedSensor.flange.s; simplevehicle1.chassis.speedDependentForce.Force.f = simplevehicle1.chassis.speedDependentForce.speedToForce.y; simplevehicle1.chassis.speedDependentForce.speedSensor.v = simplevehicle1.chassis.speedDependentForce.speedToForce.u; -simplevehicle1.Wheel.tau + simplevehicle1.chassis.DriveShaft.tau + simplevehicle1.clutchAndGearbox.GearboxAxle.tau = 0.0; -simplevehicle1.Vehicle.f + simplevehicle1.chassis.VehicleChassis.f = 0.0; simplevehicle1.chassis.VehicleMass.flange_a.s = simplevehicle1.chassis.WheelRadius.flangeT.s; simplevehicle1.chassis.Wheel.flange_b.phi = simplevehicle1.chassis.brake.flange_a.phi; simplevehicle1.chassis.WheelRadius.flangeR.phi = simplevehicle1.chassis.brake.flange_b.phi; simplevehicle1.chassis.BrakePedal = simplevehicle1.chassis.brake.f_normalized; simplevehicle1.chassis.DriveShaft.phi = simplevehicle1.chassis.Wheel.flange_a.phi; simplevehicle1.chassis.VehicleChassis.s = simplevehicle1.chassis.VehicleMass.flange_b.s; simplevehicle1.chassis.VehicleChassis.s = simplevehicle1.chassis.speedDependentForce.Flange_b.s; simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.flange_a.tau + simplevehicle1.clutchAndGearbox.clutch.flange_b.tau = 0.0; simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.flange_b.tau + -simplevehicle1.clutchAndGearbox.GearboxAxle.tau = 0.0; simplevehicle1.clutchAndGearbox.clutch.flange_a.tau + -simplevehicle1.clutchAndGearbox.ClutchAxle.tau = 0.0; simplevehicle1.clutchAndGearbox.ClutchAxle.tau + simplevehicle1.engine.CrankShaft.tau = 0.0; simplevehicle1.clutchAndGearbox.clutch.flange_b.phi = simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.flange_a.phi; simplevehicle1.clutchAndGearbox.ClutchAxle.phi = simplevehicle1.clutchAndGearbox.clutch.flange_a.phi; simplevehicle1.clutchAndGearbox.GearboxAxle.phi = simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.flange_b.phi; simplevehicle1.clutchAndGearbox.Gear = simplevehicle1.clutchAndGearbox.gearboxAndFinalDrive.Gear; simplevehicle1.clutchAndGearbox.ClutchPedal = simplevehicle1.clutchAndGearbox.clutch.f_normalized; simplevehicle1.engine.engineTorque.flange.tau + simplevehicle1.engine.engineInertia.flange_a.tau = 0.0; -simplevehicle1.engine.CrankShaft.tau + simplevehicle1.engine.engineInertia.flange_b.tau = 0.0; simplevehicle1.engine.engineTorque.tau = simplevehicle1.engine.torqueMax.y; simplevehicle1.engine.ThrottleRef = simplevehicle1.engine.torqueMax.u; simplevehicle1.engine.engineInertia.flange_a.phi = simplevehicle1.engine.engineTorque.flange.phi; simplevehicle1.engine.CrankShaft.phi = simplevehicle1.engine.engineInertia.flange_b.phi; simplevehicle1.ThrottlePedal = simplevehicle1.engine.ThrottleRef; simplevehicle1.clutchAndGearbox.ClutchAxle.phi = simplevehicle1.engine.CrankShaft.phi; simplevehicle1.Gear = simplevehicle1.clutchAndGearbox.Gear; simplevehicle1.Wheel.phi = simplevehicle1.chassis.DriveShaft.phi; simplevehicle1.Wheel.phi = simplevehicle1.clutchAndGearbox.GearboxAxle.phi; simplevehicle1.ClutchPedal = simplevehicle1.clutchAndGearbox.ClutchPedal; simplevehicle1.BrakePedal = simplevehicle1.chassis.BrakePedal; simplevehicle1.Vehicle.s = simplevehicle1.chassis.VehicleChassis.s; Gear.y = simplevehicle1.Gear; Break.y = simplevehicle1.BrakePedal; Clutch.y = simplevehicle1.ClutchPedal; Throttle.y = simplevehicle1.ThrottlePedal; end TestModel;
Change History (4)
comment:1 by , 12 years ago
Cc: | added |
---|---|
Description: | modified (diff) |
comment:2 by , 12 years ago
comment:3 by , 9 years ago
Milestone: | → Future |
---|
comment:4 by , 7 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Closing since we don't have the code for the full model to reproduce.
I got IdealGearBox is structurally singular. Maybe the full model is required? Jens, can you have a look.