/*2011-01-03T15:22:40-01:00*/

/********************************************************************
 * poste_sfp_cov.c
 * 
 * generated by: plcgen 2.1.201
 ********************************************************************/

#include "cb_comp.h"
#include "cb_covs.h"
#include "iec_1131.h"

#include "poste_sfp.h"
#include "bibliotheque_epo/functional/verin_double_effet/verin_double_effet.h"
#include "bibliotheque_epo/functional/verin_simple_effet/verin_simple_effet.h"
#include "sfp/functional/vacuostat/vacuostat.h"


/**************************** Variables *****************************/

CB_Index poste_sfp__num = 0;
CB_Mem_Bool *poste_sfp_EVGXR;
CB_Mem_Bool *poste_sfp_EVGXS;
CB_Mem_Bool *poste_sfp_EVPXR;
CB_Mem_Bool *poste_sfp_EVPXS;
CB_Mem_Bool *poste_sfp_EVVRR;
CB_Mem_Bool *poste_sfp_EVVRS;
CB_Mem_Bool *poste_sfp_EVVZ;
CB_Mem_Bool *poste_sfp_EVVTA;
CB_Mem_Bool *poste_sfp_EVVTM;
CB_Mem_Bool *poste_sfp_Presence_piece;
CB_Mem_Bool *poste_sfp_FCGXS;
CB_Mem_Bool *poste_sfp_FCGXR;
CB_Mem_Bool *poste_sfp_FCPXS;
CB_Mem_Bool *poste_sfp_FCPXR;
CB_Mem_Bool *poste_sfp_FCVRS;
CB_Mem_Bool *poste_sfp_FCVRR;
CB_Mem_Bool *poste_sfp_FCVZH;
CB_Mem_Bool *poste_sfp_FCVZB;
CB_Mem_Bool *poste_sfp_Vacuostat;

/**************************** Variables *****************************/



/************************ Components offsets ************************/

static CB_Offset sfp__poste_sfp_offset_verin_double_effet_GX;
static CB_Offset sfp__poste_sfp_offset_verin_double_effet_PX;
static CB_Offset sfp__poste_sfp_offset_verin_double_effet_VR;
static CB_Offset sfp__poste_sfp_offset_verin_simple_effet_VZ;
static CB_Offset sfp__poste_sfp_offset_vacuostat1;
static CB_Offset sfp__poste_sfp_offset__end = {0, 0, 0, 0};


/********************* Initialization function **********************/

int _sfp__poste_sfp_init(void)
{
	CB_Object __start = self;
	(poste_sfp_Presence_piece)->CB_current_value = 1; /*Presence_piece*/
	self.Bool+=12;
	self.Float+=12;

	/*initialize child verin_double_effet_GX (bibliotheque_epo.verin_double_effet):*/
	sfp__poste_sfp_offset_verin_double_effet_GX.Bool = self.Bool - __start.Bool;
	sfp__poste_sfp_offset_verin_double_effet_GX.Int = self.Int - __start.Int;
	sfp__poste_sfp_offset_verin_double_effet_GX.Float = self.Float - __start.Float;
	sfp__poste_sfp_offset_verin_double_effet_GX.Char = self.Char - __start.Char;
	verin_double_effet_energieAir = __start.Bool+11; /*poste_sfp__cn_1*/
	verin_double_effet_tensionCmd = __start.Bool+10; /*poste_sfp__cn_2*/
	verin_double_effet_tensionCpt = __start.Bool+9; /*poste_sfp__cn_3*/
	verin_double_effet_electroRetour = poste_sfp_EVGXR;
	verin_double_effet_electroTravail = poste_sfp_EVGXS;
	verin_double_effet_cptRentre = poste_sfp_FCGXR;
	verin_double_effet_cptSorti = poste_sfp_FCGXS;
	verin_double_effet_positionTige = __start.Float+11; /*poste_sfp__cn_4*/
	verin_double_effet_pourcentTige = __start.Float+10; /*poste_sfp__cn_5*/
	verin_double_effet_valeurIncrement = __start.Float+9; /*poste_sfp__cn_6*/
	_bibliotheque_epo__verin_double_effet_init();

	/*initialize child verin_double_effet_PX (bibliotheque_epo.verin_double_effet):*/
	sfp__poste_sfp_offset_verin_double_effet_PX.Bool = self.Bool - __start.Bool;
	sfp__poste_sfp_offset_verin_double_effet_PX.Int = self.Int - __start.Int;
	sfp__poste_sfp_offset_verin_double_effet_PX.Float = self.Float - __start.Float;
	sfp__poste_sfp_offset_verin_double_effet_PX.Char = self.Char - __start.Char;
	verin_double_effet_energieAir = __start.Bool+8; /*poste_sfp__cn_7*/
	verin_double_effet_tensionCmd = __start.Bool+7; /*poste_sfp__cn_8*/
	verin_double_effet_tensionCpt = __start.Bool+6; /*poste_sfp__cn_9*/
	verin_double_effet_electroRetour = poste_sfp_EVPXR;
	verin_double_effet_electroTravail = poste_sfp_EVPXS;
	verin_double_effet_cptRentre = poste_sfp_FCPXR;
	verin_double_effet_cptSorti = poste_sfp_FCPXS;
	verin_double_effet_positionTige = __start.Float+8; /*poste_sfp__cn_10*/
	verin_double_effet_pourcentTige = __start.Float+7; /*poste_sfp__cn_11*/
	verin_double_effet_valeurIncrement = __start.Float+6; /*poste_sfp__cn_12*/
	_bibliotheque_epo__verin_double_effet_init();

	/*initialize child verin_double_effet_VR (bibliotheque_epo.verin_double_effet):*/
	sfp__poste_sfp_offset_verin_double_effet_VR.Bool = self.Bool - __start.Bool;
	sfp__poste_sfp_offset_verin_double_effet_VR.Int = self.Int - __start.Int;
	sfp__poste_sfp_offset_verin_double_effet_VR.Float = self.Float - __start.Float;
	sfp__poste_sfp_offset_verin_double_effet_VR.Char = self.Char - __start.Char;
	verin_double_effet_energieAir = __start.Bool+5; /*poste_sfp__cn_13*/
	verin_double_effet_tensionCmd = __start.Bool+4; /*poste_sfp__cn_14*/
	verin_double_effet_tensionCpt = __start.Bool+3; /*poste_sfp__cn_15*/
	verin_double_effet_electroRetour = poste_sfp_EVVRR;
	verin_double_effet_electroTravail = poste_sfp_EVVRS;
	verin_double_effet_cptRentre = poste_sfp_FCVRR;
	verin_double_effet_cptSorti = poste_sfp_FCVRS;
	verin_double_effet_positionTige = __start.Float+5; /*poste_sfp__cn_16*/
	verin_double_effet_pourcentTige = __start.Float+4; /*poste_sfp__cn_17*/
	verin_double_effet_valeurIncrement = __start.Float+3; /*poste_sfp__cn_18*/
	_bibliotheque_epo__verin_double_effet_init();

	/*initialize child verin_simple_effet_VZ (bibliotheque_epo.verin_simple_effet):*/
	sfp__poste_sfp_offset_verin_simple_effet_VZ.Bool = self.Bool - __start.Bool;
	sfp__poste_sfp_offset_verin_simple_effet_VZ.Int = self.Int - __start.Int;
	sfp__poste_sfp_offset_verin_simple_effet_VZ.Float = self.Float - __start.Float;
	sfp__poste_sfp_offset_verin_simple_effet_VZ.Char = self.Char - __start.Char;
	verin_simple_effet_energieAir = __start.Bool+2; /*poste_sfp__cn_19*/
	verin_simple_effet_tensionCmd = __start.Bool+1; /*poste_sfp__cn_20*/
	verin_simple_effet_tensionCpt = __start.Bool+0; /*poste_sfp__cn_21*/
	verin_simple_effet_electroTravail = poste_sfp_EVVZ;
	verin_simple_effet_cptRentre = poste_sfp_FCVZH;
	verin_simple_effet_cptSorti = poste_sfp_FCVZB;
	verin_simple_effet_positionTige = __start.Float+2; /*poste_sfp__cn_22*/
	verin_simple_effet_pourcentTige = __start.Float+1; /*poste_sfp__cn_23*/
	verin_simple_effet_valeurIncrement = __start.Float+0; /*poste_sfp__cn_24*/
	_bibliotheque_epo__verin_simple_effet_init();

	/*initialize child vacuostat1 (sfp.vacuostat):*/
	sfp__poste_sfp_offset_vacuostat1.Bool = self.Bool - __start.Bool;
	sfp__poste_sfp_offset_vacuostat1.Int = self.Int - __start.Int;
	sfp__poste_sfp_offset_vacuostat1.Float = self.Float - __start.Float;
	sfp__poste_sfp_offset_vacuostat1.Char = self.Char - __start.Char;
	vacuostat_VZB = poste_sfp_FCVZB;
	vacuostat_VTM = poste_sfp_EVVTM;
	vacuostat_VTA = poste_sfp_EVVTA;
	vacuostat_Presence_piece = poste_sfp_Presence_piece;
	vacuostat_Vacuostat = poste_sfp_Vacuostat;
	_sfp__vacuostat_init();

	sfp__poste_sfp_offset__end.Bool = self.Bool - __start.Bool;
	sfp__poste_sfp_offset__end.Int = self.Int - __start.Int;
	sfp__poste_sfp_offset__end.Float = self.Float - __start.Float;
	sfp__poste_sfp_offset__end.Char = self.Char - __start.Char;

	return 0;
}


/************************ Behavior function *************************/

int sfp__poste_sfp(void)
{
	CB_Object __start = self;
	int __ret;
	static char *__comp_name = "sfp.poste_sfp";
	if (exec_mac_node(self_num)) {

		/*********************** Internals variables ************************/

																																																
		/********************* Pre-conditions execution *********************/

		/*no Pre-conditions*/

		/************************ Behavior execution ************************/

		{
			self.Bool = __start.Bool + sfp__poste_sfp_offset_verin_double_effet_GX.Bool;
			self.Int = __start.Int + sfp__poste_sfp_offset_verin_double_effet_GX.Int;
			self.Float = __start.Float + sfp__poste_sfp_offset_verin_double_effet_GX.Float;
			self.Char = __start.Char + sfp__poste_sfp_offset_verin_double_effet_GX.Char;

			/***************** verin_double_effet_GX execution ******************/

			self_num++;
			if (verin_double_effet__num != self_num) {
				verin_double_effet__num = self_num;
				verin_double_effet_energieAir = __start.Bool+11; /*poste_sfp__cn_1*/
				verin_double_effet_tensionCmd = __start.Bool+10; /*poste_sfp__cn_2*/
				verin_double_effet_tensionCpt = __start.Bool+9; /*poste_sfp__cn_3*/
				verin_double_effet_electroRetour = poste_sfp_EVGXR;
				verin_double_effet_electroTravail = poste_sfp_EVGXS;
				verin_double_effet_cptRentre = poste_sfp_FCGXR;
				verin_double_effet_cptSorti = poste_sfp_FCGXS;
				verin_double_effet_positionTige = __start.Float+11; /*poste_sfp__cn_4*/
				verin_double_effet_pourcentTige = __start.Float+10; /*poste_sfp__cn_5*/
				verin_double_effet_valeurIncrement = __start.Float+9; /*poste_sfp__cn_6*/
			}
			__ret = bibliotheque_epo__verin_double_effet();
			if (__ret != 0) {
				return __ret; /*child execution failure*/
			}

			/***************** verin_double_effet_PX execution ******************/

			self_num++;
			if (verin_double_effet__num != self_num) {
				verin_double_effet__num = self_num;
				verin_double_effet_energieAir = __start.Bool+8; /*poste_sfp__cn_7*/
				verin_double_effet_tensionCmd = __start.Bool+7; /*poste_sfp__cn_8*/
				verin_double_effet_tensionCpt = __start.Bool+6; /*poste_sfp__cn_9*/
				verin_double_effet_electroRetour = poste_sfp_EVPXR;
				verin_double_effet_electroTravail = poste_sfp_EVPXS;
				verin_double_effet_cptRentre = poste_sfp_FCPXR;
				verin_double_effet_cptSorti = poste_sfp_FCPXS;
				verin_double_effet_positionTige = __start.Float+8; /*poste_sfp__cn_10*/
				verin_double_effet_pourcentTige = __start.Float+7; /*poste_sfp__cn_11*/
				verin_double_effet_valeurIncrement = __start.Float+6; /*poste_sfp__cn_12*/
			}
			__ret = bibliotheque_epo__verin_double_effet();
			if (__ret != 0) {
				return __ret; /*child execution failure*/
			}

			/***************** verin_double_effet_VR execution ******************/

			self_num++;
			if (verin_double_effet__num != self_num) {
				verin_double_effet__num = self_num;
				verin_double_effet_energieAir = __start.Bool+5; /*poste_sfp__cn_13*/
				verin_double_effet_tensionCmd = __start.Bool+4; /*poste_sfp__cn_14*/
				verin_double_effet_tensionCpt = __start.Bool+3; /*poste_sfp__cn_15*/
				verin_double_effet_electroRetour = poste_sfp_EVVRR;
				verin_double_effet_electroTravail = poste_sfp_EVVRS;
				verin_double_effet_cptRentre = poste_sfp_FCVRR;
				verin_double_effet_cptSorti = poste_sfp_FCVRS;
				verin_double_effet_positionTige = __start.Float+5; /*poste_sfp__cn_16*/
				verin_double_effet_pourcentTige = __start.Float+4; /*poste_sfp__cn_17*/
				verin_double_effet_valeurIncrement = __start.Float+3; /*poste_sfp__cn_18*/
			}
			__ret = bibliotheque_epo__verin_double_effet();
			if (__ret != 0) {
				return __ret; /*child execution failure*/
			}

			/***************** verin_simple_effet_VZ execution ******************/

			self_num++;
			if (verin_simple_effet__num != self_num) {
				verin_simple_effet__num = self_num;
				verin_simple_effet_energieAir = __start.Bool+2; /*poste_sfp__cn_19*/
				verin_simple_effet_tensionCmd = __start.Bool+1; /*poste_sfp__cn_20*/
				verin_simple_effet_tensionCpt = __start.Bool+0; /*poste_sfp__cn_21*/
				verin_simple_effet_electroTravail = poste_sfp_EVVZ;
				verin_simple_effet_cptRentre = poste_sfp_FCVZH;
				verin_simple_effet_cptSorti = poste_sfp_FCVZB;
				verin_simple_effet_positionTige = __start.Float+2; /*poste_sfp__cn_22*/
				verin_simple_effet_pourcentTige = __start.Float+1; /*poste_sfp__cn_23*/
				verin_simple_effet_valeurIncrement = __start.Float+0; /*poste_sfp__cn_24*/
			}
			__ret = bibliotheque_epo__verin_simple_effet();
			if (__ret != 0) {
				return __ret; /*child execution failure*/
			}

			/*********************** vacuostat1 execution ***********************/

			self_num++;
			if (vacuostat__num != self_num) {
				vacuostat__num = self_num;
				vacuostat_VZB = poste_sfp_FCVZB;
				vacuostat_VTM = poste_sfp_EVVTM;
				vacuostat_VTA = poste_sfp_EVVTA;
				vacuostat_Presence_piece = poste_sfp_Presence_piece;
				vacuostat_Vacuostat = poste_sfp_Vacuostat;
			}
			__ret = sfp__vacuostat();
			if (__ret != 0) {
				return __ret; /*child execution failure*/
			}

		}


		/******************** Post-conditions execution *********************/

		/*no Post-conditions*/
	}

	/*************************** self update ****************************/

	self.Bool = __start.Bool + sfp__poste_sfp_offset__end.Bool;
	self.Int = __start.Int + sfp__poste_sfp_offset__end.Int;
	self.Float = __start.Float + sfp__poste_sfp_offset__end.Float;
	self.Char = __start.Char + sfp__poste_sfp_offset__end.Char;

	return 0;
}

