Skip to content

Commit dba7e1e

Browse files
committed
improved warnings
1 parent 23edf30 commit dba7e1e

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

addons/PhysiPKPD/src/PhysiPKPD_PK.cpp

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,8 @@ void setup_pk_single_dosing_schedule(Pharmacokinetics_Model *pPK, double current
380380
filename = folder + "/" + schedule_node.child("filename").text().as_string();
381381
}
382382

383+
std::cout << "PhysiPKPD Update: Reading in dosing schedule from " << filename << "." << std::endl;
384+
383385
std::ifstream file(filename, std::ios::in);
384386

385387
if (!file)
@@ -405,36 +407,23 @@ void setup_pk_single_dosing_schedule(Pharmacokinetics_Model *pPK, double current
405407
}
406408
pPK->pk_solver->max_doses = pPK->pk_solver->dose_times.size();
407409

410+
std::cout << "\tPhysiPKPD Update: Finished reading in dosing schedule from " << filename << "." << std::endl;
411+
std::cout << "\tPhysiPKPD Update: Found " << pPK->pk_solver->max_doses << " doses." << std::endl;
412+
std::cout << "\tPhysiPKPD Update: Dose times are: " << pPK->pk_solver->dose_times << std::endl;
413+
std::cout << "\tPhysiPKPD Update: Dose amounts are: " << pPK->pk_solver->dose_amounts << std::endl;
414+
408415
file.close();
409416
}
410417
else
411418
{
412-
// get max dose number
413-
// if (parameters.ints.find_index(pPK->substrate_name + "_max_number_doses") == -1)
414-
// {
415-
// std::cout << "PhysiPKPD WARNING: " << pPK->substrate_name << "_max_number_doses not set." << std::endl
416-
// << " Using a default value of 0." << std::endl;
417-
// pPK->pk_solver->max_doses = 0;
418-
// } // assume a default value of 0
419-
// else
420-
// {
421-
pPK->pk_solver->max_doses = schedule_node.child("total_doses").text().as_int();
422-
// }
419+
pPK->pk_solver->max_doses = schedule_node.child("total_doses").text().as_int();
423420

424421
if (pPK->pk_solver->max_doses == 0)
425422
{
426423
pPK->dosing_schedule_setup_done = true;
427424
return;
428425
}
429426

430-
// if ((!(schedule_node.child("confluence_start"))) && (!(schedule_node.child("confluence_condition"))))
431-
// {
432-
// std::cout << "PhysiPKPD WARNING: No specification of how to set first dose time." << std::endl
433-
// << " Defaulting to current_time." << std::endl
434-
// << " Specify this by setting " << pPK->substrate_name + "_set_first_dose_time" + " = true" << std::endl
435-
// << " Or setting " << pPK->substrate_name + "_confluence_condition" << std::endl;
436-
// }
437-
438427
pPK->pk_solver->dose_times.resize(pPK->pk_solver->max_doses, 0);
439428
pPK->pk_solver->dose_amounts.resize(pPK->pk_solver->max_doses, 0);
440429
if ((schedule_node.child("confluence_start")) && schedule_node.child("confluence_start").text().as_bool() && !(schedule_node.child("first_dose_time")))
@@ -548,6 +537,8 @@ void AnalyticConstant_PK_Solver::advance(Pharmacokinetics_Model *pPK, double cur
548537
{
549538
circulation_concentration = dose_amounts[dose_count];
550539
dose_count++;
540+
std::cout << "PhysiPKPD Update: Dosing " << dose_amounts[dose_count] << " to " << pPK->substrate_name << " at time " << current_time << "." << std::endl
541+
<< "\tUsing the constant PK model, so setting the circulation concentration to this amount." << std::endl;
551542
}
552543
return;
553544
}
@@ -559,6 +550,8 @@ void Analytic2C_PK_Solver::advance(Pharmacokinetics_Model *pPK, double current_t
559550
{
560551
compartment_concentrations[0] += dose_amounts[dose_count];
561552
dose_count++;
553+
std::cout << "PhysiPKPD Update: Dosing " << dose_amounts[dose_count] << " to " << pPK->substrate_name << " at time " << current_time << "." << std::endl
554+
<< "\tUsing the 2-compartment PK model, so adding this amount to the central compartment concentration resulting in a central concentration of " << compartment_concentrations[0] << "." << std::endl;
562555
}
563556

564557
// store previous quantities for computation
@@ -573,10 +566,12 @@ void Analytic2C_PK_Solver::advance(Pharmacokinetics_Model *pPK, double current_t
573566
void Analytic1C_PK_Solver::advance(Pharmacokinetics_Model *pPK, double current_time)
574567
{
575568
// add dose if time for that
576-
if (dose_count < max_doses && current_time > dose_times[dose_count] - tolerance)
569+
if (dose_count < max_doses && current_time > dose_times[dose_count] - tolerance)
577570
{
578571
circulation_concentration += dose_amounts[dose_count];
579572
dose_count++;
573+
std::cout << "PhysiPKPD Update: Dosing " << dose_amounts[dose_count] << " to " << pPK->substrate_name << " at time " << current_time << "." << std::endl
574+
<< "\tUsing the 1-compartment PK model, so adding this amount to the circulation concentration resulting in a concentration of " << circulation_concentration << "." << std::endl;
580575
}
581576

582577
circulation_concentration = M * circulation_concentration;

0 commit comments

Comments
 (0)