Main Content

adddose

Add dose object to model

Description

outDose = adddose(modelObj,doseName) creates a SimBiology.RepeatDose object outDose, assigns doseName to the dose property Name, adds the dose object to the SimBiology® model object modelObj, and assigns modelObj to the dose property Parent. To apply the dose in your simulation, set the Active property of outDose to true.

Note

Alternatively, you can create a dose object using sbiodose as a standalone dose object, which you can apply to different models. For details, see Creating Doses Programmatically.

example

outDose = adddose(modelObj,doseName,doseType) also specifies the type of dose to create and add to the model.

example

outDose = adddose(modelObj,doseName,inDose) adds an existing dose object inDose to the model, copies the dose object to the second dose object outDose, and assigns modelObj to the outDose property Parent.

Examples

collapse all

This example shows how to add a constant-rate infusion dose to a one-compartment model.

Background

Suppose you have a one-compartment model with a species named drug that represents the total amount of drug in the body. The drug is removed from the body via the first-order elimination represented by the reaction drug -> null, with the elimination rate constant ke. In other words, the drug concentration versus the time profile follows the monoexponential decline Ct=C0e-ket, where Ct is the drug concentration at time t, C0 is the initial concentration, and ke is the elimination rate constant. This example shows how to set up such a one-compartment model and add an infusion dose at a constant rate of 10 mg/hour for the total dose amount of 250 mg.

Create a One-Compartment Model

Create a SimBiology model named onecomp.

m1 = sbiomodel('onecomp');

Define the elimination of the drug from the system by adding a reaction drug -> null to the model.

r1 = addreaction(m1,'drug -> null');

The species drug is automatically created and added to the compartment. The null species is a reserved species that acts as a sink in this reaction.

Add a mass action kinetic law to the reaction. This kinetic law defines the drug elimination to follow the first-order kinetics.

k1 = addkineticlaw(r1,'MassAction');

Define the elimination rate parameter ke and add it to the kinetic law.

p1 = addparameter(k1,'ke','Value',1.0,'ValueUnits','1/hour');

Specify the rate parameter ke as the forward rate parameter of the reaction by setting the ParameterVariableNames property of kinetic law object k1. This allows SimBiology to determine the reaction rate for drug -> null reaction.

k1.ParameterVariableNames = 'ke';

Set Up an Infusion Dose

Add a dose object to the model using the adddose method. Specify the amount of the dose (Amount), the dose target (TargetName), and the infusion rate (Rate). You also need to set the Active property of the dose object to true so that the dose is applied to the model during simulation.

d1 = adddose(m1,'InfusionDose');
d1.Amount = 250;
d1.TargetName = 'drug';
d1.Rate = 10;
d1.RateUnits = 'milligram/hour';
d1.Active = true;

Simulate the Model

Change the simulation stop time to 48 hours to see the complete time course. Set the compartment unit to liter.

cs = getconfigset(m1);
cs.StopTime = 48;
cs.TimeUnits = 'hour';
c1 = m1.Compartments;
c1.Units = "liter";
sd = sbiosimulate(m1);

Plot Results

Plot the concentration versus the time profile of the drug in the system.

sbioplot(sd);

Figure contains an axes object. The axes object with title States versus Time, xlabel Time, ylabel States contains an object of type line. This object represents drug.

Input Arguments

collapse all

SimBiology model, specified as a Model object.

Name of the dose object to add to the model, specified as a character vector or string scalar.

Data Types: char | string

Type of the dose object, specified as "repeat" or "schedule". By default, the function creates and adds a SimBiology.RepeatDose object. Use "schedule" to add a SimBiology.ScheduleDose object instead.

Data Types: char | string

Dose to add to the model, specified as a SimBiology.RepeatDose or SimBiology.ScheduleDose object.

Output Arguments

collapse all

Added dose, returned as a SimBiology.RepeatDose or SimBiology.ScheduleDose object.

Version History

Introduced in R2010a

expand all