Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
Added day and time stamps. Still need to add a T0 and daynumber to summary page
  • Loading branch information
nebarnix authored Sep 30, 2016
1 parent 9a8f7aa commit 77fe993
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 44 deletions.
88 changes: 85 additions & 3 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ if (fileName != "")
break;
else if(line.contains(re)) //only look at lines that start with a decimal number
{
//for now, get rid of the inverted flags. Maybe we can figure this out later if there is a need
line.replace("i","");
line[line.indexOf(' ')] = '\t'; //Replace the first space with a tab
minorFrameParts = line.split('\t'); //Split on said tab
minorFramesHex.append(minorFrameParts[1]); //Put the hex data right into the window
Expand All @@ -84,13 +86,92 @@ if (fileName != "")
//displayMinorFramesDec(); //no need to spit these out to the DCS box. Its not your box anyway!
displaySpaceCraftID();
plotMinorFrameID();
getTimeStamps();
populateSummaryTable();

//Ok, we're done, go to Summary now
ui->stackedWidget->setCurrentIndex(1);
}
}

void MainWindow::getTimeStamps()
{
//if((bitshift(bitand(minorFrames(frame,9+1),bin2dec('111')),24) + bitshift(minorFrames(frame,10+1),16) + bitshift(minorFrames(frame,11+1),8) + minorFrames(frame,12+1)) < 86400000)
QString windowContents;
unsigned char byte1, byte2, byte3, byte4;
unsigned int dayNum;
float timeStamp;
float hour, minute, seconds;
for(int i=0; i < numFrames; i++)
{
if(minorFrameIDList[i] == 0)
{
byte2 = minorFramesDec[i][8];
byte1 = minorFramesDec[i][9];
dayNum =(byte2<<1)+((byte1|128) >> 7);

//byte1 = minorFramesDec[i][9];
byte2 = minorFramesDec[i][10];
byte3 = minorFramesDec[i][11];
byte4 = minorFramesDec[i][12];
timeStamp = (((byte1 & 0b111) << 24) + (byte2<<16) + (byte3<<8) + byte4) / 1000.0;
if(timeStamp < 86400) //there aren't this many seconds in a day, clearly this is an error
{
timeStampList.append(timeStamp);
timeStampTimeList.append(minorFrameTimes[i]);

windowContents.append("Frame " + QString::number(i) + "\t");
windowContents.append("Day " + QString::number(dayNum) + "\t");
windowContents.append(QString::number(minorFrameTimes[i],'f',2));
windowContents.append(" Local Seconds is ");
windowContents.append(QString::number(timeStamp,'f',2));
windowContents.append(" Spacecraft Day Seconds");


hour = floor(timeStamp/(60.0*60.0));
minute = floor((timeStamp/(60.0*60.0) - hour)*60.0);
seconds = (((timeStamp/(60.0*60.0) - hour)*60.0) - minute) *60.0;
windowContents.append(" which is ");
windowContents.append(QString::number(hour));
windowContents.append(":");
windowContents.append(QString::number(minute));
windowContents.append(":");
windowContents.append(QString::number(seconds,'f',2));
//fprintf(['' num2str(hour) ':' num2str(minute) ':' num2str(seconds)]);

windowContents.append("\tt(0) => ");

float deltaTimeSec = timeStamp-minorFrameTimes[i];
hour = floor((deltaTimeSec)/(60.0*60.0));
minute = floor(((deltaTimeSec)/(60.0*60.0) - hour)*60.0);
seconds = ((((deltaTimeSec)/(60.0*60.0) - hour)*60.0) - minute) *60.0;

//windowContents.append(QString::number(deltaTimeSec));
//windowContents.append("deltasec ");
windowContents.append(QString::number(hour));
windowContents.append(":");
windowContents.append(QString::number(minute));
windowContents.append(":");
windowContents.append(QString::number(seconds,'f',2));

/* We can do better error detection than this, like deviation from T0 maybe
if idx > 1 && dayMSeconds(idx) <= dayMSeconds(idx-1)
fprintf(' ...but this might be an error');
else
hour = floor((dayMSeconds(idx)-frameTime(frame,1)*1000)/(1000*60*60));
minute = floor(((dayMSeconds(idx)-frameTime(frame,1)*1000)/(1000*60*60) - hour)*60);
seconds = ((((dayMSeconds(idx)-frameTime(frame,1)*1000)/(1000*60*60) - hour)*60) - minute) *60;
fprintf(['' num2str(hour) ':' num2str(minute) ':' num2str(seconds)]);
end
fprintf('\n');*/
windowContents.append('\n');
}
}

}
ui->TimeStampTextBox->insertPlainText(windowContents);
}

void MainWindow::populateSummaryTable()
{

Expand Down Expand Up @@ -370,8 +451,9 @@ ui->SPIDList->insertPlainText(windowContents);
//curve1->setSymbol(new QwtSymbol(QwtSymbol::Ellipse,QColor( "Purple" ),QColor( "Purple" ),4));
marker->setStyle(QwtSymbol::Ellipse);
marker->setSize(4);
marker->setColor(QColor( "Purple" ));
marker->setPen(QColor( "Magenta" ));

marker->setColor(QColor( "purple" ));
marker->setPen(QColor( "cyan" ));
curve1->setSymbol(marker);

curve1->attach(ui->SPIDPlot);
Expand All @@ -387,7 +469,6 @@ ui->SPIDList->insertPlainText(windowContents);

void MainWindow::plotMinorFrameID()
{
QList <unsigned int> minorFrameIDList;
QByteArray spaceCraftIDList;
QString windowContents;
unsigned char byte1,byte2;
Expand Down Expand Up @@ -434,6 +515,7 @@ ui->MinorFrameIDList->insertPlainText(windowContents);
//curve1->setSymbol(new QwtSymbol(QwtSymbol::Ellipse,QColor( "Purple" ),QColor( "Purple" ),4));
marker->setStyle(QwtSymbol::Ellipse);
marker->setSize(4);

marker->setColor(QColor( "Purple" ));
marker->setPen(QColor( "Magenta" ));
curve1->setSymbol(marker);
Expand Down
5 changes: 5 additions & 0 deletions mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,17 @@ private slots:
QStringList minorFramesHex;
QByteArrayList minorFramesDec;
QList <float> minorFrameTimes;
QList <unsigned int> minorFrameIDList;
QList <float> timeStampList;
QList <unsigned long> timeStampTimeList;

void displayMinorFramesHex();
void displayMinorFramesDec();
void convertMinorFramesHex2Dec();
void displaySpaceCraftID();
void plotMinorFrameID();
void populateSummaryTable();
void getTimeStamps();
unsigned int numFrames;
unsigned char SFID;
};
Expand Down
35 changes: 13 additions & 22 deletions mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<x>0</x>
<y>0</y>
<width>1055</width>
<height>699</height>
<height>698</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
<string>Project Desert Tortoise: NOAA Telemetry Explorer by KE7PHI</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QGridLayout" name="gridLayout">
Expand Down Expand Up @@ -55,7 +55,7 @@
<x>10</x>
<y>20</y>
<width>231</width>
<height>571</height>
<height>581</height>
</rect>
</property>
<property name="wordWrap">
Expand Down Expand Up @@ -196,7 +196,7 @@
<item row="0" column="1">
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>1</number>
<number>4</number>
</property>
<widget class="QWidget" name="Demod">
<layout class="QGridLayout" name="gridLayout_3">
Expand Down Expand Up @@ -319,7 +319,7 @@
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;Spacecraft&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;There are currently three operational (as of Sept 2016) NOAA POES satellites that transmit a direct sounder broadcast on 137.350 Mhz and 137.770 Mhz&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt; font-weight:600;&quot;&gt;NOAA-15&lt;/span&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt; : 137.350 Mhz &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt; font-weight:600;&quot;&gt;NOAA-18&lt;/span&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt; : 137.350 Mhz&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt; font-weight:600;&quot;&gt;NOAA-19&lt;/span&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt; : 137.770 Mhz&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Sometimes NOAA-15 and NOAA-18 orbits overlap significantly resulting in overlapping transmissions, which is frustrating. &lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;Spacecraft&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;There are currently three operational (as of Sept 2016) NOAA POES satellites that transmit a direct sounder broadcast on 137.350 Mhz and 137.770 Mhz&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt; font-weight:600;&quot;&gt;NOAA-15&lt;/span&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt; : 137.350 Mhz &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt; font-weight:600;&quot;&gt;NOAA-18&lt;/span&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt; : 137.350 Mhz&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt; font-weight:600;&quot;&gt;NOAA-19&lt;/span&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt; : 137.770 Mhz&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Sometimes NOAA-15 and NOAA-18 orbits overlap significantly resulting in overlapping transmissions, which is frustrating. &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt; font-weight:600;&quot;&gt;Spacecraft ID: &lt;/span&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Every minor frame contains a spacecraft ID, which is needed to properly decode the frames as NOAA-15/18 is slightly different than NOAA-19 &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt; font-weight:600;&quot;&gt;Minor Frame ID: &lt;/span&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Every minor frame contains an ID which counts between 0 and 319 and is required to properly decommutate the subcommutated instrument data. It is also a useful plot of data quality.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt; font-weight:600;&quot;&gt;Timestamps: &lt;/span&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Every major frame (minor frame 0/320) contains a day number and a clock in milliseconds. The data is useful for ephemris calculations, and the T(0) time is required for initializing the DCS geolocation model.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
Expand All @@ -334,13 +334,6 @@
<widget class="QWidget" name="SPC_ID">
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>SPC_ID</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QwtPlot" name="SPIDPlot">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
Expand All @@ -350,7 +343,7 @@
</property>
</widget>
</item>
<item row="2" column="0">
<item row="1" column="0">
<widget class="QPlainTextEdit" name="SPIDList">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Maximum">
Expand Down Expand Up @@ -392,7 +385,13 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="TStamp"/>
<widget class="QWidget" name="TStamp">
<layout class="QGridLayout" name="gridLayout_11">
<item row="0" column="0">
<widget class="QPlainTextEdit" name="TimeStampTextBox"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="HIRS">
<layout class="QGridLayout" name="gridLayout_8">
<item row="0" column="0">
Expand Down Expand Up @@ -505,14 +504,6 @@
<addaction name="menuFile"/>
<addaction name="menuExit"/>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
<action name="actionLoad">
<property name="text">
Expand Down
Loading

0 comments on commit 77fe993

Please sign in to comment.