Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

PopulationNetworkSegment.h

Go to the documentation of this file.
00001 //------------------------------------------------------------------------------
00002 //
00003 //  Thomas Berger (main author), Pepijn Schreinemachers, and Thorsten Arnold
00004 //
00005 //
00006 //  Hohenheim University (490d)
00007 //  Professorship for Land Use Economics in the Tropics and Subtropics
00008 //
00009 //  May not be distributed without permission by main author
00010 //
00011 //  File:       PopulationNetworkSegment.h (formerly segment.h)
00012 //
00013 //  Contents:   Network segment class, manages innovation data and provides
00014 //              investment related coefficients to compute, for example annuity
00015 //              investment costs
00016 //
00017 //------------------------------------------------------------------------------
00018 
00019 
00020 #ifndef _PopulationNetworkSegment_h
00021 #define _PopulationNetworkSegment_h
00022 
00023 
00024 #include "MatrixDouble.h"
00025 #include "BasicDefines.h"
00026 
00027 
00028 
00030 class AvailablePermanentCrops
00031 {       //auxiliary class, everything public
00032 public:
00033 
00034         double purchasePrice;                   //0
00035         int accessible;                                 //1 (bool)
00036    double annuityYields;                        //2 periodisierte Werte
00037    double investmentCosts;                      //3 periodisierte jaehrl. Kosten (Spezialkosten + Kapitaldienst + Abschreibung)
00038    double cashDemandYear0;                      //4 Kapitalansprueche im Jahr0 (Eigenfinanzierungsanteil)
00039    double cashDemandAverage;            //5 periodisierte Kapitalansprueche (durchschnittliches Jahr)
00040         int lpColumnInvestment;                 //7 Spaltennr. in LP (Investitionsplanungsaktivitaet)
00041         int lpYieldRow;                                 //8 entsprechende Ertragszeilennr. in LP
00042    int soilSuitability;                         //9 fuer alle Bodentypen geeignet: 0; nur BodenI/II: 1; nur IV/IVa: 2
00043    double minimumArea;                          //10 erforderliche Mindestbodenausstattung (in ha)
00044    int objectID;                                                //11 Objektcode
00045         
00046         //average labor demands
00047         MatrixDouble averageLaborDemands;               //12 
00048         
00049         //average machinery demands
00050         MatrixDouble averageMachineryDemands;   //15 
00051         
00053         AvailablePermanentCrops()
00054         {       purchasePrice = 0.0;                    
00055                 accessible = 0;                         
00056                 annuityYields = 0.0;                    
00057                 investmentCosts = 0.0;          
00058                 cashDemandYear0 = 0.0;          
00059                 cashDemandAverage = 0.0;        
00060                 lpColumnInvestment = -1;        
00061                 lpYieldRow = -1;                                
00062                 soilSuitability = -1;           
00063                 minimumArea = 0.0;                      
00064                 objectID = -1;                          
00065         }
00066 
00068         virtual ~AvailablePermanentCrops()
00069         {       averageLaborDemands.deallocate();
00070                 averageMachineryDemands.deallocate();
00071         }
00072 };
00073 
00074 
00075 
00076 // Def. einer Investitionsmoeglichkeit
00077 //neu 2004 Identifikation des Objekts erfolgt Objektcode in investdef->code
00078 typedef struct
00079 {  char name[OBJNAME];//neu 2004 Investitionsobjektname
00080    int code;      //neu 2004 Objekt-ID
00081         int typ;                        //Dauerkultur, Maschine, Stallplaetze
00082    int divisible;       //teilbares Objekt (ja/nein)
00083    double purPrice;
00084         int lifeSp;
00085    int boden;           //fuer welche Bodenklasse geeignet? (fuer alle: 0)
00086    double mindest;//erforderlicher Mindestinvestitonsumfang (Anz. Aggregate)
00087         int activity;//welche Aktivitaet? (Spaltennr. in temp_LP)
00088         int capacity;//Wirkung auf welche Kapazitaet, z.B. Nr. 19 Milchviehplaetze
00089    int yieldRow;  //neu 2004 Ertragszeile
00090         double size;    //Leistung des Objekts, z.B. 100 Stallplaetze oder 283 AKh
00091    int seg;                     //Innovationsfaehigkeit bzw. Segment
00092    int available;//in welcher Periode eingefuehrt? (sofort eingefuehrt: 0)
00093    int accessible; //in welcher Periode anwendbar? (sofort anwendbar: 0)
00094    double shareEC;//neu 2004 Eigenfinanzierungsanteil
00095    double rateDC; //neu 2004 Fremdkapitalzins
00096 } investart;
00097 
00098 
00099 // Def. eines Investitionsobjektes ueber seinen Anschaffungspreis
00100 typedef struct
00101 {  char acc[3]; //not yet accounted for 'x', outdated 'o', free slot in
00102                                                 //inventory '-', otherwise ' '
00103         int code;      //Objektcode
00104    double anz;          //Anzahl der Aggregate (z.B. 32.5 ha Obstbau)
00105         double ask;             //Anschaffungspreis bzw. -kosten (je ha Obstbau)
00106         int alter;              //Alter
00107         double shareEC;//vorher eigenf neu 2004 Eigenfinanzierungsanteil
00108    double rateDC; //neu 2004 Fremdkapitalzins
00109 } investdef;
00110 
00111 
00112 
00113 class segment
00114 {  protected:
00115    int sgID;                    //segment ID
00116    int nwID;         //network ID
00117         double schw_wert;       //Schwellenwert
00118    double* invBounds;//upper bounds for investments
00119 
00120    char filename[MXLENGTH];//Inputfile
00121    FILE* datenstrom;    //Datenstrom
00122 
00123         public:
00124         segment(int sg, int nw, char* in);
00125         virtual ~segment()
00126         {  //verfuegb_dkulturen.deallokieren(); ##
00127         delete [] registryOfAvailablePermanentCrops;
00128         
00129                 delete [] invest_matrix;
00130       delete [] invBounds;
00131         }
00132 
00133    segment* nextSegment;
00134    virtual void setNextPtr (segment*);
00135    virtual segment* getNext();
00136 
00137         double rateLC;  //Zinsfuss fuer langfristige Kredite
00138    double rateSC;       //Zinsfuss fuer kurzfristge Kredite
00139    double rateSD;       //Zinsfuss fuer einjaehrige Geldanlagen
00140         double shareEC;//Eigenfinanzierungsanteil
00141    double ikalk;        //Kalkulationszins
00142         double bonus;   //direkte Einkommenstransfers
00143         double sunkcost;//Anteil der wiedergewinnbaren Kosten
00144    double sog;          //"Sogfaktor" zur Pruefung der freiwilligen Betriebsaufgabe
00145    double opplohn;//neu 2003 Opportunity wage of household head
00146         int inv_anzahl;//Anzahl der Investitionsmoeglichkeiten
00147 
00148         investart* invest_matrix;
00149         //MatrixDouble verfuegb_dkulturen;//substitute ##
00150         AvailablePermanentCrops* registryOfAvailablePermanentCrops;//substitute for <verfuegb_dkulturen>
00151         int numberOfAvailablePermanentCrops;
00152 
00153         virtual double get_sw();//liefert Schwellenwert zurueck
00154    virtual int get_sgID();
00155    virtual int get_nwID();
00156    virtual int get_objnummer(int objID);//liefert Nr. eines Inv.objekts
00157         virtual int get_n_dauer(int objID);//liefert Nutz.dauer eines Inv.objekts
00158         virtual int getObjectIdForLpActivity(int lpActivity);//returns -1 if no object found
00159    virtual int getIDforOutput(double leistg);//Uebergabe Leistung
00160         virtual int getIDforPurchasePrice(double pp);
00161         virtual int getIDforObjectType(int objType);
00162    virtual double getPPforID(int objID);//liefert ASK, Uebergabe ObjCode
00163    virtual double getSFforID(int objID);//liefert Eigenfinanzierungsanteil
00164    virtual double getILCforID(int objID);//liefert Fremdkapitalzins
00165    virtual int getLPRowforID(int objID);
00166    virtual char* getNameForID(int objID);//liefert Name, Uebergabe ObjCode
00167    virtual double getInvBound(int sClass);//upper bound on investments
00168         virtual int getNumberOfAvailablePermanentCrops();
00169 
00170    virtual void readSegmentInput();//baut Investmatrix + Lotterie mit Inputdaten auf
00171    virtual void writeSegmentInput(char*);
00172 
00173         //aktualisiert Werte in der Invest_matrix fuer ein best. Investitionsobjekt,
00174         //das ueber den ursprg. Anschaffungspreis identifiziert wird
00175         //Uebergabe: Periode, Vornutzeranteil, Objektcode, Art des
00176    //Kommunikationsprozesses
00177    virtual void wert_updaten(int, double, int, int);
00178 
00179         //virtual void dkulturen_anlegen(int anzahl);//substitute ##
00180         virtual void createRegistryOfAvailablePermanentCrops();//substitute for <dkulturen_anlegen>
00181         
00182         virtual void writeRegistryOfAvailablePermanentCropsToFile(char*);
00183         virtual void writeRegistryOfAvailablePermanentCropsToStream(FILE* stream);
00184         virtual void updateProductionCostsOfAvailablePermanentCrops();
00185         virtual AvailablePermanentCrops* getPointerToRegistryOfAvailablePermanentCrops();
00186         
00187         //virtual void dkulturen_updaten(int);//substitute ##
00188         virtual void updateAccessToPermanentCrop(int objectID);//substitute for <dkulturen_updaten>
00189 
00190 
00191         virtual void printToScreen();
00192    //virtual void lotto_datei_schreiben(char* filename);//neu 2004 in 'cluster'
00193 };
00194 
00195 
00196 #endif
00197 

Generated on Thu Aug 28 12:38:45 2008 for MPMAS by  doxygen 1.3.9.1