User Tools

Site Tools


eeros_architecture:hal:configuration_file

This is an old revision of the document!


Configuration File

The external hardware is decribed by means of a configuration file in JSON format. Every available hardware must be grouped into device, subdevice and channel. A device could be a data acquisition card, an external FPGA, or a pointing device such as a mouse. The subdevice denotes a certain function such as a group of digital-to-analog outputs or a bank of digital inputs. Finally, a channel is one of such a group of inputs or outputs.
Let's consider a first example

{
  "device0": {
    "library": "libcomedieeros.so",
      "devHandle": "/dev/comedi0",
      "subdevice1": {
        "type": "DigIn",
        "channel0": {
          "signalId": "emergency"
          "inverted": true
        }
      },
      "subdevice5": {
        "type": "AnalogOut",
        "channel0": {
          "signalId": "aOut0",
          "scale": [ { "id" :    "aOut0",
                       "minIn":   2000, "maxIn":  64000,
                       "minOut":-9.787, "maxOut": 9.923 },
                   ],
          "range": [ { "id" :   "aOut0",
                       "minIn":      0, "maxIn":  65536,
                       "minOut": -10.0,	"maxOut":  10.0 },
                   ],
          "unit": "V"
        }
      }
    }
  }
}

Every element is composed of a key / value pair. The key must be unique for every hierachy level. The key for devices, subdevices, and channels contains the number of the device, subdevice, or channel, respectively.

Library

A device must contain a library key. The system can then search for the necessary library. This library must be present in the system and will be loaded dynamically upon parsing the configuration file. For available libraries check Hardware Libraries

Type

A subdevice must contain a type key. This type must coincide with the subdevice type of the hardware library in use. Some subdevices contain channels of different types, e.g. a subdevice might hold several digital i/o's. Some will work as inputs while some other will be outputs. In this case you define the subdevice as being of type DigIn. I single input channel inherits its type from the subdevice. If it is an output you can redefine the type for the channel.

  "subdevice5": {
    "type": "DigIn",
    "channel0": {
      "type": "DigOut",
      "signalId": "enableDrv"
    },
    "channel1": {
      "signalId": "readySig1"
    }
  }

SignalId

Every channel must contain a signalId key. This is an indentification string. The HAL manager registers the channel under this name and you have to request an input or output from your EEROS application with this name.

Scale and Range

Channels carrying an analog signal must be assigned a scale and range key. With these values the HAL is able to translate between the analog signal and its digital value as this digital value is necessary when accessing the hardware converter (counter, adc, dac). For examples in how to setup the scale and range properly see Scale and Range of Analog Signals.

Available Keywords

Keyword Type Remarks
deviceX object device, X is the device number
library string EEROS wrapper library, give full name of library including file ending and version (e.g. *.so.0.1.2)
devHandle string device node which will be used for this device/group of subdevices
subdeviceY object subdevice, group of channels with specific type
type string describes the type of this subdevice group, name has to be the same as the library-name in your wrapper library
channelZ object describes one channel of this type
signalId string unique signal id for this channel, with this name you can claim the signal in your EEROS application
inverted bool invert value of this channel (working for digital in/outputs)
scale object/array scale for scalable channel
range object/array range values for scalable channel
id string used to name each scale and range array element, every scale element needs a range element with the same id
minIn double minimum input value, used to set scale or range of scalable in-/outputs, describe your hardware!
maxIn double maximum input value, used to set scale or range of scalable in-/outputs
minOut double minimum input value, used to set scale or range of scalable in-/outputs
maxOut double maximum output value, used to set scale or range of scalable in-/outputs
scale double scale value to set scale of scalable in-/output directly, do not mix with scale object!
offset double offset value to set offset of scalable in-/output directly
unit string unit of this in-/output, used for scalable in-/outputs
eeros_architecture/hal/configuration_file.1498743674.txt.gz · Last modified: 2017/06/29 15:41 by graf