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

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

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

#include "deplacement.h"
#include "sfp/functional/mdl_deplacement/mdl_deplacement.h"
#include "sfp/functional/graf_mdl_verin_bist/graf_mdl_verin_bist.h"


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

CB_Index deplacement__num = 0;
CB_Mem_Int *deplacement_Dem_Pos;
CB_Mem_Bool *deplacement_acq;
CB_Mem_Bool *deplacement_au;
CB_Mem_Bool *deplacement_GO;
CB_Mem_Bool *deplacement_FCGXS;
CB_Mem_Bool *deplacement_FCGXR;
CB_Mem_Bool *deplacement_FCPXS;
CB_Mem_Bool *deplacement_FCPXR;
CB_Mem_Bool *deplacement_FCVRR;
CB_Mem_Bool *deplacement_FCVRS;
CB_Mem_Int *deplacement_CR_Pos;
CB_Mem_Bool *deplacement_Def_Depl;
CB_Mem_Bool *deplacement_EVGXS;
CB_Mem_Bool *deplacement_EVGXR;
CB_Mem_Bool *deplacement_EVPXS;
CB_Mem_Bool *deplacement_EVPXR;
CB_Mem_Bool *deplacement_EVVRR;
CB_Mem_Bool *deplacement_EVVRS;

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



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

static CB_Offset sfp__deplacement_offset_mdl_deplacement1;
static CB_Offset sfp__deplacement_offset_Verin_PX;
static CB_Offset sfp__deplacement_offset_Verin_VR;
static CB_Offset sfp__deplacement_offset_Verin_GX;
static CB_Offset sfp__deplacement_offset__end = {0, 0, 0, 0};


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

int _sfp__deplacement_init(void)
{
	CB_Object __start = self;
	self.Bool+=15;

	/*initialize child mdl_deplacement1 (sfp.mdl_deplacement):*/
	sfp__deplacement_offset_mdl_deplacement1.Bool = self.Bool - __start.Bool;
	sfp__deplacement_offset_mdl_deplacement1.Int = self.Int - __start.Int;
	sfp__deplacement_offset_mdl_deplacement1.Float = self.Float - __start.Float;
	sfp__deplacement_offset_mdl_deplacement1.Char = self.Char - __start.Char;
	mdl_deplacement_Dem_Pos = deplacement_Dem_Pos;
	mdl_deplacement_GO = deplacement_GO;
	mdl_deplacement_acq = deplacement_acq;
	mdl_deplacement_AU = deplacement_au;
	mdl_deplacement_CR_GXR = __start.Bool+0; /*deplacement__cn_15*/
	mdl_deplacement_CR_GXS = __start.Bool+1; /*deplacement__cn_14*/
	mdl_deplacement_def_GX = __start.Bool+2; /*deplacement__cn_13*/
	mdl_deplacement_CR_PXR = __start.Bool+3; /*deplacement__cn_12*/
	mdl_deplacement_CR_PXS = __start.Bool+4; /*deplacement__cn_11*/
	mdl_deplacement_def_PX = __start.Bool+5; /*deplacement__cn_10*/
	mdl_deplacement_CR_VRR = __start.Bool+6; /*deplacement__cn_9*/
	mdl_deplacement_CR_VRS = __start.Bool+7; /*deplacement__cn_8*/
	mdl_deplacement_def_VR = __start.Bool+8; /*deplacement__cn_7*/
	mdl_deplacement_CR_Pos = deplacement_CR_Pos;
	mdl_deplacement_Def_Depl = deplacement_Def_Depl;
	mdl_deplacement_GXR = __start.Bool+13; /*deplacement__cn_2*/
	mdl_deplacement_GXS = __start.Bool+14; /*deplacement__cn_1*/
	mdl_deplacement_PXR = __start.Bool+9; /*deplacement__cn_6*/
	mdl_deplacement_PXS = __start.Bool+10; /*deplacement__cn_5*/
	mdl_deplacement_VRR = __start.Bool+11; /*deplacement__cn_4*/
	mdl_deplacement_VRS = __start.Bool+12; /*deplacement__cn_3*/
	_sfp__mdl_deplacement_init();

	/*initialize child Verin_PX (sfp.graf_mdl_verin_bist):*/
	sfp__deplacement_offset_Verin_PX.Bool = self.Bool - __start.Bool;
	sfp__deplacement_offset_Verin_PX.Int = self.Int - __start.Int;
	sfp__deplacement_offset_Verin_PX.Float = self.Float - __start.Float;
	sfp__deplacement_offset_Verin_PX.Char = self.Char - __start.Char;
	graf_mdl_verin_bist_DR = __start.Bool+9; /*deplacement__cn_6*/
	graf_mdl_verin_bist_DS = __start.Bool+10; /*deplacement__cn_5*/
	graf_mdl_verin_bist_ACQ = deplacement_acq;
	graf_mdl_verin_bist_AU = deplacement_au;
	graf_mdl_verin_bist_CR = deplacement_FCPXR;
	graf_mdl_verin_bist_CS = deplacement_FCPXS;
	graf_mdl_verin_bist_OrdreR = deplacement_EVPXR;
	graf_mdl_verin_bist_OrdreS = deplacement_EVPXS;
	graf_mdl_verin_bist_EtatR = __start.Bool+3; /*deplacement__cn_12*/
	graf_mdl_verin_bist_EtatS = __start.Bool+4; /*deplacement__cn_11*/
	graf_mdl_verin_bist_Def_verin = __start.Bool+5; /*deplacement__cn_10*/
	_sfp__graf_mdl_verin_bist_init();

	/*initialize child Verin_VR (sfp.graf_mdl_verin_bist):*/
	sfp__deplacement_offset_Verin_VR.Bool = self.Bool - __start.Bool;
	sfp__deplacement_offset_Verin_VR.Int = self.Int - __start.Int;
	sfp__deplacement_offset_Verin_VR.Float = self.Float - __start.Float;
	sfp__deplacement_offset_Verin_VR.Char = self.Char - __start.Char;
	graf_mdl_verin_bist_DR = __start.Bool+11; /*deplacement__cn_4*/
	graf_mdl_verin_bist_DS = __start.Bool+12; /*deplacement__cn_3*/
	graf_mdl_verin_bist_ACQ = deplacement_acq;
	graf_mdl_verin_bist_AU = deplacement_au;
	graf_mdl_verin_bist_CR = deplacement_FCVRR;
	graf_mdl_verin_bist_CS = deplacement_FCVRS;
	graf_mdl_verin_bist_OrdreR = deplacement_EVVRR;
	graf_mdl_verin_bist_OrdreS = deplacement_EVVRS;
	graf_mdl_verin_bist_EtatR = __start.Bool+6; /*deplacement__cn_9*/
	graf_mdl_verin_bist_EtatS = __start.Bool+7; /*deplacement__cn_8*/
	graf_mdl_verin_bist_Def_verin = __start.Bool+8; /*deplacement__cn_7*/
	_sfp__graf_mdl_verin_bist_init();

	/*initialize child Verin_GX (sfp.graf_mdl_verin_bist):*/
	sfp__deplacement_offset_Verin_GX.Bool = self.Bool - __start.Bool;
	sfp__deplacement_offset_Verin_GX.Int = self.Int - __start.Int;
	sfp__deplacement_offset_Verin_GX.Float = self.Float - __start.Float;
	sfp__deplacement_offset_Verin_GX.Char = self.Char - __start.Char;
	graf_mdl_verin_bist_DR = __start.Bool+13; /*deplacement__cn_2*/
	graf_mdl_verin_bist_DS = __start.Bool+14; /*deplacement__cn_1*/
	graf_mdl_verin_bist_ACQ = deplacement_acq;
	graf_mdl_verin_bist_AU = deplacement_au;
	graf_mdl_verin_bist_CR = deplacement_FCGXR;
	graf_mdl_verin_bist_CS = deplacement_FCGXS;
	graf_mdl_verin_bist_OrdreR = deplacement_EVGXR;
	graf_mdl_verin_bist_OrdreS = deplacement_EVGXS;
	graf_mdl_verin_bist_EtatR = __start.Bool+0; /*deplacement__cn_15*/
	graf_mdl_verin_bist_EtatS = __start.Bool+1; /*deplacement__cn_14*/
	graf_mdl_verin_bist_Def_verin = __start.Bool+2; /*deplacement__cn_13*/
	_sfp__graf_mdl_verin_bist_init();

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

	return 0;
}


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

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

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

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

		/*no Pre-conditions*/

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

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

			/******************** mdl_deplacement1 execution ********************/

			self_num++;
			if (mdl_deplacement__num != self_num) {
				mdl_deplacement__num = self_num;
				mdl_deplacement_Dem_Pos = deplacement_Dem_Pos;
				mdl_deplacement_GO = deplacement_GO;
				mdl_deplacement_acq = deplacement_acq;
				mdl_deplacement_AU = deplacement_au;
				mdl_deplacement_CR_GXR = __start.Bool+0; /*deplacement__cn_15*/
				mdl_deplacement_CR_GXS = __start.Bool+1; /*deplacement__cn_14*/
				mdl_deplacement_def_GX = __start.Bool+2; /*deplacement__cn_13*/
				mdl_deplacement_CR_PXR = __start.Bool+3; /*deplacement__cn_12*/
				mdl_deplacement_CR_PXS = __start.Bool+4; /*deplacement__cn_11*/
				mdl_deplacement_def_PX = __start.Bool+5; /*deplacement__cn_10*/
				mdl_deplacement_CR_VRR = __start.Bool+6; /*deplacement__cn_9*/
				mdl_deplacement_CR_VRS = __start.Bool+7; /*deplacement__cn_8*/
				mdl_deplacement_def_VR = __start.Bool+8; /*deplacement__cn_7*/
				mdl_deplacement_CR_Pos = deplacement_CR_Pos;
				mdl_deplacement_Def_Depl = deplacement_Def_Depl;
				mdl_deplacement_GXR = __start.Bool+13; /*deplacement__cn_2*/
				mdl_deplacement_GXS = __start.Bool+14; /*deplacement__cn_1*/
				mdl_deplacement_PXR = __start.Bool+9; /*deplacement__cn_6*/
				mdl_deplacement_PXS = __start.Bool+10; /*deplacement__cn_5*/
				mdl_deplacement_VRR = __start.Bool+11; /*deplacement__cn_4*/
				mdl_deplacement_VRS = __start.Bool+12; /*deplacement__cn_3*/
			}
			__ret = sfp__mdl_deplacement();
			if (__ret != 0) {
				return __ret; /*child execution failure*/
			}

			/************************ Verin_PX execution ************************/

			self_num++;
			if (graf_mdl_verin_bist__num != self_num) {
				graf_mdl_verin_bist__num = self_num;
				graf_mdl_verin_bist_DR = __start.Bool+9; /*deplacement__cn_6*/
				graf_mdl_verin_bist_DS = __start.Bool+10; /*deplacement__cn_5*/
				graf_mdl_verin_bist_ACQ = deplacement_acq;
				graf_mdl_verin_bist_AU = deplacement_au;
				graf_mdl_verin_bist_CR = deplacement_FCPXR;
				graf_mdl_verin_bist_CS = deplacement_FCPXS;
				graf_mdl_verin_bist_OrdreR = deplacement_EVPXR;
				graf_mdl_verin_bist_OrdreS = deplacement_EVPXS;
				graf_mdl_verin_bist_EtatR = __start.Bool+3; /*deplacement__cn_12*/
				graf_mdl_verin_bist_EtatS = __start.Bool+4; /*deplacement__cn_11*/
				graf_mdl_verin_bist_Def_verin = __start.Bool+5; /*deplacement__cn_10*/
			}
			__ret = sfp__graf_mdl_verin_bist();
			if (__ret != 0) {
				return __ret; /*child execution failure*/
			}

			/************************ Verin_VR execution ************************/

			self_num++;
			if (graf_mdl_verin_bist__num != self_num) {
				graf_mdl_verin_bist__num = self_num;
				graf_mdl_verin_bist_DR = __start.Bool+11; /*deplacement__cn_4*/
				graf_mdl_verin_bist_DS = __start.Bool+12; /*deplacement__cn_3*/
				graf_mdl_verin_bist_ACQ = deplacement_acq;
				graf_mdl_verin_bist_AU = deplacement_au;
				graf_mdl_verin_bist_CR = deplacement_FCVRR;
				graf_mdl_verin_bist_CS = deplacement_FCVRS;
				graf_mdl_verin_bist_OrdreR = deplacement_EVVRR;
				graf_mdl_verin_bist_OrdreS = deplacement_EVVRS;
				graf_mdl_verin_bist_EtatR = __start.Bool+6; /*deplacement__cn_9*/
				graf_mdl_verin_bist_EtatS = __start.Bool+7; /*deplacement__cn_8*/
				graf_mdl_verin_bist_Def_verin = __start.Bool+8; /*deplacement__cn_7*/
			}
			__ret = sfp__graf_mdl_verin_bist();
			if (__ret != 0) {
				return __ret; /*child execution failure*/
			}

			/************************ Verin_GX execution ************************/

			self_num++;
			if (graf_mdl_verin_bist__num != self_num) {
				graf_mdl_verin_bist__num = self_num;
				graf_mdl_verin_bist_DR = __start.Bool+13; /*deplacement__cn_2*/
				graf_mdl_verin_bist_DS = __start.Bool+14; /*deplacement__cn_1*/
				graf_mdl_verin_bist_ACQ = deplacement_acq;
				graf_mdl_verin_bist_AU = deplacement_au;
				graf_mdl_verin_bist_CR = deplacement_FCGXR;
				graf_mdl_verin_bist_CS = deplacement_FCGXS;
				graf_mdl_verin_bist_OrdreR = deplacement_EVGXR;
				graf_mdl_verin_bist_OrdreS = deplacement_EVGXS;
				graf_mdl_verin_bist_EtatR = __start.Bool+0; /*deplacement__cn_15*/
				graf_mdl_verin_bist_EtatS = __start.Bool+1; /*deplacement__cn_14*/
				graf_mdl_verin_bist_Def_verin = __start.Bool+2; /*deplacement__cn_13*/
			}
			__ret = sfp__graf_mdl_verin_bist();
			if (__ret != 0) {
				return __ret; /*child execution failure*/
			}

		}


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

		/*no Post-conditions*/
	}

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

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

	return 0;
}

