In SimBiology, can you change the Capacity of a compartment using an Event or Assignment (and still pass dimensional analysis)?

조회 수: 2 (최근 30일)
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.

채택된 답변

Arthur Goldsipe
Arthur Goldsipe 2015년 12월 1일
Hi Bernard,
Yes, it's possible to change the capacity of a compartment using an event or assignment. To do this, set the corresponding event function or rule expression to a string of the form Variable = Expression.
You can find some example rules on this page and sample events on this page.
But let me give you a simple example here. Let's say that you have a compartment named myCompartment and a parameter named myParameter, both of which have units of liter. Then, you could change this compartment's capacity to whatever value is associated with the parameter using an event function or rule of the form myCompartment = myParameter. And as you already discovered, you will need to make sure the compartment capacity is not marked as constant if you want to change it with a repeated assignment rule or event.
-Arthur
  댓글 수: 1
Bernard
Bernard 2015년 12월 1일
Thank you, Arthur. I did not realise that the Capacity of a compartment was the value returned by CompartmentName, and instead I had been trying to address it as a property of the compartment. Simply switching the event function to CompartmentName = ParameterName allowed verification and the model to run.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

커뮤니티

더 많은 답변 보기:  SimBiology Community

카테고리

Help CenterFile Exchange에서 Extend Modeling Environment에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by