Sample function#

float uz_PI_Controller_sample(uz_PI_Controller *self, float referenceValue, float actualValue, bool ext_clamping)#

Calculates the last sample of the PI-Controller.

Parameters:
  • self – uz_PI_Controller instance

  • referenceValue – reference value for error calculation

  • actualValue – actual value for error calculation

  • ext_clamping – input port for an external clamping signal

Returns:

float

Example#

Listing 126 Example function call to calculate the PI-Controller output. PI-Instance via init-function#
1#include "uz_piController.h"
2int main(void) {
3   float referenceValue = 1.5f;
4   float actualValue = 1.1f;
5   bool ext_clamping = false;
6   float output = uz_PI_Controller_sample(PI_instance, referenceValue, actualValue, ext_clamping);
7}

Description#

Calculates one sample of the PI-Controller. It has an output limitation and a corresponding clamping circuit. Furthermore, it has an input port for an external clamping signal. The error between the reference and actual value will be calculated inside the function.

Warning

The sample function has to be called with the same sample time as specified in the samplingTime_sec member of the configuration struct.

Figure made with TikZ

Fig. 287 parallel PI-Controller schematic

Figure made with TikZ

Fig. 288 ideal PI-Controller schematic