Advertisement
Guest User

Untitled

a guest
Nov 16th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 38.95 KB | None | 0 0
  1. // MAIN.CPP
  2.  
  3. #include <iostream>
  4. #include <fstream>
  5. #include <istream>
  6. #include <sstream>
  7. #include <string.h>
  8. #include <string>
  9. #include <map>
  10. #include "date.h"
  11. #include "VECTOR.h"
  12. #include "TIME.h"
  13. #include "FileWrite.h"
  14.  
  15. using namespace std;
  16.  
  17. Vector<string> SplitString(string source, string separator) {
  18.  
  19.     Vector<string> outValues;
  20.     int lastPos = 0;
  21.  
  22.     for (;;) {
  23.  
  24.         int pos = source.find(separator, lastPos);
  25.  
  26.         if (pos == string::npos || pos == lastPos) { break; }
  27.  
  28.         string element = source.substr(lastPos, pos - lastPos);
  29.  
  30.         outValues.push_back(element);
  31.  
  32.         lastPos = pos + 1;
  33.     }
  34.  
  35.     if (lastPos < source.length()) {
  36.  
  37.         outValues.push_back(source.substr(lastPos));
  38.     }
  39.  
  40.     return outValues;
  41.  
  42. }
  43.  
  44. //////////////////////////////////////////////////
  45. /// Description: Data of the wind log
  46. //////////////////////////////////////////////////
  47.  
  48. struct wind_log_data {
  49.     Vector<int> day; /*!< vector of Day attribute */
  50.     Vector<int> month; /*!< vector of Month attribute */
  51.     Vector<int> year; /*!< vector of Year */
  52.     Vector<float> w_speed; /*!< vector of Wind Speed attribute */
  53.     Vector<float> a_a_temp; /*!< vector of Ambient Air Temperature attribute */
  54.     Vector<float> s_radi; /*!< vector of Solar Radiation attribute */
  55. };
  56.  
  57. wind_log_data row;
  58. int i_day = 0;
  59. int i_month = 0;
  60. int i_year = 0;
  61. float f_w_speed = 0.0;
  62. float f_a_a_temp = 0.0;
  63. float f_s_radi = 0.0;
  64. string line;
  65.  
  66. int jan_length = 0;
  67. int feb_length = 0;
  68. int mar_length = 0;
  69. int apr_length = 0;
  70. int may_length = 0;
  71. int jun_length = 0;
  72. int jul_length = 0;
  73. int aug_length = 0;
  74. int sep_length = 0;
  75. int oct_length = 0;
  76. int nov_length = 0;
  77. int dec_length = 0;
  78.  
  79. int vect_length;
  80.  
  81. //////////////////////////////////////////////////
  82. /// Description: Data after calculating wind log
  83. //////////////////////////////////////////////////
  84.  
  85. struct calculated_log {
  86.     int month = 0; /*!< month of the total calculated wind log */
  87.     int year = 0; /*!< year of the total calculated wind log */
  88.     float total_w_speed = 0; /*!< total calculated wind speed */
  89.     float total_a_a_temp = 0; /*!< total calculated ambient air temperature */
  90.     float total_s_radi = 0; /*!< total calculated solar radiation */
  91.     float avg_w_speed = 0; /*!< average calculated wind speed */
  92.     float avg_a_a_temp = 0; /*!< average calculated ambient air temperature */
  93. } jan, feb, mar, apr, may, jun, jul, aug, sep, Oct, nov, Dec;
  94.  
  95. struct year_log {
  96.     calculated_log jan, feb, mar, apr, may, jun, jul, aug, sep, Oct, nov, Dec;
  97. } new_Year;
  98.  
  99. map<int, year_log> map_year;
  100.  
  101. calculated_log* logs[12];
  102.  
  103. float calculateAvg(float total, int length) {
  104.  
  105.     if (length == 0) {
  106.  
  107.         return 0;
  108.     }
  109.  
  110.     float avg_Result;
  111.     avg_Result = total / length;
  112.     return avg_Result;
  113. };
  114.  
  115. float calculateKiloWatt(float watt10) {
  116.     float kWh = watt10 / 6000;
  117.     return kWh;
  118. }
  119.  
  120. void totalLog() {
  121.     for (int n = 0; n < vect_length; n++) {
  122.  
  123.         if (row.month.at(n) == 1) {
  124.             if (jan.year == 0) {
  125.                 jan.year = row.year.at(n);
  126.             }
  127.             if (jan.month == 0) {
  128.                 jan.month = row.month.at(n);
  129.             }
  130.             jan.total_a_a_temp = jan.total_a_a_temp + row.a_a_temp.at(n);
  131.             jan.total_s_radi = jan.total_s_radi + row.s_radi.at(n);
  132.             jan.total_w_speed = jan.total_w_speed + row.w_speed.at(n);
  133.             jan_length++;
  134.         }
  135.         else if (row.month.at(n) == 2) {
  136.             if (feb.year == 0) {
  137.                 feb.year = row.year.at(n);
  138.             }
  139.             if (feb.month == 0) {
  140.                 feb.month = row.month.at(n);
  141.             }
  142.             feb.total_a_a_temp = feb.total_a_a_temp + row.a_a_temp.at(n);
  143.             feb.total_s_radi = feb.total_s_radi + row.s_radi.at(n);
  144.             feb.total_w_speed = feb.total_w_speed + row.w_speed.at(n);
  145.             feb_length++;
  146.         }
  147.         else if (row.month.at(n) == 3) {
  148.             if (mar.year == 0) {
  149.                 mar.year = row.year.at(n);
  150.             }
  151.             if (mar.month == 0) {
  152.                 mar.month = row.month.at(n);
  153.             }
  154.             mar.total_a_a_temp = mar.total_a_a_temp + row.a_a_temp.at(n);
  155.             mar.total_s_radi = mar.total_s_radi + row.s_radi.at(n);
  156.             mar.total_w_speed = mar.total_w_speed + row.w_speed.at(n);
  157.             mar_length++;
  158.         }
  159.         else if (row.month.at(n) == 4) {
  160.             if (apr.year == 0) {
  161.                 apr.year = row.year.at(n);
  162.             }
  163.             if (apr.month == 0) {
  164.                 apr.month = row.month.at(n);
  165.             }
  166.             apr.total_a_a_temp = apr.total_a_a_temp + row.a_a_temp.at(n);
  167.             apr.total_s_radi = apr.total_s_radi + row.s_radi.at(n);
  168.             apr.total_w_speed = apr.total_w_speed + row.w_speed.at(n);
  169.             apr_length++;
  170.         }
  171.         else if (row.month.at(n) == 5) {
  172.             if (may.year == 0) {
  173.                 may.year = row.year.at(n);
  174.             }
  175.             if (may.month == 0) {
  176.                 may.month = row.month.at(n);
  177.             }
  178.             may.total_a_a_temp = may.total_a_a_temp + row.a_a_temp.at(n);
  179.             may.total_s_radi = may.total_s_radi + row.s_radi.at(n);
  180.             may.total_w_speed = may.total_w_speed + row.w_speed.at(n);
  181.             may_length++;
  182.         }
  183.         else if (row.month.at(n) == 6) {
  184.             if (jun.year == 0) {
  185.                 jun.year = row.year.at(n);
  186.             }
  187.             if (jun.month == 0) {
  188.                 jun.month = row.month.at(n);
  189.             }
  190.             jun.total_a_a_temp = jun.total_a_a_temp + row.a_a_temp.at(n);
  191.             jun.total_s_radi = jun.total_s_radi + row.s_radi.at(n);
  192.             jun.total_w_speed = jun.total_w_speed + row.w_speed.at(n);
  193.             jun_length++;
  194.         }
  195.         else if (row.month.at(n) == 7) {
  196.             if (jul.year == 0) {
  197.                 jul.year = row.year.at(n);
  198.             }
  199.             if (jul.month == 0) {
  200.                 jul.month = row.month.at(n);
  201.             }
  202.             jul.total_a_a_temp = jul.total_a_a_temp + row.a_a_temp.at(n);
  203.             jul.total_s_radi = jul.total_s_radi + row.s_radi.at(n);
  204.             jul.total_w_speed = jul.total_w_speed + row.w_speed.at(n);
  205.             jul_length++;
  206.         }
  207.         else if (row.month.at(n) == 8) {
  208.             if (aug.year == 0) {
  209.                 aug.year = row.year.at(n);
  210.             }
  211.             if (aug.month == 0) {
  212.                 aug.month = row.month.at(n);
  213.             }
  214.             aug.total_a_a_temp = aug.total_a_a_temp + row.a_a_temp.at(n);
  215.             aug.total_s_radi = aug.total_s_radi + row.s_radi.at(n);
  216.             aug.total_w_speed = aug.total_w_speed + row.w_speed.at(n);
  217.             aug_length++;
  218.         }
  219.         else if (row.month.at(n) == 9) {
  220.             if (sep.year == 0) {
  221.                 sep.year = row.year.at(n);
  222.             }
  223.             if (sep.month == 0) {
  224.                 sep.month = row.month.at(n);
  225.             }
  226.             sep.total_a_a_temp = sep.total_a_a_temp + row.a_a_temp.at(n);
  227.             sep.total_s_radi = sep.total_s_radi + row.s_radi.at(n);
  228.             sep.total_w_speed = sep.total_w_speed + row.w_speed.at(n);
  229.             sep_length++;
  230.         }
  231.         else if (row.month.at(n) == 10) {
  232.             if (Oct.year == 0) {
  233.                 Oct.year = row.year.at(n);
  234.             }
  235.             if (Oct.month == 0) {
  236.                 Oct.month = row.month.at(n);
  237.             }
  238.             Oct.total_a_a_temp = Oct.total_a_a_temp + row.a_a_temp.at(n);
  239.             Oct.total_s_radi = Oct.total_s_radi + row.s_radi.at(n);
  240.             Oct.total_w_speed = Oct.total_w_speed + row.w_speed.at(n);
  241.             oct_length++;
  242.         }
  243.         else if (row.month.at(n) == 11) {
  244.             if (nov.year == 0) {
  245.                 nov.year = row.year.at(n);
  246.             }
  247.             if (nov.month == 0) {
  248.                 nov.month = row.month.at(n);
  249.             }
  250.             nov.total_a_a_temp = nov.total_a_a_temp + row.a_a_temp.at(n);
  251.             nov.total_s_radi = nov.total_s_radi + row.s_radi.at(n);
  252.             nov.total_w_speed = nov.total_w_speed + row.w_speed.at(n);
  253.             nov_length++;
  254.         }
  255.         else if (row.month.at(n) == 12) {
  256.             if (Dec.year == 0) {
  257.                 Dec.year = row.year.at(n);
  258.             }
  259.             if (Dec.month == 0) {
  260.                 Dec.month = row.month.at(n);
  261.             }
  262.             Dec.total_a_a_temp = Dec.total_a_a_temp + row.a_a_temp.at(n);
  263.             Dec.total_s_radi = Dec.total_s_radi + row.s_radi.at(n);
  264.             Dec.total_w_speed = Dec.total_w_speed + row.w_speed.at(n);
  265.             dec_length++;
  266.         }
  267.     }
  268. }
  269.  
  270. void readTheFile(ifstream& windfile, string line) {
  271.     while (getline(windfile, line))
  272.     {
  273.         if (line == "WAST,DP,Dta,Dts,EV,EV10,RF,RF10,RH,S,SR,Sx,T" ||
  274.             line == "WAST,DP,Dta,Dts,EV,EV10,RF,RF10,RH,S,SR,Sx,T\r") {
  275.             continue;
  276.         }
  277.  
  278.         if (line == "") { break; }
  279.  
  280.         Vector<string> pieces = SplitString(line, ",");
  281.  
  282.         Vector<string> DateTime = SplitString(pieces.at(0), " ");
  283.  
  284.         Vector<string> Date = SplitString(DateTime.at(0), "/");
  285.  
  286.         Vector<string> Time = SplitString(DateTime.at(1), ":");
  287.  
  288.         istringstream day(Date.at(0));
  289.  
  290.         day >> i_day;
  291.  
  292.         row.day.push_back(i_day);
  293.  
  294.         istringstream month(Date.at(1));
  295.  
  296.         month >> i_month;
  297.  
  298.         row.month.push_back(i_month);
  299.  
  300.         istringstream year(Date.at(2));
  301.  
  302.         year >> i_year;
  303.  
  304.         row.year.push_back(i_year);
  305.  
  306.         istringstream wSpeed(pieces.at(9));
  307.  
  308.         wSpeed >> f_w_speed;
  309.  
  310.         row.w_speed.push_back(f_w_speed);
  311.  
  312.         istringstream aaTemp(pieces.at(12));
  313.  
  314.         aaTemp >> f_a_a_temp;
  315.  
  316.         row.a_a_temp.push_back(f_a_a_temp);
  317.  
  318.         istringstream sRadi(pieces.at(10));
  319.  
  320.         sRadi >> f_s_radi;
  321.  
  322.         row.s_radi.push_back(f_a_a_temp);
  323.     }
  324. }
  325.  
  326. void totalAvg(struct calculated_log) {
  327.     if (calculated_log().month == 1) {
  328.         jan.avg_w_speed = calculateAvg(jan.total_w_speed, jan_length);
  329.     }
  330.     else if (calculated_log().month == 2) {
  331.         feb.avg_w_speed = calculateAvg(feb.total_w_speed, feb_length);
  332.     }
  333.     else if (calculated_log().month == 3) {
  334.         mar.avg_w_speed = calculateAvg(mar.total_w_speed, mar_length);
  335.     }
  336.     else if (calculated_log().month == 4) {
  337.         apr.avg_w_speed = calculateAvg(apr.total_w_speed, apr_length);
  338.     }
  339.     else if (calculated_log().month == 5) {
  340.         may.avg_w_speed = calculateAvg(may.total_w_speed, may_length);
  341.     }
  342.     else if (calculated_log().month == 6) {
  343.         jun.avg_w_speed = calculateAvg(jun.total_w_speed, jun_length);
  344.     }
  345.     else if (calculated_log().month == 7) {
  346.         jul.avg_w_speed = calculateAvg(jul.total_w_speed, jul_length);
  347.     }
  348.     else if (calculated_log().month == 8) {
  349.         aug.avg_w_speed = calculateAvg(aug.total_w_speed, aug_length);
  350.     }
  351.     else if (calculated_log().month == 9) {
  352.         sep.avg_w_speed = calculateAvg(sep.total_w_speed, sep_length);
  353.     }
  354.     else if (calculated_log().month == 10) {
  355.         Oct.avg_w_speed = calculateAvg(Oct.total_w_speed, oct_length);
  356.     }
  357.     else if (calculated_log().month == 11) {
  358.         nov.avg_w_speed = calculateAvg(nov.total_w_speed, nov_length);
  359.     }
  360.     else if (calculated_log().month == 12) {
  361.         Dec.avg_w_speed = calculateAvg(Dec.total_w_speed, dec_length);
  362.     }
  363.  
  364.     if (calculated_log().month == 1) {
  365.         jan.avg_a_a_temp = calculateAvg(jan.total_a_a_temp, jan_length);
  366.     }
  367.     else if (calculated_log().month == 2) {
  368.         feb.avg_a_a_temp = calculateAvg(feb.total_a_a_temp, feb_length);
  369.     }
  370.     else if (calculated_log().month == 3) {
  371.         mar.avg_a_a_temp = calculateAvg(mar.total_a_a_temp, mar_length);
  372.     }
  373.     else if (calculated_log().month == 4) {
  374.         apr.avg_a_a_temp = calculateAvg(apr.total_a_a_temp, apr_length);
  375.     }
  376.     else if (calculated_log().month == 5) {
  377.         may.avg_a_a_temp = calculateAvg(may.total_a_a_temp, may_length);
  378.     }
  379.     else if (calculated_log().month == 6) {
  380.         jun.avg_a_a_temp = calculateAvg(jun.total_a_a_temp, jun_length);
  381.     }
  382.     else if (calculated_log().month == 7) {
  383.         jul.avg_a_a_temp = calculateAvg(jul.total_a_a_temp, jul_length);
  384.     }
  385.     else if (calculated_log().month == 8) {
  386.         aug.avg_a_a_temp = calculateAvg(aug.total_a_a_temp, aug_length);
  387.     }
  388.     else if (calculated_log().month == 9) {
  389.         sep.avg_a_a_temp = calculateAvg(sep.total_a_a_temp, sep_length);
  390.     }
  391.     else if (calculated_log().month == 10) {
  392.         Oct.avg_a_a_temp = calculateAvg(Oct.total_a_a_temp, oct_length);
  393.     }
  394.     else if (calculated_log().month == 11) {
  395.         nov.avg_a_a_temp = calculateAvg(nov.total_a_a_temp, nov_length);
  396.     }
  397.     else if (calculated_log().month == 12) {
  398.         Dec.avg_a_a_temp = calculateAvg(Dec.total_a_a_temp, dec_length);
  399.     }
  400. }
  401.  
  402. void setMonthNull() {
  403.     if (jan_length == 0) {
  404.  
  405.         jan.month = 1;
  406.     }
  407.     else if (feb_length == 0) {
  408.  
  409.         feb.month = 2;
  410.     }
  411.     else if (mar_length == 0) {
  412.  
  413.         mar.month = 3;
  414.     }
  415.     else if (apr_length == 0) {
  416.  
  417.         apr.month = 4;
  418.     }
  419.     else if (may_length == 0) {
  420.  
  421.         may.month = 5;
  422.     }
  423.     else if (jun_length == 0) {
  424.  
  425.         jun.month = 6;
  426.     }
  427.     else if (jul_length == 0) {
  428.  
  429.         jul.month = 7;
  430.     }
  431.     else if (aug_length == 0) {
  432.  
  433.         aug.month = 8;
  434.     }
  435.     else if (sep_length == 0) {
  436.  
  437.         sep.month = 9;
  438.     }
  439.     else if (oct_length == 0) {
  440.  
  441.         Oct.month = 10;
  442.     }
  443.     else if (nov_length == 0) {
  444.  
  445.         nov.month = 11;
  446.     }
  447.     else if (dec_length == 0) {
  448.  
  449.         Dec.month = 12;
  450.     }
  451. }
  452.  
  453. void clearData() {
  454.     jan.month = 0;
  455.     jan.year = 0;
  456.     jan.total_w_speed = 0;
  457.     jan.total_a_a_temp = 0;
  458.     jan.total_s_radi = 0;
  459.     jan.avg_w_speed = 0;
  460.     jan.avg_a_a_temp = 0;
  461.  
  462.     feb.month = 0;
  463.     feb.year = 0;
  464.     feb.total_w_speed = 0;
  465.     feb.total_a_a_temp = 0;
  466.     feb.total_s_radi = 0;
  467.     feb.avg_w_speed = 0;
  468.     feb.avg_a_a_temp = 0;
  469.  
  470.     mar.month = 0;
  471.     mar.year = 0;
  472.     mar.total_w_speed = 0;
  473.     mar.total_a_a_temp = 0;
  474.     mar.total_s_radi = 0;
  475.     mar.avg_w_speed = 0;
  476.     mar.avg_a_a_temp = 0;
  477.  
  478.     apr.month = 0;
  479.     apr.year = 0;
  480.     apr.total_w_speed = 0;
  481.     apr.total_a_a_temp = 0;
  482.     apr.total_s_radi = 0;
  483.     apr.avg_w_speed = 0;
  484.     apr.avg_a_a_temp = 0;
  485.  
  486.     may.month = 0;
  487.     may.year = 0;
  488.     may.total_w_speed = 0;
  489.     may.total_a_a_temp = 0;
  490.     may.total_s_radi = 0;
  491.     may.avg_w_speed = 0;
  492.     may.avg_a_a_temp = 0;
  493.  
  494.     jun.month = 0;
  495.     jun.year = 0;
  496.     jun.total_w_speed = 0;
  497.     jun.total_a_a_temp = 0;
  498.     jun.total_s_radi = 0;
  499.     jun.avg_w_speed = 0;
  500.     jun.avg_a_a_temp = 0;
  501.  
  502.     jul.month = 0;
  503.     jul.year = 0;
  504.     jul.total_w_speed = 0;
  505.     jul.total_a_a_temp = 0;
  506.     jul.total_s_radi = 0;
  507.     jul.avg_w_speed = 0;
  508.     jul.avg_a_a_temp = 0;
  509.  
  510.     aug.month = 0;
  511.     aug.year = 0;
  512.     aug.total_w_speed = 0;
  513.     aug.total_a_a_temp = 0;
  514.     aug.total_s_radi = 0;
  515.     aug.avg_w_speed = 0;
  516.     aug.avg_a_a_temp = 0;
  517.  
  518.     sep.month = 0;
  519.     sep.year = 0;
  520.     sep.total_w_speed = 0;
  521.     sep.total_a_a_temp = 0;
  522.     sep.total_s_radi = 0;
  523.     sep.avg_w_speed = 0;
  524.     sep.avg_a_a_temp = 0;
  525.  
  526.     Oct.month = 0;
  527.     Oct.year = 0;
  528.     Oct.total_w_speed = 0;
  529.     Oct.total_a_a_temp = 0;
  530.     Oct.total_s_radi = 0;
  531.     Oct.avg_w_speed = 0;
  532.     Oct.avg_a_a_temp = 0;
  533.  
  534.     nov.month = 0;
  535.     nov.year = 0;
  536.     nov.total_w_speed = 0;
  537.     nov.total_a_a_temp = 0;
  538.     nov.total_s_radi = 0;
  539.     nov.avg_w_speed = 0;
  540.     nov.avg_a_a_temp = 0;
  541.  
  542.     Dec.month = 0;
  543.     Dec.year = 0;
  544.     Dec.total_w_speed = 0;
  545.     Dec.total_a_a_temp = 0;
  546.     Dec.total_s_radi = 0;
  547.     Dec.avg_w_speed = 0;
  548.     Dec.avg_a_a_temp = 0;
  549. }
  550.  
  551.  
  552. int main()
  553. {
  554.     string fileName;
  555.     int m_choice = 0;
  556.     Time time;
  557.     Date date;
  558.  
  559.     Vector<wind_log_data> windlog;
  560.  
  561.     ifstream fileDir;
  562.     ifstream windfile;
  563.  
  564.     fileDir.open("met_index.txt", ios::in);
  565.     if (!fileDir) return -1;
  566.  
  567.     while (getline(fileDir, fileName)) {
  568.         windfile.open(fileName, ios::in);
  569.         if (!windfile) return -1;
  570.         readTheFile(windfile, line);
  571.         vect_length = row.month.size();
  572.         totalLog();
  573.         logs[0] = &jan;
  574.         logs[1] = &feb;
  575.         logs[2] = &mar;
  576.         logs[3] = &apr;
  577.         logs[4] = &may;
  578.         logs[5] = &jun;
  579.         logs[6] = &jul;
  580.         logs[7] = &aug;
  581.         logs[8] = &sep;
  582.         logs[9] = &Oct;
  583.         logs[10] = &nov;
  584.         logs[11] = &Dec;
  585.         for (int i = 0; i < 12; i++) {
  586.             totalAvg(*logs[i]);
  587.         }
  588.         setMonthNull();
  589.         new_Year.jan = *logs[0];
  590.         new_Year.feb = *logs[1];
  591.         new_Year.mar = *logs[2];
  592.         new_Year.apr = *logs[3];
  593.         new_Year.may = *logs[4];
  594.         new_Year.jun = *logs[5];
  595.         new_Year.jul = *logs[6];
  596.         new_Year.aug = *logs[7];
  597.         new_Year.sep = *logs[8];
  598.         new_Year.Oct = *logs[9];
  599.         new_Year.nov = *logs[10];
  600.         new_Year.Dec = *logs[11];
  601.         map_year.insert(pair<int, year_log>(jan.year, new_Year));
  602.         clearData();
  603.         windfile.close();
  604.     }
  605.  
  606.     std::cout << "1. The average wind speed and average ambient air temperature for a specified month and year. (print on screen only)" << '\n';
  607.     std::cout << "2. Average wind speed and average ambient air temperature for each month of a specified year. (print on screen only)" << '\n';
  608.     std::cout << "3. Total solar radiation in kWh/m2 for each month of a specified year. (print on screen only)" << '\n';
  609.     std::cout << "4. Average wind speed (km/h), average ambient air tempature and total solar radiation in kWh/m2 for each month of a specified year. (print to a file called \"WindTempSolar.csv\")" << '\n';
  610.     std::cout << "5. Exit the program." << '\n';
  611.  
  612.     std::cout << "Choose a menu: ";
  613.  
  614.     while (m_choice != 5) {
  615.         cin >> m_choice;
  616.         if (m_choice == 1) {
  617.             std::cout << '\n';
  618.             std::cout << "Choose a month (input the number of the month): ";
  619.             cin >> i_month;
  620.             std::cout << '\n';
  621.             std::cout << "Choose a year: ";
  622.             cin >> i_year;
  623.             std::cout << '\n';
  624.             std::cout << '\n';
  625.  
  626.             if (map_year.find(i_year) != map_year.end()) {
  627.                 if (i_month == 1) {
  628.                     if (i_year != map_year.at(i_year).jan.year) {
  629.                         cout << date.SetStringDate(map_year.at(i_year).jan.month) << " " << i_year << ": " << "No Data" << '\n';
  630.                     }
  631.                     else {
  632.                         cout << date.SetStringDate(map_year.at(i_year).jan.month) << " " << i_year << ": ";
  633.                         if (map_year.at(i_year).jan.avg_w_speed == 0) {
  634.                             cout << "No Data" << '\n';
  635.                         }
  636.                         else {
  637.                             cout << map_year.at(i_year).jan.avg_w_speed << " km/h, " << map_year.at(i_year).jan.avg_a_a_temp << " degrees C" << '\n';
  638.                         }
  639.                     }
  640.                 }
  641.                 else if (i_month == 2) {
  642.                     if (i_year != map_year.at(i_year).feb.year) {
  643.                         cout << date.SetStringDate(map_year.at(i_year).feb.month) << " " << i_year << ": " << "No Data" << '\n';
  644.                     }
  645.                     else {
  646.                         cout << date.SetStringDate(map_year.at(i_year).feb.month) << " " << i_year << ": ";
  647.                         if (map_year.at(i_year).feb.avg_w_speed == 0) {
  648.                             cout << "No Data" << '\n';
  649.                         }
  650.                         else {
  651.                             cout << map_year.at(i_year).feb.avg_w_speed << " km/h, " << map_year.at(i_year).feb.avg_a_a_temp << " degrees C" << '\n';
  652.                         }
  653.                     }
  654.                 }
  655.                 else if (i_month == 3) {
  656.                     if (i_year != map_year.at(i_year).mar.year) {
  657.                         cout << date.SetStringDate(map_year.at(i_year).mar.month) << " " << i_year << ": " << "No Data" << '\n';
  658.                     }
  659.                     else {
  660.                         cout << date.SetStringDate(map_year.at(i_year).mar.month) << " " << i_year << ": ";
  661.                         if (map_year.at(i_year).mar.avg_w_speed == 0) {
  662.                             cout << "No Data" << '\n';
  663.                         }
  664.                         else {
  665.                             cout << map_year.at(i_year).mar.avg_w_speed << " km/h, " << map_year.at(i_year).mar.avg_a_a_temp << " degrees C" << '\n';
  666.                         }
  667.                     }
  668.                 }
  669.                 else if (i_month == 4) {
  670.                     if (i_year != map_year.at(i_year).apr.year) {
  671.                         cout << date.SetStringDate(map_year.at(i_year).apr.month) << " " << i_year << ": " << "No Data" << '\n';
  672.                     }
  673.                     else {
  674.                         cout << date.SetStringDate(map_year.at(i_year).apr.month) << " " << i_year << ": ";
  675.                         if (map_year.at(i_year).apr.avg_w_speed == 0) {
  676.                             cout << "No Data" << '\n';
  677.                         }
  678.                         else {
  679.                             cout << map_year.at(i_year).apr.avg_w_speed << " km/h, " << map_year.at(i_year).apr.avg_a_a_temp << " degrees C" << '\n';
  680.                         }
  681.                     }
  682.                 }
  683.                 else if (i_month == 5) {
  684.                     if (i_year != map_year.at(i_year).may.year) {
  685.                         cout << date.SetStringDate(map_year.at(i_year).may.month) << " " << i_year << ": " << "No Data" << '\n';
  686.                     }
  687.                     else {
  688.                         cout << date.SetStringDate(map_year.at(i_year).may.month) << " " << i_year << ": ";
  689.                         if (map_year.at(i_year).may.avg_w_speed == 0) {
  690.                             cout << "No Data" << '\n';
  691.                         }
  692.                         else {
  693.                             cout << map_year.at(i_year).may.avg_w_speed << " km/h, " << map_year.at(i_year).may.avg_a_a_temp << " degrees C" << '\n';
  694.                         }
  695.                     }
  696.                 }
  697.                 else if (i_month == 6) {
  698.                     if (i_year != map_year.at(i_year).jun.year) {
  699.                         cout << date.SetStringDate(map_year.at(i_year).jun.month) << " " << i_year << ": " << "No Data" << '\n';
  700.                     }
  701.                     else {
  702.                         cout << date.SetStringDate(map_year.at(i_year).jun.month) << " " << i_year << ": ";
  703.                         if (map_year.at(i_year).jun.avg_w_speed == 0) {
  704.                             cout << "No Data" << '\n';
  705.                         }
  706.                         else {
  707.                             cout << map_year.at(i_year).jun.avg_w_speed << " km/h, " << map_year.at(i_year).jun.avg_a_a_temp << " degrees C" << '\n';
  708.                         }
  709.                     }
  710.                 }
  711.                 else if (i_month == 7) {
  712.                     if (i_year != map_year.at(i_year).jul.year) {
  713.                         cout << date.SetStringDate(map_year.at(i_year).jul.month) << " " << i_year << ": " << "No Data" << '\n';
  714.                     }
  715.                     else {
  716.                         cout << date.SetStringDate(map_year.at(i_year).jul.month) << " " << i_year << ": ";
  717.                         if (map_year.at(i_year).jul.avg_w_speed == 0) {
  718.                             cout << "No Data" << '\n';
  719.                         }
  720.                         else {
  721.                             cout << map_year.at(i_year).jul.avg_w_speed << " km/h, " << map_year.at(i_year).jul.avg_a_a_temp << " degrees C" << '\n';
  722.                         }
  723.                     }
  724.                 }
  725.                 else if (i_month == 8) {
  726.                     if (i_year != map_year.at(i_year).aug.year) {
  727.                         cout << date.SetStringDate(map_year.at(i_year).aug.month) << " " << i_year << ": " << "No Data" << '\n';
  728.                     }
  729.                     else {
  730.                         cout << date.SetStringDate(map_year.at(i_year).aug.month) << " " << i_year << ": ";
  731.                         if (map_year.at(i_year).aug.avg_w_speed == 0) {
  732.                             cout << "No Data" << '\n';
  733.                         }
  734.                         else {
  735.                             cout << map_year.at(i_year).aug.avg_w_speed << " km/h, " << map_year.at(i_year).aug.avg_a_a_temp << " degrees C" << '\n';
  736.                         }
  737.                     }
  738.                 }
  739.                 else if (i_month == 9) {
  740.                     if (i_year != map_year.at(i_year).sep.year) {
  741.                         cout << date.SetStringDate(map_year.at(i_year).sep.month) << " " << i_year << ": " << "No Data" << '\n';
  742.                     }
  743.                     else {
  744.                         cout << date.SetStringDate(map_year.at(i_year).sep.month) << " " << i_year << ": ";
  745.                         if (map_year.at(i_year).sep.avg_w_speed == 0) {
  746.                             cout << "No Data" << '\n';
  747.                         }
  748.                         else {
  749.                             cout << map_year.at(i_year).sep.avg_w_speed << " km/h, " << map_year.at(i_year).sep.avg_a_a_temp << " degrees C" << '\n';
  750.                         }
  751.                     }
  752.                 }
  753.                 else if (i_month == 10) {
  754.                     if (i_year != map_year.at(i_year).Oct.year) {
  755.                         cout << date.SetStringDate(map_year.at(i_year).Oct.month) << " " << i_year << ": " << "No Data" << '\n';
  756.                     }
  757.                     else {
  758.                         cout << date.SetStringDate(map_year.at(i_year).Oct.month) << " " << i_year << ": ";
  759.                         if (map_year.at(i_year).Oct.avg_w_speed == 0) {
  760.                             cout << "No Data" << '\n';
  761.                         }
  762.                         else {
  763.                             cout << map_year.at(i_year).Oct.avg_w_speed << " km/h, " << map_year.at(i_year).Oct.avg_a_a_temp << " degrees C" << '\n';
  764.                         }
  765.                     }
  766.                 }
  767.                 else if (i_month == 11) {
  768.                     if (i_year != map_year.at(i_year).nov.year) {
  769.                         cout << date.SetStringDate(map_year.at(i_year).nov.month) << " " << i_year << ": " << "No Data" << '\n';
  770.                     }
  771.                     else {
  772.                         cout << date.SetStringDate(map_year.at(i_year).nov.month) << " " << i_year << ": ";
  773.                         if (map_year.at(i_year).nov.avg_w_speed == 0) {
  774.                             cout << "No Data" << '\n';
  775.                         }
  776.                         else {
  777.                             cout << map_year.at(i_year).nov.avg_w_speed << " km/h, " << map_year.at(i_year).nov.avg_a_a_temp << " degrees C" << '\n';
  778.                         }
  779.                     }
  780.                 }
  781.                 else if (i_month == 12) {
  782.                     if (i_year != map_year.at(i_year).Dec.year) {
  783.                         cout << date.SetStringDate(map_year.at(i_year).Dec.month) << " " << i_year << ": " << "No Data" << '\n';
  784.                     }
  785.                     else {
  786.                         cout << date.SetStringDate(map_year.at(i_year).Dec.month) << " " << i_year << ": ";
  787.                         if (map_year.at(i_year).Dec.avg_w_speed == 0) {
  788.                             cout << "No Data" << '\n';
  789.                         }
  790.                         else {
  791.                             cout << map_year.at(i_year).Dec.avg_w_speed << " km/h, " << map_year.at(i_year).Dec.avg_a_a_temp << " degrees C" << '\n';
  792.                         }
  793.                     }
  794.                 }
  795.             }
  796.             else {
  797.                 cout << "No data found for this year given.";
  798.                 cout << '\n';
  799.             }
  800.  
  801.         }
  802.         else if (m_choice == 2) {
  803.             std::cout << "Choose a year: ";
  804.             cin >> i_year;
  805.             std::cout << '\n';
  806.             std::cout << '\n';
  807.             cout << i_year << '\n';
  808.  
  809.             if (map_year.find(i_year) != map_year.end()) {
  810.                 cout << "January: ";
  811.                 if (i_year == map_year.at(i_year).jan.year) {
  812.                     if (map_year.at(i_year).jan.avg_w_speed == 0) {
  813.                         cout << "No Data" << '\n';
  814.                     }
  815.                     else {
  816.                         cout << map_year.at(i_year).jan.avg_w_speed << " km/h, " << map_year.at(i_year).jan.avg_a_a_temp << " degrees C" << '\n';
  817.                     }
  818.                 }
  819.                 else {
  820.                     cout << "No Data" << '\n';
  821.                 }
  822.  
  823.                 cout << "Feburary: ";
  824.                 if (i_year == map_year.at(i_year).feb.year) {
  825.                     if (map_year.at(i_year).feb.avg_w_speed == 0) {
  826.                         cout << "No Data" << '\n';
  827.                     }
  828.                     else {
  829.                         cout << map_year.at(i_year).feb.avg_w_speed << " km/h, " << map_year.at(i_year).feb.avg_a_a_temp << " degrees C" << '\n';
  830.                     }
  831.                 }
  832.                 else {
  833.                     cout << "No Data" << '\n';
  834.                 }
  835.  
  836.                 cout << "March: ";
  837.                 if (i_year == map_year.at(i_year).mar.year) {
  838.                     if (map_year.at(i_year).mar.avg_w_speed == 0) {
  839.                         cout << "No Data" << '\n';
  840.                     }
  841.                     else {
  842.                         cout << map_year.at(i_year).mar.avg_w_speed << " km/h, " << map_year.at(i_year).mar.avg_a_a_temp << " degrees C" << '\n';
  843.                     }
  844.                 }
  845.                 else {
  846.                     cout << "No Data" << '\n';
  847.                 }
  848.  
  849.                 cout << "April: ";
  850.                 if (i_year == map_year.at(i_year).apr.year) {
  851.                     if (map_year.at(i_year).apr.avg_w_speed == 0) {
  852.                         cout << "No Data" << '\n';
  853.                     }
  854.                     else {
  855.                         cout << map_year.at(i_year).apr.avg_w_speed << " km/h, " << map_year.at(i_year).apr.avg_a_a_temp << " degrees C" << '\n';
  856.                     }
  857.                 }
  858.                 else {
  859.                     cout << "No Data" << '\n';
  860.                 }
  861.  
  862.                 cout << "May: ";
  863.                 if (i_year == map_year.at(i_year).may.year) {
  864.                     if (map_year.at(i_year).may.avg_w_speed == 0) {
  865.                         cout << "No Data" << '\n';
  866.                     }
  867.                     else {
  868.                         cout << map_year.at(i_year).may.avg_w_speed << " km/h, " << map_year.at(i_year).may.avg_a_a_temp << " degrees C" << '\n';
  869.                     }
  870.                 }
  871.                 else {
  872.                     cout << "No Data" << '\n';
  873.                 }
  874.  
  875.                 cout << "June: ";
  876.                 if (i_year == map_year.at(i_year).jun.year) {
  877.                     if (map_year.at(i_year).jun.avg_w_speed == 0) {
  878.                         cout << "No Data" << '\n';
  879.                     }
  880.                     else {
  881.                         cout << map_year.at(i_year).jun.avg_w_speed << " km/h, " << map_year.at(i_year).jun.avg_a_a_temp << " degrees C" << '\n';
  882.                     }
  883.                 }
  884.                 else {
  885.                     cout << "No Data" << '\n';
  886.                 }
  887.  
  888.                 cout << "July: ";
  889.                 if (i_year == map_year.at(i_year).jul.year) {
  890.                     if (map_year.at(i_year).jul.avg_w_speed == 0) {
  891.                         cout << "No Data" << '\n';
  892.                     }
  893.                     else {
  894.                         cout << map_year.at(i_year).jul.avg_w_speed << " km/h, " << map_year.at(i_year).jul.avg_a_a_temp << " degrees C" << '\n';
  895.                     }
  896.                 }
  897.                 else {
  898.                     cout << "No Data" << '\n';
  899.                 }
  900.  
  901.                 cout << "August: ";
  902.                 if (i_year == map_year.at(i_year).aug.year) {
  903.                     if (map_year.at(i_year).aug.avg_w_speed == 0) {
  904.                         cout << "No Data" << '\n';
  905.                     }
  906.                     else {
  907.                         cout << map_year.at(i_year).aug.avg_w_speed << " km/h, " << map_year.at(i_year).aug.avg_a_a_temp << " degrees C" << '\n';
  908.                     }
  909.                 }
  910.                 else {
  911.                     cout << "No Data" << '\n';
  912.                 }
  913.  
  914.                 cout << "Sept: ";
  915.                 if (i_year == map_year.at(i_year).sep.year) {
  916.                     if (map_year.at(i_year).sep.avg_w_speed == 0) {
  917.                         cout << "No Data" << '\n';
  918.                     }
  919.                     else {
  920.                         cout << map_year.at(i_year).sep.avg_w_speed << " km/h, " << map_year.at(i_year).sep.avg_a_a_temp << " degrees C" << '\n';
  921.                     }
  922.                 }
  923.                 else {
  924.                     cout << "No Data" << '\n';
  925.                 }
  926.  
  927.                 cout << "October: ";
  928.                 if (i_year == map_year.at(i_year).Oct.year) {
  929.                     if (map_year.at(i_year).Oct.avg_w_speed == 0) {
  930.                         cout << "No Data" << '\n';
  931.                     }
  932.                     else {
  933.                         cout << map_year.at(i_year).Oct.avg_w_speed << " km/h, " << map_year.at(i_year).Oct.avg_a_a_temp << " degrees C" << '\n';
  934.                     }
  935.                 }
  936.                 else {
  937.                     cout << "No Data" << '\n';
  938.                 }
  939.  
  940.                 cout << "November: ";
  941.                 if (i_year == map_year.at(i_year).nov.year) {
  942.                     if (map_year.at(i_year).nov.avg_w_speed == 0) {
  943.                         cout << "No Data" << '\n';
  944.                     }
  945.                     else {
  946.                         cout << map_year.at(i_year).nov.avg_w_speed << " km/h, " << map_year.at(i_year).nov.avg_a_a_temp << " degrees C" << '\n';
  947.                     }
  948.                 }
  949.                 else {
  950.                     cout << "No Data" << '\n';
  951.                 }
  952.  
  953.                 cout << "December: ";
  954.                 if (i_year == map_year.at(i_year).Dec.year) {
  955.                     if (map_year.at(i_year).Dec.avg_w_speed == 0) {
  956.                         cout << "No Data" << '\n';
  957.                     }
  958.                     else {
  959.                         cout << map_year.at(i_year).Dec.avg_w_speed << " km/h, " << map_year.at(i_year).Dec.avg_a_a_temp << " degrees C" << '\n';
  960.                     }
  961.                 }
  962.                 else {
  963.                     cout << "No Data" << '\n';
  964.                 }
  965.             }
  966.  
  967.             else {
  968.                 cout << "No data for the selected year.";
  969.             }
  970.  
  971.         }
  972.         else if (m_choice == 3) {
  973.             std::cout << "Choose a year: ";
  974.             cin >> i_year;
  975.             std::cout << '\n';
  976.             std::cout << '\n';
  977.             cout << i_year << '\n';
  978.  
  979.             if (map_year.find(i_year) != map_year.end()) {
  980.                 cout << "January: ";
  981.                 if (i_year == map_year.at(i_year).jan.year) {
  982.                     if (map_year.at(i_year).jan.total_s_radi == 0) {
  983.                         cout << "No Data" << '\n';
  984.                     }
  985.                     else {
  986.                         cout << calculateKiloWatt(map_year.at(i_year).jan.total_s_radi) << " kW/h2" << '\n';
  987.                     }
  988.                 }
  989.                 else {
  990.                     cout << "No Data" << '\n';
  991.                 }
  992.  
  993.                 cout << "Feburary: ";
  994.                 if (i_year == map_year.at(i_year).feb.year) {
  995.                     if (map_year.at(i_year).feb.total_s_radi == 0) {
  996.                         cout << "No Data" << '\n';
  997.                     }
  998.                     else {
  999.                         cout << calculateKiloWatt(map_year.at(i_year).feb.total_s_radi) << " kW/h2" << '\n';
  1000.                     }
  1001.                 }
  1002.                 else {
  1003.                     cout << "No Data" << '\n';
  1004.                 }
  1005.  
  1006.                 cout << "March: ";
  1007.                 if (i_year == map_year.at(i_year).mar.year) {
  1008.                     if (map_year.at(i_year).mar.total_s_radi == 0) {
  1009.                         cout << "No Data" << '\n';
  1010.                     }
  1011.                     else {
  1012.                         cout << calculateKiloWatt(map_year.at(i_year).mar.total_s_radi) << " kW/h2" << '\n';
  1013.                     }
  1014.                 }
  1015.                 else {
  1016.                     cout << "No Data" << '\n';
  1017.                 }
  1018.  
  1019.                 cout << "April: ";
  1020.                 if (i_year == map_year.at(i_year).apr.year) {
  1021.                     if (map_year.at(i_year).apr.total_s_radi == 0) {
  1022.                         cout << "No Data" << '\n';
  1023.                     }
  1024.                     else {
  1025.                         cout << calculateKiloWatt(map_year.at(i_year).apr.total_s_radi) << " kW/h2" << '\n';
  1026.                     }
  1027.                 }
  1028.                 else {
  1029.                     cout << "No Data" << '\n';
  1030.                 }
  1031.  
  1032.                 cout << "May: ";
  1033.                 if (i_year == map_year.at(i_year).may.year) {
  1034.                     if (map_year.at(i_year).may.total_s_radi == 0) {
  1035.                         cout << "No Data" << '\n';
  1036.                     }
  1037.                     else {
  1038.                         cout << calculateKiloWatt(map_year.at(i_year).may.total_s_radi) << " kW/h2" << '\n';
  1039.                     }
  1040.                 }
  1041.                 else {
  1042.                     cout << "No Data" << '\n';
  1043.                 }
  1044.  
  1045.                 cout << "June: ";
  1046.                 if (i_year == map_year.at(i_year).jun.year) {
  1047.                     if (map_year.at(i_year).jun.total_s_radi == 0) {
  1048.                         cout << "No Data" << '\n';
  1049.                     }
  1050.                     else {
  1051.                         cout << calculateKiloWatt(map_year.at(i_year).jun.total_s_radi) << " kW/h2" << '\n';
  1052.                     }
  1053.                 }
  1054.                 else {
  1055.                     cout << "No Data" << '\n';
  1056.                 }
  1057.  
  1058.                 cout << "July: ";
  1059.                 if (i_year == map_year.at(i_year).jul.year) {
  1060.                     if (map_year.at(i_year).jul.total_s_radi == 0) {
  1061.                         cout << "No Data" << '\n';
  1062.                     }
  1063.                     else {
  1064.                         cout << calculateKiloWatt(map_year.at(i_year).jul.total_s_radi) << " kW/h2" << '\n';
  1065.                     }
  1066.                 }
  1067.                 else {
  1068.                     cout << "No Data" << '\n';
  1069.                 }
  1070.  
  1071.                 cout << "August: ";
  1072.                 if (i_year == map_year.at(i_year).aug.year) {
  1073.                     if (map_year.at(i_year).aug.total_s_radi == 0) {
  1074.                         cout << "No Data" << '\n';
  1075.                     }
  1076.                     else {
  1077.                         cout << calculateKiloWatt(map_year.at(i_year).aug.total_s_radi) << " kW/h2" << '\n';
  1078.                     }
  1079.                 }
  1080.                 else {
  1081.                     cout << "No Data" << '\n';
  1082.                 }
  1083.  
  1084.                 cout << "September: ";
  1085.                 if (i_year == map_year.at(i_year).sep.year) {
  1086.                     if (map_year.at(i_year).sep.total_s_radi == 0) {
  1087.                         cout << "No Data" << '\n';
  1088.                     }
  1089.                     else {
  1090.                         cout << calculateKiloWatt(map_year.at(i_year).sep.total_s_radi) << " kW/h2" << '\n';
  1091.                     }
  1092.                 }
  1093.                 else {
  1094.                     cout << "No Data" << '\n';
  1095.                 }
  1096.  
  1097.                 cout << "October: ";
  1098.                 if (i_year == map_year.at(i_year).Oct.year) {
  1099.                     if (map_year.at(i_year).Oct.total_s_radi == 0) {
  1100.                         cout << "No Data" << '\n';
  1101.                     }
  1102.                     else {
  1103.                         cout << calculateKiloWatt(map_year.at(i_year).Oct.total_s_radi) << " kW/h2" << '\n';
  1104.                     }
  1105.                 }
  1106.                 else {
  1107.                     cout << "No Data" << '\n';
  1108.                 }
  1109.  
  1110.                 cout << "November: ";
  1111.                 if (i_year == map_year.at(i_year).nov.year) {
  1112.                     if (map_year.at(i_year).nov.total_s_radi == 0) {
  1113.                         cout << "No Data" << '\n';
  1114.                     }
  1115.                     else {
  1116.                         cout << calculateKiloWatt(map_year.at(i_year).nov.total_s_radi) << " kW/h2" << '\n';
  1117.                     }
  1118.                 }
  1119.                 else {
  1120.                     cout << "No Data" << '\n';
  1121.                 }
  1122.  
  1123.                 cout << "December: ";
  1124.                 if (i_year == map_year.at(i_year).Dec.year) {
  1125.                     if (map_year.at(i_year).Dec.total_s_radi == 0) {
  1126.                         cout << "No Data" << '\n';
  1127.                     }
  1128.                     else {
  1129.                         cout << calculateKiloWatt(map_year.at(i_year).Dec.total_s_radi) << " kW/h2" << '\n';
  1130.                     }
  1131.                 }
  1132.                 else {
  1133.                     cout << "No Data" << '\n';
  1134.                 }
  1135.             }
  1136.  
  1137.             else {
  1138.                 cout << "No data found for selected year.";
  1139.             }
  1140.  
  1141.         }
  1142.         else if (m_choice == 4) {
  1143.             std::cout << '\n';
  1144.             std::cout << "Choose a year: ";
  1145.             cin >> i_year;
  1146.             std::cout << '\n';
  1147.             std::cout << '\n';
  1148.             std::string csvFile = "WindTempSolar.csv";
  1149.             FileWrite<string> dataFile;
  1150.             Vector<int> v_year;
  1151.  
  1152.             if (map_year.find(i_year) != map_year.end()) {
  1153.                 v_year.push_back(i_year);
  1154.                 if (!dataFile.fileExists(csvFile)) {
  1155.                     dataFile.writeCsvFileInt(csvFile, v_year);
  1156.                 }
  1157.                 else {
  1158.                     dataFile.cleanAndWriteCsvFileInt(csvFile, v_year);
  1159.                 }
  1160.                 for (int n = 0; n < 12; n++) {
  1161.                     Vector<string> input_V;
  1162.                     float c_total_s_radi;
  1163.  
  1164.                     if (n == 0 && map_year.at(i_year).jan.avg_w_speed != 0) {
  1165.                         input_V.push_back(date.SetStringDate(map_year.at(i_year).jan.month));
  1166.                         input_V.push_back(std::to_string(map_year.at(i_year).jan.avg_w_speed));
  1167.                         input_V.push_back(std::to_string(map_year.at(i_year).jan.avg_a_a_temp));
  1168.                         c_total_s_radi = calculateKiloWatt(map_year.at(i_year).jan.total_s_radi);
  1169.                         string p_s_radi = (std::to_string(c_total_s_radi));
  1170.                         input_V.push_back(p_s_radi);
  1171.                         dataFile.writeCsvFile(csvFile, input_V);
  1172.                     }
  1173.                     else if (n == 1 && map_year.at(i_year).feb.avg_w_speed != 0) {
  1174.                         input_V.push_back(date.SetStringDate(map_year.at(i_year).feb.month));
  1175.                         input_V.push_back(std::to_string(map_year.at(i_year).feb.avg_w_speed));
  1176.                         input_V.push_back(std::to_string(map_year.at(i_year).feb.avg_a_a_temp));
  1177.                         c_total_s_radi = calculateKiloWatt(map_year.at(i_year).feb.total_s_radi);
  1178.                         string p_s_radi = (std::to_string(c_total_s_radi));
  1179.                         input_V.push_back(p_s_radi);
  1180.                         dataFile.writeCsvFile(csvFile, input_V);
  1181.                     }
  1182.                     else if (n == 2 && map_year.at(i_year).mar.avg_w_speed != 0) {
  1183.                         input_V.push_back(date.SetStringDate(map_year.at(i_year).mar.month));
  1184.                         input_V.push_back(std::to_string(map_year.at(i_year).mar.avg_w_speed));
  1185.                         input_V.push_back(std::to_string(map_year.at(i_year).mar.avg_a_a_temp));
  1186.                         c_total_s_radi = calculateKiloWatt(map_year.at(i_year).mar.total_s_radi);
  1187.                         string p_s_radi = (std::to_string(c_total_s_radi));
  1188.                         input_V.push_back(p_s_radi);
  1189.                         dataFile.writeCsvFile(csvFile, input_V);
  1190.                     }
  1191.                     else if (n == 3 && map_year.at(i_year).apr.avg_w_speed != 0) {
  1192.                         input_V.push_back(date.SetStringDate(map_year.at(i_year).apr.month));
  1193.                         input_V.push_back(std::to_string(map_year.at(i_year).apr.avg_w_speed));
  1194.                         input_V.push_back(std::to_string(map_year.at(i_year).apr.avg_a_a_temp));
  1195.                         c_total_s_radi = calculateKiloWatt(map_year.at(i_year).apr.total_s_radi);
  1196.                         string p_s_radi = (std::to_string(c_total_s_radi));
  1197.                         input_V.push_back(p_s_radi);
  1198.                         dataFile.writeCsvFile(csvFile, input_V);
  1199.                     }
  1200.                     else if (n == 4 && map_year.at(i_year).may.avg_w_speed != 0) {
  1201.                         input_V.push_back(date.SetStringDate(map_year.at(i_year).may.month));
  1202.                         input_V.push_back(std::to_string(map_year.at(i_year).may.avg_w_speed));
  1203.                         input_V.push_back(std::to_string(map_year.at(i_year).may.avg_a_a_temp));
  1204.                         c_total_s_radi = calculateKiloWatt(map_year.at(i_year).may.total_s_radi);
  1205.                         string p_s_radi = (std::to_string(c_total_s_radi));
  1206.                         input_V.push_back(p_s_radi);
  1207.                         dataFile.writeCsvFile(csvFile, input_V);
  1208.                     }
  1209.                     else if (n == 5 && map_year.at(i_year).jun.avg_w_speed != 0) {
  1210.                         input_V.push_back(date.SetStringDate(map_year.at(i_year).jun.month));
  1211.                         input_V.push_back(std::to_string(map_year.at(i_year).jun.avg_w_speed));
  1212.                         input_V.push_back(std::to_string(map_year.at(i_year).jun.avg_a_a_temp));
  1213.                         c_total_s_radi = calculateKiloWatt(map_year.at(i_year).jun.total_s_radi);
  1214.                         string p_s_radi = (std::to_string(c_total_s_radi));
  1215.                         input_V.push_back(p_s_radi);
  1216.                         dataFile.writeCsvFile(csvFile, input_V);
  1217.                     }
  1218.                     else if (n == 6 && map_year.at(i_year).jul.avg_w_speed != 0) {
  1219.                         input_V.push_back(date.SetStringDate(map_year.at(i_year).jul.month));
  1220.                         input_V.push_back(std::to_string(map_year.at(i_year).jul.avg_w_speed));
  1221.                         input_V.push_back(std::to_string(map_year.at(i_year).jul.avg_a_a_temp));
  1222.                         c_total_s_radi = calculateKiloWatt(map_year.at(i_year).jul.total_s_radi);
  1223.                         string p_s_radi = (std::to_string(c_total_s_radi));
  1224.                         input_V.push_back(p_s_radi);
  1225.                         dataFile.writeCsvFile(csvFile, input_V);
  1226.                     }
  1227.                     else if (n == 7 && map_year.at(i_year).aug.avg_w_speed != 0) {
  1228.                         input_V.push_back(date.SetStringDate(map_year.at(i_year).aug.month));
  1229.                         input_V.push_back(std::to_string(map_year.at(i_year).aug.avg_w_speed));
  1230.                         input_V.push_back(std::to_string(map_year.at(i_year).aug.avg_a_a_temp));
  1231.                         c_total_s_radi = calculateKiloWatt(map_year.at(i_year).aug.total_s_radi);
  1232.                         string p_s_radi = (std::to_string(c_total_s_radi));
  1233.                         input_V.push_back(p_s_radi);
  1234.                         dataFile.writeCsvFile(csvFile, input_V);
  1235.                     }
  1236.                     else if (n == 8 && map_year.at(i_year).sep.avg_w_speed != 0) {
  1237.                         input_V.push_back(date.SetStringDate(map_year.at(i_year).sep.month));
  1238.                         input_V.push_back(std::to_string(map_year.at(i_year).sep.avg_w_speed));
  1239.                         input_V.push_back(std::to_string(map_year.at(i_year).sep.avg_a_a_temp));
  1240.                         c_total_s_radi = calculateKiloWatt(map_year.at(i_year).sep.total_s_radi);
  1241.                         string p_s_radi = (std::to_string(c_total_s_radi));
  1242.                         input_V.push_back(p_s_radi);
  1243.                         dataFile.writeCsvFile(csvFile, input_V);
  1244.                     }
  1245.                     else if (n == 9 && map_year.at(i_year).Oct.avg_w_speed != 0) {
  1246.                         input_V.push_back(date.SetStringDate(Oct.month));
  1247.                         input_V.push_back(std::to_string(map_year.at(i_year).Oct.avg_w_speed));
  1248.                         input_V.push_back(std::to_string(map_year.at(i_year).Oct.avg_a_a_temp));
  1249.                         c_total_s_radi = calculateKiloWatt(map_year.at(i_year).Oct.total_s_radi);
  1250.                         string p_s_radi = (std::to_string(c_total_s_radi));
  1251.                         input_V.push_back(p_s_radi);
  1252.                         dataFile.writeCsvFile(csvFile, input_V);
  1253.                     }
  1254.                     else if (n == 10 && map_year.at(i_year).nov.avg_w_speed != 0) {
  1255.                         input_V.push_back(date.SetStringDate(map_year.at(i_year).nov.month));
  1256.                         input_V.push_back(std::to_string(map_year.at(i_year).nov.avg_w_speed));
  1257.                         input_V.push_back(std::to_string(map_year.at(i_year).nov.avg_a_a_temp));
  1258.                         c_total_s_radi = calculateKiloWatt(map_year.at(i_year).nov.total_s_radi);
  1259.                         string p_s_radi = (std::to_string(c_total_s_radi));
  1260.                         input_V.push_back(p_s_radi);
  1261.                         dataFile.writeCsvFile(csvFile, input_V);
  1262.                     }
  1263.                     else if (n == 11 && map_year.at(i_year).Dec.avg_w_speed != 0) {
  1264.                         input_V.push_back(date.SetStringDate(map_year.at(i_year).Dec.month));
  1265.                         input_V.push_back(std::to_string(map_year.at(i_year).Dec.avg_w_speed));
  1266.                         input_V.push_back(std::to_string(map_year.at(i_year).Dec.avg_a_a_temp));
  1267.                         c_total_s_radi = calculateKiloWatt(map_year.at(i_year).Dec.total_s_radi);
  1268.                         string p_s_radi = (std::to_string(c_total_s_radi));
  1269.                         input_V.push_back(p_s_radi);
  1270.                         dataFile.writeCsvFile(csvFile, input_V);
  1271.                     }
  1272.                 }
  1273.  
  1274.                 cout << "File written to WindTempSolar.csv" << '\n';
  1275.             }
  1276.  
  1277.             cout << "No data is found for the selected year.";
  1278.  
  1279.         }
  1280.         else if (m_choice == 5) {
  1281.             break;
  1282.         }
  1283.         else {
  1284.             std::cout << '\n';
  1285.             std::cout << "That is not a valid menu option." << '\n';
  1286.             std::cout << '\n';
  1287.             std::cout << "Please choose a menu from 1 to 5: ";
  1288.         }
  1289.  
  1290.         std::cout << "Choose a menu: ";
  1291.     }
  1292.  
  1293.     return 0;
  1294. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement