text
stringlengths
1
4.74k
code
stringlengths
69
637k
Definition of relative state variables. Usually, the absolute angle and the absolute angular velocity of Modelica.Mechanics.Rotational.Components.Inertia models are used as state variables. In some circumstances, relative quantities are better suited, e.g., because it may be easier to supply initial values. In such cases, model <strong>RelativeStates</strong> allows the definition of state variables in the following way:
within Modelica.Mechanics.Rotational.Components; model RelativeStates "Definition of relative state variables" extends Rotational.Interfaces.PartialTwoFlanges; parameter StateSelect stateSelect=StateSelect.prefer "Priority to use the relative angle and relative speed as states"; parameter SI.Angle phi_nominal( displayUnit="rad", min=0.0) = 1.0 "Nominal value of the relative angle (used for scaling)"; SI.Angle phi_rel( start=0, stateSelect=stateSelect, nominal=if phi_nominal >= Modelica.Constants.eps then phi_nominal else 1) "Relative rotation angle used as state variable"; SI.AngularVelocity w_rel(start=0, stateSelect=stateSelect) "Relative angular velocity used as state variable"; SI.AngularAcceleration a_rel(start=0) "Relative angular acceleration"; equation phi_rel = flange_b.phi - flange_a.phi; w_rel = der(phi_rel); a_rel = der(w_rel); flange_a.tau = 0; flange_b.tau = 0; end RelativeStates;
Linear 1D rotational spring. A <strong>linear 1D rotational spring</strong>. The component can be connected either between two inertias/gears to describe the shaft elasticity, or between a inertia/gear and the housing (component Fixed), to describe a coupling of the element with the housing via a spring.
within Modelica.Mechanics.Rotational.Components; model Spring "Linear 1D rotational spring" extends Modelica.Mechanics.Rotational.Interfaces.PartialCompliant; parameter SI.RotationalSpringConstant c(final min=0, start=1.0e5) "Spring constant"; parameter SI.Angle phi_rel0=0 "Unstretched spring angle"; equation tau = c*(phi_rel - phi_rel0); end Spring;
Linear 1D rotational spring and damper in parallel. A <strong>spring</strong> and <strong>damper</strong> element <strong>connected in parallel</strong>. The component can be connected either between two inertias/gears to describe the shaft elasticity and damping, or between an inertia/gear and the housing (component Fixed), to describe a coupling of the element with the housing via a spring/damper.
within Modelica.Mechanics.Rotational.Components; model SpringDamper "Linear 1D rotational spring and damper in parallel" parameter SI.RotationalSpringConstant c(final min=0, start=1.0e5) "Spring constant"; parameter SI.RotationalDampingConstant d(final min=0, start=0) "Damping constant"; parameter SI.Angle phi_rel0=0 "Unstretched spring angle"; extends Modelica.Mechanics.Rotational.Interfaces.PartialCompliantWithRelativeStates; extends Modelica.Thermal.HeatTransfer.Interfaces.PartialElementaryConditionalHeatPortWithoutT; protected SI.Torque tau_c "Spring torque"; SI.Torque tau_d "Damping torque"; equation tau_c = c*(phi_rel - phi_rel0); tau_d = d*w_rel; tau = tau_c + tau_d; lossPower = tau_d*w_rel; end SpringDamper;
Signal adaptor for a Rotational flange with angle, speed, and acceleration as outputs and torque as input (especially useful for FMUs). Adaptor between a flange connector and a signal representation of the flange. This component is used to provide a pure signal interface around a Rotational model and export this model in form of an input/output block, especially as FMU (<a href=\"https://fmi-standard.org\">Functional Mock-up Unit</a>). Examples of the usage of this adaptor are provided in <a href=\"modelica://Modelica.Mechanics.Rotational.Examples.GenerationOfFMUs\">Rotational.Examples.GenerationOfFMUs</a>. This adaptor has torque as input and angle, angular velocity and angular acceleration as output signals.
within Modelica.Mechanics.Rotational.Components; model TorqueToAngleAdaptor "Signal adaptor for a Rotational flange with angle, speed, and acceleration as outputs and torque as input (especially useful for FMUs)" parameter Boolean use_w=true "= true, enable the output connector w (angular velocity)" parameter Boolean use_a=true "= true, enable the output connector a (angular acceleration)" Modelica.Mechanics.Rotational.Interfaces.Flange_a flange Modelica.Blocks.Interfaces.RealOutput phi(unit="rad") "Flange moves with angle phi due to torque tau" Modelica.Blocks.Interfaces.RealOutput w(unit="rad/s") if use_w "Flange moves with speed w due to torque tau" Modelica.Blocks.Interfaces.RealOutput a(unit="rad/s2") if use_a "Flange moves with angular acceleration a due to torque tau" Modelica.Blocks.Interfaces.RealInput tau(unit="N.m") "Torque to drive the flange" protected Modelica.Blocks.Interfaces.RealInput w_internal(unit="rad/s") "Needed to connect to conditional connector w"; Modelica.Blocks.Interfaces.RealInput a_internal(unit="rad/s2") "Needed to connect to conditional connector a"; equation connect(w, w_internal); connect(a, a_internal); phi = flange.phi; if use_w then w_internal = der(phi); else w_internal = 0.0; end if; if use_a then a_internal = der(w_internal); else a_internal = 0.0; end if; flange.tau = tau; end TorqueToAngleAdaptor;
Example to demonstrate backlash. This model demonstrates the effect of a backlash on eigenfrequency, and also that the damping torque does not lead to unphysical pulling torques (since the ElastoBacklash model takes care of it). Furthermore, it shows the differences of the <a href=\"modelica://Modelica.Mechanics.Rotational.Components.ElastoBacklash\">ElastoBacklash</a> and <a href=\"modelica://Modelica.Mechanics.Rotational.Components.ElastoBacklash2\">ElastoBacklash2</a> components (the ElastoBacklash2 component generates events when contact occurs and the torque changes discontinuously).
within Modelica.Mechanics.Rotational.Examples; model Backlash "Example to demonstrate backlash" extends Modelica.Icons.Example; Rotational.Components.Fixed fixed1 Rotational.Components.SpringDamper springDamper( c=20E3, d=50, phi_nominal=1) Rotational.Components.Inertia inertia1( J=5, w(fixed=true, start=0), phi( fixed=true, displayUnit="deg", start=1.570796326794897)) Rotational.Components.Fixed fixed2 Rotational.Components.ElastoBacklash elastoBacklash( c=20E3, d=50, b(displayUnit="deg") = 0.7853981633974483, phi_nominal=1) Rotational.Components.Inertia inertia2( J=5, w(fixed=true, start=0), phi( fixed=true, start=1.570796326794897, displayUnit="deg")) Rotational.Components.Fixed fixed3 Components.ElastoBacklash2 elastoBacklash2( c=20E3, d=50, phi_nominal=1, b(displayUnit="deg") = 0.78539816339745) Rotational.Components.Inertia inertia3( J=5, w(fixed=true, start=0), phi( fixed=true, start=1.570796326794897, displayUnit="deg")) equation connect(springDamper.flange_b, inertia1.flange_a) connect(elastoBacklash.flange_b, inertia2.flange_a) connect(fixed1.flange, springDamper.flange_a) connect(fixed2.flange, elastoBacklash.flange_a) connect(elastoBacklash2.flange_b, inertia3.flange_a) connect(fixed3.flange, elastoBacklash2.flange_a) end Backlash;
Compare different braking torques. Compare the effect of different braking torques on inertia&apos;s angular velocity (<code>inertiaN.w</code>, N = {1, 2, 3, 4}):
within Modelica.Mechanics.Rotational.Examples; model CompareBrakingTorque "Compare different braking torques" extends Modelica.Icons.Example; parameter SI.Inertia J=1 "Moment of inertia"; parameter SI.AngularVelocity w_start=100 "Initial speed of inertia"; parameter SI.Torque tau_nominal=100 "Nominal torque"; parameter SI.AngularVelocity w_nominal=abs(w_start) "Nominal speed"; parameter SI.AngularVelocity w0=1 "Speed limit for regularization"; Modelica.Mechanics.Rotational.Components.Inertia inertia1( J=J, phi(fixed=true, start=0), w(fixed=true, start=w_start)) Modelica.Mechanics.Rotational.Sources.SignTorque signTorque( tau_nominal=-tau_nominal, reg=Modelica.Blocks.Types.Regularization.Linear, w0=w0) Modelica.Mechanics.Rotational.Components.Inertia inertia2( J=J, phi(fixed=true, start=0), w(fixed=true, start=w_start)) Modelica.Mechanics.Rotational.Sources.LinearSpeedDependentTorque linearSpeedDependentTorque( tau_nominal=-tau_nominal, TorqueDirection=false, w_nominal=w_nominal) Modelica.Mechanics.Rotational.Components.Inertia inertia3( J=J, phi(fixed=true, start=0), w(fixed=true, start=w_start)) Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque quadraticSpeedDependentTorque( tau_nominal=-tau_nominal, TorqueDirection=false, w_nominal=w_nominal) Modelica.Mechanics.Rotational.Components.Inertia inertia4( J=J, phi(fixed=true, start=0), w(fixed=true, start=w_start)) Modelica.Mechanics.Rotational.Sources.InverseSpeedDependentTorque inverseSpeedDependentTorque( tau_nominal=-tau_nominal, TorqueDirection=false, w_nominal=w_nominal, w0=w0) equation connect(signTorque.flange, inertia1.flange_a) connect(linearSpeedDependentTorque.flange, inertia2.flange_a) connect(quadraticSpeedDependentTorque.flange, inertia3.flange_a) connect(inverseSpeedDependentTorque.flange, inertia4.flange_a) end CompareBrakingTorque;
Drive train with 3 dynamically coupled clutches. This example demonstrates how variable structure drive trains are handled. The drive train consists of 4 inertias and 3 clutches, where the clutches are controlled by input signals. The system has 2^3=8 different configurations and 3^3 = 27 different states (every clutch may be in forward sliding, backward sliding or locked mode when the relative angular velocity is zero). By invoking the clutches at different time instances, the switching of the configurations can be studied.
within Modelica.Mechanics.Rotational.Examples; model CoupledClutches "Drive train with 3 dynamically coupled clutches" extends Modelica.Icons.Example; parameter SI.Frequency f=0.2 "Frequency of sine function to invoke clutch1"; parameter SI.Time T2=0.4 "Time when clutch2 is invoked"; parameter SI.Time T3=0.9 "Time when clutch3 is invoked"; Rotational.Components.Inertia J1( J=1, phi(fixed=true, start=0), w(start=10, fixed=true)) Rotational.Sources.Torque torque(useSupport=true) Rotational.Components.Clutch clutch1(peak=1.1, fn_max=20) Modelica.Blocks.Sources.Sine sin1(amplitude=10, f=5) Modelica.Blocks.Sources.Step step1(startTime=T2) Rotational.Components.Inertia J2( J=1, phi(fixed=true, start=0), w(fixed=true, start=0)) Rotational.Components.Clutch clutch2(peak=1.1, fn_max=20) Rotational.Components.Inertia J3( J=1, phi(fixed=true, start=0), w(fixed=true, start=0)) Rotational.Components.Clutch clutch3(peak=1.1, fn_max=20) Rotational.Components.Inertia J4( J=1, phi(fixed=true, start=0), w(fixed=true, start=0)) Modelica.Blocks.Sources.Sine sin2( amplitude=1, f=f, phase=1.570796326794897) Modelica.Blocks.Sources.Step step2(startTime=T3) Rotational.Components.Fixed fixed equation connect(torque.flange, J1.flange_a) connect(J1.flange_b, clutch1.flange_a) connect(clutch1.flange_b, J2.flange_a) connect(J2.flange_b, clutch2.flange_a) connect(clutch2.flange_b, J3.flange_a) connect(J3.flange_b, clutch3.flange_a) connect(clutch3.flange_b, J4.flange_a) connect(sin1.y, torque.tau) connect(sin2.y, clutch1.f_normalized) connect(step1.y, clutch2.f_normalized) connect(step2.y, clutch3.f_normalized) connect(fixed.flange, torque.support) end CoupledClutches;
Demonstrate the usage of the rotational eddy current brake. An eddy current brake reduces the speed of a rotating inertia. Kinetic energy is converted to thermal energy which leads to a temperature increase of the thermal capacitance of the brake, which can be assumed as adiabatic during the rather short time span of the braking.
within Modelica.Mechanics.Rotational.Examples; model EddyCurrentBrake "Demonstrate the usage of the rotational eddy current brake" extends Modelica.Icons.Example; Modelica.Mechanics.Rotational.Sources.EddyCurrentTorque eddyCurrentTorque( useExcitationInput=true, tau_nominal=100, w_nominal=10, useSupport=false, alpha20(displayUnit="1/K") = Modelica.Electrical.Machines.Thermal.Constants.alpha20Copper, TRef=293.15, useHeatPort=true) Modelica.Mechanics.Rotational.Components.Inertia inertia( phi(fixed=true, start=0), J=1, w(fixed=true, start=20)) Modelica.Thermal.HeatTransfer.Components.HeatCapacitor heatCapacitor(C=1, T( fixed=true)) Blocks.Sources.Ramp ramp( height=1, duration=0.1, offset=0, startTime=0.1) equation connect(eddyCurrentTorque.flange, inertia.flange_a) connect(eddyCurrentTorque.heatPort, heatCapacitor.port) connect(ramp.y, eddyCurrentTorque.excitation) end EddyCurrentBrake;
Example to show possible usage of support flange. This model demonstrates the usage of the bearing flange. The gearbox is not connected rigidly to the ground, but by a spring-damper-system. This allows examination of the gearbox housing dynamics.
within Modelica.Mechanics.Rotational.Examples; model ElasticBearing "Example to show possible usage of support flange" extends Modelica.Icons.Example; Rotational.Components.Inertia shaft( phi(fixed=true, start=0), J=1, w(fixed=true, start=0)) Rotational.Components.Inertia load(J=50, w(fixed=true, start=0)) Rotational.Components.Spring spring(c=1e3, phi_rel(fixed=true)) Rotational.Components.Fixed fixed Rotational.Components.SpringDamper springDamper( c=1e5, d=5, phi_rel(fixed=true), w_rel(fixed=true, nominal=1e-4)) Rotational.Sources.Torque torque(useSupport=true) Modelica.Blocks.Sources.Ramp ramp(duration=5, height=100) Rotational.Components.IdealGear idealGear(ratio=3, useSupport=true) Rotational.Components.Inertia housing(J=5) Sensors.MultiSensor multiSensor equation connect(torque.flange, shaft.flange_a) connect(spring.flange_b, load.flange_a) connect(springDamper.flange_a, fixed.flange) connect(shaft.flange_b, idealGear.flange_a) connect(idealGear.flange_b, spring.flange_a) connect(idealGear.support, housing.flange_b) connect(ramp.y, torque.tau) connect(fixed.flange, torque.support) connect(housing.flange_a, multiSensor.flange_b) connect(multiSensor.flange_a, springDamper.flange_b) end ElasticBearing;
First example: simple drive train. The drive train consists of a motor inertia which is driven by a sine-wave motor torque. Via a gearbox the rotational energy is transmitted to a load inertia. Elasticity in the gearbox is modeled by a spring element. A linear damper is used to model the damping in the gearbox bearing.
within Modelica.Mechanics.Rotational.Examples; model First "First example: simple drive train" extends Modelica.Icons.Example; parameter SI.Torque amplitude=10 "Amplitude of driving torque"; parameter SI.Frequency f=5 "Frequency of driving torque"; parameter SI.Inertia Jmotor(min=0) = 0.1 "Motor inertia"; parameter SI.Inertia Jload(min=0) = 2 "Load inertia"; parameter Real ratio=10 "Gear ratio"; parameter Real damping=10 "Damping in bearing of gear"; Rotational.Components.Fixed fixed Rotational.Sources.Torque torque(useSupport=true) Rotational.Components.Inertia inertia1(J=Jmotor) Rotational.Components.IdealGear idealGear(ratio=ratio, useSupport=true) Rotational.Components.Inertia inertia2( J=2, phi(fixed=true, start=0), w(fixed=true, start=0)) Rotational.Components.Spring spring(c=1.e4, phi_rel(fixed=true)) Rotational.Components.Inertia inertia3(J=Jload, w(fixed=true, start=0)) Rotational.Components.Damper damper(d=damping) Modelica.Blocks.Sources.Sine sine(amplitude=amplitude, f=f) equation connect(inertia1.flange_b, idealGear.flange_a) connect(idealGear.flange_b, inertia2.flange_a) connect(inertia2.flange_b, spring.flange_a) connect(spring.flange_b, inertia3.flange_a) connect(damper.flange_a, inertia2.flange_b) connect(damper.flange_b, fixed.flange) connect(sine.y, torque.tau) connect(torque.support, fixed.flange) connect(idealGear.support, fixed.flange) connect(torque.flange, inertia1.flange_a) end First;
First example: simple drive train with grounded elements. The drive train consists of a motor inertia which is driven by a sine-wave motor torque. Via a gearbox the rotational energy is transmitted to a load inertia. Elasticity in the gearbox is modeled by a spring element. A linear damper is used to model the damping in the gearbox bearing.
within Modelica.Mechanics.Rotational.Examples; model FirstGrounded "First example: simple drive train with grounded elements" extends Modelica.Icons.Example; parameter SI.Torque amplitude=10 "Amplitude of driving torque"; parameter SI.Frequency f=5 "Frequency of driving torque"; parameter SI.Inertia Jmotor(min=0) = 0.1 "Motor inertia"; parameter SI.Inertia Jload(min=0) = 2 "Load inertia"; parameter Real ratio=10 "Gear ratio"; parameter Real damping=10 "Damping in bearing of gear"; Rotational.Components.Fixed fixed Rotational.Sources.Torque torque(useSupport=false) Rotational.Components.Inertia inertia1(J=Jmotor) Rotational.Components.IdealGear idealGear(ratio=ratio, useSupport=false) Rotational.Components.Inertia inertia2( J=2, phi(fixed=true, start=0), w(fixed=true, start=0)) Rotational.Components.Spring spring(c=1.e4, phi_rel(fixed=true)) Rotational.Components.Inertia inertia3(J=Jload, w(fixed=true, start=0)) Rotational.Components.Damper damper(d=damping) Modelica.Blocks.Sources.Sine sine(amplitude=amplitude, f=f) equation connect(inertia1.flange_b, idealGear.flange_a) connect(idealGear.flange_b, inertia2.flange_a) connect(inertia2.flange_b, spring.flange_a) connect(spring.flange_b, inertia3.flange_a) connect(damper.flange_a, inertia2.flange_b) connect(damper.flange_b, fixed.flange) connect(sine.y, torque.tau) connect(torque.flange, inertia1.flange_a) end FirstGrounded;
Drive train with clutch and brake. This drive train contains a frictional <strong>clutch</strong> and a <strong>brake</strong>. Simulate the system for 1 second using the following initial values (defined already in the model):
within Modelica.Mechanics.Rotational.Examples; model Friction "Drive train with clutch and brake" import Modelica.Constants.pi; extends Modelica.Icons.Example; parameter SI.Time startTime=0.5 "Start time of step"; output SI.Torque tMotor=torque.tau "Driving torque of inertia3"; output SI.Torque tClutch=clutch.tau "Friction torque of clutch"; output SI.Torque tBrake=brake.tau "Friction torque of brake"; output SI.Torque tSpring=spring.tau "Spring torque"; Rotational.Sources.Torque torque(useSupport=true) Rotational.Components.Inertia inertia3( J=1, phi( start=0, fixed=true, displayUnit="deg"), w(start=100, fixed=true, displayUnit="rad/s")) Rotational.Components.Clutch clutch(fn_max=160) Rotational.Components.Inertia inertia2( J=0.05, phi(start=0, fixed=true), w(start=90, fixed=true)) Rotational.Components.SpringDamper spring(c=160, d=1) Rotational.Components.Inertia inertia1( J=1, phi(start=0, fixed=true), w(start=90, fixed=true)) Rotational.Components.Brake brake(fn_max=1600, useSupport=true) Modelica.Blocks.Sources.Constant const(k=1) Modelica.Blocks.Sources.Step step(startTime=startTime) Modelica.Blocks.Sources.Step step2( height=-1, offset=1, startTime=startTime) Modelica.Blocks.Sources.Sine sine(amplitude=200, f=50/pi) Modelica.Blocks.Math.Product product Rotational.Components.Fixed fixed equation connect(torque.flange, inertia3.flange_a) connect(inertia3.flange_b, clutch.flange_a) connect(clutch.flange_b, inertia2.flange_a) connect(inertia2.flange_b, spring.flange_a) connect(spring.flange_b, brake.flange_a) connect(brake.flange_b, inertia1.flange_a) connect(sine.y, product.u1) connect(step2.y, product.u2) connect(product.y, torque.tau) connect(const.y, clutch.f_normalized) connect(step.y, brake.f_normalized) connect(torque.support, fixed.flange) connect(brake.support, fixed.flange) end Friction;
Example to demonstrate variants to generate FMUs (Functional Mock-up Units). This example demonstrates how to generate an input/output block (e.g. in form of an FMU - <a href=\"https://fmi-standard.org\">Functional Mock-up Unit</a>) from various Rotational components. The goal is to export such an input/output block from Modelica and import it in another modeling environment. The essential issue is that before exporting it must be known in which way the component is utilized in the target environment. Depending on the target usage, different flange variables need to be in the interface with either input or output causality. Note, this example model can be used to test the FMU export/import of a Modelica tool. Just export the components marked in the icons as \"toFMU\" as FMUs and import them back. The models should then still work and give the same results as a pure Modelica model.
within Modelica.Mechanics.Rotational.Examples; model GenerationOfFMUs "Example to demonstrate variants to generate FMUs (Functional Mock-up Units)" extends Modelica.Icons.Example; Modelica.Blocks.Sources.Sine sine1(f=2, amplitude=10) Modelica.Mechanics.Rotational.Examples.Utilities.DirectInertia directInertia(J=1.1) Modelica.Mechanics.Rotational.Examples.Utilities.InverseInertia inverseInertia(J=2.2) Modelica.Mechanics.Rotational.Examples.Utilities.SpringDamper springDamper(c=1e4, d=100) Modelica.Mechanics.Rotational.Components.Inertia inertia2a( J=1.1, phi(fixed=true, start=0), w(fixed=true, start=0)) Modelica.Mechanics.Rotational.Sources.Torque torque2 Components.TorqueToAngleAdaptor torqueToAngle2a(use_a=false) Modelica.Mechanics.Rotational.Components.Inertia inertia2b( J=2.2, phi(fixed=true, start=0), w(fixed=true, start=0)) Components.TorqueToAngleAdaptor torqueToAngle2b(use_a=false) Modelica.Mechanics.Rotational.Examples.Utilities.Spring spring(c=1e4) Modelica.Mechanics.Rotational.Components.Inertia inertia3a( J=1.1, phi(fixed=true, start=0), w(fixed=true, start=0)) Modelica.Mechanics.Rotational.Sources.Torque force3 Components.TorqueToAngleAdaptor torqueToAngle3a(use_w=false, use_a=false) Modelica.Mechanics.Rotational.Components.Inertia inertia3b( J=2.2, phi(fixed=true, start=0), w(fixed=true, start=0)) Components.TorqueToAngleAdaptor torqueToAngle3b(use_w=false, use_a=false) equation connect(sine1.y, directInertia.tauDrive) connect(directInertia.phi, inverseInertia.phi) connect(directInertia.w, inverseInertia.w) connect(directInertia.a, inverseInertia.a) connect(inverseInertia.tau, directInertia.tau) connect(sine1.y, torque2.tau) connect(sine1.y, force3.tau) connect(torqueToAngle2b.flange, inertia2b.flange_a) connect(inertia2a.flange_b, torqueToAngle2a.flange) connect(torque2.flange, inertia2a.flange_a) connect(inertia3a.flange_b, torqueToAngle3a.flange) connect(force3.flange, inertia3a.flange_a) connect(torqueToAngle3b.flange, inertia3b.flange_a) connect(torqueToAngle2a.phi, springDamper.phi1) connect(torqueToAngle2a.w, springDamper.w1) connect(torqueToAngle2a.tau, springDamper.tau1) connect(springDamper.tau2, torqueToAngle2b.tau) connect(springDamper.phi2, torqueToAngle2b.phi) connect(springDamper.w2, torqueToAngle2b.w) connect(torqueToAngle3a.phi, spring.phi1) connect(torqueToAngle3a.tau, spring.tau1) connect(spring.phi2, torqueToAngle3b.phi) connect(spring.tau2, torqueToAngle3b.tau) end GenerationOfFMUs;
Demonstrate the modeling of heat losses. This model demonstrates how to model the dissipated power of a drive train, by enabling the heatPort of all components and connecting these heatPorts via a convection element to the environment. The total heat flow generated by the elements of the drive train and transported to the environment is present in variable convection.fluid.
within Modelica.Mechanics.Rotational.Examples; model HeatLosses "Demonstrate the modeling of heat losses" extends Modelica.Icons.Example; Blocks.Sources.Sine sine(f=5, amplitude=20) Sources.Torque torque Components.Inertia inertia1( J=2, phi(fixed=true, start=0), w(fixed=true, start=0)) Components.Damper damper(useHeatPort=true, d=10) Components.Fixed fixed Thermal.HeatTransfer.Components.Convection convection Thermal.HeatTransfer.Celsius.FixedTemperature TAmbient(T=25) "Ambient temperature" Blocks.Sources.Constant const(k=20) Components.SpringDamper springDamper( c=1e4, d=20, useHeatPort=true) Components.Inertia inertia2( J=2, phi(fixed=true, start=0), w(fixed=true, start=0)) Components.ElastoBacklash elastoBacklash( c=1e5, d=100, useHeatPort=true, b(displayUnit="rad") = 0.001) Components.Inertia inertia3( J=2, phi(fixed=true, start=0), w(fixed=true, start=0)) Components.BearingFriction bearingFriction(useHeatPort=true) Components.Spring spring3(c=1e4) Components.Inertia inertia4( J=2, phi(fixed=true, start=0), w(fixed=true, start=0)) Components.LossyGear lossyGear( ratio=2, lossTable=[0, 0.8, 0.8, 1, 1; 1, 0.7, 0.7, 2, 2], useHeatPort=true) Components.Clutch clutch( useHeatPort=true, fn_max=10, phi_rel(fixed=true), w_rel(fixed=true)) Components.Inertia inertia5(J=2) Blocks.Sources.Sine sine2(f=0.2, amplitude=1) Components.Inertia inertia6(J=2) Components.OneWayClutch oneWayClutch( phi_rel(fixed=true), w_rel(fixed=true), startForward(fixed=true), stuck(fixed=true), fn_max=1, useHeatPort=true) Components.Brake brake(fn_max=2, useHeatPort=true) equation connect(sine.y, torque.tau) connect(torque.flange, inertia1.flange_a) connect(inertia1.flange_b, damper.flange_b) connect(damper.flange_a, fixed.flange) connect(damper.heatPort, convection.solid) connect(TAmbient.port, convection.fluid) connect(const.y, convection.Gc) connect(inertia1.flange_b, springDamper.flange_a) connect(springDamper.heatPort, convection.solid) connect(springDamper.flange_b, inertia2.flange_a) connect(elastoBacklash.flange_a, inertia2.flange_b) connect(elastoBacklash.heatPort, convection.solid) connect(elastoBacklash.flange_b, inertia3.flange_a) connect(inertia3.flange_b, bearingFriction.flange_a) connect(convection.solid, bearingFriction.heatPort) connect(spring3.flange_b, inertia4.flange_a) connect(bearingFriction.flange_b, spring3.flange_a) connect(inertia4.flange_b, lossyGear.flange_a) connect(lossyGear.heatPort, convection.solid) connect(lossyGear.flange_b, clutch.flange_a) connect(clutch.heatPort, convection.solid) connect(clutch.flange_b, inertia5.flange_a) connect(sine2.y, clutch.f_normalized) connect(inertia5.flange_b, oneWayClutch.flange_a) connect(oneWayClutch.flange_b, inertia6.flange_a) connect(sine2.y, oneWayClutch.f_normalized) connect(inertia6.flange_b, brake.flange_a) connect(sine2.y, brake.f_normalized) connect(oneWayClutch.heatPort, convection.solid) connect(brake.heatPort, convection.solid) end HeatLosses;
Example to show that gear efficiency may lead to stuck motion. This model contains two inertias which are connected by an ideal gear where the friction between the teeth of the gear is modeled in a physical meaningful way (friction may lead to stuck mode which locks the motion of the gear). The friction is defined by an efficiency factor (= 0.5) for forward and backward driving condition leading to a torque dependent friction loss. Simulate for about 0.5 seconds. The friction in the gear will take all modes (forward and backward rolling, as well as stuck).
within Modelica.Mechanics.Rotational.Examples; model LossyGearDemo1 "Example to show that gear efficiency may lead to stuck motion" extends Modelica.Icons.Example; SI.Power PowerLoss=gear.flange_a.tau*der(gear.flange_a.phi) + gear.flange_b.tau *der(gear.flange_b.phi) "Power lost in the gear"; Rotational.Components.LossyGear gear( ratio=2, lossTable=[0, 0.5, 0.5, 0, 0], useSupport=true) Rotational.Components.Inertia Inertia1(J=1) Rotational.Components.Inertia Inertia2( J=1.5, phi(fixed=true, start=0, nominal=0.001), w(fixed=true, start=0, nominal=0.01)) Rotational.Sources.Torque torque1(useSupport=true) Rotational.Sources.Torque torque2(useSupport=true) Modelica.Blocks.Sources.Sine DriveSine(amplitude=10, f=1) Modelica.Blocks.Sources.Ramp load( height=5, duration=2, offset=-10) Rotational.Components.Fixed fixed equation connect(Inertia1.flange_b, gear.flange_a) connect(gear.flange_b, Inertia2.flange_a) connect(torque1.flange, Inertia1.flange_a) connect(torque2.flange, Inertia2.flange_b) connect(DriveSine.y, torque1.tau) connect(load.y, torque2.tau) connect(fixed.flange, gear.support) connect(fixed.flange, torque1.support) connect(fixed.flange, torque2.support) end LossyGearDemo1;
Example to show combination of LossyGear and BearingFriction. This model contains bearing friction and gear friction (= efficiency). If both friction models are stuck, there is no unique solution. Still a reliable Modelica simulator should be able to handle this situation.
within Modelica.Mechanics.Rotational.Examples; model LossyGearDemo2 "Example to show combination of LossyGear and BearingFriction" extends Modelica.Icons.Example; SI.Power PowerLoss=gear.flange_a.tau*der(gear.flange_a.phi) + gear.flange_b.tau *der(gear.flange_b.phi) "Power lost in the gear"; Rotational.Components.LossyGear gear( ratio=2, lossTable=[0, 0.5, 0.5, 0, 0], useSupport=true) Rotational.Components.Inertia Inertia1(J=1) Rotational.Components.Inertia Inertia2( J=1.5, phi(fixed=true, start=0, nominal=1e-4), w(fixed=true, start=0, nominal=0.001)) Rotational.Sources.Torque torque1(useSupport=true) Rotational.Sources.Torque torque2(useSupport=true) Modelica.Blocks.Sources.Sine DriveSine(amplitude=10, f=1) Modelica.Blocks.Sources.Ramp load( height=5, duration=2, offset=-10) Rotational.Components.BearingFriction bearingFriction(tau_pos=[0, 0.5; 1, 1], useSupport=true) Rotational.Components.Fixed fixed equation connect(torque2.flange, Inertia2.flange_b) connect(Inertia2.flange_a, gear.flange_b) connect(gear.flange_a, Inertia1.flange_b) connect(Inertia1.flange_a, bearingFriction.flange_b) connect(bearingFriction.flange_a, torque1.flange) connect(DriveSine.y, torque1.tau) connect(load.y, torque2.tau) connect(gear.support, fixed.flange) connect(fixed.flange, torque2.support) connect(fixed.flange, bearingFriction.support) connect(torque1.support, fixed.flange) end LossyGearDemo2;
Example that failed in the previous version of the LossyGear version
within Modelica.Mechanics.Rotational.Examples; model LossyGearDemo3 "Example that failed in the previous version of the LossyGear version" extends Modelica.Icons.Example; Modelica.Mechanics.Rotational.Components.LossyGear gear( ratio=1, lossTable=[0, 0.25, 0.25, 0.625, 2.5], useSupport=false) Modelica.Mechanics.Rotational.Components.Inertia Inertia1(w(start=10), J= 0.001) Modelica.Mechanics.Rotational.Sources.Torque torque1(useSupport=false) Modelica.Mechanics.Rotational.Sources.Torque torque2(useSupport=false) Modelica.Blocks.Sources.Step step(height=0) Modelica.Blocks.Sources.Step step1( startTime=0.5, height=1, offset=0) Modelica.Mechanics.Rotational.Components.Inertia Inertia2( J=0.001, phi(fixed=true, start=0), w(start=10, fixed=true)) equation connect(Inertia1.flange_b, gear.flange_a) connect(torque1.flange, Inertia1.flange_a) connect(step.y, torque1.tau) connect(gear.flange_b, Inertia2.flange_a) connect(Inertia2.flange_b, torque2.flange) connect(step1.y, torque2.tau) end LossyGearDemo3;
Drive train with actively engaged one-way clutch. The drive train consists of a one-way clutch and driving and driven inertias. The one-way clutch is engaged periodically thus forcing both the inertias to match their rotational velocity. When disengaged, only the freewheel functionality of the one-way clutch is available and is active as long as the relative angular velocity w_rel becomes zero.
within Modelica.Mechanics.Rotational.Examples; model OneWayClutch "Drive train with actively engaged one-way clutch" extends Modelica.Icons.Example; Modelica.Mechanics.Rotational.Components.Inertia inertiaIn( J=1, phi(fixed=true, start=0), w(fixed=true, start=-0.5)) Modelica.Mechanics.Rotational.Components.Inertia inertiaOut( J=1, phi(fixed=true, start=0), w(fixed=true, start=0)) Modelica.Mechanics.Rotational.Components.OneWayClutch oneWayClutch( peak=25, fn_max=3, startForward(fixed=true), stuck(fixed=true)) Modelica.Mechanics.Rotational.Sources.Torque torque Modelica.Blocks.Sources.Sine signalTorque( amplitude=10, f=3) Modelica.Blocks.Sources.Pulse signalEngagement( amplitude=1, width=50, period=1.3, startTime=0.3) equation connect(torque.flange, inertiaIn.flange_a) connect(signalTorque.y, torque.tau) connect(inertiaIn.flange_b, oneWayClutch.flange_a) connect(oneWayClutch.flange_b, inertiaOut.flange_a) connect(signalEngagement.y, oneWayClutch.f_normalized) end OneWayClutch;
Drive train with disengaged one-way clutch. The drive train consists of a one-way clutch and driving and driven inertias. To demonstrate the behavior of the clutch&#39;s freewheel only, the clutch stays disengaged for all the time. The sine torque is applied on the driving inertia forcing inertia&#39;s speed change. On the driven side there is applied constant load torque only.
within Modelica.Mechanics.Rotational.Examples; model OneWayClutchDisengaged "Drive train with disengaged one-way clutch" extends Modelica.Icons.Example; Modelica.Mechanics.Rotational.Components.Inertia inertiaIn( J=1, phi(fixed=true, start=0), w(fixed=true, start=-0.5)) Modelica.Mechanics.Rotational.Components.Inertia inertiaOut( J=1, phi(fixed=true, start=0), w(fixed=true, start=0)) Modelica.Mechanics.Rotational.Components.OneWayClutch oneWayClutch( peak=25, fn_max=3, startForward(fixed=true), stuck(fixed=true)) Modelica.Mechanics.Rotational.Sources.Torque torque Modelica.Mechanics.Rotational.Sources.ConstantTorque torqueLoad(tau_constant=-0.3) Modelica.Blocks.Sources.Sine signalTorque( amplitude=10, offset=-torqueLoad.tau_constant, f=2) Modelica.Blocks.Sources.Constant signalEngagement(k=0) equation connect(torque.flange, inertiaIn.flange_a) connect(signalTorque.y, torque.tau) connect(inertiaIn.flange_b, oneWayClutch.flange_a) connect(oneWayClutch.flange_b, inertiaOut.flange_a) connect(signalEngagement.y, oneWayClutch.f_normalized) connect(inertiaOut.flange_b, torqueLoad.flange) end OneWayClutchDisengaged;
Demonstration examples of the components of this package
within Modelica.Mechanics.Rotational; package Examples "Demonstration examples of the components of this package" extends Modelica.Icons.ExamplesPackage; end Examples;
Demonstrate coupling Rotational - Translational. This model demonstrates the coupling between rotational and translational components:<br> A torque (step) accelerates both the inertia (of the wheel) and the mass (of the vehicle).<br> Due to a speed dependent force (like a driving resistance), we find an equilibrium at 5 m/s after approx. 5 s.
within Modelica.Mechanics.Rotational.Examples; model RollingWheel "Demonstrate coupling Rotational - Translational" extends Modelica.Icons.Example; Rotational.Components.IdealRollingWheel idealRollingWheel(radius=1) Rotational.Components.Inertia inertia( J=1, phi(fixed=true, start=0), w(fixed=true, start=0)) Rotational.Sources.TorqueStep torqueStep( stepTorque=10, offsetTorque=0, startTime=0.1, useSupport=false) Translational.Components.Mass mass(L=0, m=1) Translational.Sources.QuadraticSpeedDependentForce quadraticSpeedDependentForce( f_nominal=-10, ForceDirection=false, v_nominal=5) equation connect(torqueStep.flange, inertia.flange_a) connect(inertia.flange_b, idealRollingWheel.flangeR) connect(idealRollingWheel.flangeT, mass.flange_a) connect(quadraticSpeedDependentForce.flange, mass.flange_b) end RollingWheel;
Simple Gearshift. This model shows how an automatic gear shift is built up from a planetary gear, a brake and a clutch.
within Modelica.Mechanics.Rotational.Examples; model SimpleGearShift "Simple Gearshift" extends Modelica.Icons.Example; output SI.AngularVelocity wEngine=engine.w "Speed of engine"; output SI.AngularVelocity wLoad=load.w "Speed of load"; output Real gearRatio=wLoad/max(wEngine, 1E-6) "Gear ratio load/engine"; Modelica.Mechanics.Rotational.Sources.TorqueStep torqueStep( offsetTorque=0, startTime=0.5, stepTorque=20) Modelica.Mechanics.Rotational.Components.Inertia engine(J=1) Modelica.Mechanics.Rotational.Components.IdealPlanetary idealPlanetary( ratio=75/50) Modelica.Mechanics.Rotational.Components.Inertia load( J=10, phi(fixed=true, start=0), w(fixed=true, start=0)) Modelica.Mechanics.Rotational.Sources.QuadraticSpeedDependentTorque quadraticSpeedDependentTorque(w_nominal(displayUnit="rpm")= 10.471975511966, tau_nominal=-20) Modelica.Mechanics.Rotational.Components.Clutch clutch( cgeo=2, fn_max=100, phi_rel(fixed=true), w_rel(fixed=true)) Modelica.Mechanics.Rotational.Components.Brake brake(cgeo=2, fn_max=100) Modelica.Blocks.Math.Feedback feedback Modelica.Blocks.Sources.Constant const1(k=1) Modelica.Blocks.Sources.Ramp ramp( height=1, offset=0, startTime=2, duration=0.1) equation connect(torqueStep.flange, engine.flange_a) connect(quadraticSpeedDependentTorque.flange, load.flange_b) connect(feedback.y, brake.f_normalized) connect(engine.flange_b, idealPlanetary.sun) connect(idealPlanetary.sun, clutch.flange_a) connect(idealPlanetary.ring, clutch.flange_b) connect(idealPlanetary.ring, brake.flange_a) connect(idealPlanetary.carrier, load.flange_a) connect(const1.y, feedback.u1) connect(feedback.u2, clutch.f_normalized) connect(ramp.y, clutch.f_normalized) end SimpleGearShift;
Input/output block of a direct inertia model. A rotational component with pure signal interface which can be applied for a FMU (<a href=\"https://fmi-standard.org\">Functional Mock-up Unit</a>) exchange. The input torque <code>tauDrive</code> is applied on one side of a rotational component with inertia whereby the input torque <code>tau</code> is applied on the other side of it.
within Modelica.Mechanics.Rotational.Examples.Utilities; model DirectInertia "Input/output block of a direct inertia model" extends Modelica.Blocks.Icons.Block; parameter SI.Inertia J(min=0)=1 "Inertia"; Modelica.Mechanics.Rotational.Components.Inertia inertia( J=J, phi(start=0, fixed=true), w(start=0, fixed=true)) Modelica.Mechanics.Rotational.Sources.Torque torqueSource Modelica.Blocks.Interfaces.RealInput tauDrive(unit="N.m") "Accelerating torque acting at flange (= -flange.tau)" Components.TorqueToAngleAdaptor torqueToAngle Modelica.Blocks.Interfaces.RealOutput phi(unit="rad") "Inertia moves with angle phi due to torque tau" Modelica.Blocks.Interfaces.RealOutput w(unit="rad/s") "Inertia moves with speed w due to torque tau" Modelica.Blocks.Interfaces.RealOutput a(unit="rad/s2") "Inertia moves with acceleration a due to torque tau" Modelica.Blocks.Interfaces.RealInput tau(unit="N.m") "Torque to drive the inertia" equation connect(tauDrive, torqueSource.tau) connect(torqueSource.flange, inertia.flange_a) connect(inertia.flange_b, torqueToAngle.flange) connect(torqueToAngle.phi, phi) connect(torqueToAngle.w, w) connect(torqueToAngle.a, a) connect(torqueToAngle.tau, tau) end DirectInertia;
Input/output block of an inverse inertia model. A rotational component with pure signal interface which can be applied for a FMU (<a href=\"https://fmi-standard.org\">Functional Mock-up Unit</a>) exchange. Based on the kinematic inputs applied on a component with inertia the output torque <code>tau</code> is returned.
within Modelica.Mechanics.Rotational.Examples.Utilities; model InverseInertia "Input/output block of an inverse inertia model" extends Modelica.Blocks.Icons.Block; parameter SI.Inertia J=1 "Inertia"; Modelica.Mechanics.Rotational.Components.Inertia inertia( J=J, phi(start=0), w(start=0)) Components.AngleToTorqueAdaptor angleToTorque Modelica.Blocks.Interfaces.RealInput phi(unit="rad") "Angle to drive the inertia" Modelica.Blocks.Interfaces.RealInput w(unit="rad/s") "Speed to drive the inertia" Modelica.Blocks.Interfaces.RealInput a(unit="rad/s2") "Acceleration to drive the inertia" Modelica.Blocks.Interfaces.RealOutput tau(unit="N.m") "Torque needed to drive the flange according to phi, w, a" equation connect(angleToTorque.flange, inertia.flange_a) connect(phi, angleToTorque.phi) connect(w, angleToTorque.w) connect(a, angleToTorque.a) connect(tau, angleToTorque.tau) end InverseInertia;
Utility classes used by rotational example models
within Modelica.Mechanics.Rotational.Examples; package Utilities "Utility classes used by rotational example models" extends Modelica.Icons.UtilitiesPackage; end Utilities;
Input/output block of a spring model. A linear 1D rotational spring with pure signal interface which can be applied for a FMU (<a href=\"https://fmi-standard.org\">Functional Mock-up Unit</a>) exchange.
within Modelica.Mechanics.Rotational.Examples.Utilities; model Spring "Input/output block of a spring model" extends Modelica.Blocks.Icons.Block; parameter SI.RotationalSpringConstant c=1e4 "Spring constant"; parameter SI.Angle phi_rel0=0 "Unstretched spring angle"; Components.AngleToTorqueAdaptor angleToTorque1(use_w=false, use_a=false) Modelica.Blocks.Interfaces.RealInput phi1(unit="rad") "Angle of left flange of force element" Modelica.Blocks.Interfaces.RealOutput tau1(unit="N.m") "Torque generated by the force element" Modelica.Mechanics.Rotational.Components.Spring spring(c=c, phi_rel0=phi_rel0) Modelica.Blocks.Interfaces.RealInput phi2(unit="rad") "Angle of right flange of force element" Modelica.Blocks.Interfaces.RealOutput tau2(unit="N.m") "Torque generated by the force element" Components.AngleToTorqueAdaptor angleToTorque2(use_w=false, use_a=false) equation connect(angleToTorque1.flange, spring.flange_a) connect(spring.flange_b, angleToTorque2.flange) connect(phi1, angleToTorque1.phi) connect(tau1, angleToTorque1.tau) connect(angleToTorque2.phi, phi2) connect(angleToTorque2.tau, tau2) end Spring;
Input/output block of a spring/damper model. A linear 1D rotational spring and damper in parallel with pure signal interface which can be applied for a FMU (<a href=\"https://fmi-standard.org\">Functional Mock-up Unit</a>) exchange.
within Modelica.Mechanics.Rotational.Examples.Utilities; model SpringDamper "Input/output block of a spring/damper model" extends Modelica.Blocks.Icons.Block; parameter SI.RotationalSpringConstant c=1e4 "Spring constant"; parameter SI.RotationalDampingConstant d=1 "Damping constant"; parameter SI.Angle phi_rel0=0 "Unstretched spring angle"; Components.AngleToTorqueAdaptor angleToTorque1(use_a=false) Modelica.Blocks.Interfaces.RealInput phi1(unit="rad") "Angle of left flange of force element" Modelica.Blocks.Interfaces.RealInput w1(unit="rad/s") "Speed to left flange of force element" Modelica.Blocks.Interfaces.RealOutput tau1(unit="N.m") "Torque generated by the force element" SpringDamperNoRelativeStates springDamper( c=c, d=d, phi_rel0=phi_rel0) Modelica.Blocks.Interfaces.RealInput phi2(unit="rad") "Angle of right flange of force element" Modelica.Blocks.Interfaces.RealInput w2(unit="rad/s") "Speed to right flange of force element" Modelica.Blocks.Interfaces.RealOutput tau2(unit="N.m") "Torque generated by the force element" Components.AngleToTorqueAdaptor angleToTorque2(use_a=false) equation connect(springDamper.flange_b, angleToTorque2.flange) connect(angleToTorque1.flange, springDamper.flange_a) connect(phi1, angleToTorque1.phi) connect(w1, angleToTorque1.w) connect(tau1, angleToTorque1.tau) connect(angleToTorque2.phi, phi2) connect(w2, angleToTorque2.w) connect(angleToTorque2.tau, tau2) end SpringDamper;
Linear 1D rotational spring and damper in parallel (phi and w are not used as states). A <strong>spring</strong> and <strong>damper</strong> element <strong>connected in parallel</strong>. The component can be connected either between two masses to describe the joint elasticity and damping, or between a mass and the housing (component Fixed), to describe a coupling of the element with the housing via a spring/damper.
within Modelica.Mechanics.Rotational.Examples.Utilities; model SpringDamperNoRelativeStates "Linear 1D rotational spring and damper in parallel (phi and w are not used as states)" parameter SI.RotationalSpringConstant c(final min=0, start=1.0e5) "Spring constant"; parameter SI.RotationalDampingConstant d(final min=0, start=0) "Damping constant"; parameter SI.Angle phi_rel0=0 "Unstretched spring angle"; SI.AngularVelocity w_rel(start=0) "Relative angular velocity(= der(phi_rel))"; extends Modelica.Mechanics.Rotational.Interfaces.PartialCompliant; extends Modelica.Thermal.HeatTransfer.Interfaces.PartialElementaryConditionalHeatPortWithoutT; protected SI.Torque tau_c "Spring torque"; SI.Torque tau_d "Damping torque"; equation w_rel = der(phi_rel); tau_c = c*(phi_rel - phi_rel0); tau_d = d*w_rel; tau = tau_c + tau_d; lossPower = tau_d*w_rel; end SpringDamperNoRelativeStates;
Icon of a clutch. This is the icon of a clutch from the rotational package.
within Modelica.Mechanics.Rotational.Icons; model Clutch "Icon of a clutch" end Clutch;
Icon of a gear box. This is the icon of a gear box from the rotational package.
within Modelica.Mechanics.Rotational.Icons; model Gearbox "Icon of a gear box" end Gearbox;
Icons for Rotational package
within Modelica.Mechanics.Rotational; package Icons "Icons for Rotational package" extends Modelica.Icons.IconsPackage; end Icons;
Adapter model to utilize conditional support connector. This is an adapter model to utilize a&nbsp;conditional <a href=\"modelica://Modelica.Mechanics.Rotational.Interfaces.Support\">support connector</a> in a&nbsp;component. It could be applied to both textually (equations based) and graphically defined components:
within Modelica.Mechanics.Rotational.Interfaces; model InternalSupport "Adapter model to utilize conditional support connector" input SI.Torque tau "External support torque (must be computed via torque balance in model where InternalSupport is used; = flange.tau)"; SI.Angle phi "External support angle (= flange.phi)"; Flange_a flange "Internal support flange (must be connected to the conditional support connector for useSupport=true and to conditional fixed model for useSupport=false)" equation flange.tau = tau; flange.phi = phi; end InternalSupport;
Connectors and partial models for 1D rotational mechanical components
within Modelica.Mechanics.Rotational; package Interfaces "Connectors and partial models for 1D rotational mechanical components" extends Modelica.Icons.InterfacesPackage; end Interfaces;
Partial model to measure a single absolute flange variable
within Modelica.Mechanics.Rotational.Interfaces; partial model PartialAbsoluteSensor "Partial model to measure a single absolute flange variable" extends Modelica.Icons.RoundSensor; Flange_a flange "Flange of shaft from which sensor information shall be measured" equation 0 = flange.tau; end PartialAbsoluteSensor;
Partial model for the compliant connection of two rotational 1-dim. shaft flanges. This is a 1-dim. rotational component with a compliant connection of two rotational 1-dim. flanges where inertial effects between the two flanges are neglected. The basic assumption is that the cut-torques of the two flanges sum-up to zero, i.e., they have the same absolute value but opposite sign: flange_a.tau + flange_b.tau = 0. This base class is used to built up force elements such as springs, dampers, friction.
within Modelica.Mechanics.Rotational.Interfaces; partial model PartialCompliant "Partial model for the compliant connection of two rotational 1-dim. shaft flanges" SI.Angle phi_rel(start=0) "Relative rotation angle (= flange_b.phi - flange_a.phi)"; SI.Torque tau "Torque between flanges (= flange_b.tau)"; Flange_a flange_a "Left flange of compliant 1-dim. rotational component" Flange_b flange_b "Right flange of compliant 1-dim. rotational component" equation phi_rel = flange_b.phi - flange_a.phi; flange_b.tau = tau; flange_a.tau = -tau; end PartialCompliant;
Partial model for the compliant connection of two rotational 1-dim. shaft flanges where the relative angle and speed are used as preferred states. This is a 1-dim. rotational component with a compliant connection of two rotational 1-dim. flanges where inertial effects between the two flanges are neglected. The basic assumption is that the cut-torques of the two flanges sum-up to zero, i.e., they have the same absolute value but opposite sign: flange_a.tau + flange_b.tau = 0. This base class is used to built up force elements such as springs, dampers, friction.
within Modelica.Mechanics.Rotational.Interfaces; partial model PartialCompliantWithRelativeStates "Partial model for the compliant connection of two rotational 1-dim. shaft flanges where the relative angle and speed are used as preferred states" SI.Angle phi_rel( start=0, stateSelect=stateSelect, nominal=if phi_nominal >= Modelica.Constants.eps then phi_nominal else 1) "Relative rotation angle (= flange_b.phi - flange_a.phi)"; SI.AngularVelocity w_rel(start=0, stateSelect=stateSelect) "Relative angular velocity (= der(phi_rel))"; SI.AngularAcceleration a_rel(start=0) "Relative angular acceleration (= der(w_rel))"; SI.Torque tau "Torque between flanges (= flange_b.tau)"; Flange_a flange_a "Left flange of compliant 1-dim. rotational component" Flange_b flange_b "Right flange of compliant 1-dim. rotational component" parameter SI.Angle phi_nominal( displayUnit="rad", min=0.0) = 1e-4 "Nominal value of phi_rel (used for scaling)" parameter StateSelect stateSelect=StateSelect.prefer "Priority to use phi_rel and w_rel as states" equation phi_rel = flange_b.phi - flange_a.phi; w_rel = der(phi_rel); a_rel = der(w_rel); flange_b.tau = tau; flange_a.tau = -tau; end PartialCompliantWithRelativeStates;
Partial model for a component with one rotational 1-dim. shaft flange and a support used for textual modeling, i.e., for elementary models. This is a 1-dim. rotational component with one flange and a support/housing. It is used to build up elementary components of a drive train with equations in the text layer.
within Modelica.Mechanics.Rotational.Interfaces; partial model PartialElementaryOneFlangeAndSupport2 "Partial model for a component with one rotational 1-dim. shaft flange and a support used for textual modeling, i.e., for elementary models" parameter Boolean useSupport=false "= true, if support flange enabled, otherwise implicitly grounded" Flange_b flange "Flange of shaft" Support support(phi=phi_support, tau=-flange.tau) if useSupport "Support/housing of component" protected SI.Angle phi_support "Absolute angle of support flange"; equation if not useSupport then phi_support = 0; end if; end PartialElementaryOneFlangeAndSupport2;
Partial model to transform rotational into translational motion. This is a 1-dim. rotational component with
within Modelica.Mechanics.Rotational.Interfaces; partial model PartialElementaryRotationalToTranslational "Partial model to transform rotational into translational motion" parameter Boolean useSupportR=false "= true, if rotational support flange enabled, otherwise implicitly grounded" parameter Boolean useSupportT=false "= true, if translational support flange enabled, otherwise implicitly grounded" Rotational.Interfaces.Flange_a flangeR "Flange of rotational shaft" Modelica.Mechanics.Translational.Interfaces.Flange_b flangeT "Flange of translational rod" Rotational.Interfaces.Support supportR if useSupportR "Rotational support/housing of component" Translational.Interfaces.Support supportT if useSupportT "Translational support/housing of component" protected Rotational.Interfaces.InternalSupport internalSupportR(tau=-flangeR.tau) Translational.Interfaces.InternalSupport internalSupportT(f=-flangeT.f) Rotational.Components.Fixed fixedR if not useSupportR Translational.Components.Fixed fixedT if not useSupportT equation connect(internalSupportR.flange, supportR) connect(internalSupportR.flange, fixedR.flange) connect(fixedT.flange, internalSupportT.flange) connect(internalSupportT.flange, supportT) end PartialElementaryRotationalToTranslational;
Partial model for a component with two rotational 1-dim. shaft flanges and a support used for textual modeling, i.e., for elementary models. This is a 1-dim. rotational component with two flanges and a support/housing. It is used to build up elementary components of a drive train with equations in the text layer.
within Modelica.Mechanics.Rotational.Interfaces; partial model PartialElementaryTwoFlangesAndSupport2 "Partial model for a component with two rotational 1-dim. shaft flanges and a support used for textual modeling, i.e., for elementary models" parameter Boolean useSupport=false "= true, if support flange enabled, otherwise implicitly grounded" Flange_a flange_a "Flange of left shaft" Flange_b flange_b "Flange of right shaft" Support support(phi=phi_support, tau=-flange_a.tau - flange_b.tau) if useSupport "Support/housing of component" protected SI.Angle phi_support "Absolute angle of support flange"; equation if not useSupport then phi_support = 0; end if; end PartialElementaryTwoFlangesAndSupport2;
Partial model of Coulomb friction elements. Basic model for Coulomb friction that models the stuck phase in a reliable way.
within Modelica.Mechanics.Rotational.Interfaces; partial model PartialFriction "Partial model of Coulomb friction elements" // parameter SI.AngularVelocity w_small=1 "Relative angular velocity near to zero (see model info text)"; parameter SI.AngularVelocity w_small=1.0e10 "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)" // Equations to define the following variables have to be defined in subclasses SI.AngularVelocity w_relfric "Relative angular velocity between frictional surfaces"; SI.AngularAcceleration a_relfric "Relative angular acceleration between frictional surfaces"; //SI.Torque tau "Friction torque (positive, if directed in opposite direction of w_rel)"; SI.Torque tau0 "Friction torque for w_relfric=0 and forward sliding"; SI.Torque tau0_max "Maximum friction torque for w_relfric=0 and locked"; Boolean free "= true, if frictional element is not active"; // Equations to define the following variables are given in this class Real sa(final unit="1") "Path parameter of friction characteristic tau = f(a_relfric)"; Boolean startForward(start=false, fixed=true) "= true, if w_relfric=0 and start of forward sliding"; Boolean startBackward(start=false, fixed=true) "= true, if w_relfric=0 and start of backward sliding"; Boolean locked(start=false) "= true, if w_rel=0 and not sliding"; constant Integer Unknown=3 "Value of mode is not known"; constant Integer Free=2 "Element is not active"; constant Integer Forward=1 "w_relfric > 0 (forward sliding)"; constant Integer Stuck=0 "w_relfric = 0 (forward sliding, locked or backward sliding)"; constant Integer Backward=-1 "w_relfric < 0 (backward sliding)"; Integer mode( final min=Backward, final max=Unknown, start=Unknown, fixed=true) "Mode of friction (-1: backward sliding, 0: stuck, 1: forward sliding, 2: inactive, 3: unknown)"; protected constant SI.AngularAcceleration unitAngularAcceleration=1 constant SI.Torque unitTorque=1 equation /* Friction characteristic locked is introduced to help the Modelica translator determining the different structural configurations, if for each configuration special code shall be generated */ startForward = pre(mode) == Stuck and (sa > tau0_max/unitTorque or pre( startForward) and sa > tau0/unitTorque) or pre(mode) == Backward and w_relfric > w_small or initial() and (w_relfric > 0); startBackward = pre(mode) == Stuck and (sa < -tau0_max/unitTorque or pre( startBackward) and sa < -tau0/unitTorque) or pre(mode) == Forward and w_relfric < -w_small or initial() and (w_relfric < 0); locked = not free and not (pre(mode) == Forward or startForward or pre( mode) == Backward or startBackward); a_relfric/unitAngularAcceleration = if locked then 0 else if free then sa else if startForward then sa - tau0_max/unitTorque else if startBackward then sa + tau0_max/unitTorque else if pre(mode) == Forward then sa - tau0_max/unitTorque else if pre(mode) == Backward then sa + tau0_max/unitTorque else sa - sign(w_relfric)*tau0_max/unitTorque; /* Friction torque "tau" has to be defined in a subclass. Example for possible realization of a clutch utilizing interpolation by ExternalCombiTable1D see: Modelica.Mechanics.Rotational.Components.Clutch */ // finite state machine to determine configuration mode = if free then Free else (if (pre(mode) == Forward or pre(mode) == Free or startForward) and w_relfric > 0 then Forward else if (pre(mode) == Backward or pre(mode) == Free or startBackward) and w_relfric < 0 then Backward else Stuck); end PartialFriction;
Partial model for a component with one rotational 1-dim. shaft flange and a support used for graphical modeling, i.e., the model is build up by drag-and-drop from elementary components. This is a 1-dim. rotational component with one flange and a support/housing. It is used e.g., to build up parts of a drive train graphically consisting of several components.
within Modelica.Mechanics.Rotational.Interfaces; partial model PartialOneFlangeAndSupport "Partial model for a component with one rotational 1-dim. shaft flange and a support used for graphical modeling, i.e., the model is build up by drag-and-drop from elementary components" parameter Boolean useSupport=false "= true, if support flange enabled, otherwise implicitly grounded" Flange_b flange "Flange of shaft" Support support if useSupport "Support/housing of component" protected Support internalSupport "Internal support/housing of component (either connected to support, if useSupport=true, or connected to fixed, if useSupport=false)" Components.Fixed fixed if not useSupport "Fixed support/housing, if not useSupport" equation connect(support, internalSupport) connect(internalSupport, fixed.flange) end PartialOneFlangeAndSupport;
Partial model to measure a single relative variable between two flanges
within Modelica.Mechanics.Rotational.Interfaces; partial model PartialRelativeSensor "Partial model to measure a single relative variable between two flanges" extends Modelica.Icons.RoundSensor; Flange_a flange_a "Left flange of shaft" Flange_b flange_b "Right flange of shaft" equation 0 = flange_a.tau + flange_b.tau; end PartialRelativeSensor;
Partial model of a torque acting at the flange (accelerates the flange). Partial model of torque that accelerates the flange.
within Modelica.Mechanics.Rotational.Interfaces; partial model PartialTorque "Partial model of a torque acting at the flange (accelerates the flange)" extends Modelica.Mechanics.Rotational.Interfaces.PartialElementaryOneFlangeAndSupport2; SI.Angle phi "Angle of flange with respect to support (= flange.phi - support.phi)"; equation phi = flange.phi - phi_support; end PartialTorque;
Partial model for a component with two rotational 1-dim. shaft flanges. This is a 1-dim. rotational component with two flanges. It is used e.g., to build up parts of a drive train consisting of several components.
within Modelica.Mechanics.Rotational.Interfaces; partial model PartialTwoFlanges "Partial model for a component with two rotational 1-dim. shaft flanges" Flange_a flange_a "Flange of left shaft" Flange_b flange_b "Flange of right shaft" end PartialTwoFlanges;
Partial model for a component with two rotational 1-dim. shaft flanges and a support used for graphical modeling, i.e., the model is build up by drag-and-drop from elementary components. This is a 1-dim. rotational component with two flanges and a support/housing. It is used e.g., to build up parts of a drive train graphically consisting of several components.
within Modelica.Mechanics.Rotational.Interfaces; partial model PartialTwoFlangesAndSupport "Partial model for a component with two rotational 1-dim. shaft flanges and a support used for graphical modeling, i.e., the model is build up by drag-and-drop from elementary components" parameter Boolean useSupport=false "= true, if support flange enabled, otherwise implicitly grounded" Flange_a flange_a "Flange of left shaft" Flange_b flange_b "Flange of right shaft" Support support if useSupport "Support/housing of component" protected Support internalSupport "Internal support/housing of component (either connected to support, if useSupport=true, or connected to fixed, if useSupport=false)" Components.Fixed fixed if not useSupport "Fixed support/housing, if not useSupport" equation connect(support, internalSupport) connect(internalSupport, fixed.flange) end PartialTwoFlangesAndSupport;
Support/housing flange of a one-dimensional rotational shaft. This is a connector for 1-dim. rotational mechanical systems and models which represents a support or housing of a shaft. The following variables are defined in this connector:
within Modelica.Mechanics.Rotational.Interfaces; connector Support "Support/housing flange of a one-dimensional rotational shaft" extends Flange; end Support;
Ideal sensor to measure the absolute angular acceleration of flange. Measures the <em>absolute angular acceleration</em> of a&nbsp;flange in an ideal way and provides the result as output signal&nbsp;<code>a</code> (to be further processed with blocks of the <a href=\"modelica://Modelica.Blocks\">Modelica.Blocks</a> library).
within Modelica.Mechanics.Rotational.Sensors; model AccSensor "Ideal sensor to measure the absolute angular acceleration of flange" extends Rotational.Interfaces.PartialAbsoluteSensor; SI.AngularVelocity w "Absolute angular velocity of flange"; Modelica.Blocks.Interfaces.RealOutput a(unit="rad/s2") "Absolute angular acceleration of flange as output signal" equation w = der(flange.phi); a = der(w); end AccSensor;
Ideal sensor to measure the absolute angle of flange. Measures the <em>absolute angle</em> of a&nbsp;flange in an ideal way and provides the result as output signal&nbsp;<code>phi</code> (to be further processed with blocks of the <a href=\"modelica://Modelica.Blocks\">Modelica.Blocks</a> library).
within Modelica.Mechanics.Rotational.Sensors; model AngleSensor "Ideal sensor to measure the absolute angle of flange" extends Rotational.Interfaces.PartialAbsoluteSensor; Modelica.Blocks.Interfaces.RealOutput phi(unit="rad", displayUnit="deg") "Absolute angle of flange as output signal" equation phi = flange.phi; end AngleSensor;
Ideal sensor to measure the absolute angular velocity, torque and power between two flanges. Measures the <em>absolute angular velocity</em> of the <code>flange_a</code> and the <em>cut-torque</em> and <em>power</em> between two flanges in an ideal way and provides the results as output signals&nbsp;<code>w</code>, <code>tau</code> and <code>power</code>, respectively.
within Modelica.Mechanics.Rotational.Sensors; model MultiSensor "Ideal sensor to measure the absolute angular velocity, torque and power between two flanges" extends .Modelica.Mechanics.Rotational.Interfaces.PartialRelativeSensor; Modelica.Blocks.Interfaces.RealOutput power(unit="W") "Power in flange flange_a as output signal" Modelica.Blocks.Interfaces.RealOutput w(unit="rad/s") "Absolute angular velocity of flange_a as output signal" Modelica.Blocks.Interfaces.RealOutput tau(unit="N.m") "Torque in flange flange_a and flange_b (tau = flange_a.tau = -flange_b.tau) as output signal" equation flange_a.phi = flange_b.phi; w = der(flange_a.phi); tau = flange_a.tau; power = tau*w; end MultiSensor;
Sensors to measure variables in 1D rotational mechanical components
within Modelica.Mechanics.Rotational; package Sensors "Sensors to measure variables in 1D rotational mechanical components" extends Modelica.Icons.SensorsPackage; end Sensors;
Ideal sensor to measure the power between two flanges. Measures the <em>power</em> between two flanges in an ideal way and provides the result as output signal <code>power</code> (to be further processed with blocks of the <a href=\"modelica://Modelica.Blocks\">Modelica.Blocks</a> library), i.e.
within Modelica.Mechanics.Rotational.Sensors; model PowerSensor "Ideal sensor to measure the power between two flanges" extends Rotational.Interfaces.PartialRelativeSensor; Modelica.Blocks.Interfaces.RealOutput power(unit="W") "Power in flange flange_a as output signal" equation flange_a.phi = flange_b.phi; power = flange_a.tau*der(flange_a.phi); end PowerSensor;
Ideal sensor to measure the relative angular acceleration between two flanges. Measures the <em>relative angular acceleration</em> between two flanges in an ideal way and provides the result as output signal <code>a_rel</code> (to be further processed with blocks of the <a href=\"modelica://Modelica.Blocks\">Modelica.Blocks</a> library).
within Modelica.Mechanics.Rotational.Sensors; model RelAccSensor "Ideal sensor to measure the relative angular acceleration between two flanges" extends Rotational.Interfaces.PartialRelativeSensor; SI.Angle phi_rel "Relative angle between two flanges (flange_b.phi - flange_a.phi)"; SI.AngularVelocity w_rel "Relative angular velocity between two flanges"; Modelica.Blocks.Interfaces.RealOutput a_rel(unit="rad/s2") "Relative angular acceleration between two flanges as output signal" equation phi_rel = flange_b.phi - flange_a.phi; w_rel = der(phi_rel); a_rel = der(w_rel); 0 = flange_a.tau; end RelAccSensor;
Ideal sensor to measure the relative angle between two flanges. Measures the <em>relative angle</em> between two flanges in an ideal way and provides the result as output signal <code>phi_rel</code> (to be further processed with blocks of the <a href=\"modelica://Modelica.Blocks\">Modelica.Blocks</a> library).
within Modelica.Mechanics.Rotational.Sensors; model RelAngleSensor "Ideal sensor to measure the relative angle between two flanges" extends Rotational.Interfaces.PartialRelativeSensor; Modelica.Blocks.Interfaces.RealOutput phi_rel(unit="rad", displayUnit="deg") "Relative angle between two flanges (= flange_b.phi - flange_a.phi) as output signal" equation phi_rel = flange_b.phi - flange_a.phi; 0 = flange_a.tau; end RelAngleSensor;
Ideal sensor to measure the relative angular velocity between two flanges. Measures the <em>relative angular velocity</em> between two flanges in an ideal way and provides the result as output signal <code>w_rel</code> (to be further processed with blocks of the <a href=\"modelica://Modelica.Blocks\">Modelica.Blocks</a> library).
within Modelica.Mechanics.Rotational.Sensors; model RelSpeedSensor "Ideal sensor to measure the relative angular velocity between two flanges" extends Rotational.Interfaces.PartialRelativeSensor; SI.Angle phi_rel "Relative angle between two flanges (flange_b.phi - flange_a.phi)"; Modelica.Blocks.Interfaces.RealOutput w_rel(unit="rad/s") "Relative angular velocity between two flanges (= der(flange_b.phi) - der(flange_a.phi)) as output signal" equation phi_rel = flange_b.phi - flange_a.phi; w_rel = der(phi_rel); 0 = flange_a.tau; end RelSpeedSensor;
Ideal sensor to measure the absolute angular velocity of flange. Measures the <em>absolute angular velocity</em> of a&nbsp;flange in an ideal way and provides the result as output signal&nbsp;<code>w</code> (to be further processed with blocks of the <a href=\"modelica://Modelica.Blocks\">Modelica.Blocks</a> library).
within Modelica.Mechanics.Rotational.Sensors; model SpeedSensor "Ideal sensor to measure the absolute angular velocity of flange" extends Rotational.Interfaces.PartialAbsoluteSensor; Modelica.Blocks.Interfaces.RealOutput w(unit="rad/s") "Absolute angular velocity of flange as output signal" equation w = der(flange.phi); end SpeedSensor;
Ideal sensor to measure the torque between two flanges. Measures the <em>cut-torque</em> between two flanges in an ideal way and provides the result as output signal <code>tau</code> (to be further processed with blocks of the <a href=\"modelica://Modelica.Blocks\">Modelica.Blocks</a> library).
within Modelica.Mechanics.Rotational.Sensors; model TorqueSensor "Ideal sensor to measure the torque between two flanges" extends Rotational.Interfaces.PartialRelativeSensor; Modelica.Blocks.Interfaces.RealOutput tau(unit="N.m") "Torque in flange flange_a and flange_b (tau = flange_a.tau = -flange_b.tau) as output signal" equation flange_a.phi = flange_b.phi; flange_a.tau = tau; end TorqueSensor;
Forced movement of a flange according to an acceleration signal. The input signal <strong>a_ref</strong> defines an <strong>angular acceleration</strong> in [rad/s2]. Flange <strong>flange</strong> is <strong>forced</strong> to move relative to flange support with this acceleration. The angular velocity <strong>w</strong> and the rotation angle <strong>phi</strong> of the flange are automatically determined by integration of the acceleration.
within Modelica.Mechanics.Rotational.Sources; model Accelerate "Forced movement of a flange according to an acceleration signal" extends Modelica.Mechanics.Rotational.Interfaces.PartialElementaryOneFlangeAndSupport2; SI.Angle phi( start=0, fixed=true, stateSelect=StateSelect.prefer) "Rotation angle of flange with respect to support"; SI.AngularVelocity w( start=0, fixed=true, stateSelect=StateSelect.prefer) "Angular velocity of flange with respect to support"; SI.AngularAcceleration a "Angular acceleration of flange with respect to support"; Modelica.Blocks.Interfaces.RealInput a_ref(unit="rad/s2") "Absolute angular acceleration of flange with respect to support as input signal" equation phi = flange.phi - phi_support; w = der(phi); a = der(w); a = a_ref; end Accelerate;
Constant speed, not dependent on torque. Model of <strong>fixed</strong> angular velocity of flange, not dependent on torque.
within Modelica.Mechanics.Rotational.Sources; model ConstantSpeed "Constant speed, not dependent on torque" extends Modelica.Mechanics.Rotational.Interfaces.PartialTorque; SI.AngularVelocity w "Angular velocity of flange with respect to support (= der(phi))"; parameter SI.AngularVelocity w_fixed "Fixed speed"; equation w = der(phi); w = w_fixed; end ConstantSpeed;
Constant torque, not dependent on speed. Model of constant torque, not dependent on angular velocity of flange.
within Modelica.Mechanics.Rotational.Sources; model ConstantTorque "Constant torque, not dependent on speed" extends Rotational.Interfaces.PartialTorque; parameter SI.Torque tau_constant "Constant torque (if negative, torque is acting as load in positive direction of rotation)"; SI.AngularVelocity w "Angular velocity of flange with respect to support (= der(phi))"; SI.Torque tau "Accelerating torque acting at flange (= -flange.tau)"; equation w = der(phi); tau = -flange.tau; tau = tau_constant; end ConstantTorque;
Simple model of a rotational eddy current brake. This is a simple model of a rotational <strong>eddy current brake</strong>. The torque versus speed characteristic is defined by Kloss' equation.
within Modelica.Mechanics.Rotational.Sources; model EddyCurrentTorque "Simple model of a rotational eddy current brake" import Modelica.Electrical.Machines.Thermal.linearTemperatureDependency; parameter Boolean useExcitationInput=false "Enable signal input for excitation"; parameter Real constantExcitation=1 "Excitation=1 to reach maximum torque" parameter SI.Torque tau_nominal "Maximum torque (always braking)"; parameter SI.AngularVelocity w_nominal(min=Modelica.Constants.eps) "Nominal speed (leads to maximum torque) at reference temperature"; parameter SI.Temperature TRef(start=293.15) "Reference temperature"; parameter Modelica.Electrical.Machines.Thermal.LinearTemperatureCoefficient20 alpha20(start=0) "Temperature coefficient of material"; extends Modelica.Mechanics.Rotational.Interfaces.PartialTorque; extends Modelica.Thermal.HeatTransfer.Interfaces.PartialElementaryConditionalHeatPort; SI.Torque tau "Accelerating torque acting at flange (= flange.tau)"; SI.AngularVelocity w "Angular velocity of flange with respect to support (= der(phi))"; Real w_normalized "Relative speed w/w_nominal"; Blocks.Interfaces.RealInput excitation = excitationInternal if useExcitationInput "Excitation" protected Real excitationInternal "Excitation"; equation if not useExcitationInput then excitationInternal = constantExcitation; end if; tau = flange.tau; w = der(phi); w_normalized = w/(w_nominal*linearTemperatureDependency(1, TRef, alpha20, TheatPort)); tau = 2*tau_nominal*excitationInternal^2*w_normalized/(1 + w_normalized*w_normalized); lossPower = tau*w; end EddyCurrentTorque;
Torque reciprocal dependent on speed. Model of inverse speed dependent torque.
within Modelica.Mechanics.Rotational.Sources; model InverseSpeedDependentTorque "Torque reciprocal dependent on speed" extends Rotational.Interfaces.PartialTorque; import Modelica.Constants.pi; parameter SI.Torque tau_nominal "Nominal torque (if negative, torque is acting as load in positive direction of rotation)"; parameter Boolean TorqueDirection=true "Same direction of torque in both directions of rotation"; parameter SI.AngularVelocity w_nominal(min=Modelica.Constants.eps) "Nominal speed"; parameter SI.AngularVelocity w0(final min=Modelica.Constants.eps, start=0.1) "Regularization below w0" SI.AngularVelocity w "Angular velocity of flange with respect to support (= der(phi))"; SI.Torque tau "Accelerating torque acting at flange (= -flange.tau)"; equation w = der(phi); tau = -flange.tau; if TorqueDirection then tau = if abs(w)<w0 then tau_nominal*w_nominal/w0 else tau_nominal*w_nominal/abs(w); else tau = if abs(w)<w0 then tau_nominal*w/w0 else tau_nominal*w_nominal/w; end if; end InverseSpeedDependentTorque;
Linear dependency of torque versus speed. Model of torque, linearly dependent on angular velocity of flange.<br> Parameter TorqueDirection chooses whether direction of torque is the same in both directions of rotation or not.
within Modelica.Mechanics.Rotational.Sources; model LinearSpeedDependentTorque "Linear dependency of torque versus speed" extends Modelica.Mechanics.Rotational.Interfaces.PartialTorque; parameter SI.Torque tau_nominal "Nominal torque (if negative, torque is acting as load in positive direction of rotation)"; parameter Boolean TorqueDirection=true "Same direction of torque in both directions of rotation"; parameter SI.AngularVelocity w_nominal(min=Modelica.Constants.eps) "Nominal speed"; SI.AngularVelocity w "Angular velocity of flange with respect to support (= der(phi))"; SI.Torque tau "Accelerating torque acting at flange (= -flange.tau)"; equation w = der(phi); tau = -flange.tau; if TorqueDirection then tau = tau_nominal*abs(w/w_nominal); else tau = tau_nominal*(w/w_nominal); end if; end LinearSpeedDependentTorque;
Forced movement of a flange according to an angle, speed and angular acceleration signal. Flange <strong>flange</strong> is <strong>forced</strong> to move relative to flange support with a predefined motion according to the input signals:
within Modelica.Mechanics.Rotational.Sources; model Move "Forced movement of a flange according to an angle, speed and angular acceleration signal" extends Modelica.Mechanics.Rotational.Interfaces.PartialElementaryOneFlangeAndSupport2; SI.Angle phi "Rotation angle of flange with respect to support"; Modelica.Blocks.Interfaces.RealInput u[3] "Angle, angular velocity and angular acceleration of flange with respect to support as input signals" protected function position extends Modelica.Icons.Function; input Real q_qd_qdd[3] "Required values for position, speed, acceleration"; input Real dummy "Just to have one input signal that should be differentiated to avoid possible problems in the Modelica tool (is not used)"; output Real q; algorithm q := q_qd_qdd[1]; end position; function position_der extends Modelica.Icons.Function; input Real q_qd_qdd[3] "Required values for position, speed, acceleration"; input Real dummy "Just to have one input signal that should be differentiated to avoid possible problems in the Modelica tool (is not used)"; input Real dummy_der; output Real qd; algorithm qd := q_qd_qdd[2]; end position_der; function position_der2 extends Modelica.Icons.Function; input Real q_qd_qdd[3] "Required values for position, speed, acceleration"; input Real dummy "Just to have one input signal that should be differentiated to avoid possible problems in the Modelica tool (is not used)"; input Real dummy_der; input Real dummy_der2; output Real qdd; algorithm qdd := q_qd_qdd[3]; end position_der2; equation phi = flange.phi - phi_support; phi = position(u, time); end Move;
Sources to drive 1D rotational mechanical components
within Modelica.Mechanics.Rotational; package Sources "Sources to drive 1D rotational mechanical components" extends Modelica.Icons.SourcesPackage; end Sources;
Forced movement of a flange according to a reference angle signal. The input signal <strong>phi_ref</strong> defines the <strong>reference angle</strong> in [rad]. Flange <strong>flange</strong> is <strong>forced</strong> to move according to this reference motion relative to flange support. According to parameter <strong>exact</strong> (default = <strong>false</strong>), this is done in the following way:
within Modelica.Mechanics.Rotational.Sources; model Position "Forced movement of a flange according to a reference angle signal" extends Modelica.Mechanics.Rotational.Interfaces.PartialElementaryOneFlangeAndSupport2; parameter Boolean exact=false "Is true/false for exact treatment/filtering of the input signal, respectively" parameter SI.Frequency f_crit=50 "If exact=false, critical frequency of filter to filter input signal" SI.Angle phi(stateSelect=if exact then StateSelect.default else StateSelect.prefer) "Rotation angle of flange with respect to support"; SI.AngularVelocity w(start=0, stateSelect=if exact then StateSelect.default else StateSelect.prefer) "If exact=false, Angular velocity of flange with respect to support else dummy" SI.AngularAcceleration a(start=0) "If exact=false, Angular acceleration of flange with respect to support else dummy" Modelica.Blocks.Interfaces.RealInput phi_ref( final quantity="Angle", final unit="rad", displayUnit="deg") "Reference angle of flange with respect to support as input signal" protected parameter SI.AngularFrequency w_crit=2*Modelica.Constants.pi*f_crit "Critical frequency"; constant Real af=1.3617 "s coefficient of Bessel filter"; constant Real bf=0.6180 "s*s coefficient of Bessel filter"; initial equation if not exact then phi = phi_ref; end if; equation phi = flange.phi - phi_support; if exact then phi = phi_ref; w = 0; a = 0; else // Filter: a = phi_ref*s^2/(1 + (af/w_crit)*s + (bf/w_crit^2)*s^2) w = der(phi); a = der(w); a = ((phi_ref - phi)*w_crit - af*w)*(w_crit/bf); end if; end Position;
Quadratic dependency of torque versus speed. Model of torque, quadratic dependent on angular velocity of flange.<br> Parameter TorqueDirection chooses whether direction of torque is the same in both directions of rotation or not.
within Modelica.Mechanics.Rotational.Sources; model QuadraticSpeedDependentTorque "Quadratic dependency of torque versus speed" extends Modelica.Mechanics.Rotational.Interfaces.PartialTorque; parameter SI.Torque tau_nominal "Nominal torque (if negative, torque is acting as load in positive direction of rotation)"; parameter Boolean TorqueDirection=true "Same direction of torque in both directions of rotation"; parameter SI.AngularVelocity w_nominal(min=Modelica.Constants.eps) "Nominal speed"; SI.AngularVelocity w "Angular velocity of flange with respect to support (= der(phi))"; SI.Torque tau "Accelerating torque acting at flange (= -flange.tau)"; equation w = der(phi); tau = -flange.tau; if TorqueDirection then tau = tau_nominal*(w/w_nominal)^2; else tau = tau_nominal*smooth(1, if w >= 0 then (w/w_nominal)^2 else -(w/w_nominal)^2); end if; end QuadraticSpeedDependentTorque;
Constant torque changing sign with speed. Model of constant torque which changes sign with direction of rotation.
within Modelica.Mechanics.Rotational.Sources; model SignTorque "Constant torque changing sign with speed" extends Rotational.Interfaces.PartialTorque; import Modelica.Constants.pi; parameter SI.Torque tau_nominal "Nominal torque (if negative, torque is acting as load)"; parameter Modelica.Blocks.Types.Regularization reg=Modelica.Blocks.Types.Regularization.Exp "Type of regularization" parameter SI.AngularVelocity w0(final min=Modelica.Constants.eps, start=0.1) "Regularization below w0"; SI.AngularVelocity w "Angular velocity of flange with respect to support (= der(phi))"; SI.Torque tau "Accelerating torque acting at flange (= -flange.tau)"; equation w = der(phi); tau = -flange.tau; if reg==Modelica.Blocks.Types.Regularization.Exp then tau = tau_nominal*(2/(1 + Modelica.Math.exp(-w/(0.01*w0)))-1); elseif reg==Modelica.Blocks.Types.Regularization.Sine then tau = tau_nominal*smooth(1, (if abs(w)>=w0 then sign(w) else Modelica.Math.sin(pi/2*w/w0))); elseif reg==Modelica.Blocks.Types.Regularization.Linear then tau = tau_nominal*(if abs(w)>=w0 then sign(w) else (w/w0)); else//if reg==Modelica.Blocks.Types.Regularization.CoSine tau = tau_nominal*(if abs(w)>=w0 then sign(w) else sign(w)*(1 - Modelica.Math.cos(pi/2*w/w0))); end if; end SignTorque;
Forced movement of a flange according to a reference angular velocity signal. The input signal <strong>w_ref</strong> defines the <strong>reference speed</strong> in [rad/s]. Flange <strong>flange</strong> is <strong>forced</strong> to move relative to flange support according to this reference motion. According to parameter <strong>exact</strong> (default = <strong>false</strong>), this is done in the following way:
within Modelica.Mechanics.Rotational.Sources; model Speed "Forced movement of a flange according to a reference angular velocity signal" extends Modelica.Mechanics.Rotational.Interfaces.PartialElementaryOneFlangeAndSupport2; parameter Boolean exact=false "Is true/false for exact treatment/filtering of the input signal, respectively" parameter SI.Frequency f_crit=50 "If exact=false, critical frequency of filter to filter input signal" SI.Angle phi( start=0, fixed=true, stateSelect=StateSelect.prefer) "Rotation angle of flange with respect to support"; SI.AngularVelocity w(stateSelect=if exact then StateSelect.default else StateSelect.prefer) "Angular velocity of flange with respect to support"; SI.AngularAcceleration a "If exact=false, angular acceleration of flange with respect to support else dummy"; Modelica.Blocks.Interfaces.RealInput w_ref(unit="rad/s") "Reference angular velocity of flange with respect to support as input signal" protected parameter SI.AngularFrequency w_crit=2*Modelica.Constants.pi *f_crit "Critical frequency"; initial equation if not exact then w = w_ref; end if; equation phi = flange.phi - phi_support; w = der(phi); if exact then w = w_ref; a = 0; else // Filter: a = w_ref/(1 + (1/w_crit)*s) a = der(w); a = (w_ref - w)*w_crit; end if; end Speed;
Input signal acting as external torque on a flange. The input signal <strong>tau</strong> defines an external torque in [Nm] which acts (with negative sign) at a flange connector, i.e., the component connected to this flange is driven by torque <strong>tau</strong>.
within Modelica.Mechanics.Rotational.Sources; model Torque "Input signal acting as external torque on a flange" extends Modelica.Mechanics.Rotational.Interfaces.PartialElementaryOneFlangeAndSupport2; Modelica.Blocks.Interfaces.RealInput tau(unit="N.m") "Accelerating torque acting at flange (= -flange.tau)" equation flange.tau = -tau; end Torque;
Input signal acting as torque on two flanges. The input signal <strong>tau</strong> defines an external torque in [Nm] which acts at both flange connectors, i.e., the components connected to these flanges are driven by torque <strong>tau</strong>.
within Modelica.Mechanics.Rotational.Sources; model Torque2 "Input signal acting as torque on two flanges" extends Rotational.Interfaces.PartialTwoFlanges; Modelica.Blocks.Interfaces.RealInput tau(unit="N.m") "Torque driving the two flanges (a positive value accelerates the flange)" equation flange_a.tau = tau; flange_b.tau = -tau; end Torque2;
Constant torque, not dependent on speed. Model of a torque step at time startTime. Positive torque accelerates in positive direction of <code>flange</code> rotation.
within Modelica.Mechanics.Rotational.Sources; model TorqueStep "Constant torque, not dependent on speed" extends Modelica.Mechanics.Rotational.Interfaces.PartialTorque; parameter SI.Torque stepTorque(start=1) "Height of torque step (if negative, torque is acting as load)"; parameter SI.Torque offsetTorque(start=0) "Offset of torque"; parameter SI.Time startTime=0 "Torque = offset for time < startTime"; SI.Torque tau "Accelerating torque acting at flange (= -flange.tau)"; equation tau = -flange.tau; tau = offsetTorque + (if time < startTime then 0 else stepTorque); end TorqueStep;
Library to model 1-dimensional, translational mechanical systems
within Modelica.Mechanics; package Translational "Library to model 1-dimensional, translational mechanical systems" extends Modelica.Icons.Package; end Translational;
Brake based on Coulomb friction. This component models a <strong>brake</strong>, i.e., a component where a frictional force is acting between the housing and a flange and a controlled normal force presses the flange to the housing in order to increase friction. The normal force fn has to be provided as input signal f_normalized in a normalized form (0 &le; f_normalized &le; 1), fn = fn_max*f_normalized, where fn_max has to be provided as parameter. Friction in the brake is modelled in the following way:
within Modelica.Mechanics.Translational.Components; model Brake "Brake based on Coulomb friction" extends Modelica.Mechanics.Translational.Interfaces.PartialElementaryTwoFlangesAndSupport2; extends Modelica.Thermal.HeatTransfer.Interfaces.PartialElementaryConditionalHeatPortWithoutT; import Modelica.Blocks.Types.{ExternalCombiTable1D, Extrapolation, Smoothness}; import Modelica.Blocks.Tables.Internal.{getTable1DValue, getTable1DValueNoDer, getTable1DValueNoDer2}; parameter Real mu_pos[:, 2]=[0, 0.5] "Positive sliding friction coefficient [-] as function of v [m/s] (v>=0)"; parameter Smoothness smoothness = Smoothness.LinearSegments "Smoothness of interpolation in mu_pos table"; parameter Real peak(final min=1) = 1 "Peak for maximum value of mu at v==0 (mu0_max = peak*mu_pos[1,2])"; parameter Real cgeo(final min=0) = 1 "Geometry constant containing friction distribution assumption"; parameter SI.Force fn_max(final min=0, start=1) "Maximum normal force"; extends Translational.Interfaces.PartialFriction; SI.Position s "Absolute position of flange_a and of flange_b"; SI.Force f "Brake friction force"; SI.Velocity v "Absolute velocity of flange_a and flange_b"; SI.Acceleration a "Absolute acceleration of flange_a and flange_b"; Real mu "Friction coefficient"; SI.Force fn "Normal force (=fn_max*f_normalized)"; Modelica.Blocks.Interfaces.RealInput f_normalized "Normalized force signal 0..1 (normal force = fn_max*f_normalized; brake is active if > 0)" protected final parameter ExternalCombiTable1D tableID = ExternalCombiTable1D( tableName="NoName", fileName="NoName", table=mu_pos, columns={2}, smoothness=smoothness, extrapolation=Extrapolation.LastTwoPoints, verboseRead=false) "External table object for sliding friction coefficient"; final parameter Real mu0= if smoothness == Smoothness.ConstantSegments then getTable1DValueNoDer(tableID, 1, 0) elseif smoothness == Smoothness.LinearSegments then getTable1DValueNoDer2(tableID, 1, 0) else getTable1DValue(tableID, 1, 0) "Friction coefficient for v=0 and forward sliding"; Real table_signs[2] "Signs for sliding friction coefficient table interpolation: [sign for v, sign for mu]"; equation assert(size(mu_pos, 1) > 0 and size(mu_pos, 2) > 0, "Parameter mu_pos is an empty matrix"); s = s_a; s = s_b; // Velocity and acceleration of flanges flange_a and flange_b v = der(s); a = der(v); v_relfric = v; a_relfric = a; // Friction force, normal force and friction force for v=0 flange_a.f + flange_b.f - f = 0; fn = fn_max*f_normalized; f0 = mu0*cgeo*fn; f0_max = peak*f0; free = fn <= 0; // Friction force table_signs = if startForward then { 1, 1} elseif startBackward then {-1,-1} elseif pre(mode) == Forward then { 1, 1} else {-1,-1}; mu = table_signs[2]*( if smoothness == Smoothness.ConstantSegments then getTable1DValueNoDer(tableID, 1, table_signs[1]*v) elseif smoothness == Smoothness.LinearSegments then getTable1DValueNoDer2(tableID, 1, table_signs[1]*v) else getTable1DValue(tableID, 1, table_signs[1]*v)); f = if locked then sa*unitForce else if free then 0 else mu*cgeo*fn; lossPower = f*v_relfric; end Brake;
Linear 1D translational damper. <em>Linear, velocity dependent damper</em> element. It can be either connected between a sliding mass and the housing (model Fixed), or between two sliding masses.
within Modelica.Mechanics.Translational.Components; model Damper "Linear 1D translational damper" extends Translational.Interfaces.PartialCompliantWithRelativeStates; parameter SI.TranslationalDampingConstant d(final min=0, start=0) "Damping constant"; extends Modelica.Thermal.HeatTransfer.Interfaces.PartialElementaryConditionalHeatPortWithoutT; equation f = d*v_rel; lossPower = f*v_rel; end Damper;
1D translational spring damper combination with gap. This component models a spring damper combination that can lift off. It can be connected between a sliding mass and the housing (model <a href=\"modelica://Modelica.Mechanics.Translational.Components.Fixed\">Fixed</a>), to describe the contact of a sliding mass with the housing.
within Modelica.Mechanics.Translational.Components; model ElastoGap "1D translational spring damper combination with gap" extends Modelica.Mechanics.Translational.Interfaces.PartialCompliantWithRelativeStates; parameter SI.TranslationalSpringConstant c(final min=0, start=1) "Spring constant"; parameter SI.TranslationalDampingConstant d(final min=0, start=1) "Damping constant"; parameter SI.Position s_rel0=0 "Unstretched spring length"; parameter SI.Force f_ref(min=0) = c*s_ref "Reference spring force at s_ref" parameter SI.Length s_ref(min=Modelica.Constants.eps) = 1 "Reference relative compression at which f_c = f_ref" parameter Real n(final min=1) = 1 "Exponent of spring force ( f_c = -f_ref*|(s_rel-s_rel0)/s_ref|^n )"; extends Modelica.Thermal.HeatTransfer.Interfaces.PartialElementaryConditionalHeatPortWithoutT; /* Please note that initialization might fail due to the nonlinear spring characteristic (spring force is zero for s_rel > s_rel0) if a positive force is acting on the element and no other force balances this force (e.g., when setting both initial velocity and acceleration to 0) */ Boolean contact "= true, if contact, otherwise no contact"; protected SI.Force f_c "Spring force"; SI.Force f_d2 "Linear damping force"; SI.Force f_d "Linear damping force which is limited by spring force (|f_d| <= |f_c|)"; Real ratio "Scaling ratio of relative compression to s_ref"; equation // Modify contact force, so that it is only "pushing" and not // "pulling/sticking" and that it is continuous contact = s_rel < s_rel0; ratio = (s_rel - s_rel0)/s_ref; f_c = smooth(1, noEvent(if contact then -f_ref*abs(ratio)^n else 0)); f_d2 = if contact then d*v_rel else 0; f_d = smooth(0, noEvent(if contact then min(max(f_d2, f_c), -f_c) else 0)); f = f_c + f_d; lossPower = f_d*v_rel; // linear contact damper force f_d = <strong>if</strong> f_d2 &lt; f_c <strong>then</strong> f_c <strong>else</strong> <strong>if</strong> f_d2 &gt; -f_c <strong>then</strong> -f_c <strong>else</strong> f_d2; // bounded damper force f = f_c + f_d; // contact force <strong>end if</strong>; </pre></blockquote> <p> Note, since |f_d|&nbsp;&le;&nbsp;|f_c|, pulling forces cannot occur and the contact force is always continuous, especially around the start of the penetration at s_rel&nbsp;= s_rel0. On the contrary, this leads to the contact force <code>f&nbsp;=&nbsp;0</code> even if <code>contact&nbsp;= true</code> is still indicated around the end of the penetration. This is because <code>contact</code> indicates only the occurrence of geometry penetration. </p> <p> In order to have consistent units for nonlinear springs, the term <code>c*|s_rel|^n</code> is replaced by <code>f_ref*|s_rel/s_ref|^n</code>, whereby <code>s_ref</code> is a&nbsp;reference length for the spring and <code>f_ref</code> is the spring force when <code>s_rel&nbsp;=&nbsp;s_ref</code>. The default values <code>s_ref&nbsp;=&nbsp;1</code> and <code>f_ref&nbsp;= c*s_ref</code> lead to the same results of the two above-mentioned terms. Setting the advanced parameters <code>s_ref</code> and <code>f_ref</code> for a&nbsp;nonlinear spring directly gives a&nbsp;cleaner and straightforward parametrization. For simplicity reasons, both <code>s_ref</code> and <code>f_ref</code> are considered being positive. </p> <p> In the next figure, a typical simulation with the ElastoGap model is shown (<a href=\"modelica://Modelica.Mechanics.Translational.Examples.ElastoGap\">Examples.ElastoGap</a>) where the different effects are visualized: </p> <ol> <li> Curve 1 (elastoGap1.f) is the unmodified contact force, i.e., the linear spring/damper characteristic. A pulling/sticking force is present at the end of the contact.</li> <li> Curve 2 (elastoGap2.f) is the contact force, where the force is explicitly set to zero when pulling/sticking occurs. The contact force is discontinuous when contact starts.</li> <li> Curve 3 (elastoGap3.f) is the ElastoGap model of this library. No discontinuity and no pulling/sticking occurs.</li> </ol> <div> <img src=\"modelica://Modelica/Resources/Images/Mechanics/Translational/Components/ElastoGap.png\" alt=\"Elasto gap\"> </div> </html>"), Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{ 100,100}}), graphics={Line(points={{-98,0},{-48,0}}, color={0,127,0}), Line( points={{-48,36},{-48,-38}}, thickness=1, color={0,127,0}), Line( points={{-12,-38},{-12,36}}, thickness=1, color={0,127,0}),Line(points={{-12,-28},{70,-28},{70,24}}, color={0,127,0}), Line(points={{70,0},{98,0}}, color={0,127,0}), Line(points={{-12,24},{0,24},{6,34},{18,14},{30,34},{42,14},{54,34},{60,24},{70,24}}, color={0,127,0}), Rectangle( extent={{10,-6},{50,-50}}, fillColor={192,192,192}, fillPattern=FillPattern.Solid, lineColor={0,127,0}), Line(points={{-52,-70},{28,-70}}, color={95,127,95}), Polygon( points={{58,-70},{28,-60},{28,-80},{58,-70}}, lineColor={95,127,95}, fillColor={95,127,95}, fillPattern=FillPattern.Solid), Text( extent={{-150,100},{150,60}}, textString="%name", textColor={0,0,255}), Text( extent={{-150,-125},{150,-95}}, textString="c=%c"),Text( extent={{-150,-160},{150,-130}}, textString="d=%d"), Line( visible=useHeatPort, points={{-100,-100},{-100,-44},{22,-44},{22,-28}}, color={191,0,0}, pattern=LinePattern.Dot), Line(points={{0,-50},{50,-50},{50,-6},{0,-6}}, color={0,127,0})})); end ElastoGap;
Fixed flange. The <em>flange</em> of a 1D translational mechanical system <em>fixed</em> at an position s0 in the <em>housing</em>. May be used:
within Modelica.Mechanics.Translational.Components; model Fixed "Fixed flange" parameter SI.Position s0=0 "Fixed offset position of housing"; Interfaces.Flange_b flange equation flange.s = s0; end Fixed;
Signal adaptor for a Translational flange with position, speed, and acceleration as outputs and force as input (especially useful for FMUs). Adaptor between a flange connector and a signal representation of the flange. This component is used to provide a pure signal interface around a Translational model and export this model in form of an input/output block, especially as FMU (<a href=\"https://fmi-standard.org\">Functional Mock-up Unit</a>). Examples of the usage of this adaptor are provided in <a href=\"modelica://Modelica.Mechanics.Translational.Examples.GenerationOfFMUs\">Translational.Examples.GenerationOfFMUs</a>. This adaptor has force as input and position, velocity and acceleration as output signals.
within Modelica.Mechanics.Translational.Components; model GeneralForceToPositionAdaptor "Signal adaptor for a Translational flange with position, speed, and acceleration as outputs and force as input (especially useful for FMUs)" extends Modelica.Blocks.Interfaces.Adaptors.FlowToPotentialAdaptor( final Name_p="s", final Name_pder="v", final Name_pder2="a", final Name_f="f", final Name_fder="der(f)", final Name_fder2="der2(f)", final use_fder=false, final use_fder2=false, final p(unit="m"), final pder(unit="m/s"), final pder2(unit="m/s2"), final f(unit="N"), final fder(unit="N/s"), final fder2(unit="N/s2")); Modelica.Mechanics.Translational.Interfaces.Flange_a flange equation y = flange.s "output = potential = position"; u = flange.f "input = flow = force"; end GeneralForceToPositionAdaptor;
Signal adaptor for a Translational flange with force as output and position, speed and acceleration as input (especially useful for FMUs). Adaptor between a flange connector and a signal representation of the flange. This component is used to provide a pure signal interface around a Translational model and export this model in form of an input/output block, especially as FMU (<a href=\"https://fmi-standard.org\">Functional Mock-up Unit</a>). Examples of the usage of this adaptor are provided in <a href=\"modelica://Modelica.Mechanics.Translational.Examples.GenerationOfFMUs\">Translational.Examples.GenerationOfFMUs</a>. This adaptor has position, velocity and acceleration as input signals and force as output signal.
within Modelica.Mechanics.Translational.Components; model GeneralPositionToForceAdaptor "Signal adaptor for a Translational flange with force as output and position, speed and acceleration as input (especially useful for FMUs)" extends Modelica.Blocks.Interfaces.Adaptors.PotentialToFlowAdaptor( final Name_p="s", final Name_pder="v", final Name_pder2="a", final Name_f="f", final Name_fder="der(f)", final Name_fder2="der2(f)", final use_fder=false, final use_fder2=false, final p(unit="m"), final pder(unit="m/s"), final pder2(unit="m/s2"), final f(unit="N"), final fder(unit="N/s"), final fder2(unit="N/s2")); Modelica.Mechanics.Translational.Interfaces.Flange_b flange equation y = flange.f "output = flow = force"; u = flange.s "input = potential = position"; end GeneralPositionToForceAdaptor;
Gearbox transforming rotational into translational motion. Couples rotational and translational motion, like a toothed wheel with a toothed rack, specifying the ratio of rotational / translational motion.
within Modelica.Mechanics.Translational.Components; model IdealGearR2T "Gearbox transforming rotational into translational motion" extends Modelica.Mechanics.Rotational.Components.IdealGearR2T; end IdealGearR2T;
Simple 1-dim. model of an ideal rolling wheel without inertia. Couples rotational and translational motion, like an ideal rolling wheel, specifying the wheel radius.
within Modelica.Mechanics.Translational.Components; model IdealRollingWheel "Simple 1-dim. model of an ideal rolling wheel without inertia" extends Modelica.Mechanics.Rotational.Components.IdealRollingWheel; end IdealRollingWheel;
Initializes a flange with pre-defined position, speed and acceleration (usually, this is reference data from a control bus). This component is used to optionally initialize the position, speed, and/or acceleration of the flange to which this component is connected. Via parameters use_s_start, use_v_start, use_a_start the corresponding input signals s_start, v_start, a_start are conditionally activated. If an input is activated, the corresponding flange property is initialized with the input value at start time.
within Modelica.Mechanics.Translational.Components; model InitializeFlange "Initializes a flange with pre-defined position, speed and acceleration (usually, this is reference data from a control bus)" extends Modelica.Blocks.Icons.Block; parameter Boolean use_s_start=true "= true, if initial position is defined by input s_start, otherwise not initialized"; parameter Boolean use_v_start=true "= true, if initial speed is defined by input v_start, otherwise not initialized"; parameter Boolean use_a_start=true "= true, if initial acceleration is defined by input a_start, otherwise not initialized"; parameter StateSelect stateSelect=StateSelect.default "Priority to use flange angle and speed as states"; Modelica.Blocks.Interfaces.RealInput s_start(unit="m") if use_s_start "Initial position of flange" Modelica.Blocks.Interfaces.RealInput v_start(unit="m/s") if use_v_start "Initial speed of flange" Modelica.Blocks.Interfaces.RealInput a_start(unit="m/s2") if use_a_start "Initial angular acceleration of flange" Interfaces.Flange_b flange "Flange that is initialized" SI.Position s_flange(stateSelect=stateSelect) = flange.s "Flange position"; SI.Velocity v_flange(stateSelect=stateSelect) = der( s_flange) "= der(s_flange)"; protected encapsulated model Set_s_start "Set s_start" import Modelica; extends Modelica.Blocks.Icons.Block; Modelica.Blocks.Interfaces.RealInput s_start(unit="m") "Start position" Modelica.Mechanics.Translational.Interfaces.Flange_b flange initial equation flange.s = s_start; equation flange.f = 0; end Set_s_start; encapsulated model Set_v_start "Set v_start" import Modelica; extends Modelica.Blocks.Icons.Block; Modelica.Blocks.Interfaces.RealInput v_start(unit="m/s") "Start velocity" Modelica.Mechanics.Translational.Interfaces.Flange_b flange initial equation der(flange.s) = v_start; equation flange.f = 0; end Set_v_start; encapsulated model Set_a_start "Set a_start" import Modelica; extends Modelica.Blocks.Icons.Block; Modelica.Blocks.Interfaces.RealInput a_start(unit="m/s2") "Start acceleration" Modelica.Mechanics.Translational.Interfaces.Flange_b flange(s( stateSelect=StateSelect.avoid)) Modelica.Units.SI.Velocity v=der(flange.s) initial equation der(v) = a_start; equation flange.f = 0; end Set_a_start; encapsulated model Set_flange_f "Set flange_f to zero" import Modelica; extends Modelica.Blocks.Icons.Block; Modelica.Mechanics.Translational.Interfaces.Flange_b flange equation flange.f = 0; end Set_flange_f; protected Set_s_start set_s_start if use_s_start Set_v_start set_v_start if use_v_start Set_a_start set_a_start if use_a_start Set_flange_f set_flange_f equation connect(set_s_start.flange, flange) connect(set_v_start.flange, flange) connect(set_a_start.flange, flange) connect(set_flange_f.flange, flange) connect(s_start, set_s_start.s_start) connect(v_start, set_v_start.v_start) connect(a_start, set_a_start.a_start) end InitializeFlange;
Sliding mass with inertia. Sliding mass with <em>inertia, without friction</em> and two rigidly connected flanges.
within Modelica.Mechanics.Translational.Components; model Mass "Sliding mass with inertia" parameter SI.Mass m(min=0, start=1) "Mass of the sliding mass"; parameter StateSelect stateSelect=StateSelect.default "Priority to use s and v as states" extends Translational.Interfaces.PartialRigid(L=0,s(start=0, stateSelect= stateSelect)); SI.Velocity v(start=0, stateSelect=stateSelect) "Absolute velocity of component"; SI.Acceleration a(start=0) "Absolute acceleration of component"; equation v = der(s); a = der(v); m*a = flange_a.f + flange_b.f; end Mass;
Sliding mass with hard stop and Stribeck friction. Basic model for Coulomb friction that models the stuck phase in a reliable way.<br> Additionally, a left and right stop are handled.
within Modelica.Mechanics.Translational.Components; model MassWithStopAndFriction "Sliding mass with hard stop and Stribeck friction" extends PartialFrictionWithStop; SI.Velocity v(start=0, stateSelect=StateSelect.always) "Absolute velocity of flange_a and flange_b"; SI.Acceleration a(start=0) "Absolute acceleration of flange_a and flange_b"; parameter SI.Mass m(start=1) "Mass"; parameter Real F_prop( final unit="N.s/m", final min=0, start=1) "Velocity dependent friction"; parameter SI.Force F_Coulomb(start=5) "Constant friction: Coulomb force"; parameter SI.Force F_Stribeck(start=10) "Stribeck effect"; parameter Real fexp( final unit="s/m", final min=0, start=2) "Exponential decay"; extends Modelica.Thermal.HeatTransfer.Interfaces.PartialElementaryConditionalHeatPortWithoutT; Integer stopped "Mode of stop (-1: hard stop at flange_a, 0: no stop, +1: hard stop at flange_b"; encapsulated partial model PartialFrictionWithStop "Base model of Coulomb friction elements with stop" import Modelica; import Modelica.Mechanics.Translational.Interfaces.PartialRigid; parameter Modelica.Units.SI.Position smax(start=25) "Right stop for (right end of) sliding mass"; parameter Modelica.Units.SI.Position smin(start=-25) "Left stop for (left end of) sliding mass"; parameter Modelica.Units.SI.Velocity v_small=1e-3 "Relative velocity near to zero (see model info text)" // Equations to define the following variables have to be defined in subclasses Modelica.Units.SI.Velocity v_relfric "Relative velocity between frictional surfaces"; Modelica.Units.SI.Acceleration a_relfric "Relative acceleration between frictional surfaces"; Modelica.Units.SI.Force f "Friction force (positive, if directed in opposite direction of v_rel)"; Modelica.Units.SI.Force f0 "Friction force for v=0 and forward sliding"; Modelica.Units.SI.Force f0_max "Maximum friction force for v=0 and locked"; Boolean free "= true, if frictional element is not active"; // Equations to define the following variables are given in this class Real sa(unit="1") "Path parameter of friction characteristic f = f(a_relfric)"; Boolean startForward(start=false, fixed=true) "= true, if v_rel=0 and start of forward sliding or v_rel > v_small"; Boolean startBackward(start=false, fixed=true) "= true, if v_rel=0 and start of backward sliding or v_rel < -v_small"; Boolean locked(start=false) "= true, if v_rel=0 and not sliding"; extends PartialRigid(s(start=0, stateSelect=StateSelect.always)); constant Integer Unknown=3 "Value of mode is not known"; constant Integer Free=2 "Element is not active"; constant Integer Forward=1 "v_rel > 0 (forward sliding)"; constant Integer Stuck=0 "v_rel = 0 (forward sliding, locked or backward sliding)"; constant Integer Backward=-1 "v_rel < 0 (backward sliding)"; Integer mode( final min=Backward, final max=Unknown, start=Unknown, fixed=true) "Mode of friction (-1: backward sliding, 0: stuck, 1: forward sliding, 2: inactive, 3: unknown)"; protected constant Modelica.Units.SI.Acceleration unitAcceleration=1 constant Modelica.Units.SI.Force unitForce=1 equation /* Friction characteristic (locked is introduced to help the Modelica translator determining the different structural configurations, if for each configuration special code shall be generated) */ startForward = pre(mode) == Stuck and (sa > f0_max/unitForce and s < ( smax - L/2) or pre(startForward) and sa > f0/unitForce and s < (smax - L/2)) or pre(mode) == Backward and v_relfric > v_small or initial() and (v_relfric > 0); startBackward = pre(mode) == Stuck and (sa < -f0_max/unitForce and s > (smin + L/2) or pre(startBackward) and sa < -f0/unitForce and s > ( smin + L/2)) or pre(mode) == Forward and v_relfric < -v_small or initial() and (v_relfric < 0); locked = not free and not (pre(mode) == Forward or startForward or pre( mode) == Backward or startBackward); a_relfric/unitAcceleration = if locked then 0 else if free then sa else if startForward then sa - f0_max/unitForce else if startBackward then sa + f0_max/unitForce else if pre(mode) == Forward then sa - f0_max/unitForce else sa + f0_max/unitForce; /* Friction force "f" has to be defined in a subclass. Example for possible realization of friction utilizing interpolation by ExternalCombiTable1D see: Modelica.Mechanics.Translational.Components.SupportFriction */ // finite state machine to determine configuration mode = if free then Free else (if (pre(mode) == Forward or pre(mode) == Free or startForward) and v_relfric > 0 and s < (smax - L/2) then Forward else if (pre(mode) == Backward or pre(mode) == Free or startBackward) and v_relfric < 0 and s > (smin + L/2) then Backward else Stuck); end PartialFrictionWithStop; equation // Constant auxiliary variables f0 = (F_Coulomb + F_Stribeck); f0_max = f0*1.001; free = f0 <= 0 and F_prop <= 0 and s > smin + L/2 and s < smax - L/2; // Velocity and acceleration of flanges v = der(s); a = der(v); v_relfric = v; a_relfric = a; // Equilibrium of forces 0 = flange_a.f + flange_b.f - f - m*der(v); // Friction force f = if locked then sa*unitForce else if free then 0 else (if startForward then F_prop*v + F_Coulomb + F_Stribeck else if startBackward then F_prop*v - F_Coulomb - F_Stribeck else if pre(mode) == Forward then F_prop*v + F_Coulomb + F_Stribeck*Modelica.Math.exp(-fexp*abs(v)) else F_prop*v - F_Coulomb - F_Stribeck*Modelica.Math.exp(-fexp*abs(v))); lossPower = f*v_relfric; when (initial()) then assert(s > smin + L/2 or s >= smin + L/2 and v >= 0, "Error in initialization of hard stop. (s - L/2) must be >= smin\n" + "(s=" + String(s) + ", L=" + String(L) + ", smin=" + String(smin) + ")"); assert(s < smax - L/2 or s <= smax - L/2 and v <= 0, "Error in initialization of hard stop. (s + L/2) must be <= smax\n" + "(s=" + String(s) + ", L=" + String(L) + ", smax=" + String(smax) + ")"); end when; // Define events for hard stops and reinitialize the state variables velocity v and position s stopped = if s <= smin + L/2 then -1 else if s >= smax - L/2 then +1 else 0; when stopped <> 0 then reinit(s, if stopped < 0 then smin + L/2 else smax - L/2); reinit(v, 0); end when; /* Version 1: when not (s < smax - L/2) then reinit(s, smax - L/2); if (not initial() or v>0) then reinit(v, 0); end if; end when; when not (s > smin + L/2) then reinit(s, smin + L/2); if (not initial() or v<0) then reinit(v, 0); end if; end when; Version 2: stopped := if s <= smin + L/2 then -1 else if s >= smax - L/2 then +1 else 0; when (initial()) then assert(s > smin + L/2 or s >= smin + L/2 and v >= 0, "Error in initialization of hard stop. (s - L/2) must be >= smin\n"+ "(s=" + String(s) + ", L=" + String(L) + ", smin=" + String(smin) + ")"); assert(s < smax - L/2 or s <= smax - L/2 and v <= 0, "Error in initialization of hard stop. (s + L/2) must be <= smax\n"+ "(s=" + String(s) + ", L=" + String(L) + ", smax=" + String(smax) + ")"); end when; when stopped <> 0 then reinit(s, if stopped < 0 then smin + L/2 else smax - L/2); if (not initial() or stopped*v>0) then reinit(v, 0); end if; end when; */ end MassWithStopAndFriction;
Components for 1D translational mechanical drive trains
within Modelica.Mechanics.Translational; package Components "Components for 1D translational mechanical drive trains" extends Modelica.Icons.Package; end Components;
Definition of relative state variables. Usually, the absolute position and the absolute velocity of Modelica.Mechanics.Translational.Inertia models are used as state variables. In some circumstances, relative quantities are better suited, e.g., because it may be easier to supply initial values. In such cases, model <strong>RelativeStates</strong> allows the definition of state variables in the following way:
within Modelica.Mechanics.Translational.Components; model RelativeStates "Definition of relative state variables" extends Translational.Interfaces.PartialTwoFlanges; parameter StateSelect stateSelect=StateSelect.prefer "Priority to use the relative angle and relative speed as states"; SI.Position s_rel(start=0, stateSelect=StateSelect.prefer) "Relative position used as state variable"; SI.Velocity v_rel(start=0, stateSelect=StateSelect.prefer) "Relative velocity used as state variable"; SI.Acceleration a_rel(start=0) "Relative angular acceleration"; equation s_rel = flange_b.s - flange_a.s; v_rel = der(s_rel); a_rel = der(v_rel); flange_a.f = 0; flange_b.f = 0; end RelativeStates;
Rod without inertia. A translational rod <strong>without inertia</strong> and two rigidly connected flanges.
within Modelica.Mechanics.Translational.Components; model Rod "Rod without inertia" extends Translational.Interfaces.PartialRigid; equation 0 = flange_a.f + flange_b.f; end Rod;
Resistance of a rolling wheel. Simplified model of the resistance of a&nbsp;rolling wheel, dependent on vertical wheel load (due to gravity, i.e. static only), inclination and rolling resistance coefficient:
within Modelica.Mechanics.Translational.Components; model RollingResistance "Resistance of a rolling wheel" extends Modelica.Mechanics.Translational.Interfaces.PartialForce; import Modelica.Constants.pi; parameter SI.Force fWeight(start=0) "Wheel load due to gravity"; parameter Boolean useCrInput=false "Enable signal input for Cr"; parameter Real CrConstant=0.01 "Constant rolling resistance coefficient" parameter Boolean useInclinationInput=false "Enable signal input for inclination"; parameter Real inclinationConstant=0 "Constant inclination = tan(angle)" parameter Modelica.Blocks.Types.Regularization reg=Modelica.Blocks.Types.Regularization.Exp "Type of regularization" parameter SI.Velocity v0(final min=Modelica.Constants.eps)=0.1 "Regularization below v0"; SI.Velocity v "Velocity of flange with respect to support (= der(s))"; SI.Force f_nominal "Nominal rolling resistance without regularization"; Blocks.Interfaces.RealInput inclination = inclination_internal if useInclinationInput "Inclination=tan(angle)" Blocks.Interfaces.RealInput cr = Cr_internal if useCrInput "Rolling resistance coefficient" protected Real Cr_internal "Rolling resistance coefficient"; Real inclination_internal "Inclination"; equation if not useCrInput then Cr_internal = CrConstant; end if; if not useInclinationInput then inclination_internal = inclinationConstant; end if; v = der(s); f_nominal = -Cr_internal*fWeight*cos(atan(inclination_internal)); if reg==Modelica.Blocks.Types.Regularization.Exp then f = -f_nominal*(2/(1 + Modelica.Math.exp(-v/(0.01*v0)))-1); elseif reg==Modelica.Blocks.Types.Regularization.Sine then f = -f_nominal*smooth(1, (if abs(v)>=v0 then sign(v) else Modelica.Math.sin(pi/2*v/v0))); elseif reg==Modelica.Blocks.Types.Regularization.Linear then f = -f_nominal*(if abs(v)>=v0 then sign(v) else (v/v0)); else//if reg==Modelica.Blocks.Types.Regularization.CoSine f = -f_nominal*(if abs(v)>=v0 then sign(v) else sign(v)*(1 - Modelica.Math.cos(pi/2*v/v0))); end if; end RollingResistance;
Linear 1D translational spring. A <em>linear 1D translational spring</em>. The component can be connected either between two sliding masses, or between a sliding mass and the housing (model Fixed), to describe a coupling of the sliding mass with the housing via a spring.
within Modelica.Mechanics.Translational.Components; model Spring "Linear 1D translational spring" extends Translational.Interfaces.PartialCompliant; parameter SI.TranslationalSpringConstant c(final min=0, start=1) "Spring constant"; parameter SI.Distance s_rel0=0 "Unstretched spring length"; equation f = c*(s_rel - s_rel0); end Spring;
Linear 1D translational spring and damper in parallel. A <em>spring and damper element connected in parallel</em>. The component can be connected either between two sliding masses to describe the elasticity and damping, or between a sliding mass and the housing (model Fixed), to describe a coupling of the sliding mass with the housing via a spring/damper.
within Modelica.Mechanics.Translational.Components; model SpringDamper "Linear 1D translational spring and damper in parallel" extends Translational.Interfaces.PartialCompliantWithRelativeStates; parameter SI.TranslationalSpringConstant c(final min=0, start=1) "Spring constant"; parameter SI.TranslationalDampingConstant d(final min=0, start=1) "Damping constant"; parameter SI.Position s_rel0=0 "Unstretched spring length"; extends Modelica.Thermal.HeatTransfer.Interfaces.PartialElementaryConditionalHeatPortWithoutT; protected SI.Force f_c "Spring force"; SI.Force f_d "Damping force"; equation f_c = c*(s_rel - s_rel0); f_d = d*v_rel; f = f_c + f_d; lossPower = f_d*v_rel; end SpringDamper;
Coulomb friction in support. This element describes <strong>Coulomb friction</strong> in <strong>support</strong>, i.e., a frictional force acting between a flange and the housing. The positive sliding friction force \"f\" has to be defined by table \"f_pos\" as function of the absolute velocity \"v\". E.g.
within Modelica.Mechanics.Translational.Components; model SupportFriction "Coulomb friction in support" extends Modelica.Mechanics.Translational.Interfaces.PartialElementaryTwoFlangesAndSupport2; extends Modelica.Thermal.HeatTransfer.Interfaces.PartialElementaryConditionalHeatPortWithoutT; import Modelica.Blocks.Types.{ExternalCombiTable1D, Extrapolation, Smoothness}; import Modelica.Blocks.Tables.Internal.{getTable1DValue, getTable1DValueNoDer, getTable1DValueNoDer2}; parameter Real f_pos[:, 2]=[0, 1] "Positive sliding friction characteristic [N] as function of v [m/s] (v>=0)"; parameter Smoothness smoothness = Smoothness.LinearSegments "Smoothness of interpolation in f_pos table"; parameter Real peak(final min=1) = 1 "Peak for maximum friction force at v==0 (f0_max = peak*f_pos[1,2])"; extends Translational.Interfaces.PartialFriction; SI.Position s "= flange_a.s - support.s"; SI.Force f "Friction force"; SI.Velocity v "Absolute velocity of flange_a and flange_b"; SI.Acceleration a "Absolute acceleration of flange_a and flange_b"; protected final parameter ExternalCombiTable1D tableID = ExternalCombiTable1D( tableName="NoName", fileName="NoName", table=f_pos, columns={2}, smoothness=smoothness, extrapolation=Extrapolation.LastTwoPoints, verboseRead=false) "External table object for sliding friction coefficient"; Real table_signs[2] "Signs for sliding friction coefficient table interpolation: [sign for v, sign for f]"; equation assert(size(f_pos, 1) > 0 and size(f_pos, 2) > 0, "Parameter f_pos is an empty matrix"); // Constant auxiliary variables f0 = if smoothness == Smoothness.ConstantSegments then getTable1DValueNoDer(tableID, 1, 0) elseif smoothness == Smoothness.LinearSegments then getTable1DValueNoDer2(tableID, 1, 0) else getTable1DValue(tableID, 1, 0); f0_max = peak*f0; free = false; s = flange_a.s - s_support; flange_a.s = flange_b.s; // Velocity and acceleration of flanges v = der(s); a = der(v); v_relfric = v; a_relfric = a; // Force balance flange_a.f + flange_b.f - f = 0; // Friction force table_signs = if startForward then { 1, 1} elseif startBackward then {-1,-1} elseif pre(mode) == Forward then { 1, 1} else {-1,-1}; f = if locked then sa*unitForce else table_signs[2]*( if smoothness == Smoothness.ConstantSegments then getTable1DValueNoDer(tableID, 1, table_signs[1]*v) elseif smoothness == Smoothness.LinearSegments then getTable1DValueNoDer2(tableID, 1, table_signs[1]*v) else getTable1DValue(tableID, 1, table_signs[1]*v)); lossPower = f*v_relfric; end SupportFriction;
Simple vehicle model. This is a simple model of a&nbsp;ground vehicle, comprising the mass, the aerodynamic drag, the rolling resistance and the inclination resistance (caused by the road grade). For all particular resistances, significant variables can be either given by a&nbsp;parameter or input by a&nbsp;time-variable signal.
within Modelica.Mechanics.Translational.Components; model Vehicle "Simple vehicle model" parameter SI.Mass m "Total mass of vehicle"; parameter SI.Acceleration g=Modelica.Constants.g_n "Constant gravity acceleration"; parameter SI.Inertia J "Total rotational inertia of drive train"; parameter SI.Length R "Wheel radius"; parameter SI.Area A(start=1) "Cross section of vehicle" parameter Real Cd(start=0.5) "Drag resistance coefficient" parameter SI.Density rho=1.2 "Density of air" parameter Boolean useWindInput=false "Enable signal input for wind velocity" parameter SI.Velocity vWindConstant=0 "Constant wind velocity" parameter Boolean useCrInput=false "Enable signal input for Cr" parameter Real CrConstant=0.015 "Constant rolling resistance coefficient" parameter SI.Velocity vReg=1e-3 "Velocity for regularization around 0" parameter Boolean useInclinationInput=false "Enable signal input for inclination" parameter Real inclinationConstant=0 "Constant inclination = tan(angle)" SI.Position s(displayUnit="km", start=0)=mass.s "Position of vehicle"; SI.Velocity v(displayUnit="km/h", start=0)=mass.v "Velocity of vehicle"; SI.Acceleration a=mass.a "Acceleration of vehicle"; protected constant SI.Velocity vRef=1 "Reference velocity for air drag"; public Sources.QuadraticSpeedDependentForce fDrag( final useSupport=true, final f_nominal=-Cd*A*rho*vRef^2/2, final ForceDirection=false, final v_nominal=vRef) "Drag resistance" RollingResistance fRoll( final fWeight=m*g, final useCrInput=useCrInput, final CrConstant=CrConstant, final useInclinationInput=useInclinationInput, final inclinationConstant=inclinationConstant, final reg=Modelica.Blocks.Types.Regularization.Linear, final v0=vReg) "Rolling resistance" Sources.Force fGrav "Inclination resistance" Modelica.Mechanics.Translational.Interfaces.Flange_b flangeT "Translational flange" Modelica.Mechanics.Rotational.Interfaces.Flange_a flangeR "Rotational flange" Rotational.Components.Inertia inertia(final J=J) IdealRollingWheel idealRollingWheel(final radius=R) Mass mass(final m=m) Modelica.Blocks.Interfaces.RealInput inclination if useInclinationInput "Inclination=tan(angle)" Modelica.Blocks.Interfaces.RealInput cr if useCrInput "Rolling resistance coefficient" Modelica.Blocks.Interfaces.RealInput vWind(unit="m/s") if useWindInput "Wind velocity" Sources.Speed windSpeed(s(fixed=true)) Blocks.Math.Gain gravForceGain(final k=-m*g) protected Modelica.Blocks.Sources.Constant constInclination(k=inclinationConstant) if not useInclinationInput Modelica.Blocks.Sources.Constant constWindSpeed(k=vWindConstant) if not useWindInput public Blocks.Math.Atan atan Blocks.Math.Sin sin equation connect(idealRollingWheel.flangeT, mass.flange_a) connect(constWindSpeed.y, windSpeed.v_ref) connect(vWind, windSpeed.v_ref) connect(fDrag.support, windSpeed.flange) connect(mass.flange_b, flangeT) connect(sin.u, atan.y) connect(gravForceGain.u, sin.y) connect(gravForceGain.y, fGrav.f) connect(mass.flange_b, fDrag.flange) connect(mass.flange_b, fRoll.flange) connect(mass.flange_b, fGrav.flange) connect(inertia.flange_b, idealRollingWheel.flangeR) connect(flangeR, inertia.flange_a) connect(cr,fRoll.cr) connect(inclination, fRoll.inclination) connect(inclination, atan.u) connect(atan.u, constInclination.y) end Vehicle;
Use of model accelerate. Demonstrate usage of component <a href=\"modelica://Modelica.Mechanics.Translational.Sources.Accelerate\">Sources.Accelerate</a> by moving a mass with a predefined acceleration.
within Modelica.Mechanics.Translational.Examples; model Accelerate "Use of model accelerate" extends Modelica.Icons.Example; Translational.Sources.Accelerate accelerate Translational.Components.Mass mass(L=1, m=1) Modelica.Blocks.Sources.Constant constantAcc(k=1) equation connect(accelerate.flange, mass.flange_a) connect(constantAcc.y, accelerate.a_ref) end Accelerate;
Demonstrate braking of a translational moving mass. This model consists of a mass with an initial velocity of 1&nbsp;m/s. After 0.1&nbsp;s, a brake is activated and it is shown that the mass decelerates until it arrives at rest and remains at rest. Two versions of this system are present, one where the brake is implicitly grounded and one where it is grounded explicitly.
within Modelica.Mechanics.Translational.Examples; model Brake "Demonstrate braking of a translational moving mass" extends Modelica.Icons.Example; Modelica.Mechanics.Translational.Components.Brake brake(fn_max=1, useSupport=false) Modelica.Mechanics.Translational.Components.Mass mass1( m=1, s(fixed=true), v(start=1, fixed=true)) Modelica.Blocks.Sources.Step step(startTime=0.1, height=2) Modelica.Mechanics.Translational.Components.Brake brake1(fn_max=1, useSupport=true) Modelica.Mechanics.Translational.Components.Mass mass2( m=1, s(fixed=true), v(start=1, fixed=true)) Modelica.Mechanics.Translational.Components.Fixed fixed equation connect(mass1.flange_b, brake.flange_a) connect(step.y, brake.f_normalized) connect(mass2.flange_b, brake1.flange_a) connect(step.y, brake1.f_normalized) connect(fixed.flange, brake1.support) end Brake;
Compare different braking forces. Compare the effect of different braking forces on mass&apos; velocity (<code>massN.v</code>, N = {1, 2, 3, 4}):
within Modelica.Mechanics.Translational.Examples; model CompareBrakingForce "Compare different braking forces" extends Modelica.Icons.Example; parameter SI.Mass m=1 "Mass"; parameter SI.Velocity v_start=100 "Initial speed of mass"; parameter SI.Force f_nominal=100 "Nominal force"; parameter SI.Velocity v_nominal=abs(v_start) "Nominal speed"; parameter SI.Velocity v0=1 "Speed limit for regularization"; Modelica.Mechanics.Translational.Components.Mass mass1( m=m, s(fixed=true, start=0), v(fixed=true, start=v_start)) Modelica.Mechanics.Translational.Sources.SignForce signForce( f_nominal=-f_nominal, reg=Modelica.Blocks.Types.Regularization.Linear, v0=v0) Modelica.Mechanics.Translational.Components.Mass mass2( m=m, s(fixed=true, start=0), v(fixed=true, start=v_start)) Modelica.Mechanics.Translational.Sources.LinearSpeedDependentForce linearSpeedDependentForce( f_nominal=-f_nominal, ForceDirection=false, v_nominal=v_nominal) Modelica.Mechanics.Translational.Components.Mass mass3( m=m, s(fixed=true, start=0), v(fixed=true, start=v_start)) Modelica.Mechanics.Translational.Sources.QuadraticSpeedDependentForce quadraticSpeedDependentForce( f_nominal=-f_nominal, ForceDirection=false, v_nominal=v_nominal) Modelica.Mechanics.Translational.Components.Mass mass4( m=m, s(fixed=true, start=0), v(fixed=true, start=v_start)) Modelica.Mechanics.Translational.Sources.InverseSpeedDependentForce inverseSpeedDependentForce( f_nominal=-f_nominal, ForceDirection=false, v_nominal=v_nominal, v0=v0) equation connect(signForce.flange, mass1.flange_a) connect(linearSpeedDependentForce.flange, mass2.flange_a) connect(quadraticSpeedDependentForce.flange, mass3.flange_a) connect(inverseSpeedDependentForce.flange, mass4.flange_a) end CompareBrakingForce;
Use of damper models. Demonstrate usage of a translational damper component in various configurations.
within Modelica.Mechanics.Translational.Examples; model Damper "Use of damper models" extends Modelica.Icons.Example; Translational.Components.Mass mass1( L=1, s(start=3, fixed=true), v(start=10, fixed=true), m=1) Translational.Components.Damper damper1(d=25) Translational.Components.Fixed fixed1(s0=4.5) Translational.Components.Mass mass2( L=1, s(start=3, fixed=true), v(start=10, fixed=true), m=1) Translational.Components.Damper damper2(d=25) Translational.Components.Fixed fixed2(s0=4.5) Translational.Components.Mass mass3( L=1, s(start=3, fixed=true), v(start=10, fixed=true), m=1) Translational.Components.Fixed fixed3(s0=4.5) Translational.Components.Spring spring2(s_rel0=1, c=1) Translational.Components.SpringDamper springDamper3( s_rel0=1, d=25, c=1) equation connect(mass1.flange_b, damper1.flange_a) connect(mass2.flange_b, damper2.flange_a) connect(damper2.flange_b, spring2.flange_b) connect(damper2.flange_a, spring2.flange_a) connect(mass3.flange_b, springDamper3.flange_a) connect(damper1.flange_b, fixed1.flange) connect(damper2.flange_b, fixed2.flange) connect(springDamper3.flange_b, fixed3.flange) end Damper;
Demonstrate the usage of the translational eddy current brake.
within Modelica.Mechanics.Translational.Examples; model EddyCurrentBrake "Demonstrate the usage of the translational eddy current brake" extends Modelica.Icons.Example; Modelica.Mechanics.Translational.Sources.EddyCurrentForce eddyCurrentForce( useExcitationInput=true, f_nominal=100, v_nominal=10, useHeatPort=true, TRef=293.15, alpha20(displayUnit="1/K") = Modelica.Electrical.Machines.Thermal.Constants.alpha20Copper) Modelica.Mechanics.Translational.Components.Mass mass( m=1, s(fixed=true, start=0), v(fixed=true, start=20)) Modelica.Thermal.HeatTransfer.Components.HeatCapacitor heatCapacitor(C=1, T( fixed=true)) Blocks.Sources.Ramp ramp( height=1, duration=0.1, offset=0, startTime=0.1) equation connect(eddyCurrentForce.flange, mass.flange_a) connect(eddyCurrentForce.heatPort, heatCapacitor.port) connect(ramp.y, eddyCurrentForce.excitation) end EddyCurrentBrake;
Demonstrate usage of ElastoGap. This model demonstrates the effect of ElastoGaps on eigenfrequency: Plot mass1.s and mass2.s as well as mass1.v and mass2.v to see that effect.
within Modelica.Mechanics.Translational.Examples; model ElastoGap "Demonstrate usage of ElastoGap" extends Modelica.Icons.Example; Components.Fixed fixed Components.Rod rod1(L=2) Components.Rod rod2(L=2) Components.SpringDamper springDamper1( c=10, s_rel0=1, s_rel(fixed=false, start=1), d=1.5) Components.SpringDamper springDamper2( c=10, s_rel0=1, s_rel(fixed=false, start=1), d=1.5) Components.Mass mass1( s(fixed=true, start=2), L=0, m=1, v(fixed=true)) Components.ElastoGap elastoGap1( c=10, s_rel(fixed=false, start=1.5), s_rel0=1.5, d=1.5) Components.ElastoGap elastoGap2( c=10, s_rel(fixed=false, start=1.5), s_rel0=1.5, d=1.5) Components.Mass mass2( s(fixed=true, start=2), L=0, m=1, v(fixed=true)) parameter SI.TranslationalDampingConstant d=1.5 "Damping constant"; equation connect(rod1.flange_b, fixed.flange) connect(fixed.flange, rod2.flange_a) connect(springDamper1.flange_a, rod1.flange_a) connect(springDamper2.flange_b, rod2.flange_b) connect(springDamper1.flange_b, mass1.flange_a) connect(mass1.flange_b, springDamper2.flange_a) connect(rod1.flange_a, elastoGap1.flange_a) connect(rod2.flange_b, elastoGap2.flange_b) connect(elastoGap1.flange_b, mass2.flange_a) connect(mass2.flange_b, elastoGap2.flange_a) end ElastoGap;
Use of model Stop.
within Modelica.Mechanics.Translational.Examples; model Friction "Use of model Stop" extends Modelica.Icons.Example; Modelica.Mechanics.Translational.Components.MassWithStopAndFriction stop1( L=1, s(fixed=true), v(fixed=true), smax=25, smin=-25, m=1, F_prop=1, F_Coulomb=5, F_Stribeck=10, fexp=2) Translational.Sources.Force force Modelica.Blocks.Sources.Sine sineForce(amplitude=25, f=0.25) Modelica.Mechanics.Translational.Components.MassWithStopAndFriction stop2( L=1, smax=0.9, smin=-0.9, F_Coulomb=3, F_Stribeck=5, s(start=0, fixed=true), m=1, F_prop=1, fexp=2, v(start=-5, fixed=true)) Translational.Components.Spring spring(s_rel0=1, c=500) Translational.Components.Fixed fixed2(s0=-1.75) Translational.Sources.Force force2 Components.Mass mass( m=1, L=1, s(fixed=true), v(fixed=true)) Components.SupportFriction supportFriction(f_pos=Examples.Utilities.GenerateStribeckFrictionTable( F_prop=1, F_Coulomb=5, F_Stribeck=10, fexp=2, v_max=12, nTable=50)) equation connect(spring.flange_b, stop2.flange_a) connect(sineForce.y, force.f) connect(spring.flange_a, fixed2.flange) connect(force.flange, stop1.flange_a) connect(force2.flange, mass.flange_a) connect(mass.flange_b, supportFriction.flange_a) connect(sineForce.y, force2.f) end Friction;
Example to demonstrate variants to generate FMUs (Functional Mock-up Units). This example demonstrates how to generate an input/output block (e.g. in form of an FMU - <a href=\"https://fmi-standard.org\">Functional Mock-up Unit</a>) from various Translational components. The goal is to export such an input/output block from Modelica and import it in another modeling environment. The essential issue is that before exporting it must be known in which way the component is utilized in the target environment. Depending on the target usage, different flange variables need to be in the interface with either input or output causality. Note, this example model can be used to test the FMU export/import of a Modelica tool. Just export the components marked in the icons as \"toFMU\" as FMUs and import them back. The models should then still work and give the same results as a pure Modelica model.
within Modelica.Mechanics.Translational.Examples; model GenerationOfFMUs "Example to demonstrate variants to generate FMUs (Functional Mock-up Units)" extends Modelica.Icons.Example; Modelica.Blocks.Sources.Sine sine1(f=2, amplitude=10) Modelica.Mechanics.Translational.Examples.Utilities.DirectMass directMass( m=1.1) Modelica.Mechanics.Translational.Examples.Utilities.InverseMass inverseMass(m=2.2) Modelica.Mechanics.Translational.Examples.Utilities.SpringDamper springDamper(c=1e4, d=100) Modelica.Mechanics.Translational.Components.Mass mass2a( m=1.1, s(fixed=true, start=0), v(fixed=true, start=0)) Modelica.Mechanics.Translational.Sources.Force force2 Modelica.Mechanics.Translational.Components.GeneralForceToPositionAdaptor forceToPosition2a(use_pder2=false) Modelica.Mechanics.Translational.Components.Mass mass2b( m=2.2, s(fixed=true, start=0), v(fixed=true, start=0)) Modelica.Mechanics.Translational.Components.GeneralForceToPositionAdaptor forceToPosition2b(use_pder2=false) Modelica.Mechanics.Translational.Examples.Utilities.Spring spring(c=1e4) Modelica.Mechanics.Translational.Components.Mass mass3a( m=1.1, s(fixed=true, start=0), v(fixed=true, start=0)) Modelica.Mechanics.Translational.Sources.Force force3 Modelica.Mechanics.Translational.Components.GeneralForceToPositionAdaptor forceToPosition3a(use_pder=false, use_pder2=false) Modelica.Mechanics.Translational.Components.Mass mass3b( m=2.2, s(fixed=true, start=0), v(fixed=true, start=0)) Modelica.Mechanics.Translational.Components.GeneralForceToPositionAdaptor forceToPosition3b(use_pder=false, use_pder2=false) equation connect(sine1.y, directMass.fDrive) connect(directMass.s, inverseMass.s) connect(directMass.v,inverseMass.v) connect(directMass.a, inverseMass.a) connect(inverseMass.f, directMass.f) connect(force2.flange, mass2a.flange_a) connect(mass2a.flange_b, forceToPosition2a.flange) connect(forceToPosition2b.flange, mass2b.flange_a) connect(force3.flange, mass3a.flange_a) connect(mass3a.flange_b, forceToPosition3a.flange) connect(forceToPosition3b.flange, mass3b.flange_a) connect(forceToPosition2a.f, springDamper.f1) connect(springDamper.f2, forceToPosition2b.f) connect(forceToPosition3a.f, spring.f1) connect(spring.f2, forceToPosition3b.f) connect(forceToPosition3a.p, spring.s1) connect(spring.s2, forceToPosition3b.p) connect(forceToPosition2a.p, springDamper.s1) connect(forceToPosition2a.pder, springDamper.v1) connect(springDamper.s2, forceToPosition2b.p) connect(forceToPosition2b.pder, springDamper.v2) connect(sine1.y, force2.f) connect(sine1.y, force3.f) end GenerationOfFMUs;
Demonstrate the modeling of heat losses. This model demonstrates how to model the dissipated power of a Translational model, by enabling the heatPort of all components and connecting these heatPorts via a convection element to the environment. The total heat flow generated by the elements and transported to the environment is present in variable convection.fluid.
within Modelica.Mechanics.Translational.Examples; model HeatLosses "Demonstrate the modeling of heat losses" extends Modelica.Icons.Example; Components.Mass mass1( m=1, s(fixed=true), L=0.1, v(fixed=true)) Components.SpringDamper springDamper( s_rel(fixed=true), v_rel(fixed=true), c=100, d=10, useHeatPort=true) Components.Damper damper(d=10, useHeatPort=true) Components.ElastoGap elastoGap( c=100, d=20, s_rel0=-0.02, useHeatPort=true) Components.Fixed fixed1 Sources.Force force Blocks.Sources.Sine sine1(f=1, amplitude=20) Components.Mass mass2( m=1, L=0.1, s(fixed=false), v(fixed=false)) Components.SupportFriction supportFriction(useHeatPort=true) Components.Spring spring(c=100, s_rel(fixed=true)) Components.Mass mass3( m=1, L=0.1, s(fixed=false), v(fixed=true)) Components.Brake brake(fn_max=10, useHeatPort=true) Blocks.Sources.Sine sine2(amplitude=10, f=2) Components.MassWithStopAndFriction massWithStopAndFriction( L=0.1, m=1, F_prop=0.5, F_Coulomb=1, F_Stribeck=2, fexp=2, smin=0, smax=0.4, v(fixed=true), useHeatPort=true) Thermal.HeatTransfer.Components.Convection convection Blocks.Sources.Constant const(k=20) Thermal.HeatTransfer.Celsius.FixedTemperature TAmbient(T=25) "Ambient temperature" Components.Fixed fixed2 Components.SpringDamper springDamper1( c=10000, d=1000, useHeatPort=true, s_rel(fixed=true)) equation connect(mass1.flange_b, springDamper.flange_a) connect(sine1.y, force.f) connect(force.flange, mass1.flange_a) connect(mass1.flange_a, damper.flange_a) connect(damper.flange_b, fixed1.flange) connect(springDamper.flange_b, mass2.flange_a) connect(mass2.flange_b, supportFriction.flange_a) connect(supportFriction.flange_b, spring.flange_a) connect(spring.flange_b, mass3.flange_a) connect(mass3.flange_b, brake.flange_a) connect(sine2.y, brake.f_normalized) connect(elastoGap.flange_b, mass1.flange_a) connect(const.y, convection.Gc) connect(TAmbient.port, convection.fluid) connect(elastoGap.flange_a, fixed2.flange) connect(elastoGap.heatPort, convection.solid) connect(damper.heatPort, convection.solid) connect(springDamper.heatPort, convection.solid) connect(supportFriction.heatPort, convection.solid) connect(brake.heatPort, convection.solid) connect(massWithStopAndFriction.heatPort, convection.solid) connect(brake.flange_b, springDamper1.flange_a) connect(springDamper1.flange_b, massWithStopAndFriction.flange_a) connect(springDamper1.heatPort, convection.solid) end HeatLosses;