Lumped thermal element transporting heat without storing it. This is a model for transport of heat without storing it; see also:
ThermalResistor.
It may be used for complicated geometries where
the thermal conductance G (= inverse of thermal resistance)
is determined by measurements and is assumed to be constant
over the range of operations. If the component consists mainly of
one type of material and a regular geometry, it may be calculated,
e.g., with one of the following equations:

within Modelica.Thermal.HeatTransfer.Components;
model ThermalConductor
  "Lumped thermal element transporting heat without storing it"
  extends Interfaces.Element1D;
  parameter SI.ThermalConductance G
    "Constant thermal conductance of material";

equation
  Q_flow = G*dT;
end ThermalConductor;


Lumped thermal element transporting heat without storing it. This is a model for transport of heat without storing it, same as the
ThermalConductor
but using the thermal resistance instead of the thermal conductance as a parameter.
This is advantageous for series connections of ThermalResistors,
especially if it shall be allowed that a ThermalResistance is defined to be zero (i.e. no temperature difference).

within Modelica.Thermal.HeatTransfer.Components;
model ThermalResistor
  "Lumped thermal element transporting heat without storing it"
  extends Interfaces.Element1D;
  parameter SI.ThermalResistance R
    "Constant thermal resistance of material";

equation
  dT = R*Q_flow;
end ThermalResistor;


Control temperature of a resistor. A constant voltage of 10 V is applied to a
temperature dependent resistor of 10*(1+(T-20C)/(235+20C)) Ohms,
whose losses v**2/r are dissipated via a
thermal conductance of 0.1 W/K to ambient temperature 20 degree C.
The resistor is assumed to have a thermal capacity of 1 J/K,
having ambient temperature at the beginning of the experiment.
The temperature of this heating resistor is held by an OnOff controller
at reference temperature within a given bandwidth +/- 1 K
by switching on and off the voltage source.
The reference temperature starts at 25 degree C
and rises between t = 2 and 8 seconds linear to 50 degree C.
An appropriate simulating time would be 10 seconds.

within Modelica.Thermal.HeatTransfer.Examples;
model ControlledTemperature "Control temperature of a resistor"
  extends Modelica.Icons.Example;
  parameter SI.Temperature TAmb(displayUnit="degC") = 293.15
    "Ambient temperature";
  parameter SI.TemperatureDifference TDif = 2
    "Error in temperature";
  output SI.Temperature TRes(displayUnit="degC") = resistor.T_heatPort "Resulting temperature";
  Modelica.Electrical.Analog.Basic.Ground ground
  Modelica.Electrical.Analog.Sources.ConstantVoltage constantVoltage(V=10)
  HeatTransfer.Components.HeatCapacitor heatCapacitor(C=1, T(start=TAmb, fixed=
          true))
  Modelica.Electrical.Analog.Basic.Resistor resistor(
    R=10,
    T_ref=293.15,
    alpha=1/255,
    useHeatPort=true)
  HeatTransfer.Sources.FixedTemperature fixedTemperature(T=TAmb)
  HeatTransfer.Celsius.TemperatureSensor temperatureSensor
  HeatTransfer.Components.ThermalConductor thermalConductor(G=0.1)
  Modelica.Electrical.Analog.Ideal.IdealOpeningSwitch idealSwitch
  Modelica.Blocks.Sources.Ramp ramp(
    height=25,
    duration=6,
    offset=25,
    startTime=2)
  Modelica.Blocks.Logical.OnOffController onOffController(bandwidth=TDif)
  Modelica.Blocks.Logical.Not logicalNot
equation
  connect(constantVoltage.n, resistor.n)
  connect(constantVoltage.n, ground.p)
  connect(resistor.heatPort, thermalConductor.port_a)
  connect(thermalConductor.port_b, fixedTemperature.port)
  connect(resistor.heatPort, temperatureSensor.port)
  connect(resistor.heatPort, heatCapacitor.port)
  connect(constantVoltage.p, idealSwitch.p)
  connect(idealSwitch.n, resistor.p)
  connect(ramp.y, onOffController.reference)
  connect(temperatureSensor.T, onOffController.u)
  connect(onOffController.y, logicalNot.u)
  connect(logicalNot.y, idealSwitch.control)
end ControlledTemperature;


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 - Functional Mock-up Unit) from various HeatTransfer 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.Thermal.HeatTransfer.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=1000)
  HeatTransfer.Examples.Utilities.DirectCapacity directCapacity(C=1.1)
  HeatTransfer.Examples.Utilities.InverseCapacity inverseCapacity(C=2.2)
  HeatTransfer.Examples.Utilities.Conduction conductor(G=10)
  HeatTransfer.Components.HeatCapacitor capacitor3a(C=1.1, T(fixed=true, start=
          293.15))
  HeatTransfer.Sources.PrescribedHeatFlow heatFlow3
  HeatTransfer.Components.GeneralHeatFlowToTemperatureAdaptor heatFlowToTemperature3a(use_pder=
        false)
  HeatTransfer.Components.HeatCapacitor capacitor3b(C=2.2, T(fixed=true, start=
          293.15))
  HeatTransfer.Components.GeneralHeatFlowToTemperatureAdaptor heatFlowToTemperature3b(use_pder=
        false)
equation
  connect(sine1.y, directCapacity.Q_flowDrive)
  connect(directCapacity.T, inverseCapacity.T)
  connect(inverseCapacity.Q_flow, directCapacity.Q_flow)
  connect(heatFlowToTemperature3a.f, conductor.Q_flow1)
  connect(conductor.Q_flow2,heatFlowToTemperature3b. f)
  connect(heatFlowToTemperature3a.p, conductor.T1)
  connect(conductor.T2,heatFlowToTemperature3b. p)
  connect(sine1.y, heatFlow3.Q_flow)
  connect(heatFlow3.port, capacitor3a.port)
  connect(capacitor3a.port,heatFlowToTemperature3a. heatPort)
  connect(heatFlowToTemperature3b.heatPort, capacitor3b.port)
  connect(directCapacity.derT, inverseCapacity.derT)
end GenerationOfFMUs;


Second order thermal model of a motor. This example contains a simple second order thermal model of a motor.
The periodic power losses are described by table \"lossTable\":

within Modelica.Thermal.HeatTransfer.Examples;
model Motor "Second order thermal model of a motor"
  extends Modelica.Icons.Example;
  parameter SI.Temperature TAmb(displayUnit="degC") = 293.15
    "Ambient temperature";

  Modelica.Blocks.Sources.CombiTimeTable lossTable(
    extrapolation=Modelica.Blocks.Types.Extrapolation.Periodic,
    smoothness=Modelica.Blocks.Types.Smoothness.ConstantSegments,
    table=[0,100,500; 360,1000,500; 600,100,500])
  HeatTransfer.Sources.PrescribedHeatFlow windingLosses(T_ref=368.15, alpha=
        3.03E-3)
  HeatTransfer.Components.HeatCapacitor winding(C=2500, T(start=TAmb, fixed=
          true))
  HeatTransfer.Celsius.TemperatureSensor Twinding
  HeatTransfer.Components.ThermalConductor winding2core(G=10)
  HeatTransfer.Sources.PrescribedHeatFlow coreLosses
  HeatTransfer.Components.HeatCapacitor core(C=25000, T(start=TAmb, fixed=true))
  HeatTransfer.Celsius.TemperatureSensor Tcore
  Modelica.Blocks.Sources.Constant convectionConstant(k=25)
  HeatTransfer.Components.Convection convection
  HeatTransfer.Sources.FixedTemperature environment(T=TAmb)
equation
  connect(windingLosses.port, winding.port)
  connect(coreLosses.port, core.port)
  connect(winding.port, winding2core.port_a)
  connect(winding2core.port_b, core.port)
  connect(winding.port, Twinding.port)
  connect(core.port, Tcore.port)
  connect(winding2core.port_b, convection.solid)
  connect(convection.fluid, environment.port)
  connect(convectionConstant.y, convection.Gc)
  connect(lossTable.y[1], windingLosses.Q_flow)
  connect(lossTable.y[2], coreLosses.Q_flow)
end Motor;


within Modelica.Thermal.HeatTransfer;
package Examples "Example models to demonstrate the usage of package Modelica.Thermal.HeatTransfer"
  extends Modelica.Icons.ExamplesPackage;
end Examples;


Simple conduction demo. This example demonstrates the thermal response of two masses connected by
a conducting element. The two masses have the same heat capacity but different
initial temperatures (T1=100 [degC], T2= 0 [degC]). The mass with the higher
temperature will cool off while the mass with the lower temperature heats up.
They will each asymptotically approach the calculated temperature T_final_K
(T_final_degC) that results from dividing the total initial energy in the system by the sum
of the heat capacities of each element.

within Modelica.Thermal.HeatTransfer.Examples;
model TwoMasses "Simple conduction demo"
  extends Modelica.Icons.Example;
  parameter SI.Temperature T_final_K(fixed=false)
    "Projected final temperature";
  HeatTransfer.Components.HeatCapacitor mass1(C=15, T(start=373.15, fixed=true))
  HeatTransfer.Components.HeatCapacitor mass2(C=15, T(start=273.15, fixed=true))
  HeatTransfer.Components.ThermalConductor conduction(G=10)
  HeatTransfer.Celsius.TemperatureSensor Tsensor1
  HeatTransfer.Celsius.TemperatureSensor Tsensor2
equation
  connect(mass1.port, conduction.port_a)
  connect(conduction.port_b, mass2.port)
  connect(mass1.port, Tsensor1.port)
  connect(mass2.port, Tsensor2.port)
initial equation
  T_final_K = (mass1.T*mass1.C + mass2.T*mass2.C)/(mass1.C + mass2.C);
end TwoMasses;


Input/output block of a conduction model.

within Modelica.Thermal.HeatTransfer.Examples.Utilities;
model Conduction "Input/output block of a conduction model"
  extends Modelica.Blocks.Icons.Block;
  parameter SI.ThermalConductance G=1 "Thermal conductance";
  HeatTransfer.Components.GeneralTemperatureToHeatFlowAdaptor temperatureToHeatFlow1(use_pder=
        false)
  Modelica.Blocks.Interfaces.RealInput T1(unit="K", displayUnit="degC")
    "Temperature of left heatPort of conduction element"
  Modelica.Blocks.Interfaces.RealOutput Q_flow1(unit="W")
    "Heat flow generated by the conduction element"
  HeatTransfer.Components.ThermalConductor thermalConductor(G=G)
  Modelica.Blocks.Interfaces.RealInput T2(unit="K", displayUnit="degC")
    "Temperature of right heatPort of conduction element"
  Modelica.Blocks.Interfaces.RealOutput Q_flow2(unit="W")
    "Heat flow generated by the conduction element"
  HeatTransfer.Components.GeneralTemperatureToHeatFlowAdaptor temperatureToHeatFlow2(use_pder=
        false)
equation

  connect(Q_flow1,temperatureToHeatFlow1. f)
  connect(temperatureToHeatFlow2.f, Q_flow2)
  connect(temperatureToHeatFlow1.p, T1)
  connect(temperatureToHeatFlow2.p, T2)
  connect(temperatureToHeatFlow1.heatPort, thermalConductor.port_a)
  connect(thermalConductor.port_b,temperatureToHeatFlow2. heatPort)
end Conduction;


Input/output block of a direct heatCapacity model.

within Modelica.Thermal.HeatTransfer.Examples.Utilities;
model DirectCapacity
  "Input/output block of a direct heatCapacity model"
  extends Modelica.Blocks.Icons.Block;
  parameter SI.HeatCapacity C(min=0)=1 "HeatCapacity";
  HeatTransfer.Components.HeatCapacitor heatCapacitor(C=C, T(fixed=true, start=
          293.15))
  HeatTransfer.Sources.PrescribedHeatFlow forceSource
  Modelica.Blocks.Interfaces.RealInput Q_flowDrive(unit="W")
  HeatTransfer.Components.GeneralHeatFlowToTemperatureAdaptor heatFlowToTemperature(use_pder=
        true)
  Modelica.Blocks.Interfaces.RealOutput T(unit="K", displayUnit="degC")
    "Heat capacity changes temperature T due to heat flow Q_flow"
  Modelica.Blocks.Interfaces.RealOutput derT(unit="K/s")
    "Heat capacity changes temperature T due to heat flow Q_flow"
  Modelica.Blocks.Interfaces.RealInput Q_flow(unit="W")
    "Heat flow to the heat capacity"
equation
  connect(heatFlowToTemperature.f, Q_flow)
  connect(heatFlowToTemperature.p, T)
  connect(heatFlowToTemperature.pder, derT)
  connect(heatCapacitor.port,heatFlowToTemperature. heatPort)
  connect(Q_flowDrive, forceSource.Q_flow)
  connect(heatCapacitor.port, forceSource.port)
end DirectCapacity;


Input/output block of an inverse heatCapacity model.

within Modelica.Thermal.HeatTransfer.Examples.Utilities;
model InverseCapacity
  "Input/output block of an inverse heatCapacity model"
  extends Modelica.Blocks.Icons.Block;
  parameter SI.HeatCapacity C(min=0)=1 "HeatCapacity";
  HeatTransfer.Components.HeatCapacitor mass(C=C, T(fixed=true, start=293.15))
  HeatTransfer.Components.GeneralTemperatureToHeatFlowAdaptor temperatureToHeatFlow
  Modelica.Blocks.Interfaces.RealInput T(unit="K", displayUnit="degC")
    "Temperature to drive the heatCapacity"
  Modelica.Blocks.Interfaces.RealInput derT(unit="K/s")
    "Temperature to drive the heatCapacity"
  Modelica.Blocks.Interfaces.RealOutput Q_flow(unit="W")
    "Heat flow needed to drive the heatPort according to T, derT"
equation

  connect(temperatureToHeatFlow.f, Q_flow)
  connect(temperatureToHeatFlow.p, T)
  connect(temperatureToHeatFlow.pder, derT)
  connect(temperatureToHeatFlow.heatPort, mass.port)
end InverseCapacity;


within Modelica.Thermal.HeatTransfer.Examples;
package Utilities "Utility classes used by the Example models"
  extends Modelica.Icons.UtilitiesPackage;
end Utilities;


Fixed temperature boundary condition in degFahrenheit. This model defines a fixed temperature T at its port in [degF],
i.e., it defines a fixed temperature as a boundary condition.

within Modelica.Thermal.HeatTransfer.Fahrenheit;
model FixedTemperature
  "Fixed temperature boundary condition in degFahrenheit"
  extends HeatTransfer.Icons.FixedTemperature;
  parameter Modelica.Units.NonSI.Temperature_degF T
    "Fixed temperature at the port";
  Interfaces.HeatPort_b port
equation
  port.T = Modelica.Units.Conversions.from_degF(T);
end FixedTemperature;


Conversion from Kelvin to degree Fahrenheit. This component converts all input signals from Kelvin to Fahrenheit
and provides them as output signals.

within Modelica.Thermal.HeatTransfer.Fahrenheit;
model FromKelvin "Conversion from Kelvin to degree Fahrenheit"
  extends HeatTransfer.Icons.Conversion;
  Modelica.Blocks.Interfaces.RealInput Kelvin(unit="K")
  Modelica.Blocks.Interfaces.RealOutput Fahrenheit(unit="degF")
equation
  Fahrenheit = Modelica.Units.Conversions.to_degF(Kelvin);
end FromKelvin;


within Modelica.Thermal.HeatTransfer;
package Fahrenheit "Components with Fahrenheit input and/or output"
  extends Modelica.Icons.VariantsPackage;
</pre></blockquote>
</html>"));
end Fahrenheit;


Variable temperature boundary condition in degFahrenheit. This model represents a variable temperature boundary condition
The temperature value in [degF] is given by the input signal
to the model. The effect is that an instance of this model acts as
an infinite reservoir able to absorb or generate as much energy
as required to keep the temperature at the specified value.

within Modelica.Thermal.HeatTransfer.Fahrenheit;
model PrescribedTemperature
  "Variable temperature boundary condition in degFahrenheit"
  extends HeatTransfer.Icons.PrescribedTemperature;
  Interfaces.HeatPort_b port
  Modelica.Blocks.Interfaces.RealInput T(unit="degF")
equation
  port.T = Modelica.Units.Conversions.from_degF(T);
end PrescribedTemperature;


Absolute temperature sensor in degFahrenheit. This is an ideal absolute temperature sensor which returns
the temperature of the connected port in Fahrenheit as an output
signal.  The sensor itself has no thermal interaction with
whatever it is connected to.  Furthermore, no
thermocouple-like lags are associated with this
sensor model.

within Modelica.Thermal.HeatTransfer.Fahrenheit;
model TemperatureSensor "Absolute temperature sensor in degFahrenheit"

  Modelica.Blocks.Interfaces.RealOutput T
  Interfaces.HeatPort_a port
equation
  T = Modelica.Units.Conversions.to_degF(port.T);
  port.Q_flow = 0;
end TemperatureSensor;


Conversion from degree Fahrenheit to Kelvin. This component converts a input signal from degree Fahrenheit to Kelvin
and provides is as output signal.

within Modelica.Thermal.HeatTransfer.Fahrenheit;
model ToKelvin "Conversion from degree Fahrenheit to Kelvin"
  extends HeatTransfer.Icons.Conversion;
  Modelica.Blocks.Interfaces.RealInput Fahrenheit(unit="degF")
  Modelica.Blocks.Interfaces.RealOutput Kelvin(unit="K")
equation
  Kelvin = Modelica.Units.Conversions.from_degF(Fahrenheit);
end ToKelvin;


Conversion of temperatures. This icon represents part of a temperature conversion model.

within Modelica.Thermal.HeatTransfer.Icons;
model Conversion "Conversion of temperatures"
end Conversion;


Icon of fixed temperature source. This icon represents a fixed temperature source model.

within Modelica.Thermal.HeatTransfer.Icons;
model FixedTemperature "Icon of fixed temperature source"
end FixedTemperature;


Icons

within Modelica.Thermal.HeatTransfer;
package Icons "Icons"
  extends Modelica.Icons.IconsPackage;
end Icons;


Icon of prescribed temperature source. This icon represents a prescribed temperature source model.

within Modelica.Thermal.HeatTransfer.Icons;
model PrescribedTemperature "Icon of prescribed temperature source"
  extends FixedTemperature;
end PrescribedTemperature;


Partial heat transfer element with two HeatPort connectors that does not store energy. This partial model contains the basic connectors and variables to
allow heat transfer models to be created that do not store energy,
This model defines and includes equations for the temperature
drop across the element, dT, and the heat flow rate
through the element from port_a to port_b, Q_flow.

within Modelica.Thermal.HeatTransfer.Interfaces;
partial model Element1D
  "Partial heat transfer element with two HeatPort connectors that does not store energy"

  SI.HeatFlowRate Q_flow
    "Heat flow rate from port_a -> port_b";
  SI.TemperatureDifference dT "port_a.T - port_b.T";
public
  HeatPort_a port_a
  HeatPort_b port_b
equation
  dT = port_a.T - port_b.T;
  port_a.Q_flow = Q_flow;
  port_b.Q_flow = -Q_flow;
end Element1D;


Thermal port for 1-dim. heat transfer (filled rectangular icon). This connector is used for 1-dimensional heat flow between components.
The variables in the connector are:

within Modelica.Thermal.HeatTransfer.Interfaces;
connector HeatPort_a
  "Thermal port for 1-dim. heat transfer (filled rectangular icon)"

  extends HeatPort;
end HeatPort_a;


Thermal port for 1-dim. heat transfer (unfilled rectangular icon). This connector is used for 1-dimensional heat flow between components.
The variables in the connector are:

within Modelica.Thermal.HeatTransfer.Interfaces;
connector HeatPort_b
  "Thermal port for 1-dim. heat transfer (unfilled rectangular icon)"

  extends HeatPort;
end HeatPort_b;


Connectors and partial models

within Modelica.Thermal.HeatTransfer;
package Interfaces "Connectors and partial models"
  extends Modelica.Icons.InterfacesPackage;
end Interfaces;


Partial model to include a conditional HeatPort in order to dissipate losses, used for graphical modeling, i.e., for building models by drag-and-drop. This partial model provides a conditional heat port for dissipating losses.

within Modelica.Thermal.HeatTransfer.Interfaces;
partial model PartialConditionalHeatPort
  "Partial model to include a conditional HeatPort in order to dissipate losses, used for graphical modeling, i.e., for building models by drag-and-drop"
  parameter Boolean useHeatPort = false "= true, if HeatPort is enabled"
  parameter SI.Temperature T=293.15
    "Fixed device temperature if useHeatPort = false"
  HeatTransfer.Interfaces.HeatPort_a heatPort if useHeatPort
    "Optional port to which dissipated losses are transported in form of heat"
  HeatTransfer.Sources.FixedTemperature fixedTemperature(final T=T) if not
    useHeatPort
protected
  HeatPort_a internalHeatPort
equation
  connect(heatPort, internalHeatPort)
  connect(fixedTemperature.port, internalHeatPort)
end PartialConditionalHeatPort;


Partial model to include a conditional HeatPort in order to dissipate losses, used for textual modeling, i.e., for elementary models. This partial model provides a conditional heat port for dissipating losses.

within Modelica.Thermal.HeatTransfer.Interfaces;
partial model PartialElementaryConditionalHeatPort
  "Partial model to include a conditional HeatPort in order to dissipate losses, used for textual modeling, i.e., for elementary models"
  parameter Boolean useHeatPort = false "= true, if heatPort is enabled"
  parameter SI.Temperature T=293.15
    "Fixed device temperature if useHeatPort = false"
  HeatTransfer.Interfaces.HeatPort_a heatPort(final T=TheatPort, final Q_flow=-
        lossPower) if useHeatPort
    "Optional port to which dissipated losses are transported in form of heat"
  SI.Power lossPower
    "Loss power leaving component via heatPort (> 0, if heat is flowing out of component)";
  SI.Temperature TheatPort "Temperature of heatPort";
equation
  if not useHeatPort then
     TheatPort = T;
  end if;
end PartialElementaryConditionalHeatPort;


within Modelica.Thermal.HeatTransfer.Interfaces;
partial model PartialElementaryConditionalHeatPortWithoutT
  "Partial model to include a conditional HeatPort in order to dissipate losses, used for textual modeling, i.e., for elementary models"
  parameter Boolean useHeatPort = false "= true, if heatPort is enabled"
  HeatTransfer.Interfaces.HeatPort_a heatPort(final Q_flow=-lossPower) if
    useHeatPort
    "Optional port to which dissipated losses are transported in form of heat"
  SI.Power lossPower
    "Loss power leaving component via heatPort (> 0, if heat is flowing out of component)";
end PartialElementaryConditionalHeatPortWithoutT;


Fixed temperature boundary condition in degRankine. This model defines a fixed temperature T at its port in degree Rankine,
[degRk], i.e., it defines a fixed temperature as a boundary condition.

within Modelica.Thermal.HeatTransfer.Rankine;
model FixedTemperature "Fixed temperature boundary condition in degRankine"
  extends HeatTransfer.Icons.FixedTemperature;
  parameter Modelica.Units.NonSI.Temperature_degRk T
    "Fixed Temperature at the port";
  Interfaces.HeatPort_b port
equation
  port.T = Modelica.Units.Conversions.from_degRk(T);
end FixedTemperature;


Conversion from Kelvin to degree Rankine. This component converts all input signals from Kelvin to Rankine
and provides them as output signals.

within Modelica.Thermal.HeatTransfer.Rankine;
model FromKelvin "Conversion from Kelvin to degree Rankine"
  extends HeatTransfer.Icons.Conversion;
  Modelica.Blocks.Interfaces.RealInput Kelvin(unit="K")
  Modelica.Blocks.Interfaces.RealOutput Rankine(unit="degRk")
equation
  Rankine = Modelica.Units.Conversions.to_degRk(Kelvin);
end FromKelvin;


within Modelica.Thermal.HeatTransfer;
package Rankine "Components with Rankine input and/or output"
  extends Modelica.Icons.VariantsPackage;
</pre></blockquote>
</html>"));
end Rankine;


Variable temperature boundary condition in degRankine. This model represents a variable temperature boundary condition
The temperature value in degree Rankine, [degRk] is given by the input signal
to the model. The effect is that an instance of this model acts as
an infinite reservoir able to absorb or generate as much energy
as required to keep the temperature at the specified value.

within Modelica.Thermal.HeatTransfer.Rankine;
model PrescribedTemperature
  "Variable temperature boundary condition in degRankine"
  extends HeatTransfer.Icons.PrescribedTemperature;
  Interfaces.HeatPort_b port
  Modelica.Blocks.Interfaces.RealInput T(unit="degRk")
equation
  port.T = Modelica.Units.Conversions.from_degRk(T);
end PrescribedTemperature;


Absolute temperature sensor in degRankine. This is an ideal absolute temperature sensor which returns
the temperature of the connected port in Rankine as an output
signal.  The sensor itself has no thermal interaction with
whatever it is connected to.  Furthermore, no
thermocouple-like lags are associated with this
sensor model.

within Modelica.Thermal.HeatTransfer.Rankine;
model TemperatureSensor "Absolute temperature sensor in degRankine"

  Modelica.Blocks.Interfaces.RealOutput T
  Interfaces.HeatPort_a port
equation
  T = Modelica.Units.Conversions.to_degRk(port.T);
  port.Q_flow = 0;
end TemperatureSensor;


Conversion from degree Rankine to Kelvin. This component converts all input signals from degree Rankine to Kelvin
and provides them as output signals.

within Modelica.Thermal.HeatTransfer.Rankine;
model ToKelvin "Conversion from degree Rankine to Kelvin"
  extends HeatTransfer.Icons.Conversion;
  Modelica.Blocks.Interfaces.RealInput Rankine(unit="degRk")
  Modelica.Blocks.Interfaces.RealOutput Kelvin(unit="K")
equation
  Kelvin = Modelica.Units.Conversions.from_degRk(Rankine);
end ToKelvin;


HeatFlowSensor, conditional fixed temperature. If useFixedTemperature = false, this sensor acts just as a normal
HeatFlowSensor.

within Modelica.Thermal.HeatTransfer.Sensors;
model ConditionalFixedHeatFlowSensor
  "HeatFlowSensor, conditional fixed temperature"
  extends Modelica.Icons.RoundSensor;
  parameter Boolean useFixedTemperature(start=false)
    "Fixed temperature if true"
  HeatTransfer.Interfaces.HeatPort_a port_a
  HeatTransfer.Interfaces.HeatPort_b port_b
  HeatTransfer.Sensors.HeatFlowSensor heatFlowSensor
  HeatTransfer.Sources.FixedTemperature fixedTemperature(final T(displayUnit=
          "K") = 293.15) if useFixedTemperature
  Modelica.Blocks.Interfaces.RealOutput Q_flow(unit="W")
    "Heat flow from port_a to port_b as output signal"
equation
  connect(heatFlowSensor.port_b, port_b)
  connect(port_a, heatFlowSensor.port_a)
  connect(fixedTemperature.port, heatFlowSensor.port_a)
  connect(heatFlowSensor.Q_flow, Q_flow)
end ConditionalFixedHeatFlowSensor;


Heat flow rate sensor. This model is capable of monitoring the heat flow rate flowing through
this component. The sensed value of heat flow rate is the amount that
passes through this sensor while keeping the temperature drop across the
sensor zero.  This is an ideal model so it does not absorb any energy
and it has no direct effect on the thermal response of a system it is included in.
The output signal is positive, if the heat flows from port_a to port_b.

within Modelica.Thermal.HeatTransfer.Sensors;
model HeatFlowSensor "Heat flow rate sensor"
  extends Modelica.Icons.RoundSensor;
  Modelica.Blocks.Interfaces.RealOutput Q_flow(unit="W")
    "Heat flow from port_a to port_b as output signal"
  Interfaces.HeatPort_a port_a
  Interfaces.HeatPort_b port_b
equation
  port_a.T = port_b.T;
  port_a.Q_flow + port_b.Q_flow = 0;
  Q_flow = port_a.Q_flow;
end HeatFlowSensor;


Thermal sensors

within Modelica.Thermal.HeatTransfer;
package Sensors "Thermal sensors"
  extends Modelica.Icons.SensorsPackage;
end Sensors;


Relative temperature sensor. The relative temperature \"port_a.T - port_b.T\" is determined between
the two ports of this component and is provided as output signal in Kelvin.

within Modelica.Thermal.HeatTransfer.Sensors;
model RelTemperatureSensor "Relative temperature sensor"
  extends Modelica.Icons.RectangularSensor;
  Interfaces.HeatPort_a port_a
  Interfaces.HeatPort_b port_b
  Modelica.Blocks.Interfaces.RealOutput T_rel(unit="K", displayUnit="K")
    "Relative temperature as output signal"
equation
  T_rel = port_a.T - port_b.T;
  0 = port_a.Q_flow;
  0 = port_b.Q_flow;
end RelTemperatureSensor;


Absolute temperature sensor in Kelvin. This is an ideal absolute temperature sensor which returns
the temperature of the connected port in Kelvin as an output
signal.  The sensor itself has no thermal interaction with
whatever it is connected to.  Furthermore, no
thermocouple-like lags are associated with this
sensor model.

within Modelica.Thermal.HeatTransfer.Sensors;
model TemperatureSensor "Absolute temperature sensor in Kelvin"

  Modelica.Blocks.Interfaces.RealOutput T(unit="K")
    "Absolute temperature as output signal"
  Interfaces.HeatPort_a port
equation
  T = port.T;
  port.Q_flow = 0;
end TemperatureSensor;


Fixed heat flow boundary condition. This model allows a specified amount of heat flow rate to be \"injected\"
into a thermal system at a given port.  The constant amount of heat
flow rate Q_flow is given as a parameter. The heat flows into the
component to which the component FixedHeatFlow is connected,
if parameter Q_flow is positive.

within Modelica.Thermal.HeatTransfer.Sources;
model FixedHeatFlow "Fixed heat flow boundary condition"
  parameter SI.HeatFlowRate Q_flow
    "Fixed heat flow rate at port";
  parameter SI.Temperature T_ref=293.15
    "Reference temperature";
  parameter SI.LinearTemperatureCoefficient alpha=0
    "Temperature coefficient of heat flow rate";
  Interfaces.HeatPort_b port
equation
  port.Q_flow = -Q_flow*(1 + alpha*(port.T - T_ref));
end FixedHeatFlow;


Fixed temperature boundary condition in Kelvin. This model defines a fixed temperature T at its port in Kelvin,
i.e., it defines a fixed temperature as a boundary condition.

within Modelica.Thermal.HeatTransfer.Sources;
model FixedTemperature "Fixed temperature boundary condition in Kelvin"

  parameter SI.Temperature T "Fixed temperature at port";
  Interfaces.HeatPort_b port
equation
  port.T = T;
end FixedTemperature;


Thermal sources

within Modelica.Thermal.HeatTransfer;
package Sources "Thermal sources"
  extends Modelica.Icons.SourcesPackage;
end Sources;


Prescribed heat flow boundary condition. This model allows a specified amount of heat flow rate to be \"injected\"
into a thermal system at a given port.  The amount of heat
is given by the input signal Q_flow into the model. The heat flows into the
component to which the component PrescribedHeatFlow is connected,
if the input signal is positive.

within Modelica.Thermal.HeatTransfer.Sources;
model PrescribedHeatFlow "Prescribed heat flow boundary condition"
  parameter SI.Temperature T_ref=293.15
    "Reference temperature";
  parameter SI.LinearTemperatureCoefficient alpha=0
    "Temperature coefficient of heat flow rate";
  Modelica.Blocks.Interfaces.RealInput Q_flow(unit="W")
  Interfaces.HeatPort_b port
equation
  port.Q_flow = -Q_flow*(1 + alpha*(port.T - T_ref));
end PrescribedHeatFlow;


Variable temperature boundary condition in Kelvin. This model represents a variable temperature boundary condition.
The temperature in [K] is given as input signal T
to the model. The effect is that an instance of this model acts as
an infinite reservoir able to absorb or generate as much energy
as required to keep the temperature at the specified value.

within Modelica.Thermal.HeatTransfer.Sources;
model PrescribedTemperature
  "Variable temperature boundary condition in Kelvin"

  Interfaces.HeatPort_b port
  Modelica.Blocks.Interfaces.RealInput T(unit="K")
equation
  port.T = T;
end PrescribedTemperature;


within ;
package VehicleInterfaces "VehicleInterfaces Library (Version 2.0.1) - Interface definitions and architectures for vehicle system modeling"
  extends Modelica.Icons.Package;

  import Modelica.Units.SI;
end VehicleInterfaces;


Collection of type definitions

within VehicleInterfaces;
package Types "Collection of type definitions"
  extends Modelica.Icons.TypesPackage;

  type NormalizedReal = Modelica.Icons.TypeReal (
      final quantity="",
      final unit="1",
      final displayUnit="1",
      final min=0,
      final max=1) "Normalized real number";
  type Gear = Modelica.Icons.TypeInteger (final quantity="gear")
    "Gear ...,-2,-1,0,1,2,... = 2nd rear, 1st rear, neutral, 1st, 2nd forward, etc";

  package GearMode
    "Type, constants and menu choices for gear mode, as temporary solution until enumerations are available"

    // type GearMode = enumeration(Park, Drive, Neutral, Rear, Manual, Limited);

    constant Integer Park=1;
    constant Integer Drive=2;
    constant Integer Neutral=3;
    constant Integer Rear=4;
    constant Integer Manual=5;
    constant Integer Limited=6;

    type Temp
      "Temporary type of gear mode with choices for menus (until enumerations are available)"

      extends Integer(min=1,max=6);
    end Temp;
  end GearMode;

  package IgnitionSetting
    "Type, constants and menu choices for ignition setting, as temporary solution until enumerations are available"

    // type IgnitionSetting = enumeration(Off, On, Start);

    constant Integer Off=1 "Ignition is off";
    constant Integer On=2 "Ignition is on";
    constant Integer Start=3
      "Ignition is on and driver requires to start engine";

    type Temp
      "Temporary type of ignition setting with choices for menus (until enumerations are available)"

      extends Integer(min=1,max=3);
    end Temp;
  end IgnitionSetting;
end Types;


Constant torque loss and inertia due to the accessories. Simple accessory model with a single inertia and constant torque loss.

within VehicleInterfaces.Accessories;
model MinimalAccessories
  "Constant torque loss and inertia due to the accessories"
  extends VehicleInterfaces.Icons.Accessories;
  extends Interfaces.Base(includeEngineBearing=world.driveTrainMechanics3D);

  parameter SI.Inertia accessoriesInertia=0.001
    "Total effective rotational inertia of the accessories";
  parameter SI.Torque accessoriesLoad=2
    "Total effective torque load due to the accessories (constant)";
  parameter Modelica.Mechanics.MultiBody.Types.Axis axisOfRotation={1,0,0}
    "Axis of rotation for accessories when including MultiBody effects";

  Modelica.Mechanics.MultiBody.Parts.Rotor1D inertia(
    J=accessoriesInertia,
    n=axisOfRotation)
  Modelica.Mechanics.Rotational.Sources.SignTorque torqueLoss(
    tau_nominal=-accessoriesLoad,
    useSupport=includeEngineBearing,
    w0=1)
  Modelica.Mechanics.MultiBody.Parts.Mounting1D torqueReaction(
    n=axisOfRotation) if includeEngineBearing
protected
  outer Modelica.Mechanics.MultiBody.World world;
equation
  connect(torqueLoss.flange, inertia.flange_a)
  connect(inertia.flange_b, engineFlange.flange)
  connect(torqueReaction.frame_a, engineFlange.bearingFrame)
  connect(torqueReaction.flange_b,torqueLoss.support)
  connect(inertia.frame_a, torqueReaction.frame_a)
end MinimalAccessories;


Empty accessories. Empty accessories subsystem. Using this empty model in overall vehicle architecture the functionality of accessories subsystem can be eliminated.

within VehicleInterfaces.Accessories;
model NoAccessories "Empty accessories"
  extends VehicleInterfaces.Icons.Accessories;
  extends VehicleInterfaces.Icons.Empty;
  extends Interfaces.Base;
end NoAccessories;


within VehicleInterfaces;
package Accessories "Collection of accessory subsystem definitions"
  extends Modelica.Icons.VariantsPackage;
end Accessories;


Accessories Tutorial.

within VehicleInterfaces.Accessories;
class Tutorial "Accessories Tutorial"
  extends Modelica.Icons.Information;
end Tutorial;


Basic interface definition for the accessories. This partial model defines the interfaces required for an accessories subsystem.
This class should be extended to form a particular accessory model. See the
documentation and
tutorial
for more information.

within VehicleInterfaces.Accessories.Interfaces;
partial model Base "Basic interface definition for the accessories"

  parameter Boolean usingMultiBodyEngine=false
    "= true, if connecting to a MultiBody engine"
protected
  parameter Boolean includeEngineBearing=false "Include the engine bearing";

public
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing engineFlange(
    final includeBearingConnector=includeEngineBearing or usingMultiBodyEngine)
    "Source of drive torque"
  VehicleInterfaces.Interfaces.ControlBus controlBus "Control signal bus"
  Mechanics.MultiBody.MultiBodyEnd end_2(
    final includeBearingConnector=includeEngineBearing or usingMultiBodyEngine)
equation
  connect(end_2.flange, engineFlange)
end Base;


within VehicleInterfaces.Accessories;
package Interfaces "Collection of interface definitions for accessories"
  extends Modelica.Icons.InterfacesPackage;
end Interfaces;


Atmospheres with constant conditions. This is the simplest atmosphere model with constant characteristics.

within VehicleInterfaces.Atmospheres;
model ConstantAtmosphere "Atmospheres with constant conditions"
  extends VehicleInterfaces.Icons.Atmosphere;
  extends VehicleInterfaces.Atmospheres.Interfaces.Base(
    redeclare final function windVelocity = constantWindVelocity (windVelocity=v),
    redeclare final function density = constantDensity (density=rho),
    redeclare final function temperature = constantTemperature (T0=T),
    redeclare final function humidity = constantHumidity (h0=h));

  parameter SI.Velocity[3] v=zeros(3) "Wind velocity";
  parameter SI.AbsolutePressure ambientPressure=101300
    "Air pressure";
  parameter SI.Temperature T=293.15 "Air temperature";
  parameter Real h=0.5 "Air humidity (0-1)";
  constant Real R=287.0512249529787 "Gas constant for air";

protected
  parameter SI.Density rho=ambientPressure/(R*T);

  function constantWindVelocity
    extends VehicleInterfaces.Atmospheres.Interfaces.windVelocityBase;
    input SI.Velocity[3] windVelocity={0,0,0};
  algorithm
    v := windVelocity;
  end constantWindVelocity;

  function constantDensity "Determine density"
    extends VehicleInterfaces.Atmospheres.Interfaces.densityBase;
    input SI.Density density=1.18 "Density";
  algorithm
    rho := density;
  end constantDensity;

  function constantTemperature "Determine temperature"
    extends VehicleInterfaces.Atmospheres.Interfaces.temperatureBase;
    input SI.Temperature T0=293 "Constant temperature";
  algorithm
    T := T0;
  end constantTemperature;

  function constantHumidity "Determine humidity"
    extends VehicleInterfaces.Atmospheres.Interfaces.humidityBase;
    input Real h0=0.5 "Constant humidity";
  algorithm
    h := h0;
  end constantHumidity;
end ConstantAtmosphere;


within VehicleInterfaces;
package Atmospheres "Collection of atmosphere subsystem definitions"
  extends Modelica.Icons.VariantsPackage;
end Atmospheres;


Atmosphere Tutorial.

within VehicleInterfaces.Atmospheres;
class Tutorial "Atmosphere Tutorial"
  extends Modelica.Icons.Information;

  //Rest of model definition
  ...
end ConstantAtmosphere;

Adding these redeclares also means we need to add 4 parameters to
      the model v, rho, h
      and T which are the constant wind velocity, density,
      humidity and temperature respectively.

This model is now complete and can be used. The ConstantAtmosphere
      definition included in VehicleInterfaces actually has pressure,
      temperature and wind velocity as it's parameters and automatically
      calculates the air density.

"));
end Tutorial;


Base model for all atmospheres. Dummy model to demonstrate how the wind velocity model should be defined and included in atmosphere model.

within VehicleInterfaces.Atmospheres.Interfaces;
partial model Base "Base model for all atmospheres"

  replaceable function windVelocity=windVelocityBase
    "Dummy model for wind velocity"

  replaceable function density=densityBase "Dummy model for air density"

  replaceable function temperature=temperatureBase
    "Dummy model for air temperature"

  replaceable function humidity=humidityBase "Dummy model for air humidity"

end Base;


Determine density. Partial base model for air density. Extend this model appropriately to define final user model.

within VehicleInterfaces.Atmospheres.Interfaces;
partial function densityBase "Determine density"
  extends Modelica.Icons.Function;
  input SI.Position[3] r=zeros(3)
    "Position vector from world frame to point, resolved in world frame";
  output SI.Density rho=1.18 "Density";
end densityBase;


Determine humidity. Partial base model for air humidity. Extend this model appropriately to define final user model.

within VehicleInterfaces.Atmospheres.Interfaces;
partial function humidityBase "Determine humidity"
  extends Modelica.Icons.Function;
  input SI.Position[3] r=zeros(3)
    "Position vector from world frame to point, resolved in world frame";
  output Real h=0.5 "Humidity";
end humidityBase;


within VehicleInterfaces.Atmospheres;
package Interfaces "Collection of interface definitions for atmosphere"
  extends Modelica.Icons.Package;
end Interfaces;


Determine temperature. Partial base model for air temperature. Extend this model appropriately to define final user model.

within VehicleInterfaces.Atmospheres.Interfaces;
partial function temperatureBase "Determine temperature"
  extends Modelica.Icons.Function;
  input SI.Position[3] r=zeros(3)
    "Position vector from world frame to point, resolved in world frame";
  output SI.Temperature T=298 "Temperature";
end temperatureBase;


Determine wind velocity. Partial base model for wind velocity. Extend this model appropriately to define final user model.

within VehicleInterfaces.Atmospheres.Interfaces;
partial function windVelocityBase "Determine wind velocity"
  extends Modelica.Icons.Function;
  input SI.Position[3] r=zeros(3)
    "Position vector from world frame to point, resolved in world frame";
  output SI.Velocity[3] v=zeros(3)
    "Wind velocity vector, resolved in world frame";
end windVelocityBase;


Output the normalized input signal u [0..1] in inverted form y [1..0].. This block is used to invert a normalized input signal u from [0..1] to [1..0].
Formally, the output y is computed as:

within VehicleInterfaces.Blocks;
block InvertNormalizedInput
  "Output the normalized input signal u [0..1] in inverted form y [1..0]."
  extends Modelica.Blocks.Interfaces.SISO;
equation
  y = 1 - u;
end InvertNormalizedInput;


within VehicleInterfaces;
package Blocks "Collection of input/output fixed causality blocks"
  extends Modelica.Icons.Package;
end Blocks;


Simple proportional (constant gain) braking model for 4 wheeled vehicles. Brakes subsystem model that uses the driver brakePedalPosition
signal to determine the brake torque demand being requested by the driver.

within VehicleInterfaces.Brakes;
model MinimalBrakes
  "Simple proportional (constant gain) braking model for 4 wheeled vehicles"
  extends VehicleInterfaces.Icons.Brakes;
  extends VehicleInterfaces.Brakes.Interfaces.TwoAxleBase(includeWheelBearings=world.driveTrainMechanics3D);

  parameter SI.Torque maxTorque=1000
    "Maximum combined brake torque (for all brakes together)";

  Modelica.Blocks.Math.Gain computeTorque(k=maxTorque/4.0)
  Modelica.Mechanics.Rotational.Components.Brake brake_1(
    mu_pos=[0,1],
    useSupport=true,
    fn_max=1)
  Modelica.Mechanics.Rotational.Components.Brake brake_2(
    mu_pos=[0,1],
    useSupport=true,
    fn_max=1)
  Modelica.Mechanics.Rotational.Components.Brake brake_3(
    mu_pos=[0,1],
    useSupport=true,
    fn_max=1)
  Modelica.Mechanics.Rotational.Components.Brake brake_4(
    mu_pos=[0,1],
    useSupport=true,
    fn_max=1)
  Modelica.Mechanics.Rotational.Sensors.SpeedSensor wheelSpeed_1
  Modelica.Mechanics.Rotational.Sensors.SpeedSensor wheelSpeed_2
  Modelica.Mechanics.Rotational.Sensors.SpeedSensor wheelSpeed_3
  Modelica.Mechanics.Rotational.Sensors.SpeedSensor wheelSpeed_4
  Modelica.Mechanics.MultiBody.Parts.Mounting1D torqueReaction_1(n={0,1,0})
  Modelica.Mechanics.MultiBody.Parts.Mounting1D torqueReaction_2(n={0,1,0})
  Modelica.Mechanics.MultiBody.Parts.Mounting1D torqueReaction_3(n={0,1,0})
  Modelica.Mechanics.MultiBody.Parts.Mounting1D torqueReaction_4(n={0,1,0})
protected
  outer Modelica.Mechanics.MultiBody.World world;
  VehicleInterfaces.Interfaces.BrakesBus brakesBus
  VehicleInterfaces.Interfaces.DriverBus driverBus
equation
  connect(computeTorque.y, brake_1.f_normalized)
  connect(computeTorque.y, brake_2.f_normalized)
  connect(computeTorque.y, brake_3.f_normalized)
  connect(computeTorque.y, brake_4.f_normalized)
  connect(brake_1.flange_b, wheelHub_1.flange)
  connect(brake_2.flange_a, wheelHub_2.flange)
  connect(brake_3.flange_a, wheelHub_3.flange)
  connect(brake_4.flange_b, wheelHub_4.flange)
  connect(wheelSpeed_1.flange, brake_1.flange_a)
  connect(brake_2.flange_b, wheelSpeed_2.flange)
  connect(wheelSpeed_3.flange, brake_3.flange_b)
  connect(brake_4.flange_a, wheelSpeed_4.flange)
  connect(controlBus.driverBus, driverBus)
  connect(computeTorque.u, driverBus.brakePedalPosition)
  connect(wheelSpeed_1.w, brakesBus.wheelSpeed_1)
  connect(wheelSpeed_2.w, brakesBus.wheelSpeed_2)
  connect(wheelSpeed_3.w, brakesBus.wheelSpeed_3)
  connect(wheelSpeed_4.w, brakesBus.wheelSpeed_4)
  connect(controlBus.brakesBus, brakesBus)
  connect(torqueReaction_1.frame_a, wheelHub_1.bearingFrame)
  connect(torqueReaction_1.flange_b, brake_1.support)
  connect(brake_2.support, torqueReaction_2.flange_b)
  connect(torqueReaction_2.frame_a, wheelHub_2.bearingFrame)
  connect(torqueReaction_3.flange_b, brake_3.support)
  connect(torqueReaction_3.frame_a, wheelHub_3.bearingFrame)
  connect(torqueReaction_4.frame_a, wheelHub_4.bearingFrame)
  connect(torqueReaction_4.flange_b, brake_4.support)
end MinimalBrakes;


Simple proportional (constant gain) braking model for 4 wheeled vehicles, uses the brake pedal connection. Brakes subsystem model that uses the physical pedal connection to determine
the brake torque demand being requested by the driver.

within VehicleInterfaces.Brakes;
model MinimalBrakesUsingPedal
  "Simple proportional (constant gain) braking model for 4 wheeled vehicles, uses the brake pedal connection"
  extends VehicleInterfaces.Icons.Brakes;
  extends VehicleInterfaces.Brakes.Interfaces.TwoAxleBase(
    includeBrakePedal=true,
    includeWheelBearings=world.driveTrainMechanics3D);

  parameter SI.Torque maxTorque=1000
    "Maximum combined brake torque";

  Modelica.Blocks.Math.Gain computeTorque(k=maxTorque/4.0)
  Modelica.Mechanics.Rotational.Components.Brake brake_1(
    mu_pos=[0,1],
    useSupport=true,
    fn_max=1)
  Modelica.Mechanics.Rotational.Components.Brake brake_2(
    mu_pos=[0,1],
    useSupport=true,
    fn_max=1)
  Modelica.Mechanics.Rotational.Components.Brake brake_3(
    mu_pos=[0,1],
    useSupport=true,
    fn_max=1)
  Modelica.Mechanics.Rotational.Components.Brake brake_4(
    mu_pos=[0,1],
    useSupport=true,
    fn_max=1)
  Modelica.Mechanics.Translational.Sensors.PositionSensor positionSensor
  Modelica.Mechanics.Rotational.Sensors.SpeedSensor wheelSpeed_1
  Modelica.Mechanics.Rotational.Sensors.SpeedSensor wheelSpeed_2
  Modelica.Mechanics.Rotational.Sensors.SpeedSensor wheelSpeed_3
  Modelica.Mechanics.Rotational.Sensors.SpeedSensor wheelSpeed_4
  Modelica.Mechanics.MultiBody.Parts.Mounting1D torqueReaction_2(n={0,1,0})
  Modelica.Mechanics.MultiBody.Parts.Mounting1D torqueReaction_4(n={0,1,0})
  Modelica.Mechanics.MultiBody.Parts.Mounting1D torqueReaction_3(n={0,1,0})
  Modelica.Mechanics.MultiBody.Parts.Mounting1D torqueReaction_1(n={0,1,0})
protected
  outer Modelica.Mechanics.MultiBody.World world;
  VehicleInterfaces.Interfaces.BrakesBus brakesBus
equation
  connect(computeTorque.y, brake_4.f_normalized)
  connect(computeTorque.y, brake_3.f_normalized)
  connect(computeTorque.y, brake_2.f_normalized)
  connect(computeTorque.y, brake_1.f_normalized)
  connect(brake_1.flange_b, wheelHub_1.flange)
  connect(brake_2.flange_a, wheelHub_2.flange)
  connect(brake_3.flange_a, wheelHub_3.flange)
  connect(brake_4.flange_b, wheelHub_4.flange)
  connect(positionSensor.flange, brakePedal)
  connect(positionSensor.s, computeTorque.u)
  connect(wheelSpeed_1.flange, brake_1.flange_a)
  connect(wheelSpeed_2.flange, brake_2.flange_b)
  connect(wheelSpeed_3.flange, brake_3.flange_b)
  connect(wheelSpeed_4.flange, brake_4.flange_a)
  connect(controlBus.brakesBus, brakesBus)
  connect(wheelSpeed_1.w, brakesBus.wheelSpeed_1)
  connect(wheelSpeed_2.w, brakesBus.wheelSpeed_2)
  connect(wheelSpeed_3.w, brakesBus.wheelSpeed_3)
  connect(wheelSpeed_4.w, brakesBus.wheelSpeed_4)
  connect(torqueReaction_1.frame_a, wheelHub_1.bearingFrame)
  connect(torqueReaction_1.flange_b, brake_1.support)
  connect(torqueReaction_2.frame_a, wheelHub_2.bearingFrame)
  connect(brake_2.support, torqueReaction_2.flange_b)
  connect(torqueReaction_3.frame_a, wheelHub_3.bearingFrame)
  connect(torqueReaction_3.flange_b, brake_3.support)
  connect(torqueReaction_4.frame_a, wheelHub_4.bearingFrame)
  connect(torqueReaction_4.flange_b, brake_4.support)
end MinimalBrakesUsingPedal;


Empty brakes model for 4 wheeled vehicles. Zero torque is applied to all the wheelhubs and the reaction paths in to
the wheel hubs included if the driveTrainMechanics3D flag
in the world object is true.

within VehicleInterfaces.Brakes;
model NoBrakes "Empty brakes model for 4 wheeled vehicles"
  extends VehicleInterfaces.Icons.Brakes;
  extends VehicleInterfaces.Icons.Empty;
  extends VehicleInterfaces.Brakes.Interfaces.TwoAxleBase(includeWheelBearings=world.driveTrainMechanics3D);
protected
  outer Modelica.Mechanics.MultiBody.World world;
end NoBrakes;


within VehicleInterfaces;
package Brakes "Collection of brakes subsystem definitions"
  extends Modelica.Icons.VariantsPackage;
end Brakes;


Brakes Tutorial.

within VehicleInterfaces.Brakes;
class Tutorial "Brakes Tutorial"
  extends Modelica.Icons.Information;
end Tutorial;


Base interface definition for a brakes. This partial model defines the basic interfaces required for any brakes
subsystem. This class should be extended to form a brakes interface
definition with the correct number of wheelHub connectors for the type
of vehicle being modelled. See the
documentation and
tutorial
for more information.

within VehicleInterfaces.Brakes.Interfaces;
partial model Base "Base interface definition for a brakes"

  parameter Boolean usingMultiBodyChassis=false
    "= true, if connecting to a MultiBody chassis"
protected
  parameter Boolean includeBrakePedal=false "Include the brake pedal connection";
  parameter Boolean includeWheelBearings=false "Include the wheel bearing connectors";

public
  Modelica.Mechanics.Translational.Interfaces.Flange_a brakePedal
    if includeBrakePedal "Brake pedal connection (optional)"
  VehicleInterfaces.Interfaces.ControlBus controlBus "Control signal bus"
end Base;


Interface definition for the brakes on a 8 wheeled vehicle. This partial model defines the interfaces required for the brakes subsystem
of a four axled vehicle within the VehicleInterfaces package. See the
documentation and
tutorial
for more information.

within VehicleInterfaces.Brakes.Interfaces;
partial model FourAxleBase
  "Interface definition for the brakes on a 8 wheeled vehicle"
  extends Base;

  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_1(
    final includeBearingConnector=includeWheelBearings)
    "Front left wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_2(
    final includeBearingConnector=includeWheelBearings)
    "Front right wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_3(
    final includeBearingConnector=includeWheelBearings)
    "Second axle left wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_4(
    final includeBearingConnector=includeWheelBearings)
    "Second axle right wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_5(
    final includeBearingConnector=includeWheelBearings)
    "Third axle left wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_6(
    final includeBearingConnector=includeWheelBearings)
    "Third axle right wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_7(
    final includeBearingConnector=includeWheelBearings)
    "Fourth axle left wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_8(
    final includeBearingConnector=includeWheelBearings)
    "Fourth axle right wheel"
  Mechanics.MultiBody.MultiBodyEnd end_1(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_2(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_3(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_4(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_5(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_6(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_7(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_8(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
equation
  connect(end_1.flange, wheelHub_1)
  connect(end_2.flange, wheelHub_2)
  connect(end_3.flange, wheelHub_3)
  connect(end_4.flange, wheelHub_4)
  connect(end_5.flange, wheelHub_5)
  connect(end_6.flange, wheelHub_6)
  connect(end_7.flange, wheelHub_7)
  connect(end_8.flange, wheelHub_8)
end FourAxleBase;


within VehicleInterfaces.Brakes;
package Interfaces "Collection of interface definitions for brakes"
  extends Modelica.Icons.InterfacesPackage;
end Interfaces;


Interface definition for the brakes on a 6 wheeled vehicle. This partial model defines the interfaces required for the brakes subsystem
of a three axled vehicle within the VehicleInterfaces package. See the
documentation and
tutorial
for more information.

within VehicleInterfaces.Brakes.Interfaces;
partial model ThreeAxleBase
  "Interface definition for the brakes on a 6 wheeled vehicle"
  extends Base;

  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_1(
    final includeBearingConnector=includeWheelBearings)
    "Front left wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_2(
    final includeBearingConnector=includeWheelBearings)
    "Front right wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_3(
    final includeBearingConnector=includeWheelBearings)
    "Second axle left wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_4(
    final includeBearingConnector=includeWheelBearings)
    "Second axle right wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_5(
    final includeBearingConnector=includeWheelBearings)
    "Third axle left wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_6(
    final includeBearingConnector=includeWheelBearings)
    "Third axle right wheel"
  Mechanics.MultiBody.MultiBodyEnd end_1(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_2(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_3(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_4(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_5(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_6(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
equation
  connect(end_1.flange, wheelHub_1)
  connect(end_2.flange, wheelHub_2)
  connect(end_3.flange, wheelHub_3)
  connect(end_4.flange, wheelHub_4)
  connect(end_5.flange, wheelHub_5)
  connect(end_6.flange, wheelHub_6)
end ThreeAxleBase;


Interface definition for the brakes on a 4 wheeled vehicle. This partial model defines the interfaces required for the brakes subsystem
of a two axled vehicle within the VehicleInterfaces package. See the
documentation and
tutorial
for more information.

within VehicleInterfaces.Brakes.Interfaces;
partial model TwoAxleBase
  "Interface definition for the brakes on a 4 wheeled vehicle"
  extends Base;

  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_1(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
    "Front left wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_2(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
    "Front right wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_3(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
    "Rear left wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_4(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
    "Rear right wheel"
  Mechanics.MultiBody.MultiBodyEnd end_1(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_2(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_3(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_4(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
equation
  connect(end_1.flange, wheelHub_1)
  connect(end_2.flange, wheelHub_2)
  connect(end_3.flange, wheelHub_3)
  connect(end_4.flange, wheelHub_4)
end TwoAxleBase;


within VehicleInterfaces.Brakes;
package Internal "Collection of internal material involving brakes"
  extends Modelica.Icons.InternalPackage;
end Internal;


Basic chassis model with rigid connection between all 4 wheels. Single degree-of-freedom chassis model with mass and speed dependant drag model.

within VehicleInterfaces.Chassis;
model MinimalChassis
  "Basic chassis model with rigid connection between all 4 wheels"
  extends VehicleInterfaces.Icons.Chassis;
  extends VehicleInterfaces.Chassis.Interfaces.TwoAxleBase;

  parameter SI.Mass vehicleMass=1200 "Vehicle mass";
  parameter SI.Radius tyreRadius=0.34 "Tyre rolling radius";
  parameter SI.TranslationalDampingConstant drag=1 "Drag force (force = drag*vehicle_speed)";

  Modelica.Mechanics.Rotational.Components.IdealRollingWheel tyres(
    radius=tyreRadius,
    useSupportT=true,
    useSupportR=true)
  Modelica.Mechanics.Translational.Components.Mass body(
    m=vehicleMass,
    s(stateSelect=StateSelect.always,
      start=0,
      fixed=true))
  Modelica.Mechanics.Translational.Components.Damper dragForces(
    d=drag)
  Modelica.Mechanics.Translational.Components.Fixed ground
  Modelica.Mechanics.Translational.Sensors.SpeedSensor longitudinalVelocity
protected
  VehicleInterfaces.Interfaces.ChassisBus chassisBus
public
  Modelica.Mechanics.Rotational.Components.Fixed fixed
equation
  connect(tyres.flangeT,  body.flange_a)
  connect(body.flange_b, dragForces.flange_a)
  connect(dragForces.flange_b,ground.flange)
  connect(body.flange_b,longitudinalVelocity.flange)
  connect(tyres.flangeR,  wheelHub_1.flange)
  connect(tyres.flangeR,  wheelHub_2.flange)
  connect(tyres.flangeR,  wheelHub_3.flange)
  connect(tyres.flangeR,  wheelHub_4.flange)
  connect(controlBus.chassisBus, chassisBus)
  connect(ground.flange, tyres.supportT)
  connect(fixed.flange, tyres.supportR)
  connect(chassisBus.longitudinalVelocity, longitudinalVelocity.v)
end MinimalChassis;


Basic chassis model with rigid connection between all 4 wheels, uses chassisFrame connection. Single degree-of-freedom chassis model with mass and speed dependant drag model.
Couples the 1d system to a Multibody system to support the other subsystems.

within VehicleInterfaces.Chassis;
model MinimalChassis2
  "Basic chassis model with rigid connection between all 4 wheels, uses chassisFrame connection"
  extends VehicleInterfaces.Icons.Chassis;
  extends VehicleInterfaces.Chassis.Interfaces.TwoAxleBase(includeChassisFrame=true);

  parameter SI.Mass vehicleMass=1200 "Vehicle mass";
  parameter SI.Radius tyreRadius=0.34 "Tyre rolling radius";
  parameter SI.TranslationalDampingConstant drag=1 "Drag force (force = drag*vehicle_speed)";

  Modelica.Mechanics.Rotational.Components.IdealRollingWheel tyres(
    useSupportR=true,
    useSupportT=true,
    radius=tyreRadius)
  Modelica.Mechanics.Translational.Components.Damper dragForces(
    d=drag)
  Modelica.Mechanics.Translational.Sensors.SpeedSensor longitudinalVelocity
  Modelica.Mechanics.MultiBody.Parts.Body body(m=vehicleMass)
  Modelica.Mechanics.MultiBody.Joints.Prismatic constraint(
    useAxisFlange=true,
    a(fixed=false),
    s(fixed=true),
    v(fixed=false))
  Modelica.Mechanics.MultiBody.Parts.Fixed ground
protected
  VehicleInterfaces.Interfaces.ChassisBus chassisBus
public
  Modelica.Mechanics.MultiBody.Parts.Mounting1D mountingR(n=constraint.n)
equation
  connect(tyres.flangeR, wheelHub_2.flange)
  connect(tyres.flangeR, wheelHub_1.flange)
  connect(tyres.flangeR, wheelHub_4.flange)
  connect(tyres.flangeR, wheelHub_3.flange)
  connect(tyres.flangeT, dragForces.flange_a)
  connect(longitudinalVelocity.flange, dragForces.flange_a)
  connect(dragForces.flange_b, constraint.support)
  connect(dragForces.flange_a, constraint.axis)
  connect(controlBus.chassisBus, chassisBus)
  connect(constraint.frame_a, ground.frame_b)
  connect(mountingR.flange_b, tyres.supportR)
  connect(constraint.support, tyres.supportT)
  connect(chassisBus.longitudinalVelocity, longitudinalVelocity.v)
  connect(body.frame_a, mountingR.frame_a)
  connect(body.frame_a, constraint.frame_b)
  connect(body.frame_a, chassisFrame)
end MinimalChassis2;


Basic chassis model with rigid connection between all 4 wheels, uses chassisFrame connection, includes wheel bearings. Single degree-of-freedom chassis model with mass and speed dependant drag model.
Uses MultiBody wheelHub connections and positions these relative to the
vehicle body position.

within VehicleInterfaces.Chassis;
model MinimalChassis3
  "Basic chassis model with rigid connection between all 4 wheels, uses chassisFrame connection, includes wheel bearings"
  extends MinimalChassis2(includeWheelBearings=true, body(r_CM={0,0,0}));

public
  Modelica.Mechanics.MultiBody.Parts.FixedTranslation fixedTranslation(r={0,-1.4,
        0}, animation=false)
  Modelica.Mechanics.MultiBody.Parts.FixedTranslation fixedTranslation1(r={0,
        -1.4,0}, animation=false)
  Modelica.Mechanics.MultiBody.Parts.FixedTranslation fixedTranslation2(r={0,
        0.7,0}, animation=false)
  Modelica.Mechanics.MultiBody.Parts.FixedTranslation fixedTranslation3(r={-2.6,
        0.7,0}, animation=false)
equation
  connect(fixedTranslation.frame_b, wheelHub_2.bearingFrame)
  connect(fixedTranslation1.frame_b, wheelHub_4.bearingFrame)
  connect(fixedTranslation1.frame_a, fixedTranslation3.frame_b)
  connect(fixedTranslation2.frame_b, fixedTranslation.frame_a)
  connect(fixedTranslation2.frame_b, wheelHub_1.bearingFrame)
  connect(fixedTranslation3.frame_b, wheelHub_3.bearingFrame)
  connect(fixedTranslation2.frame_a, fixedTranslation3.frame_a)
  connect(body.frame_a, fixedTranslation2.frame_a)
end MinimalChassis3;


Empty chassis. Empty chassis model. Using this empty model in overall vehicle architecture the functionality of chassis can be eliminated.

within VehicleInterfaces.Chassis;
model NoChassis "Empty chassis"
  extends VehicleInterfaces.Icons.Chassis;
  extends VehicleInterfaces.Icons.Empty;
  extends VehicleInterfaces.Chassis.Interfaces.TwoAxleBase(includeWheelBearings=world.driveTrainMechanics3D);
protected
  outer Modelica.Mechanics.MultiBody.World world;
end NoChassis;


within VehicleInterfaces;
package Chassis "Collection of chassis subsystem definitions"
  extends Modelica.Icons.VariantsPackage;
end Chassis;


Chassis Tutorial.

within VehicleInterfaces.Chassis;
class Tutorial "Chassis Tutorial"
  extends Modelica.Icons.Information;
end Tutorial;


Basic interface definition for a chassis. This partial model defines the basic interfaces required for any chassis
subsystem. This class should be extended to form a chassis interface
definition with the correct number of wheelHub connectors for the type
of vehicle being modelled. See the
documentation and
tutorial
for more information.

within VehicleInterfaces.Chassis.Interfaces;
partial model Base "Basic interface definition for a chassis"

  parameter Boolean usingMultiBodyDriveline=false
    "= true, if connecting to a MultiBody driveline"
protected
  parameter Boolean includeWheelBearings=false "Include wheel bearing connectors";
  parameter Boolean includeChassisFrame=false "Include the chassis frame";
  parameter Boolean includeSteeringWheel=false "Include the steering wheel connection";

public
  Modelica.Mechanics.MultiBody.Interfaces.Frame_b chassisFrame
    if includeChassisFrame "Chassis reference frame (optional)"
  Modelica.Mechanics.Rotational.Interfaces.Flange_a steeringWheel
    if includeSteeringWheel "Steering wheel connection (optional)"

public
  VehicleInterfaces.Interfaces.ControlBus controlBus "Control signal bus"
end Base;


Interface definition for a chassis of a 8 wheeled vehicle. This partial model defines the interfaces required for the chassis subsystem
of a four axled vehicle within the VehicleInterfaces package. See the
documentation and
tutorial
for more information.

within VehicleInterfaces.Chassis.Interfaces;
partial model FourAxleBase
  "Interface definition for a chassis of a 8 wheeled vehicle"
  extends Base;
public
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_1(
    final includeBearingConnector=includeWheelBearings)
    "Front left wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_2(
    final includeBearingConnector=includeWheelBearings)
    "Front right wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_3(
    final includeBearingConnector=includeWheelBearings)
    "Second axle left wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_4(
    final includeBearingConnector=includeWheelBearings)
    "Second axle right wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_5(
    final includeBearingConnector=includeWheelBearings)
    "Third axle left wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_6(
    final includeBearingConnector=includeWheelBearings)
    "Third axle right wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_7(
    final includeBearingConnector=includeWheelBearings)
    "Fourth axle left wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_8(
    final includeBearingConnector=includeWheelBearings)
    "Fourth axle right wheel"
  Mechanics.MultiBody.MultiBodyEnd end_1(
    includeBearingConnector=includeWheelBearings or usingMultiBodyDriveline)
  Mechanics.MultiBody.MultiBodyEnd end_2(
    includeBearingConnector=includeWheelBearings or usingMultiBodyDriveline)
  Mechanics.MultiBody.MultiBodyEnd end_3(
    includeBearingConnector=includeWheelBearings or usingMultiBodyDriveline)
  Mechanics.MultiBody.MultiBodyEnd end_4(
    includeBearingConnector=includeWheelBearings or usingMultiBodyDriveline)
  Mechanics.MultiBody.MultiBodyEnd end_5(
    includeBearingConnector=includeWheelBearings or usingMultiBodyDriveline)
  Mechanics.MultiBody.MultiBodyEnd end_6(
    includeBearingConnector=includeWheelBearings or usingMultiBodyDriveline)
  Mechanics.MultiBody.MultiBodyEnd end_7(
    includeBearingConnector=includeWheelBearings or usingMultiBodyDriveline)
  Mechanics.MultiBody.MultiBodyEnd end_8(
    includeBearingConnector=includeWheelBearings or usingMultiBodyDriveline)
equation
  connect(end_1.flange, wheelHub_1)
  connect(end_2.flange, wheelHub_2)
  connect(end_3.flange, wheelHub_3)
  connect(end_4.flange, wheelHub_4)
  connect(end_5.flange, wheelHub_6)
  connect(end_6.flange, wheelHub_5)
  connect(end_7.flange, wheelHub_8)
  connect(end_8.flange, wheelHub_7)
end FourAxleBase;


within VehicleInterfaces.Chassis;
package Interfaces "Collection of interface definitions for chassis"
  extends Modelica.Icons.InterfacesPackage;
end Interfaces;


Interface definition for a chassis of a 6 wheeled vehicle. This partial model defines the interfaces required for the chassis subsystem
of a three axled vehicle within the VehicleInterfaces package. See the
documentation and
tutorial
for more information.

within VehicleInterfaces.Chassis.Interfaces;
partial model ThreeAxleBase
  "Interface definition for a chassis of a 6 wheeled vehicle"
  extends Base;
public
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_1(
    final includeBearingConnector=includeWheelBearings)
    "Front left wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_2(
    final includeBearingConnector=includeWheelBearings)
    "Front right wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_3(
    final includeBearingConnector=includeWheelBearings)
    "Second axle left wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_4(
    final includeBearingConnector=includeWheelBearings)
    "Second axle right wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_5(
    final includeBearingConnector=includeWheelBearings)
    "Third axle left wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_6(
    final includeBearingConnector=includeWheelBearings)
    "Third axle right wheel"
  Mechanics.MultiBody.MultiBodyEnd end_1(
    includeBearingConnector=includeWheelBearings or usingMultiBodyDriveline)
  Mechanics.MultiBody.MultiBodyEnd end_2(
    includeBearingConnector=includeWheelBearings or usingMultiBodyDriveline)
  Mechanics.MultiBody.MultiBodyEnd end_3(
    includeBearingConnector=includeWheelBearings or usingMultiBodyDriveline)
  Mechanics.MultiBody.MultiBodyEnd end_4(
    includeBearingConnector=includeWheelBearings or usingMultiBodyDriveline)
  Mechanics.MultiBody.MultiBodyEnd end_5(
    includeBearingConnector=includeWheelBearings or usingMultiBodyDriveline)
  Mechanics.MultiBody.MultiBodyEnd end_6(
    includeBearingConnector=includeWheelBearings or usingMultiBodyDriveline)
equation
  connect(end_1.flange, wheelHub_1)
  connect(end_2.flange, wheelHub_2)
  connect(end_3.flange, wheelHub_3)
  connect(end_4.flange, wheelHub_4)
  connect(end_6.flange, wheelHub_5)
  connect(end_5.flange, wheelHub_6)
end ThreeAxleBase;


Interface definition for a chassis of a 4 wheeled vehicle. This partial model defines the interfaces required for the chassis subsystem
of a two axled vehicle within the VehicleInterfaces package. See the
documentation and
tutorial
for more information.

within VehicleInterfaces.Chassis.Interfaces;
partial model TwoAxleBase
  "Interface definition for a chassis of a 4 wheeled vehicle"
  extends Base;
public
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_1(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyDriveline)
    "Front left wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_2(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyDriveline)
    "Front right wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_3(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyDriveline)
    "Rear left wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_4(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyDriveline)
    "Rear right wheel"
  Mechanics.MultiBody.MultiBodyEnd end_1(
    includeBearingConnector=includeWheelBearings or usingMultiBodyDriveline)
  Mechanics.MultiBody.MultiBodyEnd end_2(
    includeBearingConnector=includeWheelBearings or usingMultiBodyDriveline)
  Mechanics.MultiBody.MultiBodyEnd end_3(
    includeBearingConnector=includeWheelBearings or usingMultiBodyDriveline)
  Mechanics.MultiBody.MultiBodyEnd end_4(
    includeBearingConnector=includeWheelBearings or usingMultiBodyDriveline)
equation
  connect(end_1.flange, wheelHub_1)
  connect(end_2.flange, wheelHub_2)
  connect(end_3.flange, wheelHub_3)
  connect(end_4.flange, wheelHub_4)
end TwoAxleBase;


within VehicleInterfaces.Chassis;
package Internal "Collection of internal material involving chassis"
  extends Modelica.Icons.InternalPackage;
end Internal;


Empty controller. Empty controller model. Using this empty model in overall vehicle architecture the functionality of controller can be eliminated.

within VehicleInterfaces.Controllers;
model NoController "Empty controller"
  extends VehicleInterfaces.Icons.Controller;
  extends VehicleInterfaces.Icons.Empty;
  extends Interfaces.Base;
end NoController;


within VehicleInterfaces;
package Controllers "Collection of controllers subsystem definitions"
  extends Modelica.Icons.VariantsPackage;
end Controllers;


Controllers Tutorial.

within VehicleInterfaces.Controllers;
class Tutorial "Controllers Tutorial"
  extends Modelica.Icons.Information;
end Tutorial;


Basic interface definition for a controller. This partial model defines the interfaces required for a controller
subsystem. This class should be extended to form a particular
controller model. See the
documentation and
tutorial
for more information.

within VehicleInterfaces.Controllers.Interfaces;
partial model Base "Basic interface definition for a controller"

  VehicleInterfaces.Interfaces.ControlBus controlBus "Control signal bus"
end Base;


within VehicleInterfaces.Controllers;
package Interfaces "Collection of interface definitions for controller"
  extends Modelica.Icons.InterfacesPackage;
end Interfaces;


Basic data dictionary example. A simple data dictionary example that creates a new signal called
v_veh within the chassisBus sub-bus of
the control bus.

within VehicleInterfaces.DataDictionaries;
model MinimalExample "Basic data dictionary example"
  extends VehicleInterfaces.Icons.DataDictionary;
  extends VehicleInterfaces.DataDictionaries.Interfaces.Base;
protected
  Modelica.Blocks.Routing.RealPassThrough v_veh
  VehicleInterfaces.Interfaces.ChassisBus chassisBus

equation
  connect(chassisBus, controlBus.chassisBus)
  connect(v_veh.u, chassisBus.longitudinalVelocity)
  connect(chassisBus.v_veh, v_veh.y)
end MinimalExample;


Empty data dictionary. Empty data dictionary model. Using this empty model in overall vehicle architecture the functionality of data dictionary can be eliminated.

within VehicleInterfaces.DataDictionaries;
model NoDataDictionary "Empty data dictionary"
  extends VehicleInterfaces.Icons.DataDictionary;
  extends VehicleInterfaces.Icons.Empty;
  extends VehicleInterfaces.DataDictionaries.Interfaces.Base;
end NoDataDictionary;


within VehicleInterfaces;
package DataDictionaries "Collection of data dictionary definitions"
  extends Modelica.Icons.VariantsPackage;
end DataDictionaries;


Data Dictionary Tutorial.

within VehicleInterfaces.DataDictionaries;
class Tutorial "Data Dictionary Tutorial"
  extends Modelica.Icons.Information;
end Tutorial;


Basic interface definition for a data dictionary. This partial model defines the interfaces required for a data dictionary
within the VehicleInterfaces package. Especially, it provide alias names
for the controBus. See the
documentation and
tutorial
for more information.

within VehicleInterfaces.DataDictionaries.Interfaces;
partial model Base "Basic interface definition for a data dictionary"

  VehicleInterfaces.Interfaces.ControlBus controlBus "Control signal bus"
end Base;


within VehicleInterfaces.DataDictionaries;
package Interfaces "Collection of interface definitions for data dictionary"
  extends Modelica.Icons.InterfacesPackage;
end Interfaces;


Front wheel drive, 4 wheeled vehicle. This driveline model is of a front-wheel drive 4-wheeled vehicle.
The front differential is modelled using an ideal gear and planetary gear.
The model does include the 3D mount effects if the
driveTrainMechanics3D in the world object is set to true.
To properly include these effects the additional constant and
FrameForceAndTorque actuators are required on the front wheel hubs.
A constant zero torque is applied to the rear wheelhubs and the reaction
paths in to the wheelhubs are included.

within VehicleInterfaces.Drivelines;
model MinimalDriveline "Front wheel drive, 4 wheeled vehicle"
  extends VehicleInterfaces.Icons.Driveline;
  extends VehicleInterfaces.Drivelines.Interfaces.TwoAxleBase(includeMount=world.driveTrainMechanics3D);

  parameter SI.Inertia halfshaftInertia=0.1
    "Inertia of each halfshaft";
  parameter Real finalDriveRatio=3 "Final drive ratio";

  Modelica.Mechanics.MultiBody.Parts.Rotor1D rightHalfShaft(
    J=halfshaftInertia)
  Modelica.Mechanics.MultiBody.Parts.Rotor1D leftHalfShaft(
    J=halfshaftInertia)
  Modelica.Mechanics.Rotational.Components.IdealPlanetary differential(
    ratio=1)
protected
  outer Modelica.Mechanics.MultiBody.World world;
public
  Modelica.Mechanics.Rotational.Components.IdealGear finalDrive(
    ratio=finalDriveRatio,
    useSupport=false)
equation
  connect(rightHalfShaft.flange_a, wheelHub_2.flange)
  connect(leftHalfShaft.flange_a, wheelHub_1.flange)
  connect(leftHalfShaft.flange_b, differential.sun)
  connect(differential.ring, rightHalfShaft.flange_b)
  connect(rightHalfShaft.frame_a, drivelineMount)
  connect(leftHalfShaft.frame_a, drivelineMount)
  connect(finalDrive.flange_b, differential.carrier)
  connect(finalDrive.flange_a, transmissionFlange.flange)
end MinimalDriveline;


Empty driveline model for a 4 wheeled vehicle. Zero torque is applied to all the wheelhubs and the reaction paths in to
the wheel hubs included if the driveTrainMechanics3D
flag in the world object is true.

within VehicleInterfaces.Drivelines;
model NoDriveline "Empty driveline model for a 4 wheeled vehicle"
  extends VehicleInterfaces.Icons.Driveline;
  extends VehicleInterfaces.Icons.Empty;
  extends VehicleInterfaces.Drivelines.Interfaces.TwoAxleBase(
    includeWheelBearings=world.driveTrainMechanics3D);
protected
  outer Modelica.Mechanics.MultiBody.World world;
end NoDriveline;


within VehicleInterfaces;
package Drivelines "Collection of drivelines subsystem definitions"
  extends Modelica.Icons.VariantsPackage;
end Drivelines;


Driveline Tutorial.

within VehicleInterfaces.Drivelines;
class Tutorial "Driveline Tutorial"
  extends Modelica.Icons.Information;
end Tutorial;


Basic interface definition for a driveline. This partial model defines the basic interfaces required for any driveline
subsystem. This class should be extended to form a driveline interface
definition with the correct number of wheelHub connectors for the type of
vehicle being modelled. See the
documentation and
tutorial
for more information.

within VehicleInterfaces.Drivelines.Interfaces;
partial model Base "Basic interface definition for a driveline"

  parameter Boolean usingMultiBodyChassis=false
    "= true, if connecting to a MultiBody chassis"
  parameter Boolean usingMultiBodyTransmission=false
    "= true, if connecting to a MultiBody transmission"
protected
  parameter Boolean includeWheelBearings=false "Include wheel bearing connectors";
  parameter Boolean includeMount=false "Include the driveline mount";
  parameter Boolean includeTransmissionBearing=false
    "Include the transmission bearing";

public
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing transmissionFlange(
    final includeBearingConnector=includeTransmissionBearing or usingMultiBodyTransmission)
    "Connection to the Transmission output shaft"
  Modelica.Mechanics.MultiBody.Interfaces.Frame_a drivelineMount
    if includeMount "Driveline mount connection (optional)"
  VehicleInterfaces.Interfaces.ControlBus controlBus "Control signal bus"
  Mechanics.MultiBody.MultiBodyEnd end_0(
    final includeBearingConnector=includeTransmissionBearing or usingMultiBodyTransmission)
equation
  connect(end_0.flange, transmissionFlange)
end Base;


Interface definition for a driveline of a 8 wheeled vehicle. This partial model defines the interfaces required for the driveline subsystem
of a four axled vehicle within the VehicleInterfaces package.  See the
documentation and
tutorial
for more information.

within VehicleInterfaces.Drivelines.Interfaces;
partial model FourAxleBase
  "Interface definition for a driveline of a 8 wheeled vehicle"
  extends VehicleInterfaces.Drivelines.Interfaces.Base;

  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_1(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
    "Front left wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_2(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
    "Front right wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_3(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
    "Second axle left wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_4(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
    "Second axle right wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_5(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
    "Third axle left wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_6(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
    "Third axle right wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_7(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
    "Fourth axle left wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_8(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
    "Fourth axle right wheel"
  Mechanics.MultiBody.MultiBodyEnd end_1(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_2(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_3(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_4(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_5(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_6(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_7(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_8(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
equation
  connect(end_1.flange, wheelHub_1)
  connect(end_2.flange, wheelHub_2)
  connect(end_3.flange, wheelHub_3)
  connect(end_4.flange, wheelHub_4)
  connect(end_5.flange, wheelHub_5)
  connect(end_6.flange, wheelHub_6)
  connect(end_7.flange, wheelHub_7)
  connect(end_8.flange, wheelHub_8)
end FourAxleBase;


within VehicleInterfaces.Drivelines;
package Interfaces "Collection of interface definitions for driveline"
  extends Modelica.Icons.InterfacesPackage;
end Interfaces;


Interface definition for a driveline of a 6 wheeled vehicle. This partial model defines the interfaces required for the driveline subsystem
of a three axled vehicle within the VehicleInterfaces package.  See the
documentation and
tutorial
for more information.

within VehicleInterfaces.Drivelines.Interfaces;
partial model ThreeAxleBase
  "Interface definition for a driveline of a 6 wheeled vehicle"
  extends VehicleInterfaces.Drivelines.Interfaces.Base;

  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_1(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
    "Front left wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_2(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
    "Front right wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_3(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
    "Second axle left wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_4(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
    "Second axle right wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_5(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
    "Third axle left wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_6(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
    "Third axle right wheel"
  Mechanics.MultiBody.MultiBodyEnd end_1(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_2(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_3(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_4(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_5(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_6(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
equation
  connect(end_1.flange, wheelHub_1)
  connect(end_2.flange, wheelHub_2)
  connect(end_3.flange, wheelHub_3)
  connect(end_4.flange, wheelHub_4)
  connect(end_5.flange, wheelHub_5)
  connect(end_6.flange, wheelHub_6)
end ThreeAxleBase;


Interface definition for a driveline of a 4 wheeled vehicle. This partial model defines the interfaces required for the driveline subsystem
of a two axled vehicle within the VehicleInterfaces package. See the
documentation and
tutorial
for more information.

within VehicleInterfaces.Drivelines.Interfaces;
partial model TwoAxleBase
  "Interface definition for a driveline of a 4 wheeled vehicle"
  extends Base;

  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_1(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
    "Front left wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_2(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
    "Front right wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_3(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
    "Rear left wheel"
  Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing wheelHub_4(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
    "Rear right wheel"
  Mechanics.MultiBody.MultiBodyEnd end_1(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_2(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_3(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
  Mechanics.MultiBody.MultiBodyEnd end_4(
    final includeBearingConnector=includeWheelBearings or usingMultiBodyChassis)
equation
  connect(end_1.flange, wheelHub_1)
  connect(end_2.flange, wheelHub_2)
  connect(end_3.flange, wheelHub_3)
  connect(end_4.flange, wheelHub_4)
end TwoAxleBase;


Minimal Driver-Vehicle Interface, manual transmission, uses physical pedal connections. Constant acceleration driver with the capabilitiy to step between two
constant throttle values. Fixed gear and constant clutch position.

within VehicleInterfaces.DriverEnvironments;
model ConventionalManual
  "Minimal Driver-Vehicle Interface, manual transmission, uses physical pedal connections"
  extends VehicleInterfaces.Icons.DriverEnvironment;
  extends Interfaces.BaseManualTransmission(
    includeManualShiftConnector=true,
    includeAcceleratorPedal=true,
    includeBrakePedal=true,
    includeClutchPedal=true);

public
  parameter Real initialAccelRequest(min=0, max=1) = 1 "Initial accelerator pedal position";
  parameter Real initialBrakeRequest(min=0, max=1) = 0 "Initial brake pedal position";
  parameter Real finalAccelRequest(min=0, max=1) = 1 "Final accelerator pedal position";
  parameter Real finalBrakeRequest(min=0, max=1) = 0 "Final brake pedal position";
  parameter SI.Time accelTime=10 "Time of accel apply";
  parameter SI.Time brakeTime=10 "Time of brake apply";
  parameter VehicleInterfaces.Types.Gear selectedGear=2
    "Requested gear in manual mode";
  parameter Real clutchRequest=0
    "Clutch position (constant during simulation)";

  Modelica.Blocks.Sources.Step brakeDemand(
    height=finalBrakeRequest,
    offset=initialBrakeRequest,
    startTime=brakeTime)
  Modelica.Blocks.Sources.Step acceleratorDemand(
    height=finalAccelRequest,
    offset=initialAccelRequest,
    startTime=accelTime)
  Modelica.Blocks.Sources.IntegerConstant gear(k=selectedGear)
  Modelica.Blocks.Sources.Constant clutchDemand(k=clutchRequest)
  VehicleInterfaces.Interfaces.ShiftInput shiftInput
  Modelica.Mechanics.Translational.Sources.Position acceleratorPosition
  Modelica.Mechanics.Translational.Sources.Position clutchPosition
  Modelica.Mechanics.Translational.Sources.Position brakePosition
  Modelica.Blocks.Sources.IntegerStep ignition(
    height=-1,
    startTime=0.5,
    offset=VehicleInterfaces.Types.IgnitionSetting.Start)
protected
  VehicleInterfaces.Interfaces.DriverBus driverBus
equation
  connect(acceleratorDemand.y, acceleratorPosition.s_ref)
  connect(acceleratorPosition.flange,   acceleratorPedal)
  connect(brakeDemand.y, brakePosition.s_ref)
  connect(brakePosition.flange,   brakePedal)
  connect(clutchDemand.y, clutchPosition.s_ref)
  connect(clutchPosition.flange,   clutchPedal)
  connect(shiftInput.shiftConnector, shiftConnector)
  connect(gear.y, shiftInput.gear)
  connect(controlBus.driverBus, driverBus)
  connect(ignition.y, driverBus.ignition)
end ConventionalManual;


Minimal Drive-by-wire Driver-Vehicle Interface. Constant acceleration driver with the capabilitiy to step between two
constant throttle values and to step on/off the brakes.

within VehicleInterfaces.DriverEnvironments;
model DriveByWireAutomatic "Minimal Drive-by-wire Driver-Vehicle Interface"
  extends VehicleInterfaces.Icons.DriverEnvironment;
  extends VehicleInterfaces.DriverEnvironments.Interfaces.BaseAutomaticTransmission;
public
  parameter Real initialAccelRequest(min=0, max=1) = 1 "Initial accelerator pedal position";
  parameter Real initialBrakeRequest(min=0, max=1) = 0 "Initial brake pedal position";
  parameter Real finalAccelRequest(min=0, max=1) = 1 "Final accelerator pedal position";
  parameter Real finalBrakeRequest(min=0, max=1) = 0 "Final brake pedal position";
  parameter SI.Time accelTime=10 "Time of accel apply";
  parameter SI.Time brakeTime=10 "Time of brake apply";
  parameter VehicleInterfaces.Types.GearMode.Temp selectedGearboxMode=
    VehicleInterfaces.Types.GearMode.Drive "Current gearbox mode";
  parameter VehicleInterfaces.Types.Gear manualGearRequest=0
    "Requested gear in manual mode";

  Modelica.Blocks.Sources.Step brakeDemand(
    height=finalBrakeRequest,
    offset=initialBrakeRequest,
    startTime=brakeTime)
  Modelica.Blocks.Sources.Step acceleratorDemand(
    height=finalAccelRequest,
    offset=initialAccelRequest,
    startTime=accelTime)

  Modelica.Blocks.Sources.IntegerConstant gearSelect(k=manualGearRequest)
  Modelica.Blocks.Sources.IntegerConstant gearMode(k=selectedGearboxMode)
  Modelica.Blocks.Sources.IntegerStep ignition(
    height=-1,
    startTime=0.5,
    offset=VehicleInterfaces.Types.IgnitionSetting.Start)
protected
  VehicleInterfaces.Interfaces.DriverBus driverBus
equation
  connect(controlBus.driverBus, driverBus)
  connect(acceleratorDemand.y, driverBus.acceleratorPedalPosition)
  connect(gearSelect.y, driverBus.requestedGear)
  connect(driverBus.brakePedalPosition, brakeDemand.y)
  connect(gearMode.y, driverBus.gearboxMode)
  connect(ignition.y, driverBus.ignition)
end DriveByWireAutomatic;


Minimal drive-by-wire driver-vehicle interface with external driver model. Driver environment that requires an external driver model. Signals received
from external driver model are simply propagated throug withouth any
modification.

within VehicleInterfaces.DriverEnvironments;
model DriveByWireAutomaticExternalDriver
  "Minimal drive-by-wire driver-vehicle interface with external driver model"
  extends VehicleInterfaces.Icons.DriverEnvironment;
  extends Interfaces.BaseAutomaticTransmissionExternalDriver;

public
  Mechanics.NormalisedTranslational.PositionSensor acceleratorPosition
  Mechanics.NormalisedTranslational.PositionSensor brakePosition
  Modelica.Blocks.Routing.IntegerPassThrough gearboxMode
  Modelica.Blocks.Routing.IntegerPassThrough requestedGear
  Modelica.Blocks.Routing.IntegerPassThrough ignition
protected
  VehicleInterfaces.Interfaces.DriverBus driverBus
equation
  connect(driverBus, controlBus.driverBus)
  connect(driverInterface.gearboxMode, gearboxMode.u)
  connect(gearboxMode.y, driverBus.gearboxMode)
  connect(driverInterface.requestedGear, requestedGear.u)
  connect(requestedGear.y, driverBus.requestedGear)
  connect(driverInterface.ignition, ignition.u)
  connect(ignition.y, driverBus.ignition)
  connect(driverInterface.brakePedal, brakePosition.flange_a)
  connect(driverInterface.acceleratorPedal, acceleratorPosition.flange_a)
  connect(acceleratorPosition.position, driverBus.acceleratorPedalPosition)
  connect(brakePosition.position, driverBus.brakePedalPosition)
end DriveByWireAutomaticExternalDriver;


Empty driver-vehicle interface. Empty driver environment. Using this empty model in overall vehicle
architecture the functionality of driver environment can be eliminated.

within VehicleInterfaces.DriverEnvironments;
model NoDriverEnvironment "Empty driver-vehicle interface"
  extends VehicleInterfaces.Icons.DriverEnvironment;
  extends VehicleInterfaces.Icons.Empty;
  extends Interfaces.Base;
end NoDriverEnvironment;


within VehicleInterfaces;
package DriverEnvironments "Collection of driver environment subsystem definitions"
  extends Modelica.Icons.VariantsPackage;
end DriverEnvironments;


Driver Environment Tutorial.

within VehicleInterfaces.DriverEnvironments;
class Tutorial "Driver Environment Tutorial"
  extends Modelica.Icons.Information;
end Tutorial;


Basic interface definition for the driver-vehicle interface. This partial model defines the interfaces required for the driver environment
subsystem. See the
documentation
and
tutorial
for more information.

within VehicleInterfaces.DriverEnvironments.Interfaces;
partial model Base
  "Basic interface definition for the driver-vehicle interface"

  VehicleInterfaces.Interfaces.ControlBus controlBus "Control signal bus"
  Modelica.Mechanics.MultiBody.Interfaces.Frame_a chassisFrame
    if includeDriverSeat "Chassis reference frame (optional)"
  Modelica.Mechanics.Rotational.Interfaces.Flange_a steeringWheel
    if includeSteeringWheel "Steering wheel connection (optional)"
  Modelica.Mechanics.Translational.Interfaces.Flange_a acceleratorPedal
    if includeAcceleratorPedal "Accelerator pedal connection (optional)"
  Modelica.Mechanics.Translational.Interfaces.Flange_a brakePedal
    if includeBrakePedal "Brake pedal connection (optional)"
protected
  parameter Boolean includeDriverSeat=false
    "Include the drivers seat connection to the body";
  parameter Boolean includeSteeringWheel=false
    "Include the steering wheel connection";
  parameter Boolean includeAcceleratorPedal=false
    "Include the accelerator pedal connection";
  parameter Boolean includeBrakePedal=false
    "Include the brake pedal connection";
end Base;


Interface definition for the driver-vehicle interface with an automatic transmission. Base class for driver models for vehicles with automatic transmissions
where the driver control logic is contained within the derived model.

within VehicleInterfaces.DriverEnvironments.Interfaces;
partial model BaseAutomaticTransmission
  "Interface definition for the driver-vehicle interface with an automatic transmission"
  extends Base;
end BaseAutomaticTransmission;


Interface definition for the driver-vehicle interface with an automatic transmission and external driver. Base class for driver models for vehicles with automatic transmissions
where the driver control logic is contained in an
external driver model.

within VehicleInterfaces.DriverEnvironments.Interfaces;
partial model BaseAutomaticTransmissionExternalDriver
  "Interface definition for the driver-vehicle interface with an automatic transmission and external driver"
  extends BaseAutomaticTransmission;
  replaceable VehicleInterfaces.Interfaces.DriverInterface driverInterface
    "Driver Interaction Bus"
end BaseAutomaticTransmissionExternalDriver;


Interface definition for the driver-vehicle interface with a manual transmission. Base class for driver models for vehicles with manual transmissions where
the driver control logic is contained within the derived model.

within VehicleInterfaces.DriverEnvironments.Interfaces;
partial model BaseManualTransmission
  "Interface definition for the driver-vehicle interface with a manual transmission"
  extends Base;
protected
  parameter Boolean includeClutchPedal=false
    "Include the clutch pedal connection";
  parameter Boolean includeManualShiftConnector=false
    "Include the manual shift connection";
public
  Modelica.Mechanics.Translational.Interfaces.Flange_a clutchPedal if
    includeClutchPedal "Clutch pedal connection (optional)"
  VehicleInterfaces.Interfaces.ShiftConnector shiftConnector if
    includeManualShiftConnector
    "Manual transmission shift connection (optional)"
end BaseManualTransmission;


Interface definition for the driver-vehicle interface with a manual transmission and external driver. Base class for driver models for vehicles with manual transmissions where
the driver control logic is contained in an
external driver model.

within VehicleInterfaces.DriverEnvironments.Interfaces;
partial model BaseManualTransmissionExternalDriver
  "Interface definition for the driver-vehicle interface with a manual transmission and external driver"
  extends BaseManualTransmission;
  replaceable VehicleInterfaces.Interfaces.DriverInterface driverInterface
    "Driver Interaction Bus"
end BaseManualTransmissionExternalDriver;


within VehicleInterfaces.DriverEnvironments;
package Interfaces "Collection of interface definitions for driver environment"
  extends Modelica.Icons.InterfacesPackage;
end Interfaces;


within VehicleInterfaces.DriverEnvironments;
package Internal "Collection of internal material involving driver environments"
  extends Modelica.Icons.InternalPackage;
end Internal;