Channel Initialisation

Overview

Controller module channel initialisation functions This group defines all functions to initialise controller channels properly.

Each measurement and control device that is attached to the labbCAN bus offers a number of controller channels.

+ Collaboration diagram for Channel Initialisation:

Functions

long LCC_CreatePIDControlChannel (dev_hdl AnalogInput, dev_hdl Output, unsigned int LoopOutType, dev_hdl *pCreatedChannel)
 Function for creation of dynamic PID control channels. More...
 
long LCC_GetChannelHandle (unsigned char Index, dev_hdl *pChanHdl)
 Get controller channel handle by its index. More...
 
long LCC_GetNoOfControlChannels ()
 Query number of available controller channels. More...
 
long LCC_LookupChanByName (const char *pChannelName, dev_hdl *pChanHdl)
 Lookup for a controller channel by its name. More...
 

Function Documentation

long LCC_CreatePIDControlChannel ( dev_hdl  AnalogInput,
dev_hdl  Output,
unsigned int  LoopOutType,
dev_hdl pCreatedChannel 
)

Function for creation of dynamic PID control channels.

With dynamic control channels you can create your own custom PID control loops. You just need to provide an analog input channel that measures the actual value and a control loop output for writing the control loop output value. You can use analog /digital output channels and pumps as control loop output. You can easily implement pressure controlled dosage by combining an analog pressure sensor as control loop input and a syringe pump as control loop output. The following example code shows how to do this

dev_hdl ControlLoopIn;
dev_hdl Pump;
dev_hdl ControlChannel;
LCAIO_GetInChanHandle(0, &ControlLoopIn);
LCC_CreatePIDControlChannel(ControlLoopIn, Pump, PUMP_FLOW, &ControlChannel);

If you have created a channel, you need to call LCC_SetPIDParameter() to configure the PID parameters of the channel. If you have configured the PID parameters properly, you can enable the control loop via LCC_EnableControlLoop().

Parameters
AnalogInputThe control loop input - channel handle of an analog input device.
OutputThe control loop output - you can pass in an analog out channel a digital out channel or a pump device.
LoopOutTypeProvide the type of the loop output that should get created by this function. The type need to match the type passed in in Output parameter. The following types are supported:
  • ANALOG A simple analog output - e.g. for controlling a heater
  • DIGITAL A simple digital switch - e.g. for switching a heater
  • DIGITAL_PWM A loop output that uses a digital output channel to create a PWM - e.g. for PWM control of a peltier element
  • PUMP_FLOW A loop output that controls the flow rate of a pump (see LoopOutType for all output type identifiers)
pCreatedChannelReturns the handle to controller channel handle if the channel was successfully created.
See also
LoopOutType for an enumeration of all loop output types
Returns
Error code - ERR_NOERR indicates success
Examples:
capi_dynamic_controller_test.cpp, and capi_pressure_control_test.cpp.
long LCC_GetChannelHandle ( unsigned char  Index,
dev_hdl pChanHdl 
)

Get controller channel handle by its index.

Parameters
[in]IndexIndex into list of available controller channels. The index must be in the range of 0 - (LCC_GetNoOfControlChannels() - 1)
[out]pChanHdlReturns handle to control channel or 0 if the given index is out of range
Return values
-ERR_PARAM_RANGEIf the given device index is out of range
ERR_NOERRindicates success
Examples:
capi_qmixqplus_test.cpp.
long LCC_GetNoOfControlChannels ( )

Query number of available controller channels.

Return values
>=0 Number of available control channels
<0 Error code
Examples:
capi_qmixqplus_test.cpp.
long LCC_LookupChanByName ( const char *  pChannelName,
dev_hdl pChanHdl 
)

Lookup for a controller channel by its name.

Parameters
[in]pChannelNameThe name to assign with this channel
[out]pChanHdlHandle to controller channel handle if the channel was sucessfully opened
Return values
-ERR_NODEVNo device with the given name found
ERR_NOERRindicates success
Returns
Error code - ERR_NOERR indicates success
Examples:
capi_qmixqplus_test.cpp.