GetBroad - A Data Encoding Program for Broadcasted Data on the Net

Nov-18-2002/jn


Introduction



Getbroad is a program, which reads the data broadcasted on the net by various other computers and encodes them into a general data structure. This data structure is available for other programs as a shared memory-region. There exist two versions of the program: one can be run without the X-Window system, the other uses X-Windows. The programs have the same name with the difference of the prefix X for the window version.



Using the program



The program can, but need not be called specifying parameters on the command line:

getbroad [ -x close ]

Xgetbroad [ -d <displayname> -x close/nox --h]

<displayname> is a name (for example: internet address + display etc.), where the graphical display should be sent.

-x close means to free the occupied shared memory region for the data structure.

-x nox means not to display an informational window.



Calling the program will first establish the shared memory to hold the data structure if not yet created before. Then the process listens to a certain broadcast address for messages on the net and continuously encodes them into the data structure in the shared memory-region.

During startup there can be displayed an error message saying

The address is alredy in use ( Die Adresse wird bereits verwendet )

That means that another process is already listening at the special UDP-port for these broadcasted messages. Normally that is this program started by another user, what means the data structure will already be updated continuously by that process. But it can also mean that there is a general problem with this computer connecting to the special UDP-port.

Using the X-Window version of the program will also display a small window where the running (or not ) data reception is displayed by changing colours. Deleting that window will also delete the process. The non Window version can only be eliminated by using the kill-command, if it was started as background process.



Programming Considerations



In order to have access to the data structure in user programs, there exist two include-files

sharemem_subs.cpp with the functions to access the shared memory and

datastruct_def.h with the general data structure

In the program itself one has only to define a pointer to the data structure and a function call to insert that structure.

DISPLAY_DATA *dp; // the pointer for the data structure

dp=(DISPLAY_DATA *)display_sharemem(&shm_id,1024); // inserting the data structure from shared memory

if ((int)dp == ERROR) // ... means a problem during insertion



The data structure



The last version of the data structure is as follows:



***************************************************************************

Version: Nov 15 2002

***************************************************************************/





#ifndef DATASTRUCTDEF_H

style="font-size: 9pt;" size="2">#define DATASTRUCTDEF_H





#ifndef BOOL

#define BOOL unsigned short

#endif





typedef struct dat_dbl

{

double azi; // Azimut, Grad

double dazi; // soll-ist

double mdazi; // Regelungsabweichung

double cazi; // counterdifferenz und einzelne

double caz1;

double caz2;

double vazi; // Geschw.

double uazi; // up-down counter

double sazi; // Striche

double pazi; // ideal Azimut ohne Pointing

double pvaz;

double sollazi; // Sollwerte

double sollvaz;

double indazi; // indicated

double indvaz;

double tecazi; // unbehandelte hardware inputs

double tecvaz;

double outazi; // Ausgabewerte

double outvaz;

double outbaz; // Beschleunigung



double elv; // Elevation dgl.

double delv;

double mdelv; // Regelungsabweichung

double celv; // counterdifferenz und einzelne

double cel1;

double cel2;

double velv;

double uelv;

double selv;

double pelv; // ideal Elevation ohne Pointing

double pvel;

double sollelv; // Sollwerte und Abweichung

double sollvel;

double indelv; // indicated

double indvel;

double tecelv; // unbehandelte hardware inputs

double tecvel;

double outelv; // Ausgabewerte

double outvel;

double outbel; // Beschleunigung



//----- FC1 Radialer Focus

double fc1;

double dfc1; // Soll - Ist

double sollfc1; // Sollwerte und Abweichung

double sollvfc1;

double indfc1; // indicated

double indvfc1;

double tecfc1; // unbehandelte hardware inputs

double tecvfc1;

double outfc1; // Ausgabewerte

double outvfc1;

double outbfc1; // Beschleunigung



//----- FC2 Fokussierung

double fc2;

double dfc2; // Soll - Ist

double sollfc2; // Sollwerte und Abweichung

double sollvfc2;

double indfc2; // indicated

double indvfc2;

double tecfc2; // unbehandelte hardware inputs

double tecvfc2;

double outfc2; // Ausgabewerte

double outvfc2;

double outbfc2; // Beschleunigung



//----- FC3 Kippung

double fc3;

double dfc3; // Soll - Ist

double sollfc3; // Sollwerte und Abweichung

double sollvfc3;

double indfc3; // indicated

double indvfc3;

double tecfc3; // unbehandelte hardware inputs

double tecvfc3;

double outfc3; // Ausgabewerte

double outvfc3;

double outbfc3; // Beschleunigung



//----- POS Polarisationsdrehung

double pos;

double dpos; // Soll - Ist

double sollpos; // Sollwerte und Abweichung

double sollvpos;

double indpos; // indicated

double indvpos;

double tecpos; // unbehandelte hardware inputs

double tecvpos;

double outpos; // Ausgabewerte

double outvpos;

double outbpos; // Beschleunigung



double slam; // eingegeben

double vlam;

double olam;

double sbet;

double vbet;

double obet;



double ra50; // Rektaszension, Deklination

double dk50;

double ra2000;

double dk2000;

double ramean;

double dkmean;

double hangle; // Stundenwinkel

double paral; // Parallaktischer Winkel



double actlam; // aktive Werte fuer Anzeige

double actbet;

double actruncoor; // laufende und fixed Koordinate

double actfixcoor;

double actveloc; // aktive Geschw.





double hpa; // Luftdruck in Hpa

double temp; // Temperatur in °C

double humi; // Luftfeuchte in %

double waterpress; // Wasserdruck in Hpa

double refract; // Refractive Index in "

double windvel; // Windgeschw in km/s

double winddir; // Windrichtung in Grad



double juldat; // julianisches Datum in [d]

double time; // Uhrzeit in [h]

double sit; // siderische Zeit in [h]

double subsctime; // Zeit im Subscan [h]

double subscdist; // Distanz im Subscan in [°]

double rxfreq; // RX-Frequenz



double nule; // Pointingwerte

double nula;

double coll;

double poifc1;

double poifc2;



double vme_elv1[11]; // AXPUG-Feld vmetelescope

double vme_elv2[11]; // AXPUG-Feld vmetelescope

double vme_azi1[11]; // AXPUG-Feld vmetelescope

double vme_azi2[11]; // AXPUG-Feld vmetelescope



double obs_timeon; // selected observation time per subscan (on) [h]

double obs_timeref; // selected observation time per subscan (ref) [h]

double obs_timeact; // actual observation time in subscan [h]

double obs_velocity; // selected observation velocity [° per min]

double obs_distance; // selected observation distance [°]

double obs_timerest; // rest time in subscan [h]



//***** naechster ist double(171)



// Frontend-Daten

double fe_ulo_frqs[3]; // berechnete ULO-Frequenzen signal,switch,fixed

double fe_update; // update-time in JD

double fe_frqs[3]; // Synthesizer-Frequenzen signal,switch,fixed in [GHz]

double fe_amps[3]; // ... dgl Amplituden in [dBm]

double fe_dfms[3]; // gelesene Frequenzen

double fe_diffs[3]; // Diff zwischen gelesen und gesetzt

double fe_facts[3]; // Faktor für Frequenzberechnung

double fe_scfs[7]; // eingegebene Frqs: scf,ocf,rlf,olf,rhf,ohf,suf

double fe_rxfrq; // receiver Frequenz

double fe_reffrq; // Referenz "

double fe_frqoff; // Offset "

double fe_sif; // IF "

double fe_sif2; // not used





double dreserve[48];



} DOUBLE_DATA;



#define DOUBLE_DATA_DIM 250



typedef struct dat_intg

{

long year; // Kalenderdaten

long month;

long day;

long weekday;

long day_year;

long statazi; // Status-Bits der Achsen

long statelv;

long statfc1;

long statfc2;

long statfc3;

long statpos;

long scannr;

long subscnr;

long srp1;

long srp2;

long srp3;

long srp4;

long vax_statclock[2]; // BCD-kodierte Stationsuhr

long vax_antclock; // VAX Antennencrate Clockcontroller

long vax_beclock; // VAX Backend Clockcontroller

long steuerpult_sw; // Steuerpultschalter

long camac_adcs[16]; // ADCS von VAX Camac

long camac_dacs[16 ]; // DACS von VAX-Camac 12 Bit

long camac_dac18[2]; // 18-Bit DAC von VAX Camac

long camac_digin[6]; // Digitale Inputs von VAX Camac

long camac_digout[2]; // Digitale Outputs von VAX Camac

long camac_veloc[4]; // Geschw. von VAX Camac

long camac_currents[16]; // actuelle Werte von VAX Camac

long vaxevents96; // Eventflags der VAX

long vaxevents64;

long scanning_axis; // scannende Achse 1:lam,2:bet,3:azm ...



//***** naechste beginnt mit long(87)



// Frontend Daten

long fe_status_bits; // gegenwärtiger Status Frontend

long fe_used_syn; // benutzte Synthesizer (sut)

long fe_ulomode; // fsm

long fe_act_fcunr; // aktive fcu-Nr

long fe_fcu_first; // erste und letzte fcu-Nr

long fe_fcu_last;

long fe_fcu_avail; // verfuegbare fcus

long fe_fcu_notavail;

long fe_obs_status; // Status of observation

long fe_err_severity; // Error Severity

long fe_ulo_contr[6]; // Frontend Einheiten Einstellung

// ulocontr1,2,esm_contr,vlba_contr, 2 not used



long fe_syn_typ[3]; // Synthesizer typ

long fe_syn_adr[3]; // IEC adresse

long fe_syn_fd[3]; // file-descriptor (IEC)

long fe_syn_funct[3]; // welche Funktion hat er

long fe_syn_severity[3]; // error severity



long fe_dfm_alert[3]; // Frequenz-Abweichungs Status

long fe_dfm_typ[3]; // Typ

long fe_dfm_adr[3]; // IEC Adresse

long fe_dfm_fd[3]; // filedescriptor (IEC)

long fe_dfm_funct[3]; // welche Funktion hat er

long fe_dfm_chan[3]; // welcher Eingangskanal

long fe_dfm_severity[3]; // error severity



long fe_fcu_number; // Nr der Steuereinheit

long fe_fcu_base_adr; //basis adr. IEC

long fe_fcu_adr; // adr IEC

long fe_fcu_fd; // filedescriptor IEC

long fe_fcu_blanktime; // Blankzeit in 100 microsec

long fe_fcu_phtime; // Phasenzeit in millisec

long fe_fcu_status; // Betriebsmode

long fe_fcu_mode; // Status-info

long fe_fcu_severity; // error severity

long fe_fcu_dyn10; // Schalter dynamisch blockiert

long fe_fcu_dynxx; // " geschaltet

long fe_fcu_off10; // dgl. fuer Offscan

long fe_fcu_offxx; //

long fe_fcu_stat1; // statische Schalter 9-16

long fe_fcu_stat2; // " 17-24

long fe_fcu_phases; // Anzahl Phasen

long fe_fcu_workmode; //

long fe_fcu_phmatrix[4]; // Phasenmatrix



long fe_scf_opts[7]; // eingegebene Frequenzoptions

// scf,ocf,rlf,olf,rhf,ohf,frq

long fe_mul;

long fe_sid;

long fe_switchmode;

long fe_version[4];

long steps; // Nr. of steps in scanning direction



long ireserve[74];



} INTEG_DATA;



#define INTEG_DATA_DIM 250



typedef struct dat_bool

{

bool alive;

bool man_elv;

bool man_azi;

bool man_foci;

bool ok_elv;

bool ok_azi;

bool ok_foci;

bool ist_onscan;

bool observation;

bool azim_ein; // Inputs von SPS

bool azim_rechner;

bool azim_soll0;

bool azim_endsch;

bool azim_ist20d;

bool azim_ist40d;

bool elev_ein;

bool elev_rechner;

bool elev_soll0;

bool elev_endsch;

bool elev_ist10d;

bool elev_ist20d;

bool foci_ein;

bool foci_rechner;

bool fc1_endsch;

bool fc2_endsch;

bool fc3_endsch;

bool pol_endsch;

bool ok_fc1;

bool ok_fc2;

bool ok_fc3;

bool ok_pos;



// Frontend-Daten

bool fe_unit_remote[6]; // FrontendKontrolleinheiten remote

// ulocontr1,2,esm_contr,vlba_contr, 2 not used

bool fe_syn_standby[3]; // Synthesizer standby-mode

bool fe_syn_exist[3]; // Synthesizer exist

bool fe_dfm_exist[3]; // Frequenzzaehler exist

bool fe_fcu_hand; // Wird in Hand benutzt

bool fe_fcu_exist; // existiert

bool fe_fcu_remote; // Schalter auf remote



bool breserve[51];



} BOOL_DATA;



#define BOOL_DATA_DIM 100



typedef struct in_data

{

BOOL write; // TRUE, wenn noch nicht alle Werte erneuert sind

BOOL read; // TRUE, wenn Werte noch dargestellt werden

int running; // wird immer von 0-99 gezählt bei jedem Update



char datum[32]; // Kalenderzeit in ascii

char sourcename[80];

char scancoord[16]; // Scannende Koordinate lam,bet,azm usw.

char velocity[16]; // aktuelle Geschwindigkeitsart

char displ_coo_lam[16]; // Displaykoordinate in Lam

char displ_coo_bet[16]; // Displaykoordinate in Bet

char front_msg[256]; // Error von Frontend

char front_inf[80]; // Info von Frontend (severity 0,1)



union

{

DOUBLE_DATA d;

double dfeld[DOUBLE_DATA_DIM];

} d;

union

{

INTEG_DATA i;

long ifeld[INTEG_DATA_DIM];

} i;

union

{

BOOL_DATA b;

bool bfeld[BOOL_DATA_DIM];

} b;



} DISPLAY_DATA;





#endif // DATASTRUCTDEF_H




jneidhoefer_at_mpifr-bonn.mpg.de