Computational routine
eng
modpsk
/* Modnumlib Scicos interfacing function
* Copyright (C) 2009 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.
*/
/* modpsk Scicos Mary Phase Shift Keying modulator block
* Type 4 simulation function ver 1.0 - scilab-3.0
* 21 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 codeur MPSK.
* Les sorties y1 et y2 correspondent aux valeurs de I et de Q
* codées en fonction du nombre d'états et du numéro symbole
* présent à l'entrée u[] aux dates de déclanchements.
* La fonction calcule :
* I=cos(%pi*(2*u+1)/m)
* Q=-sin(%pi*(2*u+1)/m)
* où u est l'entrée et m le nombre d'états.
*
* entrées régulières : u[0..insz[0]-1] : vecteur des numéros symboles
* sorties régulières : y1[0..insz[0]-1] : vecteur des composantes I
* y2[0..insz[0]-1] : vecteur des composantes Q
* entrée évènementielles : instants de déclenchement.
* sortie évènementielle : néant
* paramètres entiers : ipar[0..insz[0]-1]:m vecteur des nombre d'états
*/
/*prototype*/
void modpsk(scicos_block *block,int flag)
{
/*Déclaration des variables*/
double *y1,*y2;
double *u;
/*Récupération des adresses des ports réguliers*/
y1=(double *)block->outptr[0];
y2=(double *)block->outptr[1];
u=(double *)block->inptr[0];
/*
Le flag 1 calcule la valeur de I et de Q en fonction
du numéro symbole u[] et du nombre du nombre d'état m
*/
if(flag==1||flag==6)
{
/*Appel routine modpsk*/
modpskv_c(&block->insz[0],&block->ipar[0],&u[0],&y1[0],&y2[0]);
}
}