105 lines
5.2 KiB
C
105 lines
5.2 KiB
C
#include "ats0002/ats0002.h"
|
|
#include "ats0002/21_50_14.h"
|
|
#include "ats0002/21_52_80.h"
|
|
#include "ats0002/21_53_89.h"
|
|
#include "ats0002/21_53_88.h"
|
|
|
|
static const heat_exchanger_data_t heat_exchanger_data[] = {
|
|
{"Honeywell Heat Exchanger CMM 21-50-14", heat_exchanger_21_50_14_data, ARRAY_SIZE(heat_exchanger_21_50_14_data)},
|
|
{"Honeywell Ram Heat Exchanger CMM 21-52-80", heat_exchanger_21_52_80_data, ARRAY_SIZE(heat_exchanger_21_52_80_data)},
|
|
{"Liebherr Reheater CMM 21-53-89", heat_exchanger_21_53_89_data, ARRAY_SIZE(heat_exchanger_21_53_89_data)},
|
|
{"Liebherr Condenser CMM 21-53-88", heat_exchanger_21_53_88_data, ARRAY_SIZE(heat_exchanger_21_53_88_data)}};
|
|
|
|
int main(void)
|
|
{
|
|
setlocale(LC_NUMERIC, "C");
|
|
for (;;)
|
|
{
|
|
#ifdef _WIN32
|
|
system("cls");
|
|
#else
|
|
system("clear");
|
|
#endif
|
|
printf("************************************************************\n"
|
|
"* *\n"
|
|
"* Heat Exchanger Airflow Pressure Drop Calculation Program *\n"
|
|
"* *\n"
|
|
"* Developed by @rick_professor *\n"
|
|
"* Participation by @cabanleo *\n"
|
|
"* Property of Aerotech LLC *\n"
|
|
"* *\n"
|
|
"************************************************************\n"
|
|
"\n");
|
|
for (uint8_t i = 0; i < ARRAY_SIZE(heat_exchanger_data); ++i)
|
|
{
|
|
printf("%d. %s\n", i + 1, heat_exchanger_data[i].heat_exchanger_description);
|
|
}
|
|
printf("\n");
|
|
uint16_t heat_exchanger_number = 0;
|
|
ASK_CHOICE(heat_exchanger_number, get_heat_exchanger_number, ARRAY_SIZE(heat_exchanger_data));
|
|
printf("\n");
|
|
const heat_exchanger_data_t *he = &heat_exchanger_data[heat_exchanger_number];
|
|
for (uint8_t i = 0; i < he->heat_exchanger_type_data_size; ++i)
|
|
{
|
|
printf("%d. %s\n", i + 1, he->heat_exchanger_type_data[i].part_number_description);
|
|
}
|
|
printf("\n");
|
|
uint16_t part_number = 0;
|
|
ASK_CHOICE(part_number, get_heat_exchanger_part_number, he->heat_exchanger_type_data_size);
|
|
printf("\n");
|
|
const heat_exchanger_type_data_t *hetd = &he->heat_exchanger_type_data[part_number];
|
|
for (uint8_t i = 0; i < hetd->air_passages_data_size; ++i)
|
|
{
|
|
printf("%d. %s\n", i + 1, hetd->air_passages_data[i].air_passage_description);
|
|
}
|
|
printf("\n");
|
|
uint16_t air_passage_number = 0;
|
|
ASK_CHOICE(air_passage_number, get_heat_exchanger_air_passage_number, hetd->air_passages_data_size);
|
|
printf("\n");
|
|
const air_passage_data_t *apd = &hetd->air_passages_data[air_passage_number];
|
|
double airflow = 0.0;
|
|
get_airflow(&airflow, apd);
|
|
EXIT_CHECK(airflow);
|
|
printf("\n");
|
|
double airflow_pressure = 0.0;
|
|
get_airflow_pressure(&airflow_pressure, apd);
|
|
EXIT_CHECK(airflow_pressure);
|
|
printf("\n");
|
|
double barometric_pressure = 0.0;
|
|
double airflow_temperature = 0.0;
|
|
if (apd->recalculated_required == true)
|
|
{
|
|
get_barometric_pressure(&barometric_pressure, apd);
|
|
EXIT_CHECK(barometric_pressure);
|
|
printf("\n");
|
|
get_airflow_temperature(&airflow_temperature, apd);
|
|
EXIT_CHECK(airflow_temperature);
|
|
printf("\n");
|
|
}
|
|
double pressure_drop_limit = 0.0;
|
|
double corrected_airflow_pressure = 0.0;
|
|
get_pressure_drop(&pressure_drop_limit, &airflow, &airflow_pressure, &corrected_airflow_pressure, &barometric_pressure, &airflow_temperature, apd);
|
|
const char *unit = apd->airflow_pressure_unit == KPA ? "KPA" : "PSIG";
|
|
printf("****************** Test summary *******************\n");
|
|
printf("Name: %s\n", he->heat_exchanger_description);
|
|
printf("P/N: %s\n", he->heat_exchanger_type_data[part_number].part_number_description);
|
|
printf("Side: %s\n", hetd->air_passages_data[air_passage_number].air_passage_description);
|
|
printf("Airflow: %0.2f LB/MIN\n", airflow);
|
|
printf("Static inlet pressure: %0.2f %s\n", airflow_pressure, unit);
|
|
if (apd->recalculated_required == true)
|
|
{
|
|
printf("Barometric pressure: %0.2f MBAR\n", barometric_pressure);
|
|
printf("Airflow temperature: %0.2f C\n", airflow_temperature);
|
|
printf("Corrected static inlet pressure: %0.2f %s\n", corrected_airflow_pressure, unit);
|
|
}
|
|
printf("Max allowed pressure drop: %0.2f %s\n", pressure_drop_limit, unit);
|
|
double test_pressure = apd->recalculated_required == true ? corrected_airflow_pressure : airflow_pressure;
|
|
printf("Test result: %s\n", test_pressure <= pressure_drop_limit ? "PASSED" : "FAILED");
|
|
printf("***************************************************\n");
|
|
printf("\n");
|
|
uint16_t command = 0;
|
|
get_user_command(&command);
|
|
EXIT_CHECK(command);
|
|
}
|
|
return 0;
|
|
} |