/**
 * @file	   pressureController.h
 *
 * @copyright  Nehemis SARL reserves all rights even in the event of industrial
 *             property rights. We reserve all rights of disposal such as
 *             copying and passing on to third parties.
 *
 * @brief	   
 *
 */


#ifndef PRESSURECONTROLLER_H_
#define PRESSURECONTROLLER_H_

/******************************************************************************
 * Include Header Files
 ******************************************************************************/
#include "nms_types.h"

/******************************************************************************
 * Macro constant declarations
 ******************************************************************************/

/******************************************************************************
 * Type declarations
 ******************************************************************************/
typedef struct
{
    float32 regulatorActivation_f32;
    float32 commandRm_f32;
    float32 setpoint_f32;
    float32 measFilt_f32;
    float32 measFilt2_f32;
    float32 kpGain_f32;
    float32 kiGain_f32;
    float32 kdGain_f32;
    float32 sampleTime_f32;
    float32 satDeriv_f32;
    float32 commandMax_f32;
    float32 commandMin_f32;
    bool integralResetFlag_b;
    float32 tolerance_f32;
} PuControllersPidInput_st;

/**
 * @brief Output structure for regulator controller model.
 */
typedef struct
{
	float32 commandSetpoint_f32;
	float32 propOutput_f32;
	float32 integOutput_f32;
	float32 derivOutput_f32;
} PuControllersPidOutput_st;

typedef struct
{
	float32 sumOutput_f32;
    float32 prevMeasFilt2_f32;
    float32 integState_f32;
    float32 prevCommandInput_f32;
    bool    isRegulatorActive_b;
} PuControllersPidState_st;

/******************************************************************************
 * Extern Function Declarations
 ******************************************************************************/
void PuControllersInitInputs(PuControllersPidInput_st *pumpPin_pst);


void PuControllersPidLoop(const PuControllersPidInput_st *input_pst, PuControllersPidOutput_st *output_pst, PuControllersPidState_st *state_pst);
#endif /* PRESSURECONTROLLER_H_ */
