Question: #include #include #include #include #include using namespace std; #define GroundStationOutputChannel cout #define masterInfoSatellite masterInfoDiscriminatedUnionStruct.masterUnion.satelliteInformation #define masterInfoExperiment masterInfoDiscriminatedUnionStruct.masterUnion.expirimentInformation #define infoStoredArrayatindexSatellite infoStoredArray [ index ] . masterUnion.satelliteInformation
#include #include #include #include #include using namespace std;
#define GroundStationOutputChannel cout
#define masterInfoSatellite masterInfoDiscriminatedUnionStruct.masterUnion.satelliteInformation
#define masterInfoExperiment masterInfoDiscriminatedUnionStruct.masterUnion.expirimentInformation
#define infoStoredArrayatindexSatellite infoStoredArrayindexmasterUnion.satelliteInformation
#define infoStoredArrayatindexExperiment infoStoredArrayindexmasterUnion.expirimentInformation
const string TELEMETRYINPUTCHANNEL "inputTelemetryData.txt;
enum class MESSAGEIDENUMCLASS SATELLITEINFORMATIONMESSAGE EXPERIMENTINFORMATIONMESSAGE ;
MESSAGEIDENUMCLASS messageIdEnum;
enum class INFOTYPEENUMCLASS SATELLITEINFORMATION, EXPIRIMENTINFORMATION, EMPTY ;
const uintt ARRAYDATASTORAGESIZE ;
floatt minTemperature
maxTemperature ;
floatt minVoltage
maxVoltage ;
struct SatelliteInfoStruct floatt temperature; floatt voltage;;
struct ExperimentInfoStruct uintt radiationCount; uintt latchupEventsCount;;
union MasterUnion SatelliteInfoStruct satelliteInformation;
ExperimentInfoStruct expirimentInformation;; Descriminated Union
struct MasterInfoDiscriminatedUnionStruct
INFOTYPEENUMCLASS infoTypeEnum;
MasterUnion masterUnion;;
int main
MasterInfoDiscriminatedUnionStruct infoStoredArrayARRAYDATASTORAGESIZE;
uintt entryPositionIndex ;
MasterInfoDiscriminatedUnionStruct masterInfoDiscriminatedUnionStruct;
ifstream telemetryInputChannelTELEMETRYINPUTCHANNEL;
Check if open failure, pause screen, leave
GroundStationOutputChannel setprecision fixed showpoint;
in infoStoredArray set each element infoType to EMPTY
uintt messageIdUInt;
while telemetryInputChannel messageIdUInt
GroundStationOutputChannel
"Current Telemetry Information: endl
endl;
convert file number messageIdUInt to enumerated messageIdEnum variable
enum are just integer constats
switch messageIdEnum
case MESSAGEIDENUMCLASS::SATELLITEINFORMATIONMESSAGE:
set discriminated union masterInfoDiscriminatedUnionStruct infoType to SATELLITE INFORMATION
read in from telemetryInputChannel into union masterInfoSatellite temperature and voltage
send this information to the Ground Station Output Channel, see output in the assignment
put masterInfoDiscriminatedUnionStruct into stored array at the entry Position Index
adjust entryPositionIndex to next entry or back to start index if past end of array
break; MESSAGEIDENUMCLASS::SATELLITEINFORMATIONMESSAGE:
case MESSAGEIDENUMCLASS::EXPERIMENTINFORMATIONMESSAGE:
set discriminated union masterInfoDiscriminatedUnionStruct infoTypeEnum to EXPIRIMENT INFORMATION
read in from telemetryInputChannel into union masterInfoSatellite radiation Count and latchupEventsCount
send this information to the Ground Station Output Channel, see output in the assignment
put masterInfoDiscriminatedUnionStruct into stored array at the entry Position Index
adjust entryPositionIndex to next entry or back to start index if past end of array
break; MESSAGEID::EXPERIMENTINFORMATIONMESSAGE:
switch infoStoredArrayindexinfoType
send summary information initialization
uintt totalRadiationCount
totalLatchupEventCount
infoSICount
infoEICount ;
send SI Info calculate min max for SI
GroundStationOutputChannel
"History:" endl
endl;
for uintt index ; index ARRAYDATASTORAGESIZE; index
switch infoStoredArrayindexinfoTypeEnum
case INFOTYPEENUMCLASS::SATELLITEINFORMATION:
send to ground station output channel temperature and voltage
see assignment output example
increment info SI Count
set running min max summary information temperature voltage
break; case SATELLITEINFORMATION:
case INFOTYPEENUMCLASS::EXPIRIMENTINFORMATION:
send to ground station output channel radiation and latchup Events Count
the rest of the assignment is on chegg juest need asnwer for this specific code snip plus the rest because of character long issues
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
