/*
 *  Copyright 2002 by Soos, Antal 
 *  All rights reserved. Property of Soos, Antal. 
 *  Restricted rights to use, duplicate or disclose this code are 
 *  granted through contract.   
 */ 
/***************************************************************************/ 
/*                                                                         */ 
/*     sysContr . hpp	                                                   */ 
/*                                                                         */ 
/*     System Control - Common definitions.		                   */ 
/*                                                                         */ 
/*                                                                         */ 
/***************************************************************************/ 
 
// Include files definition: 
#ifndef _SYSCONTR_HPP_ 
#define _SYSCONTR_HPP_ 

 
#include "global_def.h" 
#include "MatrixCal.hpp"
#include <cstdlib> 

// Declaration of the system identification paramethers: 
 
#define NxT NxTs    // the lenght beatwen two decision t=N*T
//----------------------------------------------------------------------------- 
// Declaration of the sysCR object 
class syscr {  // system Control class 
 	 
protected: 
  
   float y_sys_n;		// output's error - the system is stable in origin
   float u_sys_n;		// control effort 
   float y_sys_2;		// output's error - the system is stable in origin
   float u_sys_2;		// control effort 


   
  Matrix state;         //  the estimated state vector
  float state_v[ARMAX_a+2];

//-----------------------------------------------------------------------------

  	int controlStatRedy; // Statistic calculation for the control:
    int count_n;	// counter for the sample lenght 
    float performance_index; // generalized performance index 

public: 

    syscr(void); 
    ~syscr(void); 
    void get_state(Matrix *gtheta); 
 
	int update_stat(void);  // Statistic calculation for the identification  
 	float get_output_error(void);   // the system output error 
	float get_control_effort(void); // the control effort  
	
  
}; 
//----------------------------------------------------------------------------- 
 
#endif // _SYSCONTR_HPP_
