1 /********************************************************** 2 * Version $Id: ihacres_elev_cal.h 911 2011-02-14 16:38:15Z reklov_w $ 3 *********************************************************/ 4 /////////////////////////////////////////////////////////// 5 // ihacres_elev_cal.h // 6 // // 7 // Copyright (C) 2008 by // 8 // Stefan Liersch // 9 //-------------------------------------------------------// 10 // e-mail: stefan.liersch@ufz.de // 11 // stefan.liersch@gmail.com // 12 // 2008-02-13 // 13 //-------------------------------------------------------// 14 15 //*******************************************************// 16 // ToDo // 17 //-------------------------------------------------------// 18 // - 19 //*******************************************************// 20 21 //--------------------------------------------------------- 22 #ifndef HEADER_INCLUDED__ihacres_elev_cal_H 23 #define HEADER_INCLUDED__ihacres_elev_cal_H 24 //--------------------------------------------------------- 25 #include "MLB_Interface.h" 26 #include "ihacres_eq.h" 27 #include "ihacres_elev_bands.h" 28 #include "snow_module.h" 29 30 #include <vector> // used for storing date string values in array 31 //using namespace std; 32 33 typedef std::vector<std::string> date_array; 34 35 36 class Cihacres_elev_cal : public CSG_Tool 37 { 38 public: 39 40 //-------------------------------------------------------- 41 // CONSTRUCTORS 42 //-------------------------------------------------------- 43 44 // default 45 Cihacres_elev_cal(); 46 47 // destructor 48 virtual ~Cihacres_elev_cal(void); 49 needs_GUI(void)50 virtual bool needs_GUI (void) { return( true ); } 51 52 53 protected: 54 55 // execute module 56 virtual bool On_Execute(void); 57 58 private: 59 60 //-------------------------------------------------------- 61 // PRIVATE MEMBER VARIABLES 62 //-------------------------------------------------------- 63 64 int m_counter; 65 66 //---------------------------------- 67 // parameters of first module dialog 68 //---------------------------------- 69 int m_nElevBands; // number of used elevation bands 70 int m_nsim; // number of simulations 71 double m_Area_tot; // total catchment area [km2] 72 int m_IHAC_version; // Different versions of IHACRES exist, corresponding 73 // to the version... 74 int m_StorConf; // Storage configuration 75 // 0 = single, 1 = two in parallel, 2 = two in series 76 bool m_bSnowModule; // true if snow module is active 77 78 int m_nStorages; // number of storages 79 80 int m_obj_func; 81 82 double m_NSEmin; 83 84 //---------------------------------- 85 // parameters of second module dialog 86 //---------------------------------- 87 // time series variables 88 CSG_Table* m_p_InputTable; // IHACRES input table 89 int m_nValues; // number of selected records 90 date_array m_vec_date; 91 double* m_p_Q_obs_m3s; // pointer containing observed streamflow in [m3/s] 92 double* m_p_Q_obs_mmday; // pointer containing observed streamflow in [mm] 93 double* m_p_Q_sim_mmday; 94 Cihacres_elev_bands* m_p_elevbands; // Class Cihacres_elev_cal_bands 95 96 // Field numbers 97 int m_dateField; // table field numbers 98 int m_streamflowField; 99 // elevation band parameters 100 int* m_p_pcpField; 101 int* m_p_tmpField; 102 //double* m_p_Area; 103 //double* m_p_mean_elev; 104 105 //---------------------------------- 106 // parameters of third module dialog 107 //---------------------------------- 108 CSG_String m_date1; // first day of time series YYYYMMDD 109 CSG_String m_date2; // last day 110 111 int m_first; 112 int m_last; 113 114 //---------------------------------- 115 // Model parameter (in: ihacres_eq.h) 116 //---------------------------------- 117 C_IHAC_LinearParms* m_p_lin_lb; 118 C_IHAC_LinearParms* m_p_lin_ub; 119 C_IHAC_LinearParms* m_p_linparms; // parameters of the linear storage module 120 C_IHAC_NonLinearParms* m_p_nl_lb; 121 C_IHAC_NonLinearParms* m_p_nl_ub; 122 C_IHAC_NonLinearParms* m_p_nonlinparms; // parameters of the non-linear rainfall loss module 123 CSnowParms* m_pSnowparms_lb; 124 CSnowParms* m_pSnowparms_ub; 125 CSnowParms* m_pSnowparms; // 3 snow module paramters 126 CSnowModule* m_p_SnowModule; 127 int m_delay; 128 double* m_vq; 129 double* m_vs; 130 131 double m_NSE; 132 double m_NSE_highflow; 133 double m_NSE_lowflow; 134 double m_PBIAS; 135 136 CSG_Table* m_pTable; 137 CSG_Table* m_pTable_parms; 138 139 //-------------------------------------------------------- 140 // PRIVATE MEMBER FUNCTIONS 141 //-------------------------------------------------------- 142 143 void _Init_ElevBands(int n); // n = m_nElevBands 144 void _Init_Pointers(int nvals); 145 void _CreateDialog1(); 146 bool _CreateDialog2(); 147 bool _CreateDialog3(); 148 void _ReadInputFile(); 149 void _CalcSnowModule(int elevband); 150 void _Simulate_NonLinearModule(); 151 void _Simulate_Streamflow(); 152 void _Sum_Streamflow(); 153 void _CalcEfficiency(); 154 void _CreateTableSim(); 155 void _CreateTableParms(); 156 void _WriteTableParms(); 157 158 // Class ihacres_eq 159 Cihacres_eq ihacres; 160 161 }; 162 163 #endif /* HEADER_INCLUDED__ihacres_elev_cal_H */ 164