# Concentration–time curve of a one- or two-compartment model for a stated regimen

`pk_compartment_simulate` · Runs: On the server · Level: Checked against a reference: a 40-digit matrix exponential, each value compared with PKPDsim 1.4.1

Works out the concentrations of a one- or two-compartment model at stated times for a dosing regimen.

Research and education software; not medical advice, and not for diagnosis or treatment decisions. It computes from the inputs it receives. It does not check the person's data, design or sample.

[Catalogue](https://www.drybench.com/mcp/catalogue) / [Pharmacokinetics](https://www.drybench.com/mcp/catalogue/pharmacokinetics)

[Ask your assistant](https://www.drybench.com/mcp/connect)

```cite
Concentration–time curve of a one- or two-compartment model for a stated regimen (pk_compartment_simulate), Drybench MCP server 1.0.0; pk-compartment-simulate@2.0.2 (Checked against a reference); https://www.drybench.com/mcp/tools/pk-compartment-simulate
```

## What it is

Returns a one- or two-compartment model's concentrations at stated times for a bolus, infusion or oral regimen. Use when the model's parameters and the doses are known and the curve is wanted; closed forms summed over the doses. Not for converting parameters: use \`pk\_two\_compartment\_constants\`, or use \`pk\_one\_compartment\_parameters\` for one compartment; it fits nothing and computes no dose. Refuses parameters that do not belong to the model or route, overlapping infusions and more than 1000 doses; every value needs its unit.

Field: [Pharmacokinetics and DMPK](https://www.drybench.com/mcp/catalogue/pharmacokinetics).

## What it does

**You give**

- `model` (required): The compartment model.
- `route` (required): How each dose is given.
- `parameters` (required): The model's parameters: CL and V for one compartment; CL, V1, Q and V2 for two. A parameter of the other model is refused, not ignored.
- `doses` (required): The doses, in increasing time.
- `times` (required): The output times, strictly increasing, none before the first dose.
- `absorptionRateConstant`: First-order absorption rate constant (ka); first\_order\_absorption only. Must be above 0 1/h. Optional.

and 2 more, listed below

No request is recorded for this tool.

**Limits**

- Pharmacokinetics and DMPK: research arithmetic on concentrations, times and parameters you supply; not a dosing, clinical, welfare or diagnostic authority.
- No tool here outputs or recommends a dose, and no result is a prediction for any person or animal.
- Concentrations from the one- or two-compartment model and parameters you supply, summed over the doses you state (linear, time-invariant kinetics; no lag time; a dose at an output time is applied before that time's value; only a bolus makes the concentration jump: at a bolus instant after the first dose the value is the one just after the dose and the value just before it is given beside it, while an infusion or oral dose contributes zero at its dose time, so no value before is given there).
- A model curve, not a prediction for any subject and not a regimen recommendation.
- Research arithmetic; not a dosing, clinical, welfare or diagnostic authority.
- Every computed number a reply returns, other than an integer or an exact decimal, is rounded once to 12 significant figures: to the nearest, a change of at most 5 × 10⁻¹² of its value, except that a lower bound is rounded down and an upper bound up, a change of less than 1 × 10⁻¹¹; the method computes, and decides any pass or fail, on the unrounded value.

**It will not answer when**

- a parameter of the other model is given: refused, not ignored.
- a parameter of the chosen model is missing.
- an absorption rate constant or bioavailability with an intravenous route, or an infusion duration with another route.
- first\_order\_absorption without ka or F, or iv\_infusion without its duration.

### Every input, with its units

8 inputs

- `model` (required): The compartment model.
- `route` (required): How each dose is given.
- `parameters` (required): The model's parameters: CL and V for one compartment; CL, V1, Q and V2 for two. A parameter of the other model is refused, not ignored.
- `doses` (required): The doses, in increasing time.
- `times` (required): The output times, strictly increasing, none before the first dose.
- `absorptionRateConstant`: First-order absorption rate constant (ka); first\_order\_absorption only. Must be above 0 1/h. Optional.
- `bioavailability`: Fraction of each oral dose absorbed (F), stated; first\_order\_absorption only. Must be above 0 and at most 1. Optional.
- `infusionDuration`: Duration of each infusion; iv\_infusion only. Must be above 0 h. Optional.

### Every refusal, with its code

10 refusals

| Code | When |
| --- | --- |
| `ARGUMENT_NOT_FOR_MODEL` | a parameter of the other model is given: refused, not ignored. |
| `ARGUMENT_REQUIRED_FOR_MODEL` | a parameter of the chosen model is missing. |
| `ARGUMENT_NOT_FOR_ROUTE` | an absorption rate constant or bioavailability with an intravenous route, or an infusion duration with another route. |
| `ARGUMENT_REQUIRED_FOR_ROUTE` | first\_order\_absorption without ka or F, or iv\_infusion without its duration. |
| `TOO_MANY_DOSES` | more than 1000 doses (the compute band). |
| `DOSE_TIMES_NOT_INCREASING` | dose times not strictly increasing. |
| `DIMENSIONS_MIXED` | doses in both mass and amount of substance: no molar mass is assumed. |
| `INFUSIONS_OVERLAP` | an infusion starts before the previous one ends (starting exactly at its end is allowed). |
| `OUTPUT_TIMES_NOT_INCREASING` | output times repeated or not in increasing order. |
| `TIME_BEFORE_FIRST_DOSE` | an output time before the first dose: the model assumes no drug before the first stated dose; a zero there would read as a statement about exposure the caller has not made. |

## The calculation

The method's equations, constants and worked example.

### [Concentrations of a one- or two-compartment model for a stated regimen](https://www.drybench.com/methods/m/pk-compartment-simulate/2.0.2)

`pk-compartment-simulate@2.0.2`

**Equation 1**

```text
per unit amount, C(s) = Σ_i c_i·e^(−λ_i s): one compartment c = 1/V, λ = CL/V
two compartments c = (A, B)/dose and λ = (α, β) of pk-two-compartment-constants
```

| Symbol | Meaning |
| --- | --- |
| `c_i` | coefficient per unit amount dosed, 1/L |
| `λ_i` | exponent, 1/h |
| `s` | time since the dose, h |

Source 1.

**Equation 2**

```text
C(s) = D·Σ c_i·e^(−λ_i s)
```

| Symbol | Meaning |
| --- | --- |
| `C` | concentration at time since the dose (or in nM), mg/L |
| `D` | the dose (or in nmol), mg |

Source 1.

**Equation 3**

```text
R = D/T
C(s) = R·Σ c_i·(1 − e^(−λ_i s))/λ_i for s ≤ T, and R·Σ c_i·(1 − e^(−λ_i T))/λ_i·e^(−λ_i (s − T)) after
```

| Symbol | Meaning |
| --- | --- |
| `R` | infusion rate (or in nmol/h), mg/h |
| `T` | infusion duration, h |

Source 2.

**Equation 4**

```text
C(s) = F·D·ka·Σ c_i·(e^(−λ_i s) − e^(−ka·s))/(ka − λ_i), and at ka = λ_i the limit F·D·ka·c_i·s·e^(−λ_i s)
```

| Symbol | Meaning |
| --- | --- |
| `F` | fraction absorbed |
| `ka` | absorption rate constant, 1/h |

Source 3.

**Equation 5**

```text
C(t) = Σ over doses d with t_d ≤ t of C_d(t − t_d), each response zero before its dose: the record's statement of linear time-invariant superposition. Only a bolus makes the concentration jump. Where an iv_bolus dose other than the first is given at an output time (the two times equal in hours after the kit's exact conversion), the value at t includes that dose, and concentrationBeforeDose gives the sum over doses with t_d < t. An infusion or oral dose contributes zero at its dose time and the concentration is continuous there, so concentrationBeforeDose never appears on those routes
nor at the first dose on any route, since no drug is assumed before it
```

| Symbol | Meaning |
| --- | --- |
| `C` | concentration at the output time (or in nM), mg/L |
| `t` | output time, h |
| `t_d` | dose time, h |

Source not recorded.

**Conventions**

- model = one\_compartment: One central compartment with first-order elimination: parameters CL and V.
- model = two\_compartment: A central and a peripheral compartment, elimination from the central one: parameters CL, V1, Q and V2.

A definition, not a model: the equation states what the quantity means. A different convention gives a different number.

**Worked example**

Worked example: one case of pk-compartment-simulate\@2.0.2, from its inputs through each step to the answer. Values are written as a person writes them; the working carries more digits, so your own figure may differ in the last digit shown.

**Inputs**

- model = one\_compartment
- route = iv\_bolus
- parameters.clearance = 2.5 L/h
- parameters.volume = 30 L
- doses\[0\].time = 0 h
- doses\[0\].amount = 100 mg
- times\[0\] = 0 h
- times\[1\] = 0.5 h
- times\[2\] = 1 h
- times\[3\] = 2 h
- times\[4\] = 4 h
- times\[5\] = 8 h
- times\[6\] = 12 h
- times\[7\] = 24 h
- times\[8\] = 48 h

**Steps**

1. lambda = 0.083333333 1/h, from parameters.clearance, parameters.volume; by equation 1.
2. c1 = 0.033333333 1/L, from parameters.volume; by equation 1.
3. c-0 = 3.3333333 mg/L, from doses\[0\].amount, c1, times\[0\]; by equation 2; gives concentrations\[0\].concentration.
4. c-half = 3.1972982 mg/L, from c-0, lambda, times\[1\]; by equation 2; gives concentrations\[1\].concentration.

The working, as the case writes it:

```text
k = 2.5/30 = 0.0833333 1/h
C(0.5 h) = (100/30)·e^(−0.0416667) = 3.333333 × 0.9591894 = 3.197298 mg/L
C(0) = 100/30 = 3.333333 mg/L
```

**Answer**

- concentrations\[0\].concentration = 3.3333333 mg/L
- concentrations\[1\].concentration = 3.1972982 mg/L

Where these values came from: an outside program, PKPDsim 1.4.1; 40-digit matrix exponential of the compartment equations; the 40-digit Taylor integration agrees within 5.1e-41 relative; every value confirmed by PKPDsim 1.4.1's library model within 8.4e-14 relative at its nonzero outputs (the worst over the file is in about.crossCheck).

At build the tool returned this answer within the tolerance the file states: relative 1e-10 against a 40-digit solution of the compartment equations, absolute 1e-20 below 1e-10 in the elements' unit; every concentration confirmed by PKPDsim 1.4.1 within 1e-8 relative; times relative 1e-12 (absolute 1e-22 h below 1e-10 h), since a time in minutes is converted; statuses, codes and units exact.

Who worked this case: not recorded.

## Sources

1. Bourne DWA. Basic Pharmacokinetics, online textbook (boomer.org/c/p4), Chapter 4, One Compartment IV Bolus Used for: Concentrations of a one- or two-compartment model for a stated regimen. At: p. Chapter 4, page 6 (Apparent Volume of Distribution), section as stated in Bourne: Equation 4.6.6, Cp = (Dose/V)·e^(−kel·t) (image Fig24.gif, SHA-256 8119096da4e9a81bf767d2fbc354efa131758232bba91e0e47da7a5da0a2a951), with kel = CL/V as in pk-one-compartment-parameters (Eq. 4.8.5); two compartments through pk-two-compartment-constants (Bourne, Chapter 19, page 2, Eqs. 19.2.2 to 19.2.4); writing each as a sum of coefficients per unit amount times exponentials is the record's; p. Chapter 4, page 6 (Apparent Volume of Distribution), section as stated in Bourne: Equation 4.6.6, Cp = (Dose/V)·e^(−kel·t) (image Fig24.gif, SHA-256 8119096da4e9a81bf767d2fbc354efa131758232bba91e0e47da7a5da0a2a951); for two compartments Bourne, Chapter 19, page 2, Equation 19.2.3 (Fig3023.gif, SHA-256 b9008a830e1157fab461b90925a5bb2a12f334d4324c74921a923c591422c6a3), through pk-two-compartment-constants. **Read in full, 17 November 2026**
2. Bourne DWA. Basic Pharmacokinetics, online textbook (boomer.org/c/p4), Chapter 6, Intravenous Infusion Used for: Concentrations of a one- or two-compartment model for a stated regimen. At: p. Chapter 6, page 6 (Post Infusion), section as stated in Bourne, one compartment: Equation 6.6.1, Cp = (k0/(kel·V))·\[1 − e^(−kel·t)\] during the infusion (image Fig1504.gif, SHA-256 1f6c514a635b7693ff358201fc66707c98d951585f350a14009771ff78a2d120), Equation 6.6.2, its value at the end D (fig0601.png, SHA-256 78e320eea1b2130c797ce702343bc7b7dfaabd37ee3e2c715ccfa0a63354c9da), and Equations 6.6.3 and 6.6.4, Cp = (k0/(kel·V))·\[1 − e^(−kel·D)\]·e^(−kel·(t − D)) after it (Fig0602.jpg, SHA-256 b5d6182b5ad0f765dac1353c31dcd3fdcc63d99b45a0c5f9eeb0d39539dd77c6; Fig0603.jpg, SHA-256 3f8a895abb73e54d3f50d0f4fe8bf1f95e2b515d2370366a37305f5b2551c5d2), Bourne's k0 the rate and D the duration (the record's R and T). For two compartments the record applies the same form to each exponential term c\_i·e^(−λ\_i s) of the bolus response (its derivation by convolution, accepted in this project's scientific review of 10 November 2026); the book prints no two-compartment infusion form. **Read in full, 17 November 2026**
3. Bourne DWA. Basic Pharmacokinetics, online textbook (boomer.org/c/p4), Chapter 8, Pharmacokinetics of Oral Administration Used for: Concentrations of a one- or two-compartment model for a stated regimen. At: p. Chapter 8, page 3 (Integrated equation), section as stated in Bourne, one compartment: Equation 8.3.1, Cp = (F·Dose·ka/(V·(ka − kel)))·\[e^(−kel·t) − e^(−ka·t)\] (image Fig1706.gif, SHA-256 437387298ff9d6d9ea543ac3babd04f6c48bee67f44eb1ef7281a2ddc1249a2a), and its kel = ka = k case, Equation 8.3.5, Cp = (F·Dose·k/V)·t·e^(−k·t) (Eq080305.png, SHA-256 19b742e815c5679b78e599d71b5a0727362112e8520a7ea88dbb76eddf66820d). For two compartments the record applies the same form to each exponential term c\_i·e^(−λ\_i s) (its derivation by convolution); the two-compartment limit at ka = α or β and the divided difference are the record's derivation; the book prints the two-compartment oral curve only as A·e^(−αt) + B·e^(−βt) + C·e^(−ka·t) with A + B + C = 0 (Chapter 19, page 7), without its coefficients. **Read in full, 17 November 2026**

Read by AI-assisted sessions. No person has checked these readings.

## How it is checked

**Level:** Checked against a reference.

**Checked against:** Our own exact-arithmetic script and a hand-worked case; an outside program, PKPDsim, 1.4.1.

**Cases:** No case set is linked to this version.

**Not checked:** Three compartments, lag times, time-varying or dose-dependent parameters (none offered). A concentration above 0 on the stated values (a bolus at or before the output time, or an infusion or oral dose strictly before it) that comes out as exactly 0 in double precision, its exponents λ·s above about 745, is refused as RESULT\_OUTSIDE\_DOUBLE\_RANGE, never served as 0.

No independent scientist has yet reviewed this.

### What was not checked, in full

from the method records

- Three compartments, lag times, time-varying or dose-dependent parameters (none offered).
- A concentration above 0 on the stated values (a bolus at or before the output time, or an infusion or oral dose strictly before it) that comes out as exactly 0 in double precision, its exponents λ·s above about 745, is refused as RESULT\_OUTSIDE\_DOUBLE\_RANGE, never served as 0.
- So is a normal concentration formed through a value below the normal range: an intermediate of the two-compartment terms as pk-two-compartment-constants flags it (k12·k21 subnormal, say), an exponent λ that is not normal, or a term one of whose factors or partial products (a coefficient, the amount, e^(−λs), the oral divided difference, the infusion's 1 − e^(−λs)) is above 0 on the stated values but came out 0 or subnormal, where that term's bound could move the value by more than 2^−54 of it.
- Such a term below that bound is kept as negligible.
- No reordering is attempted.

### What this project's records still lack

1 thing

- The source's location for each equation for pk-compartment-simulate\@2.0.2.

### Changes to its methods

0 changes

No change is logged for these method versions.
