Commit 8df96532 authored by jouke's avatar jouke
Browse files

Supporting specificWeight instead of density. Making sure relative time

is used. This would lead to different results if density was not a
constant, but it practically always was.
parent 1372fa26
Loading
Loading
Loading
Loading
+13 −16
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ NOTE: The GPL.v3 license requires that all derivative work is distributed under



RootSegmentDryWeight::RootSegmentDryWeight(SimulaDynamic* pSD):TotalBase(pSD),mode(0)
RootSegmentDryWeight::RootSegmentDryWeight(SimulaDynamic* pSD):TotalBase(pSD),mode(0),relTime(0.)
{
	//plant type and root type
	std::string plantType;
@@ -34,6 +34,7 @@ RootSegmentDryWeight::RootSegmentDryWeight(SimulaDynamic* pSD):TotalBase(pSD),mo
	//get the root type
	std::string rootType;
	pSD->getParent(3)->getChild("rootType")->get(rootType);
	SimulaBase *param=GETROOTPARAMETERS(plantType,rootType);


	//root segment volume simulator
@@ -50,9 +51,10 @@ RootSegmentDryWeight::RootSegmentDryWeight(SimulaDynamic* pSD):TotalBase(pSD),mo
			densitySimulator=pSD->existingSibling("rootSegmentSpecificWeight");
			//root specific weight
			if(!densitySimulator){
				//pointer to object that gives root type specific density
				densitySimulator=GETROOTPARAMETERS(plantType,rootType)->getChild("density");
				densitySimulator=param->getOneOfThesePaths("specificWeight","density");
				relTime=pSD->getStartTime();
			}

		}
	}else if(name=="rootSegmentDryWeightNoRCS"){
		volumeSimulator=pSD->getSibling("rootSegmentDryWeightSteel");
@@ -63,28 +65,23 @@ RootSegmentDryWeight::RootSegmentDryWeight(SimulaDynamic* pSD):TotalBase(pSD),mo
		densitySimulator=pSD->existingSibling("rootSegmentSpecificWeightSteel");
		//root specific weight
		if(!densitySimulator){
			densitySimulator=GETROOTPARAMETERS(plantType,rootType)->existingChild("densitySteel");
		}
		if(!densitySimulator){
			densitySimulator=GETROOTPARAMETERS(plantType,rootType)->existingChild("density");
			densitySimulator=param->getOneOfThesePaths("specificWeigtSteel","densitySteel","specificWeight","density");
			relTime=pSD->getStartTime();
		}
	}else if(name=="rootSegmentDryWeightCortex"){
		volumeSimulator=pSD->getSibling("rootSegmentVolumeCortex");
		densitySimulator=pSD->existingSibling("rootSegmentSpecificWeightCortex");
		if(!densitySimulator){
			densitySimulator=GETROOTPARAMETERS(plantType,rootType)->existingChild("densityCortex");
		}
		if(!densitySimulator){
			densitySimulator=GETROOTPARAMETERS(plantType,rootType)->existingChild("density");
			densitySimulator=param->getOneOfThesePaths("specificWeightCortex","densityCortex","specificWeight","density");
			relTime=pSD->getStartTime();

		}
	}else if(name=="rootSegmentDryWeightCortexNoRCS"){
		volumeSimulator=pSD->getSibling("rootSegmentVolumeCortexNoRCS");
		densitySimulator=pSD->existingSibling("rootSegmentSpecificWeightCortex");
		if(!densitySimulator){
			densitySimulator=GETROOTPARAMETERS(plantType,rootType)->existingChild("densityCortex");
		}
		if(!densitySimulator){
			densitySimulator=GETROOTPARAMETERS(plantType,rootType)->existingChild("density");
			densitySimulator=param->getOneOfThesePaths("specificWeightCortex","densityCortex","specificWeigth","density");
			relTime=pSD->getStartTime();
		}
	}else{
		msg::error("RootSegmentDryWeight: Unknown mode for "+name);
@@ -97,7 +94,7 @@ void RootSegmentDryWeight::calculate(const Time &t,double &vol){
	volumeSimulator->get(t,vol);
	//segment density
	double dens;
	densitySimulator->get(t,dens);
	densitySimulator->get(t-relTime,dens);
	if(mode){
		//add up cortex and steel dw
		vol+=dens;
+1 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ protected:
	SimulaBase *densitySimulator, *volumeSimulator;
	double dw;
	int mode;
	Time relTime;
};
class RootSegmentSpecificWeight:public DerivativeBase{   
public: