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

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

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

#include "prise_pose.h"
#include "sfp/functional/graf_mdl_prdpos/graf_mdl_prdpos.h"
#include "sfp/functional/graf_mdl_verin_mono/graf_mdl_verin_mono.h"
#include "sfp/functional/graf_mdl_ventouse/graf_mdl_ventouse.h"


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

CB_Index prise_pose__num = 0;
CB_Mem_Bool *prise_pose_acq;
CB_Mem_Bool *prise_pose_au;
CB_Mem_Bool *prise_pose_vacuostat;
CB_Mem_Bool *prise_pose_dprise;
CB_Mem_Bool *prise_pose_dpose;
CB_Mem_Bool *prise_pose_FCVZB;
CB_Mem_Bool *prise_pose_FCVZH;
CB_Mem_Bool *prise_pose_EVVZ;
CB_Mem_Bool *prise_pose_EVVTM;
CB_Mem_Bool *prise_pose_EVVTA;
CB_Mem_Bool *prise_pose_OKprise;
CB_Mem_Bool *prise_pose_OKpose;
CB_Mem_Bool *prise_pose_def_prisepose;

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



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

static CB_Offset sfp__prise_pose_offset_graf_mdl_prdpos1;
static CB_Offset sfp__prise_pose_offset_Verin_VZ;
static CB_Offset sfp__prise_pose_offset_Vent_VT;
static CB_Offset sfp__prise_pose_offset__end = {0, 0, 0, 0};


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

int _sfp__prise_pose_init(void)
{
	CB_Object __start = self;
	self.Bool+=9;

	/*initialize child graf_mdl_prdpos1 (sfp.graf_mdl_prdpos):*/
	sfp__prise_pose_offset_graf_mdl_prdpos1.Bool = self.Bool - __start.Bool;
	sfp__prise_pose_offset_graf_mdl_prdpos1.Int = self.Int - __start.Int;
	sfp__prise_pose_offset_graf_mdl_prdpos1.Float = self.Float - __start.Float;
	sfp__prise_pose_offset_graf_mdl_prdpos1.Char = self.Char - __start.Char;
	graf_mdl_prdpos_acq = prise_pose_acq;
	graf_mdl_prdpos_AU = prise_pose_au;
	graf_mdl_prdpos_dprise = prise_pose_dprise;
	graf_mdl_prdpos_dpose = prise_pose_dpose;
	graf_mdl_prdpos_vacuostat = prise_pose_vacuostat;
	graf_mdl_prdpos_CR_VZS = __start.Bool+2; /*prise_pose__cn_7*/
	graf_mdl_prdpos_CR_VZR = __start.Bool+3; /*prise_pose__cn_6*/
	graf_mdl_prdpos_def_VZ = __start.Bool+4; /*prise_pose__cn_5*/
	graf_mdl_prdpos_VZS = __start.Bool+5; /*prise_pose__cn_4*/
	graf_mdl_prdpos_VZR = __start.Bool+6; /*prise_pose__cn_3*/
	graf_mdl_prdpos_VTM = __start.Bool+7; /*prise_pose__cn_2*/
	graf_mdl_prdpos_VTA = __start.Bool+8; /*prise_pose__cn_1*/
	graf_mdl_prdpos_OKprise = prise_pose_OKprise;
	graf_mdl_prdpos_OKpose = prise_pose_OKpose;
	graf_mdl_prdpos_def_prisepose = prise_pose_def_prisepose;
	_sfp__graf_mdl_prdpos_init();

	/*initialize child Verin_VZ (sfp.graf_mdl_verin_mono):*/
	sfp__prise_pose_offset_Verin_VZ.Bool = self.Bool - __start.Bool;
	sfp__prise_pose_offset_Verin_VZ.Int = self.Int - __start.Int;
	sfp__prise_pose_offset_Verin_VZ.Float = self.Float - __start.Float;
	sfp__prise_pose_offset_Verin_VZ.Char = self.Char - __start.Char;
	graf_mdl_verin_mono_DS = __start.Bool+5; /*prise_pose__cn_4*/
	graf_mdl_verin_mono_DR = __start.Bool+6; /*prise_pose__cn_3*/
	graf_mdl_verin_mono_ACQ = prise_pose_acq;
	graf_mdl_verin_mono_AU = prise_pose_au;
	graf_mdl_verin_mono_CR = prise_pose_FCVZH;
	graf_mdl_verin_mono_CS = prise_pose_FCVZB;
	graf_mdl_verin_mono_OrdreS = prise_pose_EVVZ;
	graf_mdl_verin_mono_EtatR = __start.Bool+3; /*prise_pose__cn_6*/
	graf_mdl_verin_mono_EtatS = __start.Bool+2; /*prise_pose__cn_7*/
	graf_mdl_verin_mono_Def_verin = __start.Bool+4; /*prise_pose__cn_5*/
	_sfp__graf_mdl_verin_mono_init();

	/*initialize child Vent_VT (sfp.graf_mdl_ventouse):*/
	sfp__prise_pose_offset_Vent_VT.Bool = self.Bool - __start.Bool;
	sfp__prise_pose_offset_Vent_VT.Int = self.Int - __start.Int;
	sfp__prise_pose_offset_Vent_VT.Float = self.Float - __start.Float;
	sfp__prise_pose_offset_Vent_VT.Char = self.Char - __start.Char;
	graf_mdl_ventouse_DS = __start.Bool+7; /*prise_pose__cn_2*/
	graf_mdl_ventouse_DR = __start.Bool+8; /*prise_pose__cn_1*/
	graf_mdl_ventouse_ACQ = prise_pose_acq;
	graf_mdl_ventouse_AU = prise_pose_au;
	graf_mdl_ventouse_OrdreR = prise_pose_EVVTA;
	graf_mdl_ventouse_OrdreS = prise_pose_EVVTM;
	graf_mdl_ventouse_EtatS = __start.Bool+1; /*prise_pose__cn_8*/
	graf_mdl_ventouse_EtatR = __start.Bool+0; /*prise_pose__cn_9*/
	_sfp__graf_mdl_ventouse_init();

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

	return 0;
}


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

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

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

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

		/*no Pre-conditions*/

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

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

			/******************** graf_mdl_prdpos1 execution ********************/

			self_num++;
			if (graf_mdl_prdpos__num != self_num) {
				graf_mdl_prdpos__num = self_num;
				graf_mdl_prdpos_acq = prise_pose_acq;
				graf_mdl_prdpos_AU = prise_pose_au;
				graf_mdl_prdpos_dprise = prise_pose_dprise;
				graf_mdl_prdpos_dpose = prise_pose_dpose;
				graf_mdl_prdpos_vacuostat = prise_pose_vacuostat;
				graf_mdl_prdpos_CR_VZS = __start.Bool+2; /*prise_pose__cn_7*/
				graf_mdl_prdpos_CR_VZR = __start.Bool+3; /*prise_pose__cn_6*/
				graf_mdl_prdpos_def_VZ = __start.Bool+4; /*prise_pose__cn_5*/
				graf_mdl_prdpos_VZS = __start.Bool+5; /*prise_pose__cn_4*/
				graf_mdl_prdpos_VZR = __start.Bool+6; /*prise_pose__cn_3*/
				graf_mdl_prdpos_VTM = __start.Bool+7; /*prise_pose__cn_2*/
				graf_mdl_prdpos_VTA = __start.Bool+8; /*prise_pose__cn_1*/
				graf_mdl_prdpos_OKprise = prise_pose_OKprise;
				graf_mdl_prdpos_OKpose = prise_pose_OKpose;
				graf_mdl_prdpos_def_prisepose = prise_pose_def_prisepose;
			}
			__ret = sfp__graf_mdl_prdpos();
			if (__ret != 0) {
				return __ret; /*child execution failure*/
			}

			/************************ Verin_VZ execution ************************/

			self_num++;
			if (graf_mdl_verin_mono__num != self_num) {
				graf_mdl_verin_mono__num = self_num;
				graf_mdl_verin_mono_DS = __start.Bool+5; /*prise_pose__cn_4*/
				graf_mdl_verin_mono_DR = __start.Bool+6; /*prise_pose__cn_3*/
				graf_mdl_verin_mono_ACQ = prise_pose_acq;
				graf_mdl_verin_mono_AU = prise_pose_au;
				graf_mdl_verin_mono_CR = prise_pose_FCVZH;
				graf_mdl_verin_mono_CS = prise_pose_FCVZB;
				graf_mdl_verin_mono_OrdreS = prise_pose_EVVZ;
				graf_mdl_verin_mono_EtatR = __start.Bool+3; /*prise_pose__cn_6*/
				graf_mdl_verin_mono_EtatS = __start.Bool+2; /*prise_pose__cn_7*/
				graf_mdl_verin_mono_Def_verin = __start.Bool+4; /*prise_pose__cn_5*/
			}
			__ret = sfp__graf_mdl_verin_mono();
			if (__ret != 0) {
				return __ret; /*child execution failure*/
			}

			/************************ Vent_VT execution *************************/

			self_num++;
			if (graf_mdl_ventouse__num != self_num) {
				graf_mdl_ventouse__num = self_num;
				graf_mdl_ventouse_DS = __start.Bool+7; /*prise_pose__cn_2*/
				graf_mdl_ventouse_DR = __start.Bool+8; /*prise_pose__cn_1*/
				graf_mdl_ventouse_ACQ = prise_pose_acq;
				graf_mdl_ventouse_AU = prise_pose_au;
				graf_mdl_ventouse_OrdreR = prise_pose_EVVTA;
				graf_mdl_ventouse_OrdreS = prise_pose_EVVTM;
				graf_mdl_ventouse_EtatS = __start.Bool+1; /*prise_pose__cn_8*/
				graf_mdl_ventouse_EtatR = __start.Bool+0; /*prise_pose__cn_9*/
			}
			__ret = sfp__graf_mdl_ventouse();
			if (__ret != 0) {
				return __ret; /*child execution failure*/
			}

		}


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

		/*no Post-conditions*/
	}

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

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

	return 0;
}

