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

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

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

#include "commut_2pos_1sortie.h"


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

CB_Index commut_2pos_1sortie__num = 0;
CB_Mem_Bool *commut_2pos_1sortie_variable;
CB_Mem_Bool *commut_2pos_1sortie_posGauche;
CB_Mem_Bool *commut_2pos_1sortie_posDroite;

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

#define variable (commut_2pos_1sortie_variable->CB_current_value)
#define posGauche (commut_2pos_1sortie_posGauche->CB_current_value)
#define posDroite (commut_2pos_1sortie_posDroite->CB_current_value)


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


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

int _bibliotheque_epo__commut_2pos_1sortie_init(void)
{
	self.Bool+=2;


	return 0;
}


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

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

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

		commut_2pos_1sortie_posGauche = self.Bool+0;
		commut_2pos_1sortie_posDroite = self.Bool+1;

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

		/*no Pre-conditions*/

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

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

		CB_post_bool(commut_2pos_1sortie_variable);

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

		/*no Post-conditions*/
	}

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

	self.Bool += 2;

	return 0;
}

