None Notebook

This notebook contains material from cbe30338-2021; content is available on Github.

< 2.0 Linear Process Models | Contents | Tag Index | 2.2 Properties of Scalar First Order Linear Systems >

Open in Colab

Download

2.1 One Compartment Pharmacokinetics

2.1.1 Learning Goals

The notebook introduces a single, linear, first-order differential equation in the general form

$$\frac{dx}{dt} = a x + b u$$

as mathematical model to describe the dynamic response of a system to a changing input.

In any particular application, the state variable $x$ corresponds to a process variable such as temperature, pressure, concentration, or position. The input variable $u(t)$ corresponds to a changing input such as heater power, flowrate, or valve position. This notebook uses this equation to describe a one-compartment model for a pharmacokinetics in the which the state is the concentration of an antimicrobrial, and the input is a rate of intraveneous administration.

This notebook demonstrates features of this model that can be used in a wide range of process applications:

2.1.2 Pharamacokinetics

Pharmacokinetics is a branch of pharmacology that studies the fate of chemical species in living organisms. The diverse range of applications includes the administration of drugs and anesthesia in humans. This notebook introduces a one compartment model for pharmacokinetics and shows how it can be used to determine strategies for the intravenous administration of an antimicrobial.

2.1.2.1 One-Compartment Model

For the purposes of drug administration, for a one-compartment model of the human body is assumed to consist of a single compartment of a constant volume $V$ containing all the plasma of the body. The plasma is assumed to be sufficiently well mixed that any drug is uniformly distributed with concentration $C(t)$. The drug enters the plasma by direct injection into the plasma at rate $u(t)$. The drug leaves the body as a component of the plasma where $Q$ is the constant plasma clearance rate.

A generic mass balance for a single species is given by

$$\fbox{Rate of Accumulation} = \fbox{Inflow} - \fbox{Outflow} + \fbox{Production by reaction} - \fbox{Consumption by reaction}$$

Assuming the drug is neither produced or consumed by reaction in the body, this generic mass balance can be translated to differential equation

$$\begin{align*} \underbrace{\fbox{Rate of Accumulation}}_{V \frac{dC}{dt}} & = \underbrace{\fbox{Inflow}}_{u(t)} - \underbrace{\fbox{Outflow}}_{Q C} + \underbrace{\fbox{Production by reaction}}_0 - \underbrace{\fbox{Consumption by reaction}}_0 \end{align*}$$

or, summarizing,

$$V \frac{dC}{dt} = u(t) - Q C(t)$$

This model is characterized by two parameters, the plasma volume $V$ and the clearance rate $Q$.

2.1.2.2 Antimicrobials

Let's consider the administration of an antimicrobial to a patient. Concentration $C(t)$ refers to the concentration of the antibiotic in blood plasma in units of [mg/L or $\mu$g/mL]. There are two concentration levels of interest in the medical use of an antimicrobrial:

Minimum Inhibitory Concentration (MIC) The minimum concentration of the antibiotic that prevents visible growth of a particular microorganism after overnight incubation. This is generally not enough to kill the microorganism, only enough to prevent further growth.

Minimum Bactricidal Concentration (MBC) The lowest concentration of the antimicrobrial that prevents the growth of the microorganism after subculture to antimicrobrial-free media. MBC is generally the concentration needed "kill" the microorganism.

Extended exposure to an antimicrobrial at levels below MBC leads to antimicrobrial resistance.

2.1.2.3 What questions can we ask and answer with this model?

There are multiple reasons to create mathematical models. In research and development, for example, a mathematical model forms a testable hypothesis of one's understanding of a system. The model guides the design of experiments to either validate or falsify the assumptions incorporated in the model.

In the present context of control systems, a model is used to answer operating questions. In pharmacokinetics, for example, the operational questions might include:

Questions like these can be answered through simulation, regression to experimental data, and mathematical analysis. We'll explore several of these techniques below.

2.1.3 Simulation

2.1.3.1 Simulation from a Known Initial Condition

2.1.3.1.1 Problem Statement

Assume the minimum inhibitory concentration (MIC) of a particular organism to a particular antimicrobial is 5 mg/liter, and the minimum bactricidal concentration (MBC) is 8 mg/liter. Further assume the plasma volume $V$ is 4 liters with a clearance rate $Q$ of 0.5 liters/hour.

An initial intravenous antimicrobial dose of 64 mg in 4 liters of plasm results in a plasma concentration $C_{initial}$ of 16 mg/liter. How long will the concentration stay above MBC? Above MIC?

2.1.3.1.2 Step 1. Import libraries

For this first simulation we compute the response of the one compartment model due starting with an initial condition $C_{initial}$, and assuming input $u(t) = 0$. We will use the solve_ivp function for solving differential equations from the scipy.integrate library.

The first steps to a solution are:

  1. Initialize the plotting system.
  2. Import the numpy library for basic mathematical functions.
  3. Import the matplotlib.pyplot library for plotting.
  4. Import the any needed mathematical functions or libraries.

2.1.3.1.3 Step 2. Enter Parameter Values

2.1.3.1.4 Step 3. Write the differential equation in standard form

The most commonly solvers for systems of differential equations require a function evaluating the right hand sides of the differential equations when written in a standard form

$$\frac{dC}{dt} = \frac{1}{V}u(t) - \frac{Q}{V}C$$

Here we write two functions. One function returns values of the input $u(t)$ for a specified point in time, the second returns values of the right hand side as a function of time and state.

2.1.3.1.5 Step 4. Solution and Visualization

The decision on how to display or visualize a solution is problem dependent. Here we create a simple function to visualize the solution and relevant problem specifications.

2.1.3.1.6 Step 5. Analysis of the Results

Let's compare our results to a typical experimental result.

We see that that the assumption of a fixed initial condition is questionable. Can we fix this?

Levison, Matthew E., and Julie H. Levison. “Pharmacokinetics and Pharmacodynamics of Antibacterial Agents.” Infectious disease clinics of North America 23.4 (2009): 791–vii. PMC. Web. 8 May 2017.

2.1.3.2 Example 2: Improving Simulation using Time-Dependent Input

For the next simulation we will assume the dosing takes place over a short period of time $\delta t$. To obtain a total dose $U_{dose}$ in a time period $\delta t$, the mass flow rate rate must be

$$u(t) = \begin{cases} U/ \delta t \qquad \mbox{for } 0 \leq t \leq \delta t \\ 0 \qquad \mbox{for } t \geq \delta t \end{cases} $$

Before doing a simulation, we will write a Python function for $u(t)$.

This code cell demonstrates the use of a list comprehension to apply a function to each value in a list.

Simulation

2.1.3.2.1 Analysis of the Results

Let's compare our results to a typical experimental result.

While it isn't perfect, this is a closer facsimile of actual physiological response.

Levison, Matthew E., and Julie H. Levison. “Pharmacokinetics and Pharmacodynamics of Antibacterial Agents.” Infectious disease clinics of North America 23.4 (2009): 791–vii. PMC. Web. 8 May 2017.

2.1.3.3 Example 2: Periodic Dosng

The minimum inhibitory concentration (MIC) of a particular organism to a particular antibiotic is 5 mg/liter, the minimum bactricidal concentration (MBC) is 8 mg/liter. Assume the plasma volume $V$ is 4 liters with a clearance rate $Q$ of 0.5 liters/hour.

Design an antibiotic therapy to keep the plasma concentration above the MIC level for a period of 96 hours.

2.1.3.3.1 Solution

We consider the case of repetitive dosing where a new dose is administered every $t_{dose}$ hours. A simple Python "trick" for this calculation is the % operator which returns the remainder following division. This is a useful tool worth remembering whenever you need to functions that repeat in time.

The dosing function $u(t)$ is now applied to the simulation of drug concentration in the blood plasma. A fourth argument is added to odeint(deriv, Cinitial, t, tcrit=t) indicating that special care must be used for every time step. This is needed in order to get a high fidelity simulation that accounts for the rapidly varying values of $u(t)$.

This looks like a unevem. The problem here is that the solver may be using time steps that are larger than the dosing interval, and missing important changes in the input. The fix is to specify the max_step option for the solver. As a rule of thumb, your simulations should always specify a max_step shorter than the minimum feature in the input sequence. In this case, we will specify a max_step of 0.1 hr which is short enough to not miss a change in the input.

2.1.4 Assignment 2

2.1.4.1 Exercise 1

The purpose of the dosing regime is to maintain the plasma concentration above the MBC level for at least 96 hours. Assuming that each dose is 64 mg, modify the simulation and find a value of $t_{dose}$ that satisfies the MBC objective for a 96 hour period. Show a plot concentration versus time, and include Python code to compute the total amount of antibiotic administered for the whole treatment.

2.1.4.2 Exercise 2

Consider a continous antibiotic injection at a constant rate designed to maintain the plasma concentration at minimum bactricidal level. Your solution should proceed in three steps:

  1. First, by hand, set up and solve the steady state equation to find the desired constant dosage rate.
  2. Modify the Python function for $u(t)$ to simulate the desired flowrate.
  3. Verify your result by repeating the above simulation using your function for $u(t)$.

< 2.0 Linear Process Models | Contents | Tag Index | 2.2 Properties of Scalar First Order Linear Systems >

Open in Colab

Download