Subsections


Ramp

\epsfig{file=RAMP.eps,width=90.00pt}

Library

Sources

Description

The Ramp block generates a signal that starts at a specified time and value and changes by a specified rate. The block's Slope , Start time and Initial output parameters determine the characteristics of the output signal. All must have the consistent dimensions after scalar expansion.

Dialog Box

Set ramp parameters
Slope 0
Start time 0
Initial output 0

Default properties

Interfacing function

scilab/macros/scicos_blocks/sources/RAMP.sci

Computational function (type 4)


#include "scicos_block.h"
#include <math.h>

void ramp(scicos_block *block,int flag)
{double dt;
  if (flag==1){
    dt=get_scicos_time()-block->rpar[1];
    if (get_phase_simulation()==1) {
      if(dt>0) {
	block->outptr[0][0]=block->rpar[2]+block->rpar[0]*dt;
      }else{
	block->outptr[0][0]=block->rpar[2];
      }
    }else{
      if(block->mode[0]==1) {
	block->outptr[0][0]=block->rpar[2]+block->rpar[0]*dt;
      }else {
	block->outptr[0][0]=block->rpar[2];
      }
    }
  } else if (flag==9){
    block->g[0]=get_scicos_time()-(block->rpar[1]);
    if (get_phase_simulation()==1) {
      if (block->g[0]>=0){
	block->mode[0]=1;
      }else{
	block->mode[0]=2;
      }
    }
  }
}

Ramine Nikoukhah 2004-06-22