Module equation
Expand description
Handwritten equation families and their shared simulation interfaces.
This module is the public home for handwritten ODE, Analytical, and
SDE models, plus the shared Equation trait and the metadata types
that attach public names to parameters, states, routes, and outputs.
Use this module when you want to:
- choose between deterministic ODE, analytical, and stochastic SDE models
- attach metadata so dataset labels such as
"iv"and"cp"resolve by name instead of by dense numeric index - work with prediction or likelihood APIs across equation families
§Equation Families
ODEfor deterministic models that must be numerically integrated.Analyticalfor supported closed-form models.SDEfor stochastic models that use particles.
§Labels And Metadata
Input and output labels arrive from public data APIs as strings.
- Without metadata, handwritten models fall back to numeric labels such as
0or1. - With
metadata::ModelMetadataattached, route and output labels are resolved by name against the declared routes and outputs before simulation.
That label-first path is the preferred public workflow for current authoring.
§Example
use pharmsol::{metadata, ModelKind};
let metadata = metadata::new("one_cmt")
.kind(ModelKind::Ode)
.parameters(["cl", "v"])
.states(["central"])
.outputs(["cp"])
.route(metadata::Route::infusion("iv").to_state("central"))
.validate()
.unwrap();
assert_eq!(metadata.route("iv").unwrap().destination(), "central");
assert!(metadata.output("cp").is_some());Modules§
- analytical
- metadata
- Metadata builders and validated metadata views for handwritten models.
- ode
- sde
Structs§
- Analytical
- Model equation using analytical solutions.
- Covariate
- One named covariate plus interpolation semantics.
- Model
Metadata - Builder for handwritten model metadata.
- ODE
- Output
- One named output in model order.
- Parameter
- One named parameter in model order.
- Route
- One named route declaration.
- SDE
- Stochastic Differential Equation solver for pharmacometric models.
- Validated
Model Metadata - Validated metadata view used by the execution layer.
- Validated
Route - One validated route declaration with resolved execution details.
Enums§
- Analytical
Kernel - Analytical
Metadata Error - EqnKind
- Runtime family tag for handwritten equations.
- Explicit
RkTableau - Tableau for
OdeSolver::ExplicitRk. - Model
Kind - Model
Metadata Error - Validation errors for handwritten model metadata.
- Name
Domain - Name domain used in duplicate-name validation messages.
- OdeMetadata
Error - OdeSolver
- ODE solver selection.
- Route
Input Policy - How route inputs should be interpreted by the execution layer.
- Route
Kind - Route declaration kind.
- SdeMetadata
Error - Sdirk
Tableau - Tableau for
OdeSolver::Sdirk.
Traits§
- Cache
- Trait for enabling prediction caching on equation types.
- Equation
- Trait for handwritten model equations that can be simulated.
- Equation
Types - Associated state and prediction container types for an equation family.
- Predictions
- Trait for prediction containers.
- State
- Trait for state vectors that can receive bolus doses.
Functions§
- new
- Shorthand for
ModelMetadata::new. - one_
compartment - Analytical solution for one compartment model.
- one_
compartment_ cl - Analytical solution for one compartment model parameterized by clearance.
- one_
compartment_ cl_ with_ absorption - Analytical solution for one compartment model with first-order absorption, parameterized by clearance.
- one_
compartment_ with_ absorption - Analytical solution for one compartment model with first-order absorption.
- pm_
one_ compartment - pm_
one_ compartment_ cl - pm_
one_ compartment_ cl_ with_ absorption - pm_
one_ compartment_ with_ absorption - pm_
three_ compartments - pm_
three_ compartments_ cl - pm_
three_ compartments_ cl_ with_ absorption - pm_
three_ compartments_ with_ absorption - pm_
two_ compartments - pm_
two_ compartments_ cl - pm_
two_ compartments_ cl_ with_ absorption - pm_
two_ compartments_ with_ absorption - three_
compartments - Analytical for three compartments Assumptions:
- three_
compartments_ cl - Analytical solution for three compartment model parameterized by clearances.
- three_
compartments_ cl_ with_ absorption - Analytical solution for three compartment model with first-order absorption, parameterized by clearances.
- three_
compartments_ with_ absorption - Analytical solution for three compartment model with first-order absorption. Assumptions:
- two_
compartments - Analytical solution for two compartment model.
- two_
compartments_ cl - Analytical solution for two compartment model parameterized by clearances.
- two_
compartments_ cl_ with_ absorption - Analytical solution for two compartment model with first-order absorption, parameterized by clearances.
- two_
compartments_ with_ absorption - Analytical solution for two compartment model with first-order absorption.