Computational routine
eng
dtime
/* 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.
*/
/* time Scicos time signal block
* Originaly write in fortran in the LARY_CR package
* by C.Médigue, A. Monti, A. Wambergue.
* www.inria.fr/rrrt/rt-0259.html
* Rewrite in C with capability to compute output vector
* Type 4 simulation function ver 1.0 - scilab-2.6&2.7
* 19 novembre 2003 - IRCOM GROUP - Author : A.Layec
*
* 10 janvier 2004 : passage type 4
* 30 mai 2009 : change le nom en dtime pour
* éviter une erreur avec la génération
* de code scicos sous linux
*/
/* REVISION HISTORY :
* $Log$
*/
#include <scicos/scicos_block.h>
/* Cette fonction de simulation délivre la valeur de la variable t
* à chaque instant de déclenchement :
* y[k]=y[k-1]+T[k]
* avec T[k] le vecteur des paramètres et y[k] le vecteur des sortie
*
* Entrée régulière : néant.
* Sorties régulières : y[0..nu-1] : sorties des nu signaux.
* Entrée évenementielle : période de déclenchement
* Sortie évènementielle : néant.
*
* Etats discrets : z[0..nu-1] : valeur des y[k-1]
* paramètres réels : rpar[0..nu-1] : vecteurs des paramètres (T[k]=1/rpar)
*/
/*prototype*/
void dtime(scicos_block *block,int flag)
{
/*déclaration des variables*/
double *y;
int i,nu;
/*Récupération de l'adresse du port de sortie régulier*/
y=(double *)block->outptr[0];
/*récupération de la taille du port de sortie*/
nu=block->outsz[0];
/*Le flag 1 place le registre z dans le registre y*/
if(flag==1||flag==6)
{
for(i=0;i<nu;i++) y[i]=block->z[i];
}
/*la flag 2 calcul l'incrément temporel*/
else if(flag==2)
{
for(i=0;i<nu;i++) block->z[i]=block->z[i]+1/block->rpar[i];
}
}