Abed Alnaif in MATLAB Answers
Última actividad el 27 de En. de 2023

Hello, I'm trying to keep track of the max value of a variable during simulation. I'm currently doing this using an event, as follows: mdl.addevent('A > maxA',{'maxA = A'}) However, this isn't working. I believe the reason it's not working is because events are only trigerred on rising edges, and thus maxA doesn't track A as A rises gradually. Is there a way to accomplish tracking of the maximum value of a variable during a simulation? Since I am using maxA during the simulation, I cannot calculate it post-hoc (i.e., can't use an observable). Thank you! Abed
Abed Alnaif in MATLAB Answers
Última actividad el 3 de Dic. de 2019

Hello, Is there a good way to stop a simulation early if an event occurs; i.e., stop the simulation as soon as the event is triggered? Also, I'd like to do this in a way that causes the objective function value to be infinite when using 'sbiofit'. Thank you, Abed
Bernard in MATLAB Answers
Última actividad el 1 de Dic. de 2015

The Help file suggests that this should be possible. I am trying this with set(CompartmentName, 'Capacity', ParameterName) as the event function. The compartment, CompartmentName, has the appropriate units and is not ConstantCapacity. The parameter, ParameterName, is scoped to the model and has appropriate units. Verification fails as dimensional analysis cannot cope with set(). I can work around this in an adequate manner generating a SimBiology model object through M code but I wanted to know if this can be performed using the sbiodesktop interface.
al in MATLAB Answers
Última actividad el 8 de Sept. de 2014

I am wondering if it's possible to define time delay as an event for a trigger in simbiology. I want to define a duration of 2 hours for one stage of the system. For example, when species_1 gets a certain value (like species_1 == 5), I need the system to stay in this state for 2 hours and afterwards species_1 =0 and species_2 = 1 (while some other species are interacting with each other independent of this process). I defined a function as event and used "tic toc" to make a delay after trigger, but even though this provides a delay, the amount of corresponding species are changed at the beginning of delay not at the end! Can somebody help me with this? thanks
Omar in MATLAB Answers
Última actividad el 12 de Sept. de 2011

Hi there, I'm simulating a model with 2 events from the Simbiology desktop and it runs smoothly. However, when trying to do so from the MatLab desktop with sbiosimulate(obj) the simulation runs OK but the events never take place. Both events are active: >> obj.Events(1).Active ans = 1 >> obj.Events(2).Active ans = 1 The solver used is 'sundials'. What am I missing here? Thanks in advance, Omar