Events
Contain all event objects
Description
Property to indicate events in a model object. Read-only array
of Event
objects.
An event defines an action when a defined condition is met.
For example, the quantity of a species may double when the quantity
of species B
is 100
. An event
is triggered when the conditions specified in the event are met by
the model. For more information, see Events and Events in SimBiology Models.
Add an event to a Model
object with the method addevent (model)
method and remove an event with the delete
method. See SimBiology.Event
for more information.
You can view event object properties with the get
command and modify the properties
with the set
command.
Characteristics
Applies to | Object: model |
Data type | Array of event objects |
Data values | Event object. The default is [] (empty). |
Access | Read-only |
Examples
Add an Event
Create a simple model with a mass action reaction A -> B
, where A and B are species. Also add the reaction rate parameter, p1, with a parameter value of 0.5.
model = sbiomodel('example'); r1 = addreaction(model,'A -> B'); kl = addkineticlaw(r1,'MassAction'); p1 = addparameter(model,'p1',0.5); kl.ParameterVariableNames = 'p1';
Increase the amount of species A to 100 at time = 2. You can do this by adding an event object to the model. You must specify the event trigger (time >= 2
), and also the event function, which defines what happens when the event is triggered. In this example, the event function is A = 100
.
e1 = addevent(model,'time>=2','A = 100');
Simulate the model, and plot the result.
sd = sbiosimulate(model); sbioplot(sd);