Skip to content
Snippets Groups Projects
Commit 44114cfd authored by Andreas Gattringer's avatar Andreas Gattringer
Browse files

butterflies: more debug info at start

parent 3ff8279c
No related branches found
No related tags found
No related merge requests found
......@@ -15,10 +15,52 @@
#include "butterflies_overlays.h"
#include "butterflies_filenames.h"
#include "inline.h"
#include "lambda/leslie_matrix.h"
enum action_status bf_action_stats_reset(struct cats_grid *grid, struct cats_configuration *conf)
{
// FIXME MOVE
if (conf->time.year_current == conf->time.year_start) {
log_message(LOG_INFO, "SUMMARY: Scale factor: %Lf", grid->param.scale_factor);
struct lambda_parameters l_param = {0};
l_param.calculate_scale = true;
l_param.suitability = grid->param.OT;
l_param.N = 0;
l_param.K = (cats_dt_population)
(get_vital_rate_maximum(&conf->param[grid->id].carrying_capacity) * conf->param->max_adult_cc_fraction);
l_param.grid = 0;
l_param.row = 0;
l_param.col = 0;
l_param.param = &conf->param[grid->id];
l_param.species_id = grid->id;
bool print_rate = false;
struct conf_data_butterflies *module_conf = CATS_MODULE_DATA;
cats_dt_rates female_fraction = module_conf->female_fraction;
cats_dt_rates stationary = module_conf->probability_to_stay;
cats_dt_rates mobile = 1.0 - stationary;
cats_dt_rates egg_fraction_source = module_conf->egg_fraction_source;
cats_dt_rates eggs_per_female = calculate_rate_for_matrix(&module_conf->eggs_per_female, &l_param, print_rate);
cats_dt_rates reproduction_rate = calculate_rate_for_matrix(&module_conf->reproduction_rate, &l_param, print_rate);
cats_dt_rates local_eggs = (stationary + mobile * egg_fraction_source ) * eggs_per_female;
// female -> female
// to achieve the target reproduction rate, the number of eggs per female laid in the cell
// that survive and become adult has to be the reproduction rate divided by the female fraction divided by the number of eggs
cats_dt_rates eggs_to_adults_rate = bf_egg_to_adult_survival_rate(reproduction_rate, local_eggs, female_fraction);
cats_dt_rates result = local_eggs * eggs_to_adults_rate * female_fraction;
log_message(LOG_INFO, "SUMMARY: reproduction rate at OT: %Lf", reproduction_rate);
log_message(LOG_INFO, "SUMMARY: eggs per female at OT: %Lf", eggs_per_female);
log_message(LOG_INFO, "SUMMARY: local eggs at OT: %Lf", local_eggs);
log_message(LOG_INFO, "SUMMARY: stationary females at OT: %Lf", stationary);
log_message(LOG_INFO, "SUMMARY: eggs to adult rate at OT: %Lf", eggs_to_adults_rate);
log_message(LOG_INFO, "SUMMARY: egg fraction source at OT: %Lf", egg_fraction_source);
log_message(LOG_INFO, "SUMMARY: carrying capacity at OT: %d", l_param.K);
log_message(LOG_INFO, "SUMMARY: effective female to female rate at OT: %Lf\n", result);
}
return action_grid_stats_reset(grid, conf);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment