Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Trafficradarxml201.zip some insight

Featured Replies

Hi, Currently I'm trying to use the nice little module from Arne Bartels for use in the "Round the World Race" coming up. I use it for situation awareness at the airports and such when on multiplayer. I have FSNavigator which works perfectly, but using this requires it to "hook" up to the multiplayer session... It's strongly advised by our server admin not to do this because of certain MP quirks IE drop offs, boots offs etc.. We run on a VPN w/ FSHost. AI traffic using this module is perfect.Now the problem, I am using the module provided and works somewhat OK, the problem is that it just plains drops connection w/ some aircraft randomly. Both fellow FS9 & FSX flyers on MP. Now if I connect FSNavigator or AIBridge back up to the multiplayer session the missing aircraft reappear, but,,,, then again after awhile they "may" disappear again. It is very random. I have tried both the old & new version of TrafficInfo.dll 9.00.30612.02 & a version w/ the same vers. # but a much newer date. ( 10/23/2006 versus 9/19/2003 ) If ther are those who know C++ and want to toy with this, Is there a way to fix this? -or- Some kind of reload? I kinda believe the problem may be in TrafficData.cpp w/ the code below which "could" be the culprit. (Highly Doubtfull) -OR- MS just plain pooched the deal right from the start in TrafficInfo.dll. Again, is there any insight/experience with this? Internally I believe there is a mis-communication/ buffer o-load/ refresh or something that just is not totally working right. ( AI = Perfect, MP = So Close ) His Instructions work as delivered otherwise.BTW -- In NO WAY am I dissing what Arne provided. No way, no how. ( He was my RPN teacher in FS02 :-) ) Arne, I believe is now out of the FS hobby, I didnot try his mail. The module & source is available here... http://library.avsim....php?DLID=88811 & is the newest provided by Arne. Thank-You for any insight.Roman

/*TrafficData.cpp (c) 2006 Arne Bartels [email protected] to TrafficInfo.dll and precalculating of AI-Data.*/#include		"TrafficData.h"#include		"tools.h"#include		<math.h>//help function in C style for qsort and bsearchint compare_ids( const void *arg1, const void *arg2 ){	int				result		=	0;	tAircraftData	*ac_data1	=	(tAircraftData*) arg1,					*ac_data2	=	(tAircraftData*) arg2;	if(ac_data1!=NULL && ac_data2!=NULL)		result=  (int)ac_data1->id-(int)ac_data2->id;		return result;}void	TrafficData::GetAircraftData(UINT32 ai_id,tAircraftData*	pai_data){	if(pai_data!=NULL && m_ptraffic_info!=NULL && ai_id!=0)	{			//preset with zeros		memset(pai_data,0,sizeof(tAircraftData));		pai_data->id			=	ai_id;		//default:		pai_data->tcas_state	=	TCAS_OFF;		m_ptraffic_info->AircraftVarGetFloat	(ai_id,	m_var_lat,	m_unit_deg,	&pai_data->lat,	1);		m_ptraffic_info->AircraftVarGetFloat	(ai_id,	m_var_lon,	m_unit_deg,	&pai_data->lon,	1);        		if (!m_ptraffic_info->IsMultiplayerActive())//"normal" AI		{			m_ptraffic_info->AircraftVarGetFloat	(ai_id,	m_var_ind_alt,	m_unit_feet,		&pai_data->alt,		1);			m_ptraffic_info->AircraftVarGetString	(ai_id,	m_var_tail_nr,	pai_data->atc_id,	MAX_CHARS_ATC_ID);			m_ptraffic_info->AircraftVarGetFloat	(ai_id,	m_var_comb,		m_unit_bool,		&pai_data->comb,	1);			m_ptraffic_info->AircraftVarGetFloat	(ai_id,	m_var_is_user,	m_unit_bool,		&pai_data->is_user,	1);			m_ptraffic_info->AircraftVarGetFloat	(ai_id,	m_var_vs,		m_unit_fpm,			&pai_data->vs,		1);			m_ptraffic_info->AircraftVarGetFloat	(ai_id,	m_var_ns,		m_unit_kts,			&pai_data->ns,		1);			m_ptraffic_info->AircraftVarGetFloat	(ai_id,	m_var_es,		m_unit_kts,			&pai_data->es,		1);			m_ptraffic_info->AircraftVarGetFloat	(ai_id,	m_var_alt_agl,	m_unit_feet,		&pai_data->alt_agl,		1);					}		else//multiplayer mode, some data not available		{			m_ptraffic_info->AircraftVarGetFloat	(ai_id,	m_var_alt,		m_unit_feet,		&pai_data->alt,		1);			strncpy_s(pai_data->atc_id,	m_ptraffic_info->GetPlayerName(ai_id),	MAX_CHARS_ATC_ID);			pai_data->comb		=	1;			pai_data->is_user	=	0;			pai_data->vs		=	0.0;			pai_data->ns		=	0.0;			pai_data->es		=	0.0;			pai_data->alt_agl	=	0.0;			m_ptraffic_info->AircraftVarGetFloat	(ai_id,	m_var_hdg_true,	m_unit_deg,	&pai_data->trck_angl,	1);		}	}}//calculate distance,bearing,dif alt,slant range,track angle ground speed//new version with binary searchvoid	TrafficData::DifferentiateData	(tAircraftData*	pai_data,UINT32 old_ai_num,tAircraftData*	old_pai_data,FLOAT64	time_diff,FLOAT64 plane_vs){	tAircraftData*	phelper		=	NULL;	UINT32			i			=	0;	FLOAT64			dummytrckang=	0;	FLOAT64			tau_inv		=	0,					rad_alt		=	CLEAR_OF_GROUND*2,					alt_sep		=	0,					dlt_vs		=	0;	if(pai_data	!=	NULL && old_ai_num!=0 && old_pai_data!=NULL && time_diff>0 &&m_ptraffic_info!=NULL)	{		if(pai_data->slnt_rng<3)			return;		phelper=(tAircraftData*)bsearch((void *)pai_data,(void *)old_pai_data, (size_t)old_ai_num, sizeof( tAircraftData ), compare_ids);				//found the data set		if(phelper!=NULL)		{			//ground speed is not directly available in 			//multiplayer mode, so calculate from previous data set			//setting to at least 1 enables track drawing			if (m_ptraffic_info->IsMultiplayerActive())			{				pai_data->grnd_spd	=	max(1,3600*GrtCrcDist(&dummytrckang,pai_data->lat,pai_data->lon,phelper->lat,phelper->lon)/time_diff);				pai_data->vs		=	(phelper->alt-pai_data->alt)/time_diff*60;				rad_alt		=	CLEAR_OF_GROUND*2;			}			else				rad_alt	=	pai_data->alt_agl;			dlt_vs	=	pai_data->vs-plane_vs;						//how fast reduces the slant_range ?			pai_data->rng_rate=(phelper->slnt_rng-pai_data->slnt_rng)/time_diff;						//depending on range rate and range determine the TA,RA,other states of the display			//Note: this is just a simple example, 			//      it can be a good deal more elaborate! (e.g.:http://www.aerowinx.com/html/tcas.html)									//other traffic:			if(	rad_alt				>=	m_other_min_ralt	&&				pai_data->dlt_alt	<=	m_other_above_alt	&&				-pai_data->dlt_alt	<=	m_other_below_alt)				pai_data->tcas_state	=	TCAS_OTHER;			if(rad_alt>=CLEAR_OF_GROUND)//aircraft in air			{				if(	pai_data->dist		<=	m_proxy_range		&&					pai_data->dlt_alt	<=	m_proxy_above_alt	&&					-pai_data->dlt_alt	<=	m_proxy_below_alt)				pai_data->tcas_state	=	TCAS_PROXY_TRAFFIC;				//time to CPA (Closest Point of Approach) but inverted, to avoid extra care for rng_rate<=0 				//20<1.0/tau_inv<=35	=> TA (yellow)				//20<=1.0/tau_inv		=> RA (red)								tau_inv		=	pai_data->rng_rate/max(pai_data->slnt_rng,.0001);				//TA time				if(tau_inv		>=	1.0/max(m_time_sep_ta,.001))				{					//altitude separation					alt_sep		=	pai_data->dlt_alt+1.0/max(1.0e-10,tau_inv)/60.0*dlt_vs;					if(pai_data->dlt_alt>=0 && alt_sep < m_altitude_sep_ta)						pai_data->tcas_state	=	TCAS_TA_TRAFFIC;					if(pai_data->dlt_alt<0 && alt_sep > -m_altitude_sep_ta)						pai_data->tcas_state	=	TCAS_TA_TRAFFIC;				}				//TA distance				if(pai_data->dist	<=	m_distance_sep_ta)				{					//altitude separation no vertical speed					if(fabs(pai_data->dlt_alt)<m_altitude_sep_ta)						pai_data->tcas_state	=	TCAS_TA_TRAFFIC;				}				//RA time				if(tau_inv		>=	1.0/max(m_time_sep_ra,.001)) 				{					//altitude separation					alt_sep		=	pai_data->dlt_alt+1.0/max(1.0e-10,tau_inv)/60.0*dlt_vs;					if(pai_data->dlt_alt>=0 && alt_sep < m_altitude_sep_ra)						pai_data->tcas_state	=	TCAS_RA_TRAFFIC;					if(pai_data->dlt_alt<0 && alt_sep > -m_altitude_sep_ra)						pai_data->tcas_state	=	TCAS_RA_TRAFFIC;				}				if(pai_data->dist	<=	m_distance_sep_ra)//RA				{					//altitude separation no vertical speed					if(fabs(pai_data->dlt_alt)<m_altitude_sep_ra)						pai_data->tcas_state	=	TCAS_RA_TRAFFIC;				}			}			if(pai_data->tcas_state>TCAS_PROXY_TRAFFIC)			{				//first threat				if(m_closest_threat.tcas_state<=TCAS_PROXY_TRAFFIC)					memcpy(&m_closest_threat,pai_data,sizeof(m_closest_threat));				//sucessive threat				if((pai_data->tcas_state>=m_closest_threat.tcas_state) && (pai_data->dist<=m_closest_threat.dist) ) 					memcpy(&m_closest_threat,pai_data,sizeof(m_closest_threat));			}		}	}}void	TrafficData::DeriveData			(UINT32 ai_num,tAircraftData*	pai_data,UINT32 old_ai_num,tAircraftData*	old_pai_data){	FLOAT64			plane_lat	=	aircraft_varget(m_var_lat,m_unit_deg,0),					plane_lon	=	aircraft_varget(m_var_lon,m_unit_deg,0),					alt			=	aircraft_varget(m_var_ind_alt,m_unit_feet,0),					vs			=	aircraft_varget(m_var_vs,m_unit_fpm,0),					dist_ft		=	0,					time_diff	=	m_elapsed_secs.var_value.n-m_elapsed_secs.var_old.n;	tAircraftData*	phelper		=	NULL;	UINT32			i			=	0;	if(pai_data!=NULL && m_ptraffic_info!=NULL && ai_num!=0 &&m_ptraffic_info!=NULL)	{		for(i=0;i<ai_num;i++)		{			phelper=&(pai_data[i]);			if(phelper!=NULL)			{				//distance, delta alt,slant_range				phelper->dist			=	GrtCrcDist(&(phelper->brg),phelper->lat,phelper->lon,plane_lat,plane_lon);				phelper->dlt_alt		=	phelper->alt-alt;				dist_ft					=	METER_TO_FEET(NAUTIC_MILE_TO_METER(phelper->dist));				phelper->slnt_rng		=	sqrt(phelper->dlt_alt*phelper->dlt_alt + dist_ft*dist_ft);				//ground speed vector: angle(deg true), speed (kts)				//only available in non-multiplayer mode				if (!m_ptraffic_info->IsMultiplayerActive())//"normal" AI				{					phelper->trck_angl	=	fmod(360.0+DEG_ATAN2(phelper->es,phelper->ns),360.0);					phelper->grnd_spd	=	sqrt(phelper->es*phelper->es + phelper->ns*phelper->ns);				}								if(phelper->slnt_rng<3)//this is your own ac or it's already much too late!				{					phelper->slnt_rng	=	0;					phelper->dist		=	0;				}				else//calculate data on difference to previous timestep					DifferentiateData(phelper,old_ai_num,old_pai_data,time_diff,vs);					}		}	}}UINT32	TrafficData::QueryData		(	UINT32 maxnum_act,FLOAT64 max_range_nm,										FLOAT64 time_sep_ta,FLOAT64 time_sep_ra,										FLOAT64 dist_sep_ta,FLOAT64 dist_sep_ra,										FLOAT64 alt_sep_ta,FLOAT64 alt_sep_ra){	UINT32			result		=	0,					*ai_ids		=	NULL,					i			=	0;		tAircraftData*	ai_data		=	NULL;	m_time_sep_ta				=	time_sep_ta;	m_time_sep_ra				=	time_sep_ra;	m_distance_sep_ta			=	dist_sep_ta;	m_distance_sep_ra			=	dist_sep_ra;	m_altitude_sep_ta			=	alt_sep_ta;		m_altitude_sep_ra			=	alt_sep_ra;	if(m_ptraffic_info!=NULL)	{			//Get an array of available aircraft ids		//first allocate new array, then fill it		ai_ids	=	new	UINT32[maxnum_act];		if(ai_ids!=NULL)		{			result			=	m_ptraffic_info->QueryAircraftNearUser(NAUTIC_MILE_TO_METER(max_range_nm), maxnum_act, ai_ids);						if(result>0)			{				ai_data	=	new	tAircraftData[result];				if(ai_data!=NULL)				{					//reset data of closest threat					memset(&m_closest_threat,0,sizeof(m_closest_threat));					m_closest_threat.tcas_state	=	TCAS_PROXY_TRAFFIC;					//read data for each id					for(i=0;i<result;i++)						GetAircraftData(ai_ids[i],&(ai_data[i]));					//lookup present time					lookup_var(&m_elapsed_secs);										//qsort old data by ids to allow calculating between new and old vars					qsort( (void *)m_ai_data, (size_t)m_num_ai_ids, sizeof( tAircraftData ), compare_ids );					//calculate some derivable values. Some calculations need the values from the previous cycle					//result,ai_data are new data,m_num_ai_ids,m_ai_data are old data					DeriveData(result,ai_data,m_num_ai_ids,m_ai_data);										//remember present time for next cycle					m_elapsed_secs.var_old.n	=	m_elapsed_secs.var_value.n;					//free old data					SAFE_DELETE(m_ai_data);										//use new data 					m_num_ai_ids	=	result;					m_ai_data		=	ai_data;				}			}			//free help array of ids			SAFE_DELETE(ai_ids);		}	}	return	result;}void	TrafficData::SetCatRules(double other_min_ralt,double other_above_alt,double other_below_alt,double proxy_range,double proxy_above_alt,double proxy_below_alt){	m_other_min_ralt	=	other_min_ralt;	m_other_above_alt	=	other_above_alt;	m_other_below_alt	=	other_below_alt;	m_proxy_range		=	proxy_range;	m_proxy_above_alt	=	proxy_above_alt;	m_proxy_below_alt	=	proxy_below_alt;}TrafficData::TrafficData		(void){	m_ppanel_cb			=	NULL;	m_ptraffic_info		=	NULL;	m_var_lat			=	XML_PLANE_LATITUDE;	m_var_lon			=	XML_PLANE_LONGITUDE;	m_var_alt			=	XML_PLANE_ALTITUDE;	m_var_ind_alt		=	XML_INDICATED_ALTITUDE;	m_var_vs			=	XML_VELOCITY_WORLD_Y;	m_var_ns			=	XML_VELOCITY_WORLD_Z;	m_var_es			=	XML_VELOCITY_WORLD_X;	m_var_hdg_true		=	XML_PLANE_HEADING_DEGREES_TRUE;	m_var_tail_nr		=	XML_ATC_ID;	m_var_comb			=	XML_ENG_COMBUSTION;	m_var_is_user		=	XML_IS_USER_SIM;	m_var_alt_agl		=	XML_PLANE_ALT_ABOVE_GROUND;	m_unit_feet			=	0;	m_unit_bool			=	0;	m_unit_deg			=	0;	m_unit_kts			=	0;	m_unit_fpm			=	0;		m_ai_data			=	NULL;	memset(&m_closest_threat,0,sizeof(m_closest_threat));	m_closest_threat.tcas_state	=	TCAS_PROXY_TRAFFIC;	m_num_ai_ids		=	0;	m_elapsed_secs.id	=	ELAPSED_SECONDS;	m_other_min_ralt	=	CLEAR_OF_GROUND;	m_other_above_alt	=	OTHER_DIFFALT;	m_other_below_alt	=	OTHER_DIFFALT;	m_proxy_range		=	PROXY_RANGE;	m_proxy_above_alt	=	PROXY_DIFFALT;	m_proxy_below_alt	=	PROXY_DIFFALT;	m_time_sep_ta		=	35;	m_time_sep_ra		=	20;	m_distance_sep_ta	=	1;	m_distance_sep_ra	=	0.1;	m_altitude_sep_ta	=	1200;	m_altitude_sep_ra	=	300;	lookup_var(&m_elapsed_secs);	m_elapsed_secs.var_old.n	=	m_elapsed_secs.var_value.n;    m_ppanel_cb		=	panel_get_registered_c_callback(TRAFFIC_INFO_INTERFACE_NAME);    if(m_ppanel_cb	!=	NULL)	{		//This call is the reason for using VC, GCC doesn't work here!		m_ptraffic_info		=	static_cast<ITrafficInfo*>(m_ppanel_cb->QueryInterface(TRAFFIC_INFO_INTERFACE_NAME));		if(m_ptraffic_info	!=	NULL)		{			m_var_lat		=	m_ptraffic_info->QueryAircraftVarEnum("PLANE LATITUDE");			m_var_lon		=	m_ptraffic_info->QueryAircraftVarEnum("PLANE LONGITUDE");			m_var_alt		=	m_ptraffic_info->QueryAircraftVarEnum("PLANE ALTITUDE");			m_var_ind_alt	=	m_ptraffic_info->QueryAircraftVarEnum("INDICATED ALTITUDE");			m_var_vs		=	m_ptraffic_info->QueryAircraftVarEnum("VELOCITY WORLD Y");			m_var_ns		=	m_ptraffic_info->QueryAircraftVarEnum("VELOCITY WORLD Z");			m_var_es		=	m_ptraffic_info->QueryAircraftVarEnum("VELOCITY WORLD X");			m_var_hdg_true	=	m_ptraffic_info->QueryAircraftVarEnum("PLANE HEADING DEGREES TRUE");			m_var_tail_nr	=	m_ptraffic_info->QueryAircraftVarEnum("ATC ID");			m_var_comb		=	m_ptraffic_info->QueryAircraftVarEnum("ENG COMBUSTION");			m_var_is_user	=	m_ptraffic_info->QueryAircraftVarEnum("IS USER SIM");			m_var_alt_agl	=	m_ptraffic_info->QueryAircraftVarEnum("PLANE ALT ABOVE GROUND");				m_unit_feet		=	m_ptraffic_info->QueryUnitEnum("FEET");			m_unit_bool		=	m_ptraffic_info->QueryUnitEnum("BOOL");			m_unit_deg		=	m_ptraffic_info->QueryUnitEnum("DEGREES");			m_unit_kts		=	m_ptraffic_info->QueryUnitEnum("KNOTS");			m_unit_fpm		=	m_ptraffic_info->QueryUnitEnum("FEET PER MINUTE");		}	}}TrafficData::~TrafficData	(void){	SAFE_DELETE(m_ai_data);}

20AUG21_Avsim_Sig.png?dl=1  FS RTWR   SHRS F-111   JoinFS   Little Navmap 
 

 

  • 3 weeks later...

Hi Roman,Maybe this has something to do with the freezing that "trafficradarxml201" produces after a certain amount of time?It's discussed in this thread http://forum.avsim....els-tas600mhd/

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.