radar

Capsim Block Documentation

Short Description

This star implements an alpha-beta tracking filter.

Top
Input Connections
Port Type Name
0 float xm
Top
Output Connections
Port Type Name
0 float ys
1 float yp
2 float ysd
3 float ypd
Top
Parameters
Num Description Type Name Default Value
0 alpha float alpha 0.5
1 beta float beta 0.5
2 scan time (msec) float ts 10.0
3 initial velocity (-knots) float figuess -400.0
Top
States
Num Type Name Initial Value Description
0 int npts 0
Top

Declarations


 

	float dv;
	float tdel;
	float tmp;



Top

Initialization Code



 





Top

Main Code



 


	tdel=ts/1000.0;
	dv=1.0;
	tmp=0.0;

	while(IT_IN(0))  {
		if(npts < 2)  {
			if(IT_OUT(0)) {
				KrnOverflow("radar",0);
				return(99);
			}
			ys(0) = xm(0);
			if(IT_OUT(1)) {
				KrnOverflow("radar",1);
				return(99);
			}
			yp(0) = xm(0);
			if(IT_OUT(2)) {
				KrnOverflow("radar",2);
				return(99);
			}

			if(npts == 1)
				ysd(0) = 3600.0*xm(1)/tdel-3600.0*xm(0)/tdel;
			else
				ysd(0) = figuess; 

			if(IT_OUT(3)) {
				KrnOverflow("radar",1);
				return(99);
			}
			ypd(0) = ysd(0);
		}
		else  {
			if(xm(0) == 0.0)
				dv = 0.0;
			else
				dv = 1.0;
			if(IT_OUT(1)) {
				KrnOverflow("radar",1);
				return(99);
			}
			if(IT_OUT(2)) {
				KrnOverflow("radar",2);
				return(99);
			}
			if(IT_OUT(3)) {
				KrnOverflow("radar",3);
				return(99);
			}
			if(IT_OUT(0)) {
				KrnOverflow("radar",0);
				return(99);
			}
			yp(0) = ys(1)+ysd(1)*tdel/3600.0;
			ypd(0) = ysd(1);
			ys(0) = yp(0)+dv*alpha*xm(0)-dv*alpha*yp(0);
			tmp = dv*beta*3600.0/tdel;
			ysd(0) = ypd(0)+tmp*xm(0)-tmp*yp(0);
		}
		npts++;
	}

	return(0);




Top

Wrapup Code



 





Top

License



/*  Capsim (r) Text Mode Kernel (TMK) Star Library (Blocks)
    Copyright (C) 1989-2017  Silicon DSP Corporation

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 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
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser 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

    http://www.silicondsp.com
    Silicon DSP  Corporation
    Las Vegas, Nevada
*/


Top

Description



 

/*
 	radar.s:	tracking filter
 	parameters:	alpha, beta, scan time, initial velocity
 	inputs:		range measurements in nautical miles
 	outputs:	predicted range
 			smoothed range
 			predicted velocity
			smoothed velocity
 	description:	This star implements an alpha-beta
 			tracking filter.

radar


This star implements an alpha-beta tracking filter.
	parameters:	alpha, beta, scan time, initial velocity
 	inputs:		range measurements in nautical miles
 	outputs:	predicted range
 			smoothed range
 			predicted velocity
			smoothed velocity


 			written by Ray Kassel
 			August 13, 1990

 */