Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me with my code in C++: The program must include a history of stored telemetry information A history listing of the current entries

Please help me with my code in C++:

The program must include a history of stored telemetry information

A history listing of the current entries in the array, which includes the current telemetry reading, using the discriminator to send information on the contents for the type of information (whether its SI or EI). I am struggling with that specifically.

I just need some help writing that portion of the code. The rest is fully complete and functional.

This is what I currently have

#include #include #include #include #include #include using namespace std;#define GroundStationOutputChannel cout#define masterInfoSatellite masterInfoDiscriminatedUnionStruct.masterUnion.satelliteInformation#define masterInfoExperiment masterInfoDiscriminatedUnionStruct.masterUnion.experimentInformation#define infoStoredArrayatindexSatellite infoStoredArray[index].masterUnion.satelliteInformation#define infoStoredArrayatindexExperiment infoStoredArray[index].masterUnion.experimentInformationconst string TELEMETRY_INPUT_CHANNEL = "inputTelemetryData.txt";enum class MESSAGE_ID_ENUM_CLASS { SATELLITE_INFORMATION_MESSAGE = 1, EXPERIMENT_INFORMATION_MESSAGE = 2};enum class INFO_TYPE_ENUM_CLASS { SATELLITE_INFORMATION, EXPERIMENT_INFORMATION, EMPTY};const uint8_t ARRAY_DATA_STORAGE_SIZE = 5;struct SatelliteInfoStruct { float temperature; float voltage;};struct ExperimentInfoStruct { uint16_t radiationCount; uint16_t latchupEventsCount;};union MasterUnion { SatelliteInfoStruct satelliteInformation; ExperimentInfoStruct experimentInformation;};struct MasterInfoDiscriminatedUnionStruct { INFO_TYPE_ENUM_CLASS infoTypeEnum; MasterUnion masterUnion;};int main() { MasterInfoDiscriminatedUnionStruct infoStoredArray[ARRAY_DATA_STORAGE_SIZE]; uint8_t entryPositionIndex = 0; ifstream telemetryInputChannel(TELEMETRY_INPUT_CHANNEL); if (!telemetryInputChannel) { GroundStationOutputChannel > messageIdUInt) { GroundStationOutputChannel (messageIdUInt)) { case MESSAGE_ID_ENUM_CLASS::SATELLITE_INFORMATION_MESSAGE: masterInfoDiscriminatedUnionStruct.infoTypeEnum = INFO_TYPE_ENUM_CLASS::SATELLITE_INFORMATION; // Read temperature and voltage telemetryInputChannel >> masterInfoSatellite.temperature >> masterInfoSatellite.voltage; // Output temperature and voltage GroundStationOutputChannel  maxTemperature) { maxTemperature = masterInfoSatellite.temperature; } if (masterInfoSatellite.voltage  maxVoltage) { maxVoltage = masterInfoSatellite.voltage; } /* THIS IS WHERE I NEED HELP, THIS SECTION "HISTORY" */ // Display History GroundStationOutputChannel > masterInfoExperiment.radiationCount >> masterInfoExperiment.latchupEventsCount; // Output radiationCount and latchupEventsCount GroundStationOutputChannel 

Here is the required input file: (1=Satellite, 2=experiment)

1-35.250.4212116137.460.1260101210201-10.928.521526

I need my output to match the following:

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed
The display information sent to the ground station for the above input is: Current Telemetry Information: Temperature : -35.2 Voltage : 50.4 History: Temperature : -35.2 Voltage : 50.4 Summary Information Number of Satellite Information Records: 1 Number of Experiment Information Records: 0 Total Radiation Count : 0 Total Latch Up Event Count : 0 Maximum Temperature -35 .2 Minimum Temperature : -35.2 Maximum Voltage : 50 .4 Minimum Voltage : 50 .4 Press the enter key once or twice to continue... Current Telemetry Information: Radiation Count : 121 Latch up Event Count : 16 History: Temperature : -35.2 Voltage : 50.4 Radiation Count : 121 Latch Up Event Count : 16 Summary Information Number of Satellite Information Records: 1 Number of Experiment Information Records: 1 Total Radiation Count 121 Total Latch Up Event Count : 16 Maximum Temperature -35.2 Minimum Temperature -35.2 Maximum Voltage : 50.4 Minimum Voltage : 50 .4 Press the enter key once or twice to continue. .. Current Telemetry Information: Temperature : 37.4 Voltage : 60.1History: Temperature : -35.2 Voltage : 50.4 Radiation Count : 121 Latch Up Event Count : 16 Temperature : 37.4 Voltage : 60.1 Summary Information Number of Satellite Information Records: 2 Number of Experiment Information Records: 1 Total Radiation Count : 121 Total Latch Up Event Count : 16 Maximum Temperature : 37.4 Minimum Temperature -35.2 Maximum Voltage 60 .1 Minimum Voltage : 50.4 Press the enter key once or twice to continue... Current Telemetry Information: Radiation Count : 60 Latch up Event Count : 101 History: Temperature : -35.2 Voltage : 50.4 Radiation Count : 121 Latch Up Event Count : 16 Temperature : 37.4 Voltage : 60.1 Radiation Count : 60 Latch Up Event Count : 101 Summary Information Number of Satellite Information Records: 2 Number of Experiment Information Records: 2 Total Radiation Count : 181 Total Latch Up Event Count : 117 Maximum Temperature 37.4 Minimum Temperature -35.2 Maximum Voltage : 60.1 Minimum Voltage 50 .4 Press the enter key once or twice to continue...Current Telemetry Information: Radiation Count : 10 Latch up Event Count : 20 History: Temperature : -35.2 Voltage : 50.4 Radiation Count : 121 Latch Up Event Count : 16 Temperature : 37.4 Voltage : 60.1 Radiation Count : 60 Latch Up Event Count : 101 Radiation Count : 10 Latch Up Event Count : 20 Summary Information Number of Satellite Information Records: 2 Number of Experiment Information Records: 3 Total Radiation Count : 191 Total Latch Up Event Count : 137 Maximum Temperature 37 .4 Minimum Temperature -35.2 Maximum Voltage 60 .1 Minimum Voltage : 50 .4 Press the enter key once or twice to continue... Current Telemetry Information: Temperature : -10.9 Voltage : 20.5 History: Temperature : -10.9 Voltage : 20.5 Radiation Count : 121 Latch Up Event Count : 16 Temperature : 37.4 Voltage : 60.1 Radiation Count : 60 Latch Up Event Count : 101 Radiation Count : 10 Latch Up Event Count : 20 Summary InformationNumber of Satellite Information Records: 2 Number of Experiment Information Records: Total Radiation Count : 191 Total Latch Up Event Count : 137 Maximum Temperature 37 . 4 Minimum Temperature -35.2 Maximum Voltage 60 .1 Minimum Voltage Press the enter key once or twice to continue. . Current Telemetry Information: Radiation Count : 15 Latch up Event Count : 26 History: Temperature : -10.9 Voltage : 20.5 Radiation Count 15 Latch Up Event Count : 26 Temperature : 37.4 Voltage : 60.1 Radiation Count 60 Latch Up Event Count : 101 Radiation Count : 10 Latch Up Event Count : 20 Summary Information Number of Satellite Information Records: 2 Number of Experiment Information Records: 3 Total Radiation Count : 85 Total Latch Up Event Count : 147 Maximum Temperature : 37.4 Minimum Temperature -35 .2 Maximum Voltage : 60.1 Minimum Voltage : 20 .5 Press the enter key once or twice to continue. .. Program Done

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions