/*2011-01-03T15:23:29-01:00*/

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

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

#include "commut_2pos_2sorties.h"


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

CB_Index commut_2pos_2sorties__num = 0;
CB_Mem_Bool *commut_2pos_2sorties_variableGauche;
CB_Mem_Bool *commut_2pos_2sorties_variableDroite;
CB_Mem_Bool *commut_2pos_2sorties_posGauche;
CB_Mem_Bool *commut_2pos_2sorties_posDroite;

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

#define variableGauche (commut_2pos_2sorties_variableGauche->CB_current_value)
#define variableDroite (commut_2pos_2sorties_variableDroite->CB_current_value)
#define posGauche (commut_2pos_2sorties_posGauche->CB_current_value)
#define posDroite (commut_2pos_2sorties_posDroite->CB_current_value)


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


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

int _bibliotheque_epo__commut_2pos_2sorties_init(void)
{
	(commut_2pos_2sorties_variableGauche)->CB_current_value = 1; /*variableGauche*/
	self.Bool+=2;


	return 0;
}


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

int bibliotheque_epo__commut_2pos_2sorties(void)
{
	static char *__comp_name = "bibliotheque_epo.commut_2pos_2sorties";
	if (exec_term_node(self_num)) {

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

		commut_2pos_2sorties_posGauche = self.Bool+0;
		commut_2pos_2sorties_posDroite = self.Bool+1;

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

		/*no Pre-conditions*/

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

		{
			if (posGauche) {
				cov_control_struct(__comp_name, self_num, INCODE, 10, IFTHEN);
				variableGauche = 1;
				variableDroite = 0;
			}
			else {
				cov_control_struct(__comp_name, self_num, INCODE, 10, IFELSE);
			}
			if (posDroite) {
				cov_control_struct(__comp_name, self_num, INCODE, 14, IFTHEN);
				variableGauche = 0;
				variableDroite = 1;
			}
			else {
				cov_control_struct(__comp_name, self_num, INCODE, 14, IFELSE);
			}
			posGauche = 0;
			posDroite = 0;
		}

		CB_post_bool(commut_2pos_2sorties_variableGauche);
		CB_post_bool(commut_2pos_2sorties_variableDroite);

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

		/*no Post-conditions*/
	}

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

	self.Bool += 2;

	return 0;
}

