Tutorials › Quantitative Systems Pharmacology (QSP) › Verifying Dosing Events and Discontinuous Inputs

Verification, Validation and Independent Validation · Tutorial 754 of 799

Verifying Dosing Events and Discontinuous Inputs

Use event-specific checks to distinguish an instantaneous dose from a continuous infusion and to detect timing, reset, and mass-balance errors.

Advanced 12 min read

What You'll Learn

  • Calculate the expected pre-event and post-event states for a bolus dose.
  • Check infusion start and stop times without treating them as instantaneous doses.
  • Verify repeated dose schedules while avoiding missed or duplicated events.
  • Account for deliberate state resets in jump and mass-balance checks.
  • Distinguish event errors from ordinary integration error near discontinuities.

Why dosing events need their own checks

A QSP simulation can integrate smoothly between events and still implement a regimen incorrectly. A bolus may be applied at the wrong time, an infusion may continue past its stop time, or a scheduled dose may be applied twice. These are not ordinary small errors in the differential equation solver: they change the input or state transition the model is meant to represent. Verification therefore requires checks aimed directly at discontinuities.

The key is to distinguish the state immediately before an event from the state immediately after it. For an instantaneous dose, the state may jump. For a finite-rate infusion starting or stopping, the infusion rate changes abruptly but the amount in the body ordinarily remains continuous. A programmed state reset is a separate kind of discontinuity and must be checked against its specified reset rule.

Definition: For a state \(x(t)\) and event time \(t_e\), \(x(t_e^-)\) denotes the left-hand limit, the state just before the event, and \(x(t_e^+)\) denotes the right-hand limit, the state just after it. The event jump is \(x(t_e^+)-x(t_e^-)\). A discontinuous input can change an input rate without producing a jump in the state.

The checks below assume that the event schedule, dose amount, units, target compartment, and any reset map are specified independently of the simulation output. They also assume that a state is interpreted consistently: for example, an amount is not confused with a concentration. If the model includes bioavailability or a dose conversion, the expected jump must include that specified transformation.

Bolus doses: verify the jump

Let \(A(t)\) be the amount of drug in a compartment, measured in mg. If a bolus of amount \(D\) mg is delivered directly to that compartment at \(t_e\), with no additional transformation, then the expected event rule is \(A(t_e^+)=A(t_e^-)+D\). The differential equation governs the evolution between events; the bolus is implemented as a separate jump condition.

$$ A(t_e^+)-A(t_e^-)=D $$

If the model represents the dose as entering a depot with bioavailability \(F\), the expected amount added to that depot is \(FD\), not \(D\). If the model uses concentration \(C=A/V\), with fixed volume \(V\), the corresponding concentration jump is \(D/V\) for direct delivery. These checks should use the model's actual state definition and dose convention.

Worked Example: Checking a Direct Bolus

In a hypothetical simulation, a direct bolus of 100 mg is scheduled for \(t=4\) h. The central amount just before the event is 20 mg, and the central volume is 20 L. The simulation reports 119.8 mg just after the event. Check the jump and its concentration implication.

The specified event requires a 100 mg increase. Thus the expected post-event amount is \(20+100=120\) mg, and the expected jump is \(120-20=100\) mg. The reported jump is \(119.8-20=99.8\) mg, which is 0.2 mg smaller than specified. This discrepancy should be compared with the implementation's event-handling precision and acceptance criteria; it should not be hidden by examining only the later trajectory.

With fixed volume 20 L, the pre-event concentration is \(20/20=1.00\) mg/L and the expected post-event concentration is \(120/20=6.00\) mg/L. The expected concentration jump is \(100/20=5.00\) mg/L. The reported amount would instead give \(119.8/20=5.99\) mg/L. Both amount and concentration checks point to the same small jump error, with their different units made explicit.

A local mass-balance check clarifies what to compare. Across an ideal instantaneous bolus, continuous rates contribute vanishingly little over a time interval that shrinks to zero. The finite change in the amount is therefore the discrete input. For a compartment with continuous input rate \(u(t)\) and elimination rate \(r(t)\), integrate over a short interval around the event and then let its width approach zero:

$$ A(t_e^+)-A(t_e^-) = \lim_{\epsilon\to 0} \int_{t_e-\epsilon}^{t_e+\epsilon} \bigl(u(t)-r(t)\bigr)\,dt +D =D $$

This argument assumes the continuous rates remain finite near \(t_e\). It justifies checking the jump separately from the ordinary between-event mass balance.

Infusions: verify rate changes and continuity

For a constant-rate infusion, the input \(R(t)\) has units of amount per time. Starting or stopping the infusion changes \(R(t)\) at a specified time, but does not instantaneously add the amount \(R\) to the state. Over an interval \([t_s,t_f)\), a rate \(R\) supplies total amount \(R(t_f-t_s)\), assuming no interruptions. At the start and stop, the amount state should be continuous unless the model specifies another event at the same time.

$$ A(t_e^+)=A(t_e^-), \qquad \text{and} \qquad \int_{t_s}^{t_f} R\,dt=R(t_f-t_s) $$

The interval convention matters. Here the infusion is active from its start time \(t_s\) up to, but not including, its stop time \(t_f\). A different convention can be valid, but it must be applied consistently, particularly when a bolus and an infusion boundary share a timestamp.

Worked Example: Checking an Infusion Start, Stop, and Mass Balance

Consider a hypothetical one-compartment amount model with \(dA/dt=R-kA\). At \(t=2\) h, \(A=50\) mg. A 12 mg/h infusion is scheduled from \(t=2\) h to \(t=5\) h, and \(k=0.2\) h\(^{-1}\). Check the expected amount at the stop time and the total eliminated amount during the infusion.

At \(t=2\) h, the infusion rate changes from zero to 12 mg/h, but the amount does not jump: \(A(2^+)=A(2^-)=50\) mg. During the three-hour infusion, the solution of the stated differential equation is

$$ A(5^-)=A(2)e^{-k(5-2)}+\frac{R}{k}\left(1-e^{-k(5-2)}\right) $$

Substitution gives \(A(5^-)=50e^{-0.6}+60(1-e^{-0.6})\). Since \(e^{-0.6}\approx0.5488\), this is \(27.44+27.07=54.51\) mg. Turning off the infusion at \(t=5\) h does not itself remove drug, so \(A(5^+)=54.51\) mg, while the input rate changes from 12 mg/h to zero.

The infusion supplies \(12\times3=36\) mg. The amount balance over the interval is initial amount plus input minus elimination, giving total elimination \(50+36-54.51=31.49\) mg. This also follows by integrating the elimination rate: \(0.2\int_2^5 A(t)\,dt=31.49\) mg (rounding to two decimal places). A simulation that ends the infusion late will generally show excess input; one that starts it late will show deficient input. The balance check helps quantify the resulting error.

Repeated schedules and reset maps

Repeated events should be checked one by one, not only through a final concentration. For each scheduled dose, verify the timestamp, the number of applications, the target state, and the expected jump. Between doses, verify the model's continuous dynamics. This separates an event-counting mistake from a problem with the differential equation or solver.

Worked Example: Verifying a Repeated Bolus Schedule

A hypothetical amount state follows \(dA/dt=-0.1A\), with no other input or loss, and receives 40 mg boluses at 0, 8, and 16 h. Initially \(A(0^-)=0\) mg. Calculate the amounts immediately after each scheduled dose and just before the second and third doses.

At 0 h, \(A(0^+)=0+40=40\) mg. Between events, the solution is \(A(t)=A(t_0^+)e^{-0.1(t-t_0)}\). Just before 8 h, \(A(8^-)=40e^{-0.8}\approx17.97\) mg; the second dose then gives \(A(8^+)=17.97+40=57.97\) mg.

Just before 16 h, \(A(16^-)=57.97e^{-0.8}\approx26.05\) mg, using the unrounded value in the calculation. The third dose gives \(A(16^+)=26.05+40=66.05\) mg. Each jump should be 40 mg, and the decay between jumps should follow the specified exponential solution. A missing dose, duplicate dose, or shifted event time violates at least one of these checks, even if a later output happens to look plausible.

A reset is not automatically a dose. It is a specified mapping from the pre-event state to the post-event state. For a state vector \(x\), write this as \(x(t_e^+)=G(x(t_e^-))\), where \(G\) is the model's reset rule. For a conserved amount, any decrease caused by the reset must be represented as a removal or sink in the event balance. For a non-mass state, such as a dimensionless signaling variable reset to baseline, a physical mass balance may not apply; the reset mapping itself is still testable.

Worked Example: Accounting for a Reset

Suppose a hypothetical amount state is 25 mg immediately before a programmed reset at \(t=10\) h, and the specified rule sets it to 10 mg. Check the jump and identify the mass-balance implication.

The expected jump is \(10-25=-15\) mg. If the reset represents removal from the modeled compartment, the event has a 15 mg discrete sink. The event balance is therefore \(25-15=10\) mg. A simulation reporting 25 mg after the reset has failed to apply the rule; one reporting 5 mg has removed 20 mg rather than the specified 15 mg. If the reset is merely an artificial numerical operation on a quantity that represents physical mass, it still changes the mass balance and must not be mistaken for a mass-conserving transition.

A practical verification sequence

For every discontinuity, record the event specification and compare the simulated left- and right-hand values with the expected rule. A useful event ledger contains the scheduled time, event type, target state or input, expected jump or rate change, and observed pre- and post-event values. The following sequence makes the check reproducible:

1
List the event specification.
Record the time, dose or rate, units, target compartment, and any event-ordering convention. For a reset, write down its mapping explicitly.
2
Inspect both sides of the event.
Obtain \(x(t_e^-)\) and \(x(t_e^+)\) separately. A saved output only at widely spaced observation times may conceal a misplaced or missed event.
3
Check the event rule and units.
Compare observed jumps with the prescribed bolus or reset map; for an infusion, check the rate change and state continuity. Convert amount to concentration only using the stated volume.
4
Check the local balance and the schedule.
Account for continuous inputs and losses over intervals, and confirm each repeated event occurs exactly once at its intended time.

A solver that steps across an event without placing a step boundary there can smear an input or evaluate the wrong rate on part of a step. For verification, event times should be represented explicitly as integration boundaries, or handled by a documented event mechanism that gives the same left- and right-hand semantics. Tightening tolerances or reducing the step size can reveal sensitivity to event handling, but it does not by itself prove that the event schedule is correct.

Diagnostics, alternatives, and limitations

Several patterns help localize failures. A correct bolus time but incorrect jump points toward dose conversion, target-state, or event-application logic. A correct jump at the wrong time suggests schedule or time-unit errors. A continuous amount with an incorrect infusion rate interval points toward start/stop logic. A correct event ledger but a growing between-event mass-balance residual points instead toward continuous fluxes or numerical integration. Compare results at event boundaries, not just at routinely sampled times.

Event-specific checks complement, rather than replace, other verification approaches. An analytical reference solution is useful when a simple between-event model has a closed-form solution, as in the repeated-dose example. A mass-balance check is useful when total inputs and outputs are known, but cannot by itself establish that the correct species or compartment received a dose. Convergence checks assess sensitivity to numerical settings; they can show that a trajectory stabilizes without detecting a stable but incorrectly timed event. No single check establishes every aspect of correctness.

A common mistake is to treat an infusion rate as an amount and add it to the state at infusion start. The incorrect reasoning is, “the rate is 12 mg/h, so the amount jumps by 12 mg.” The correction is that 12 mg/h is delivered over time: over three hours it supplies 36 mg, while the amount remains continuous at the start and stop. Another pitfall is checking only an endpoint. A missed early dose and a duplicated later dose can partially offset at that endpoint, while the individual event checks expose both errors.

These checks depend on knowing the intended schedule and reset semantics. They cannot determine whether the regimen is clinically appropriate, whether a biological mechanism is valid, or whether an event is adequately represented by an instantaneous jump rather than a finite-duration process. Simultaneous events also require an explicit ordering rule when their mappings do not commute. If two reset or dose operations act on the same state, applying them in different orders can produce different results; the implementation and specification must agree on the order.

Key takeaway: Verify discontinuities locally. Check event time, pre- and post-event states, the prescribed jump or rate change, and the associated input-output balance. A smooth trajectory between events does not establish that the events themselves were implemented correctly.

Check Your Understanding

Work each problem using the stated event conventions. Solutions follow each question.

  1. A compartment contains 12 mg immediately before a direct 30 mg bolus. What are the expected post-bolus amount and jump? Solution: The expected amount is \(12+30=42\) mg, and the jump is \(42-12=30\) mg.
  2. An infusion of 8 mg/h runs from 1 h to 4 h. What is its total delivered amount, and should the amount state jump at 4 h? Solution: The duration is \(4-1=3\) h, so the delivered amount is \(8\times3=24\) mg. The amount state should be continuous at 4 h; the infusion rate changes to zero.
  3. A 20 mg bolus is scheduled at both 0 h and 6 h. With no loss between doses and initial amount zero, what amount should be present immediately after the second dose? Solution: The first dose produces 20 mg. With no loss, 20 mg remains before 6 h; adding the second 20 mg gives 40 mg after the second dose.
  4. A reset changes a conserved amount from 18 mg to 11 mg. What discrete removal must be included in the event balance? Solution: The jump is \(11-18=-7\) mg, so the event removes 7 mg. The balance is \(18-7=11\) mg.
  5. A simulation's amount is continuous at infusion start, but the input rate changes two hours later than scheduled. Which part of the event check fails? Solution: Continuity at infusion start is consistent with an ordinary infusion, but the event-time check fails: the rate transition occurred late. The delivered amount over the intended interval will therefore be wrong unless another schedule feature compensates for it.
Clinical Biostats