Events

# First load the model
dataModel = CCopasiRootContainer.addDatamodel()

# import your model from SBML

dataModel.importSBML("BIOMD152.xml") # ModelA from Fernandez 2006

# or load from a COPASI file

# dataModel.loadModel("dataModelz2.cps") # ModelA from Fernandez 2006

 

# Get the events

model = dataModel.getModel()

olay = model.getEvents()

L=olay.size()

 

# Display the events and its components

 for i in range(0,L):

    ADA=olay.get(i)

    ADB=ADA.getSBMLId() # name of the event

    ADC=ADA.getObjectName()#name of event

    ADD=ADA.getTriggerExpression() #gives the time when the event will fire 

    key=ADA.getKey() # need this to remove the event

    ADE=ADA.getAssignments().get(0).getExpression() #gives the assigned value

    # get(0) gets the first assignment

    ADF=ADA.getAssignments().get(0).getTargetObject() # 

    ADG=ADF.getObjectDisplayName() # prints affected variable!!!!!!!!!

    print ADB # ADC prints the name name

    print ADD # time

    print ADE # value when event fires

    print ADG # name of the target variable in format Value[MyTarget]

 

# PP 08/01/2013