-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathorgan.cpp
79 lines (67 loc) · 1.37 KB
/
organ.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include <algorithm>
#include "organ.h"
using namespace std;
#define CO2_MW 44.0098
#define C_MW 12.011
#define CH2O_MW 30.03
#define C_CONC 0.45
COrgan::COrgan()
{
age = physAge = mass = 0;
CH2O=N=0;
temperature = 25;
growthDuration=10;
longevity=50;
GDD = NULL;
GDD = new CThermalTime();
C_conc = 0.45;
}
COrgan::COrgan(double C)
{
COrgan();
C_conc = C;
}
COrgan::COrgan(const TInitInfo& info)
{
initInfo = info;
temperature=25.0;
CH2O=N=0;
age = physAge = mass = 0;
growthDuration=10;
longevity=50;
GDD = NULL;
GDD = new CThermalTime();
}
COrgan::~COrgan()
{
if (GDD != NULL) delete GDD;
}
void COrgan::initialize()
{
if (GDD == NULL) GDD = new CThermalTime();
GDD->initialize(initInfo.timeStep);
}
void COrgan::update()
{
GDD->add(temperature);
age = GDD->get_actualAge();
physAge=GDD->get_sum();
mass = max(0.0, CH2O*(C_MW/CH2O_MW)/C_CONC); // C content = 45%, hard coded for now
}
void COrgan::import_CH2O(double dCH2O)
{
CH2O += dCH2O;
mass = max(0.0, CH2O*(C_MW/CH2O_MW)/C_CONC); // C content = 45%, hard coded for now
}
void COrgan::import_N(double dN)
{
N += dN;
}
void COrgan::respire()
// this needs to be worked on
// currently not used at all
{
double Rm = 0.02; //maintenance respiration
double Ka = 0.1; //growth respiration
CH2O -= Ka*CH2O + Rm*CH2O;
}