.VehicleInterfaces.Controllers.Tutorial

Information

Tutorial - Defining a new controller model

The following process will demonstrate how to create a new controller model using these interface definitions. This tutorial will guide you through building a simple idle speed controller for an engine.

  1. Create a new model that extends VehicleInterfaces.Controllers.Interfaces.Base, it should look like this:



  2. You can now define your controller model as required

Creating a simple idle speed controller example

The following steps demonstrate how to create a simple idle speed controller model. The controller model will sense the engine speed, coolant temperature and accelerator pedal position and adjust the throttle signal to the engine to attempt to maintain the correct idle speed.

Starting from step 2 above.

  1. Add the following blocks and connections to the diagram.



  2. The controller model is built on the assumption that a corresponding engine model will be developed that outputs the required signals to the control signal bus. We need to add connections to the control signal bus and will assume the following names for the additional signals required that are not part of the minimal set defined as part of the VehicleInterfaces:
  3. To add these control signals we first need to add the engineBus and engineControlBus connectors and connect them to the controlBus. These connectors are VehicleInterfaces.Interfaces.EngineBus and VehicleInterfaces.Interfaces.EngineControlBus. When connecting these to the controlBus the following dialog will be produced and should be completed as following substituting engineControlBus for engineBus as appropriate.



  4. We can then complete the model by connecting the blocks to the control bus connectors and using the appropriate signal names. The finished model should look like:



  5. The model is now complete and should check successfully and can be used in any model compatible with the VehicleInterfaces library assuming the selected engine model puts the required signals on to the control signal bus

Generated at 2024-11-22T19:25:38Z by OpenModelicaOpenModelica 1.24.2 using GenerateDoc.mos