updated utility tools(unrefractored)
This commit is contained in:
parent
e48bdfe4c6
commit
f9cdb4a5b6
|
@ -169,7 +169,7 @@
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<!-- n-columns=2 n-rows=2 -->
|
<!-- n-columns=3 n-rows=2 -->
|
||||||
<object class="GtkGrid">
|
<object class="GtkGrid">
|
||||||
<property name="width-request">100</property>
|
<property name="width-request">100</property>
|
||||||
<property name="height-request">80</property>
|
<property name="height-request">80</property>
|
||||||
|
@ -179,7 +179,7 @@
|
||||||
<property name="margin-top">10</property>
|
<property name="margin-top">10</property>
|
||||||
<property name="column-spacing">6</property>
|
<property name="column-spacing">6</property>
|
||||||
<child>
|
<child>
|
||||||
<!-- n-columns=1 n-rows=5 -->
|
<!-- n-columns=1 n-rows=9 -->
|
||||||
<object class="GtkGrid">
|
<object class="GtkGrid">
|
||||||
<property name="width-request">80</property>
|
<property name="width-request">80</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -187,7 +187,7 @@
|
||||||
<property name="row-spacing">35</property>
|
<property name="row-spacing">35</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="voltage">
|
<object class="GtkButton" id="voltage">
|
||||||
<property name="label" translatable="yes">Voltage</property>
|
<property name="label" translatable="yes">Voltage Magnitude</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">True</property>
|
<property name="can-focus">True</property>
|
||||||
<property name="receives-default">True</property>
|
<property name="receives-default">True</property>
|
||||||
|
@ -218,7 +218,7 @@
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left-attach">0</property>
|
<property name="left-attach">0</property>
|
||||||
<property name="top-attach">2</property>
|
<property name="top-attach">3</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -227,13 +227,14 @@
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="active">0</property>
|
<property name="active">0</property>
|
||||||
<items>
|
<items>
|
||||||
<item id="0" translatable="yes">kmeans</item>
|
<item id="0" translatable="yes">Gaussian</item>
|
||||||
<item id="1" translatable="yes">simple</item>
|
<item id="1" translatable="yes">kmeans</item>
|
||||||
|
<item translatable="yes">DTW</item>
|
||||||
</items>
|
</items>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left-attach">0</property>
|
<property name="left-attach">0</property>
|
||||||
<property name="top-attach">3</property>
|
<property name="top-attach">5</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -243,15 +244,52 @@
|
||||||
<property name="active">0</property>
|
<property name="active">0</property>
|
||||||
<items>
|
<items>
|
||||||
<item id="0" translatable="yes">frequency only</item>
|
<item id="0" translatable="yes">frequency only</item>
|
||||||
<item id="1" translatable="yes">frequency,voltage</item>
|
<item id="1" translatable="yes">voltage only</item>
|
||||||
<item id="2" translatable="yes">voltage</item>
|
<item id="2" translatable="yes">frequency,voltage</item>
|
||||||
</items>
|
</items>
|
||||||
</object>
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">7</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="dfreq">
|
||||||
|
<property name="label" translatable="yes">dfreq</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="receives-default">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="algo_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Algorithm</property>
|
||||||
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left-attach">0</property>
|
<property name="left-attach">0</property>
|
||||||
<property name="top-attach">4</property>
|
<property name="top-attach">4</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="dimm_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Dimmensions</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">6</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left-attach">0</property>
|
<property name="left-attach">0</property>
|
||||||
|
@ -281,6 +319,202 @@
|
||||||
<property name="top-attach">1</property>
|
<property name="top-attach">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Legend</property>
|
||||||
|
<property name="use-markup">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<!-- n-columns=2 n-rows=1 -->
|
||||||
|
<object class="GtkGrid">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkColorButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="receives-default">True</property>
|
||||||
|
<property name="title" translatable="yes">red</property>
|
||||||
|
<property name="rgba">rgb(238,29,0)</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="legend_label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Attack/Event</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<!-- n-columns=2 n-rows=1 -->
|
||||||
|
<object class="GtkGrid">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkColorButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="receives-default">True</property>
|
||||||
|
<property name="rgba">rgb(0,255,0)</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Normal</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">2</property>
|
||||||
|
<property name="top-attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkScrolledWindow">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="shadow-type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkViewport">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="graph_legend1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Graph Legend</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<!-- n-columns=2 n-rows=1 -->
|
||||||
|
<object class="GtkGrid">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkColorButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="receives-default">True</property>
|
||||||
|
<property name="rgba">rgb(255,120,0)</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Pmu</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkColorButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="receives-default">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkColorButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="receives-default">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">2</property>
|
||||||
|
<property name="top-attach">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<placeholder/>
|
<placeholder/>
|
||||||
</child>
|
</child>
|
||||||
|
|
|
@ -8,5 +8,15 @@ typedef struct{
|
||||||
int current_selection;
|
int current_selection;
|
||||||
} myParameters;
|
} myParameters;
|
||||||
|
|
||||||
|
struct vis_data{
|
||||||
|
int id;
|
||||||
|
float lat;
|
||||||
|
float lon;
|
||||||
|
GdkPixbuf *last_image;
|
||||||
|
GTimeVal last_update_time;
|
||||||
|
struct vis_data *next;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct vis_data *head;
|
||||||
|
|
||||||
gboolean update_images(gpointer* pars);
|
gboolean update_images(gpointer* pars);
|
|
@ -29,8 +29,8 @@ gboolean update_images(gpointer* pars){
|
||||||
if (curr_measurement==0)
|
if (curr_measurement==0)
|
||||||
{
|
{
|
||||||
int i = 0, k = 0;
|
int i = 0, k = 0;
|
||||||
float freq;
|
float freq,vol_magnitude,angle, dfreq;
|
||||||
unsigned char fmt;
|
unsigned char freq_fmt, anal_fmt, phas_fmt, polar_fmt;
|
||||||
while (df!=NULL){
|
while (df!=NULL){
|
||||||
float lat;
|
float lat;
|
||||||
float lon;
|
float lon;
|
||||||
|
@ -46,21 +46,36 @@ gboolean update_images(gpointer* pars){
|
||||||
if(id == to_intconvertor(temp_cfg->idcode)){
|
if(id == to_intconvertor(temp_cfg->idcode)){
|
||||||
cfg_match = 1;
|
cfg_match = 1;
|
||||||
printf("Matched - id : %d\n",id);
|
printf("Matched - id : %d\n",id);
|
||||||
fmt = temp_cfg->pmu[0]->fmt->freq;
|
freq_fmt = temp_cfg->pmu[0]->fmt->freq;
|
||||||
|
anal_fmt = temp_cfg->pmu[0]->fmt->analog;
|
||||||
|
phas_fmt = temp_cfg->pmu[0]->fmt->phasor;
|
||||||
|
polar_fmt = temp_cfg->pmu[0]->fmt->polar;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
temp_cfg = temp_cfg->cfgnext;
|
temp_cfg = temp_cfg->cfgnext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&mutex_cfg);
|
pthread_mutex_unlock(&mutex_cfg);
|
||||||
if(fmt == '1'){
|
|
||||||
|
// get data from df.
|
||||||
|
if(freq_fmt == '1'){
|
||||||
freq = decode_ieee_single(df->dpmu[i]->freq);
|
freq = decode_ieee_single(df->dpmu[i]->freq);
|
||||||
printf("freq = %f\n",freq);
|
printf("freq = %f\n",freq);
|
||||||
}else{
|
}else{
|
||||||
freq = to_intconvertor(df->dpmu[i]->freq)*1e-6+50;
|
freq = to_intconvertor(df->dpmu[i]->freq)*1e-6+50;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned char first2bytes[2];
|
||||||
|
strncpy(first2bytes, df->dpmu[i]->phasors[0], 2);
|
||||||
|
unsigned char last2bytes[2];
|
||||||
|
strncpy(last2bytes, df->dpmu[i]->phasors[0]+2, 2);
|
||||||
|
vol_magnitude = to_intconvertor(first2bytes);
|
||||||
|
float imaginary = to_intconvertor(last2bytes);
|
||||||
|
printf("vol = %f imag = %f\n",vol_magnitude, imaginary);
|
||||||
|
|
||||||
live_chart_serie_add(serie, freq);
|
live_chart_serie_add(serie, freq);
|
||||||
|
|
||||||
|
// check lower layer details to get longitude and lattitude.
|
||||||
pthread_mutex_lock(&mutex_Lower_Layer_Details);
|
pthread_mutex_lock(&mutex_Lower_Layer_Details);
|
||||||
LLptr = LLfirst;
|
LLptr = LLfirst;
|
||||||
match = 0;
|
match = 0;
|
||||||
|
|
|
@ -105,12 +105,15 @@ void utility_tools(GtkButton *but, gpointer udata)
|
||||||
"map-source", OSM_GPS_MAP_SOURCE_OSMC_TRAILS,
|
"map-source", OSM_GPS_MAP_SOURCE_OSMC_TRAILS,
|
||||||
"tile-cache", "/tmp/",
|
"tile-cache", "/tmp/",
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
// TODO: centering the map
|
||||||
osm_gps_map_set_center_and_zoom(utdata->util_map, 15.4589, 75.0078, 10);
|
osm_gps_map_set_center_and_zoom(utdata->util_map, 15.4589, 75.0078, 10);
|
||||||
|
|
||||||
// TODO: add the points to window.
|
// TODO: add the points to window.
|
||||||
g_last_image = osm_gps_map_image_add(utdata->util_map, 15.4589, 75.0078, g_red_image);
|
g_last_image = osm_gps_map_image_add(utdata->util_map, 15.4589, 75.0078, g_red_image);
|
||||||
g_last_image = osm_gps_map_image_add(utdata->util_map, 15.518597, 74.925584, g_green_image);
|
g_last_image = osm_gps_map_image_add(utdata->util_map, 15.518597, 74.925584, g_green_image);
|
||||||
|
|
||||||
|
|
||||||
curr_measurement = 0;
|
curr_measurement = 0;
|
||||||
algorithm = 0;
|
algorithm = 0;
|
||||||
dimmension = 0;
|
dimmension = 0;
|
||||||
|
|
Loading…
Reference in New Issue