INOS
Process image

Overview


Process image classes

dot_inline_dotgraph_1.png

Overview of all classes handling the process images


Process image channel classes

dot_inline_dotgraph_2.png

Overview of all classes handling the process image channels


Introduction

Processimages are responsible for all the peripheral digital and analog inputs and outputs. INOS ensures that they are updated with the requested cycletime. Typical cycletimes are 1kHz, 4kHz, 8kHz and 16kHz depending on the hardware one is using. The application always interacts with the corresponding process image if it e.g. needs to test a digital input or set an analog output. The following process image types are available

  • Digital Inputs : it represents all digital inputs of the whole system
  • Digital Outputs : it represents all digital outputs of the whole system
  • Analog Inputs : it represents all analog inputs of the whole system
  • Analog Outputs : it represents all analog outputs of the whole system

A process image type always lies in a continous area of memory. The size of this area needs to be defined in the corresponding system variable.

Example to define max. 4096 digital inputs:

in a system.dt2

"DIGITAL.NumberOfInputs" ; "4096" ;

or in a ch.indel.data.system.xml

<object id="ch.indel.data.system">
<object id="digital">
<property id="numberofinputs" type="string">4096</property>
</object>
</object>
Definition cinosmcmodule.h:1900

The memory size used for the mentioned 4096 inputs is 512 bytes. A PC application could theoretically read all 4096 inputs by reading 128*uint32 with one GetBlock32.

A process image is represented by the class CINOSProcessImage, its channels by CINOSProcessImageChannel and its descendents. All process image channels have a unique name. The pointer to the required channel can be get with the Find method of the corresonding process image instance. Due to the fact that the method Find takes some time in a huge system, one should use it only during initialisation phase and not in a realtime part. The Find method takes two parameters, the channel name and an additional simulation level. With this level one can tell the system what to do if the requested channel is not found. There are three options :

#define DF_INOS_IMAGE_CHN_SIM_NO 0 // no simulation -> return 0 if not found
#define DF_INOS_IMAGE_CHN_SIM_YES 1 // simulate channel if not found
#define DF_INOS_IMAGE_CHN_SIM_DEF 2 // simulation level defined by system.dt2

If DF_INOS_IMAGE_CHN_SIM_DEF is used (the default case), the simulation level is defined by the system variable INOS.SimulateProcessImage.

Example to set default level to yes (1):

in a system.dt2

"INOS.SimulateProcessImage" ; "yes" ;

or in a ch.indel.data.system.xml

<object id="ch.indel.data.system">
<object id="inos">
<property id="simulateprocessimage" type="string">yes</property>
</object>
</object>

Digital IO's


Digital Inputs

This process image represents all digital inputs of the whole system, independent of the fieldbus they are coming from. It therefore contains all inputs from a GinLink, COPBus, IMPBus as well as from a possible foreign fieldbus.

The base class for the image itself is CINOSBits, the one for an input CINOSBit.

Example how to access a digital input:

#include <inos.h>
{
// pointer ot button valid?
if (0 != startButton) {
// yes
return startButton->Test();
}
return false;
}
{
// get pointer to digital input named 'COP0.DiStart'
startButton = g_pInputs->Find("COP0.DiStart");
}
Short comment.

Hint: The name used in Find is the part behind Image.Digital.Input if you check the inco tree with the Indel INCOExplorer


Digital Outputs

This process image represents all digital outputs of the whole system, independent of the fieldbus they are coming from. It therefore contains all outputs from a GinLink, COPBus, IMPBus as well as from a possible foreign fieldbus.

The base class for the image itself is CINOSBits, the one for an output CINOSBit.

Example how to toggle a digital output:

#include <inos.h>
void MyTask()
{
// get pointer to alarm output, simulate it if not found
CINOSBit* alarmLamp = g_pOutputs->Find("COP0.DoAlarm", DF_INOS_IMAGE_CHN_SIM_YES);
// stay here forever
while (1) {
// set output
alarmLamp->Set();
Sleep(100);
// set output
alarmLamp->Clear();
Sleep(100);
}
}
{
// create task with lowest priority
true, defDefaultTimeSlice, false, (void*) &MyTask));
}
Definition cinosbit.h:54
Definition cinostask.h:52
#define DF_INOS_TASK_PRIO_LOWEST
Definition inosdefine.h:187

The parameter DF_INOS_IMAGE_CHN_SIM_YES, tells the system to simulate the requested output, if it is currently not available. Thats why we do not check if the pointer is valid.

Hint: The name used in Find is the part behind Image.Digital.Output if you check the inco tree with the Indel INCOExplorer


Analog IO's


Analog Inputs

Due to historical reasons, the process image for all other not bit type inputs is called analog inputs and is handled by the class CINOSAdcChannels. One input itself by the class CINOSAdcChannel. Examples of such channels are e.g. real analog inputs like a PT100 temperature or pseudo analog inputs like a module state of a customer specific card.

Example how to read a PT100 temperature:

#include <inos.h>
{
// pointer to temp valid?
if (0 != zoneTemperature) {
// yes
return zoneTemperature->GetValue();
}
return 0.0;
}
{
// get pointer to analog input named 'COP0.ZoneTemp'
zoneTemperature = g_pAdcChannels->Find("COP0.ZoneTemp", DF_INOS_IMAGE_CHN_SIM_YES);
}
Definition cinosadcchannel.h:53

Hint: The name used in Find is the part behind Image.Analog.Input if you check the inco tree with the Indel INCOExplorer


Analog Outputs

Due to historical reasons, the process image for all other not bit type outputs is called analog outputs and is handled by the class CINOSDacChannels. One input itself by the class CINOSDacChannel. Examples of such channels are e.g. real analog outputs like a current source on a COP module or pseudo analog outputs like a module flag of a customer specific card.

Example how to write a analog output:

#include <inos.h>
void OpenValve()
{
// set value
return valveOut->SetValue(5000.0);
}
void CloseValve()
{
// set value
return valveOut->SetValue(0.0);
}
{
// get pointer to analog output named 'COP0.Valve'
valveOut = g_pDacChannels->Find("COP0.Valve", DF_INOS_IMAGE_CHN_SIM_YES);
}
Definition cinosdacchannel.h:52

Hint: The name used in Find is the part behind Image.Analog.Output if you check the inco tree with the Indel INCOExplorer


Position channels

All counting values like e.g. encoders are handled by position channels process image.

The base class for the image itself is CINOSPosChannels, the one for a channel CINOSPosChannel.

Example how to read and encoder value:

#include <inos.h>
int32 GetEncoder()
{
// set value
return encoderZ->GetPosition();
}
{
// get pointer to encoder 'COP0.PositionZ'
encoderZ = g_pPosChannels->Find("COP0.PositionZ", DF_INOS_IMAGE_CHN_SIM_YES);
}
Definition cinosposchannel.h:59

Hint: The name used in Find is the part behind Image.Analog.Output if you check the inco tree with the Indel INCOExplorer