- stage is used to ensure that the second event triggers at the correct time
- stage_start_time stores the time the event is triggered. This is needed to calculate the time the second event should be started at the stage_start_time + the time the first stage takes
- In order to keep species_1 and species_2 on there values you have to set the generating and removing kinetics to 0
- The trigger for the second event is that stage=1 (meaning the first stage took place) and that the time is past stage_start_time+the time the first stage takes
Triggering Events In SimBiology toolbox
조회 수: 8 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
채택된 답변
Ingrid Tigges
2014년 9월 2일
I have attached a .zip file which contains a .sbproj file with a small example. In this example species_1 is created with constant rate, than you have reversible reaction which creates species_2 and species_2 degenerated with constant rate. I have then also created a copy of this whole set. This copy should not be effected by stages while the species_1 and species_2 are.
The two stages are modelled using two events: The first event gets triggered if species_1 gets above a certain threshold. During a simulation it is unlikely that for example 5 is exactly hit, hence one uses >5. Then you have several event functions:
Is this explanation understandable?
댓글 수: 4
Ingrid Tigges
2014년 9월 8일
편집: Ingrid Tigges
2014년 9월 8일
Like before, let me answer your points separately:
A: Sorry, I made a typing mistake. It should have been nextEventTime rather than eventTime. After this small change you can use the code I have posted in my previous comment.
B: Yes, it is. You can use another MATLAB expression there as well
The following shows the example from the above mentioned page of the documentation and once the same example but with time as parameter, note how the slope changed
m = sbiomodel('m');
c = addcompartment(m,'comp');
s = addspecies(m,'x','InitialAmount',2);
p = addparameter(m,'k','Value',1);
r = addrule(m,'x = -k * x*time','RuleType','rate');
output=sbiosimulate(m);
m2=sbiomodel('m2');
c2 = addcompartment(m2,'comp');
s2 = addspecies(m2,'x','InitialAmount',2);
p2 = addparameter(m2,'k','Value',1);
r2 = addrule(m2,'x = -k * x','RuleType','rate');
m2output=sbiosimulate(m2);
figure(2) subplot(1,2,1) plot(output.Time,output.Data) ylim([0 2]) title('Time in rule') subplot(1,2,2) ylim([0 2]) title('Time not in rule') plot(m2output.Time,m2output.Data)
As a side note, if you have a completely new question, it helps the readability if you create a new post :-).
추가 답변 (0개)
커뮤니티
더 많은 답변 보기: SimBiology Community
참고 항목
카테고리
Help Center 및 File Exchange에서 Perform Sensitivity Analysis에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!