Computational routine
eng


demodpsk

File content


/* Modnumlib Scicos interfacing function
 * Copyright (C) 2009-2011 Alan Layec
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */
 
/* demodpsk Scicos demodulator MPSK block
 * Type 4 simulation function ver 1.0 - scilab-3.0
 * 22 décembre 2004 - IRCOM GROUP - Author : A.Layec
 */
 
/* REVISION HISTORY :
 * $Log$
 */

#include <scicos/scicos_block.h>
#include "modnum_lib.h"

/* Cette fonction de simulation réalise un démodulateur MPSK.
 * A chaque instant de déclenchement les valeurs de I et Q sont
 * lues en entrée et la fonction calcule dans un premier temps
 * arctang[-Q/I] pour récupérer la valeur de la phase. Ensuite
 * elle calcule la valeur du numéro symbole par la formule
 * y=(int)((phi*n)/(2*%pi)) avec n le nombre d'états et phi la valeur
 * de arctang[-Q/I].
 *
 * entrées régulières: u1[0..insz[0]-1] vecteur des signaux I
 *                     u2[0..insz[0]-1] vecteur des signaux Q
 * sorties régulières : y[0..insz[0]-1] vecteur des numéros symboles
 * entrée évènementielles : instants de déclenchement
 * sorties évènementielles : néant
 * paramatres entiers : ipar[0..insz[0]-1] : vecteur du nombre d'état
 */

/*Prototype*/
void demodpsk(scicos_block *block,int flag)
{
 /*Déclaration des variables*/
 double *y;
 double *u1,*u2;

 /*Récupération des adresses des ports réguliers*/
 y=(double *)block->outptr[0];
 u1=(double *)block->inptr[0];
 u2=(double *)block->inptr[1];

 /*Le flag 1 calcule le numéro symbole*/
 if(flag==1)
 {
  /*Appel routine demodpsk_c*/
  demodpskv_c(&block->insz[0],&block->ipar[0],&u1[0],&u2[0],&y[0]);
 }
}