-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBirth.mpp
More file actions
43 lines (40 loc) · 1.23 KB
/
Birth.mpp
File metadata and controls
43 lines (40 loc) · 1.23 KB
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
classification LARVA_NR
{
FIRST,
SUBSEQUENT
};
TIME TsetseFly::timeLarvalProductionEvent()
{
return next_larva_deposit;
}
void TsetseFly::LarvalProductionEvent()
{
number_pupa++;
Pupa *paPupa = new Pupa();
paPupa->Start();
first_larvae = SUBSEQUENT;
next_larva_deposit = WAIT( (TIME) NEXT_LARVA_DEPOSIT( time, larva_const[first_larvae], larva_TempPar[first_larvae] ) );
}
double TsetseFly::NEXT_LARVA_DEPOSIT(double current_time, double k1, double k2)
{
double inter_larval_period = int(current_time) - current_time;
double sum = (k1 + k2*( DailyAvgTemperature[RANGE_POS( REPORT_TIME, int(current_time) )] - offset ))*inter_larval_period;
while ( sum < 1 )
{
sum += k1 + k2*( DailyAvgTemperature[RANGE_POS( REPORT_TIME, int(current_time + inter_larval_period) )] - offset );
inter_larval_period++;
if (sum > 1)
{
double time_reduction = (sum-1)/(k1 + k2*( DailyAvgTemperature[RANGE_POS( REPORT_TIME, int(current_time + inter_larval_period) )] - offset ) );
//inter_larval_period = inter_larval_period - time_reduction;
if( time_reduction >= 0.375)
{
inter_larval_period = inter_larval_period - 1 + 0.625;
} else
{
inter_larval_period = inter_larval_period - 1 + 1.625;
}
}
}
return inter_larval_period;
};