22#ifndef MODELCORESPATIAL_H
23#define MODELCORESPATIAL_H
112 double computeExpectedPrice(
const double & curLocPrice,
const double & worldCurPrice,
const double & worldFutPrice,
const double & sl,
const double & sa,
const double & expCoef);
120 double getVHaByYear (
const Pixel* px,
const int& ft,
const int& year,
const double& extraBiomass_ratio,
const int& regId )
const;
123 double gpd(
const string &type_h,
const int& regId_h,
const string &prodId_h,
const int& year=
DATA_NOW,
const string &freeDim_h=
"")
const {
return MTHREAD->
MD->
getProdData(type_h, regId_h, prodId_h, year, freeDim_h);};
124 double gfd(
const string &type_h,
const int& regId_h,
const string &forType_h,
const string &freeDim_h,
const int& year=
DATA_NOW)
const {
return MTHREAD->
MD->
getForData(type_h, regId_h, forType_h, freeDim_h, year);};
125 void spd(
const double& value_h,
const string &type_h,
const int& regId_h,
const string &prodId_h,
const int& year=
DATA_NOW,
const bool& allowCreate=
false,
const string &freeDim_h=
"")
const {
MTHREAD->
MD->
setProdData(value_h, type_h, regId_h, prodId_h, year, allowCreate, freeDim_h);};
126 void sfd(
const double& value_h,
const string &type_h,
const int& regId_h,
const string &forType_h,
const string &freeDim_h,
const int& year=
DATA_NOW,
const bool& allowCreate=
false)
const {
MTHREAD->
MD->
setForData(value_h, type_h, regId_h, forType_h, freeDim_h, year, allowCreate);};
142 vector <vector <int> >
l2r;
This file is the header of BaseClass and it is included by ALL compiled code.
@ DATA_NOW
The required data is for the current year.
Base class for the regmas application.
ThreadManager * MTHREAD
Pointer to the Thread manager.
The core of the model (spatial version).
void runMarketModule()
computes st (supply total) and pw (weighted price). Optimisation inside.
vector< double > allocateHarvesting(vector< double > total_st, const int ®Id)
Using the deathTimberInventory map, this function allocate the total st in st from death timber (that...
void sumRegionalForData()
computes vol, hV, harvestedArea, regArea and expReturns at reg level from the pixel level
vector< string > allProducts
void cachePixelExogenousData()
computes pixel level tp, meta and mort
void cacheSettings()
just cache exogenous settings from ModelData
void computeInventary()
in=f(vol_t-1)
void registerCarbonEvents()
call registerHarvesting(), registerDeathBiomass(), registerProducts() and registerTransports()
void printDebugInitRegionalValues()
print initial inv, st, sl and sa in each region
void computeEconomicBalances()
compute the policy balances (- -> costs; + -> rev) and the producer/consumer surpluses
void loadExogenousForestLayers(const string &what)
Set pixel volumes (what="vol") OR areas (what="area") by specific forest types as defined in gis laye...
void runBiologicalModule()
computes hV, hArea and new vol at end of year
void resetPixelValues()
swap volumes->lagged_volumes and reset the other pixel vectors
void updateMapAreas()
computes forArea_{ft}
vector< string > priProducts
void assignSpMultiplierPropToVols()
ModelCoreSpatial::assignSpMultiplierPropToVols assigns the spatial multiplier (used in the time of re...
void runManagementModule()
computes regArea and expectedReturns
double getAvgAgeByDc(Pixel *px, int ft, int dc)
return the average age of a tree at a given diameter class, using the cumTp vector
double gfd(const string &type_h, const int ®Id_h, const string &forType_h, const string &freeDim_h, const int &year=DATA_NOW) const
void computeCumulativeData()
computes cumTp_exp, vHa_exp, vHa
void initMarketModule()
computes st and pw for second year and several needed-only-at-t0-vars for the market module
vector< vector< int > > l2r
void initializePixelVolumes()
distribuite regional exogenous volumes to pixel volumes using corine land cover area as weight
vector< string > secProducts
void sfd(const double &value_h, const string &type_h, const int ®Id_h, const string &forType_h, const string &freeDim_h, const int &year=DATA_NOW, const bool &allowCreate=false) const
double gpd(const string &type_h, const int ®Id_h, const string &prodId_h, const int &year=DATA_NOW, const string &freeDim_h="") const
double computeExpectedPrice(const double &curLocPrice, const double &worldCurPrice, const double &worldFutPrice, const double &sl, const double &sa, const double &expCoef)
Compute weighted expected price for a given product.
bool app(const string &prod_h, const string &forType_h, const string &dClass_h) const
vector< string > dClasses
vector< string > pDClasses
void initialiseDeathTimber()
Set deathTimberInventory to zero for the previous years (under the hipotesis that we don't have advan...
double getVHaByYear(const Pixel *px, const int &ft, const int &year, const double &extraBiomass_ratio, const int ®Id) const
return the Volume/ha in a forest after a given number of year after planting, for a specific forest t...
string forestAreaChangeMethod
void spd(const double &value_h, const string &type_h, const int ®Id_h, const string &prodId_h, const int &year=DATA_NOW, const bool &allowCreate=false, const string &freeDim_h="") const
void initialiseCarbonModule()
call initialiseDeathBiomassStocks(), initialiseProductsStocks() and initialiseEmissionCounters()
void initializePixelArea()
compute px->area for each ft and dc
void updateOtherMapData()
update (if the layer exists) other gis-based data, as volumes and expected returns,...
void cacheDynamicSettings()
cache settings that may change with time
Regional data, including macros and settings.
void setProdData(const double &value_h, const string &type_h, const int ®Id_h, const string &prodId_h, const int &year=DATA_NOW, const bool &allowCreate=false, const string &freeDim_h="")
const double getForData(const string &type_h, const int ®Id_h, const string &forType_h, const string &freeDim_h, const int &year=DATA_NOW)
void setForData(const double &value_h, const string &type_h, const int ®Id_h, const string &forType_h, const string &freeDim_h, const int &year=DATA_NOW, const bool &allowCreate=false)
const bool assessProdPossibility(const string &prod_h, const string &forType_h, const string &dClass_h)
A simple function to assess if a specified product can be made by a certain forest type and diameter ...
const double getProdData(const string &type_h, const int ®Id_h, const string &prodId_h, const int &year=DATA_NOW, const string &freeDim_h="")
Thread manager. Responsable to manage the main thread and "speak" with the GUI.
ModelData * MD
the model data object