| Volume pwrb | |
| Attributes: Runtime | Development | System | Template | Detail C Binding: Struct | Class | Code  ClassTree | INDEX NO INDEX |
Class PiPos
|
||
|---|---|---|
| Version | 1.0 | |
| Modified | 08-MAR-2026 11:05:32.00 | |
| Code | rt_plc_io.c | |
Translates a pulse counter value into an engineering value, e.g. position, volume etc.

Suppose the engineering value is a position. The actual
position is then calculated at every scanning by means
of the straight line equation
ActVal = Gain * (PulsIn - PiCal1) + PosCal1
The ActVal position is calculated relative to the
position in calibration point 1 by means of the current
pulse signal, PulsIn, saved pulse signal PiCal1, and
saved position, PosCal1, at calibration point 1. The
Gain factor is either specified or calculated by means
of a second calibration point, calibration point 2.

How to carry out the calibrations is described below under Calibration.

| RtBody attributes pwr_sClass_pipos | |||
|---|---|---|---|
| Int32 | PulsIn | PI | Pulse counter value, e.g. the pulse number PI or PIX from a GetPi or Count object. |
| Float32 | CalPos1 | CP1 | Specifies a position that will be used at the next absolute value calibration at point 1. The attribute can be assigned a value in the development environment by means of the Attribute Editor and in the target environment e.g. by means of a function in C or PLC programs. If the input is connected the value of the connected quantity is used at calibration. |
| Boolean | CalOrder1 | co1 | Calibration order 1. Specifies whether to start an absolute value calibration in point 1 or not. FALSE means no action. The transition FALSE -> TRUE triggers the calibration in point 1 and the pulse value PulsIn is read and stored in PICal1, and the value of CalPos1 is moved into PosCal1. A connected input signal is supposed to be a pulse. If the input left open it can be set from anywhere when to trigger the calibration. In this case it is cleared by the ProviewR system when it has been noticed. |
| Float32 | CalPos2 | CP2 | Specifies a position that will be used at the next gain factor calibration at point 2. The attribute can be assigned a value in the development environment by means of the Attribute Editor and in the target environment, for instance, by means of a function in C or PLC programs. If the input is connected the value of the connected quantity is used at calibration. |
| Boolean | CalOrder2 | co2 | Calibration order 2. Specifies whether to start a gain factor calibration in point 2 or not. FALSE means no action. The transition FALSE -> TRUE triggers the gain calibration in point 2. A connected input signal is supposed to be a pulse. If the input is left open it can be set from anywhere when to trigger the calibration. In this case it is cleared by the ProviewR system when it has been noticed. |
| Float32 | ActVal | POS | Current position. The unit comes from the unit of Gain. If Gain is in mm per pulse then ActVal will be in mm. |
| Float32 | Gain | Gain | If the conversion factor is denoted Omsfak is Omsfak = the number of pulses per x-unit, where x-unit can be mm, degrees etc. The Gain is obtained as the value of 1 / Omsfak. The value is either specified or calculated; see Calibration below. |
| Int32 | PICal1 | PICal1 | Pulse counter value at the last absolute value calibration at point 1. Its corresponding position value is specified by PosCal1. |
| Boolean | CalOrder1Old | CalOrder1Old | Used at edge detecting. |
| Boolean | CalOrder2Old | CalOrder2Old | Used at edge detecting. |
| Float32 | PosCal1 | PosCal1 | Position value at the last absolute value calibration at point 1. Its corresponding pulse counter value is specified by PiCal1. PosCal1 has the same unit as ActVal. |
| Float32 | PosCal2 | CalPos2 | Position value at the last gain calibration at point 2. |
| Int32 | AccCalPos1 | AccCalPos1 | The operator's authorities regarding CalPos1 respectively CalOrder1. 0 -- Changes not allowed. != 0 -- Changes allowed. |
| Int32 | AccCalOrder1 | AccCalOrder1 | The operator's authorities regarding CalPos2 respectively CalOrder2. 0 -- Changes not allowed. != 0 -- Changes allowed. |
| Int32 | AccCalPos2 | AccCalPos2 | The minimum and maximum allowed value of CalPos1 at changes made by an operator. |
| Int32 | AccCalOrder2 | AccCalOrder2 | |
| Float32 | MinCalPos1 | MinCalPos1 | The minimum and maximum allowed value of CalPos2 at changes made by an operator. Calibration Determination of absolute position. Calibration by means of calibration point 1. In fact, there are four different methods to determine the absolute position: 1 No calibration. At configuration specifies the pulse value PICal1 when ActVal is equal to the known position PosCal1. This method can be used if the pulse value is known at a fixed position at the configuration stage. 2 The operator calibrates. The operator specifies the position CalPos1 and then gives order to calibrate by setting CalOrder1. 3 Automatic calibration at a fixed position. Connects co1 to a digital signal. Specify the corresponding position in CalPos1. At a leading edge on CalOrder1 the pulse value PulsIn is read and stored in PICal1, and the value of CalPos1 is moved into PosCal1. 4 Automatic calibration against a varying position. The same as for a fixed position but CalPos1 is also connected to a calculated position signal. At a leading edge on CalOrder1 the pulse value PulsIn is read and stored in PICal1, and PosCal1 is updated by a value from the external signal. Automatic calibration ought to be done at low speed to avoid position error. Determination of gain. Calibration by means of calibration point 2. 1 No calibration. The designer specifies the value of Gain; (= the difference in position per pulse). This is the normal case when the characteristic of the position transducer is known. If the conversion factor is denoted Omsfak , Omsfak is equal to the number of pulses per x-unit, where x-unit can be mm, degrees, etc. The Gain is obtained as the value of 1 / Omsfak. 2 Moment 2, 3 and 4 as for absolute position above. The calibration in point 1 has to be done first. Then a calibration is carried out in point 2, at which a new position and its corresponding pulse value are read. The values are compared with those from point value, and Gain is calculated. Automatic calibration of the gain is supposed to be unusual. However it is possible that there is a need of re-calibration at exchange of measuring unit. |
| Float32 | MaxCalPos1 | MaxCalPos1 | |
| Float32 | MinCalPos2 | MinCalPos2 | |
| Float32 | MaxCalPos2 | MaxCalPos2 | |
| DevBody attributes | |||
|---|---|---|---|
| PlcNode | PlcNode | ||
| GraphPlcNode | |
|---|---|
| object_type | 69 |
| parameters[0] | 5 |
| parameters[1] | 0 |
| parameters[2] | 1 |
| parameters[3] | 0 |
| subwindows | 0 |
| graphmethod | 0 (standard, individual attributes) |
| graphindex | 0 |
| default_mask[0] | 1 |
| default_mask[1] | 1 |
| segname_annotation | 1 |
| compmethod | 4 |
| compindex | 0 |
| executeordermethod | 2 |
| objname | PiPos |
| graphname | PiPos |
| debugpar | |
| Template Object | |
|---|---|
| Gain | 1.0 |
| AccCalPos1 | 15 |
| AccCalOrder1 | 15 |
| PulsIn Input | ||
|---|---|---|
| Class | Input | |
| Type | Int32 | |
| Flags | STATE | NOEDIT | REDUTRANSFER | |
| GraphName | PI | |
| Body | RtBody | |
Pulse counter value, e.g. the pulse number PI or PIX from a GetPi or Count object.
| CalPos1 Input | ||
|---|---|---|
| Class | Input | |
| Type | Float32 | |
| Flags | REDUTRANSFER | |
| GraphName | CP1 | |
| Body | RtBody | |
Specifies a position that will be used at the next absolute value calibration at point 1. The attribute can be assigned a value in the development environment by means of the Attribute Editor and in the target environment e.g. by means of a function in C or PLC programs. If the input is connected the value of the connected quantity is used at calibration.
| CalOrder1 Input | ||
|---|---|---|
| Class | Input | |
| Type | Boolean | |
| Flags | STATE | NOEDIT | NOINVERT | REDUTRANSFER | |
| GraphName | co1 | |
| Body | RtBody | |
Calibration order 1. Specifies whether to start an absolute value calibration in point 1 or not. FALSE means no action. The transition FALSE -> TRUE triggers the calibration in point 1 and the pulse value PulsIn is read and stored in PICal1, and the value of CalPos1 is moved into PosCal1. A connected input signal is supposed to be a pulse. If the input left open it can be set from anywhere when to trigger the calibration. In this case it is cleared by the ProviewR system when it has been noticed.
| CalPos2 Input | ||
|---|---|---|
| Class | Input | |
| Type | Float32 | |
| Flags | REDUTRANSFER | |
| GraphName | CP2 | |
| Body | RtBody | |
Specifies a position that will be used at the next gain factor calibration at point 2. The attribute can be assigned a value in the development environment by means of the Attribute Editor and in the target environment, for instance, by means of a function in C or PLC programs. If the input is connected the value of the connected quantity is used at calibration.
| CalOrder2 Input | ||
|---|---|---|
| Class | Input | |
| Type | Boolean | |
| Flags | STATE | NOEDIT | NOINVERT | REDUTRANSFER | |
| GraphName | co2 | |
| Body | RtBody | |
Calibration order 2. Specifies whether to start a gain factor calibration in point 2 or not. FALSE means no action. The transition FALSE -> TRUE triggers the gain calibration in point 2. A connected input signal is supposed to be a pulse. If the input is left open it can be set from anywhere when to trigger the calibration. In this case it is cleared by the ProviewR system when it has been noticed.
| ActVal Output | ||
|---|---|---|
| Class | Output | |
| Type | Float32 | |
| Flags | STATE | NOEDIT | REDUTRANSFER | |
| GraphName | POS | |
| Body | RtBody | |
Current position. The unit comes from the unit of Gain. If Gain is in mm per pulse then ActVal will be in mm.
| Gain Intern | ||
|---|---|---|
| Class | Intern | |
| Type | Float32 | |
| Flags | REDUTRANSFER | |
| GraphName | Gain | |
| Body | RtBody | |
If the conversion factor is denoted Omsfak is Omsfak = the number of pulses per x-unit, where x-unit can be mm, degrees etc. The Gain is obtained as the value of 1 / Omsfak. The value is either specified or calculated; see Calibration below.
| PICal1 Intern | ||
|---|---|---|
| Class | Intern | |
| Type | Int32 | |
| Flags | REDUTRANSFER | |
| GraphName | PICal1 | |
| Body | RtBody | |
Pulse counter value at the last absolute value calibration at point 1. Its corresponding position value is specified by PosCal1.
| CalOrder1Old Intern | ||
|---|---|---|
| Class | Intern | |
| Type | Boolean | |
| Flags | STATE | NOEDIT | INVISIBLE | REDUTRANSFER | |
| GraphName | CalOrder1Old | |
| Body | RtBody | |
Used at edge detecting.
| CalOrder2Old Intern | ||
|---|---|---|
| Class | Intern | |
| Type | Boolean | |
| Flags | STATE | NOEDIT | INVISIBLE | REDUTRANSFER | |
| GraphName | CalOrder2Old | |
| Body | RtBody | |
Used at edge detecting.
| PosCal1 Intern | ||
|---|---|---|
| Class | Intern | |
| Type | Float32 | |
| Flags | STATE | NOEDIT | INVISIBLE | REDUTRANSFER | |
| GraphName | PosCal1 | |
| Body | RtBody | |
Position value at the last absolute value calibration at point 1. Its corresponding pulse counter value is specified by PiCal1. PosCal1 has the same unit as ActVal.
| PosCal2 Intern | ||
|---|---|---|
| Class | Intern | |
| Type | Float32 | |
| Flags | STATE | NOEDIT | INVISIBLE | REDUTRANSFER | |
| GraphName | CalPos2 | |
| Body | RtBody | |
Position value at the last gain calibration at point 2.
| AccCalPos1 Intern | ||
|---|---|---|
| Class | Intern | |
| Type | Int32 | |
| Flags | ||
| GraphName | AccCalPos1 | |
| Body | RtBody | |
The operator's authorities regarding CalPos1 respectively CalOrder1. 0 -- Changes not allowed. != 0 -- Changes allowed.
| AccCalOrder1 Intern | ||
|---|---|---|
| Class | Intern | |
| Type | Int32 | |
| Flags | ||
| GraphName | AccCalOrder1 | |
| Body | RtBody | |
The operator's authorities regarding CalPos2 respectively CalOrder2. 0 -- Changes not allowed. != 0 -- Changes allowed.
| AccCalPos2 Intern | ||
|---|---|---|
| Class | Intern | |
| Type | Int32 | |
| Flags | ||
| GraphName | AccCalPos2 | |
| Body | RtBody | |
The minimum and maximum allowed value of CalPos1 at changes made by an operator.
| AccCalOrder2 Intern | ||
|---|---|---|
| Class | Intern | |
| Type | Int32 | |
| Flags | ||
| GraphName | AccCalOrder2 | |
| Body | RtBody | |
| MinCalPos1 Intern | ||
|---|---|---|
| Class | Intern | |
| Type | Float32 | |
| Flags | REDUTRANSFER | |
| GraphName | MinCalPos1 | |
| Body | RtBody | |
The minimum and maximum allowed value of CalPos2 at
changes made by an operator.
Calibration
Determination of absolute position. Calibration by
means of calibration point 1.
In fact, there are four different methods to determine
the absolute position:
1 No calibration. At configuration specifies the pulse
value PICal1 when ActVal is equal to the known
position PosCal1. This method can be used if the
pulse value is known at a fixed position at the
configuration stage.
2 The operator calibrates. The operator specifies the
position CalPos1 and then gives order to calibrate
by setting CalOrder1.
3 Automatic calibration at a fixed position. Connects
co1 to a digital signal. Specify the corresponding
position in CalPos1. At a leading edge on CalOrder1
the pulse value PulsIn is read and stored in PICal1,
and the value of CalPos1 is moved into PosCal1.
4 Automatic calibration against a varying position.
The same as for a fixed position but CalPos1 is also
connected to a calculated position signal. At a
leading edge on CalOrder1 the pulse value PulsIn is
read and stored in PICal1, and PosCal1 is updated by
a value from the external signal.
Automatic calibration ought to be done at low speed
to avoid position error.
Determination of gain. Calibration by means of
calibration point 2.
1 No calibration.
The designer specifies the value of Gain; (= the
difference in position per pulse). This is the
normal case when the characteristic of the position
transducer is known. If the conversion factor is
denoted Omsfak , Omsfak is equal to the number of
pulses per x-unit, where x-unit can be mm, degrees,
etc. The Gain is obtained as the value of 1 /
Omsfak.
2 Moment 2, 3 and 4 as for absolute position above.
The calibration in point 1 has to be done first.
Then a calibration is carried out in point 2, at
which a new position and its corresponding pulse
value are read. The values are compared with those
from point value, and Gain is calculated.
Automatic calibration of the gain is supposed to be
unusual. However it is possible that there is a need
of re-calibration at exchange of measuring unit.
| MaxCalPos1 Intern | ||
|---|---|---|
| Class | Intern | |
| Type | Float32 | |
| Flags | REDUTRANSFER | |
| GraphName | MaxCalPos1 | |
| Body | RtBody | |
| MinCalPos2 Intern | ||
|---|---|---|
| Class | Intern | |
| Type | Float32 | |
| Flags | REDUTRANSFER | |
| GraphName | MinCalPos2 | |
| Body | RtBody | |
| MaxCalPos2 Intern | ||
|---|---|---|
| Class | Intern | |
| Type | Float32 | |
| Flags | REDUTRANSFER | |
| GraphName | MaxCalPos2 | |
| Body | RtBody | |
| PlcNode Buffer | ||
|---|---|---|
| Class | Buffer | |
| Type | PlcNode | |
| Flags | INVISIBLE | |
| Body | DevBody | |