Digital to Analog Converter block
- q :
Type 'vec' of size -1. The level step.
- vmin :
Type 'vec' of size -1. The first input value where the convertion begins.
- type :
Type 'vec' of size -1. Set the type of the quantification.
- number of bit :
Type 'vec' of size -1. The number of bit of the CAN. Set also the maximum input level.
- CC2 (0/1) :
Type 'vec' of size -1. Set if the output integer is unsigned or signed.
- always active: no
- direct-feedthrough: no
- zero-crossing: no
- mode: no
- number/sizes of inputs: 1 / 1
- number/sizes of outputs: 1 / 1
- number/sizes of activation inputs: 1 / 1
- number/sizes of activation outputs: 0 /
- continuous-time state: no
- discrete-time state: no
- name of computational function: cna
CNA_f.sci
c cna.f Digital to Analog Convertor
c IRCOM Group - A. Layec
c REVISION HISTORY :
c $Log$
c
subroutine cna(flag,nevprt,t,xd,x,nx,z,nz,tvec,ntvec,
& rpar,nrpar,ipar,nipar,u,nu,y,ny)
double precision t,xd(*),x(*),z(*),tvec(*),rpar(*),u(*),y(*)
integer flag,nevprt,nx,nz,ntvec,nrpar,ipar(*)
integer nipar,nu,ny
integer i,j
double precision fsr
do 15 i=1,nu
if(ipar(i+nu).eq.1) then
y(i)=rpar(i)*(u(i)+(2**(ipar(i)-1)))+rpar(i+nu)
else
y(i)=rpar(i)*u(i)+rpar(i+nu)
endif
15 continue
end
IRCOM Group
Alan Layec