Error or bug in SimBiology: creating custom kinetic laws.
조회 수: 1 (최근 30일)
이전 댓글 표시
I am building a model that requires a user defined kinetic law. My code:
Mobj = sbiomodel('u_PA_parameter_generation'); %create model object
comp_obj = addcompartment(Mobj, 'plasma'); %create compartment object
Robj2 = addreaction(Mobj, 'PLS + Pro_u_PA -> PLS + u_PA'); %create reaction object
abskineticlawObj2 = sbioabstractkineticlaw('reaction_2','PLS*Pro_u_PA^ci*keff_PLS'); %create kinetic law
sbioaddtolibrary(abskineticlawObj2) %add kinetic law to the library.
The last line above is the causing my problem. In the absence of sbioaddtolibrary function I get an error:
'Error using SimBiology.Reaction/addkineticlaw The kinetic law named 'abskineticlawObj2' does not exist in the user-defined library. Use SBIOADDTOLIBRARY to add to the library before using it.'
...and when I do as the error suggests (adding the sbioaddtolibrary line above) I get a different error:
'Error using SimBiology.Root/addtolibrary The kinetic law 'reaction_2' already exists as a user-defined. Rename by changing the Name property or re-create by using SBIOABSTRACTKINETICLAW.'
Since these errors are basically a paradox I was wondering if anyone knew if this is a problem with the software or is there a problem with my code. The rest of the reaction is listed below:
Kobj2= addkineticlaw(Robj2, 'abskineticlawObj2');
Pobj2a = addparameter(Kobj2, 'keff_PLS',40); %This rate needs a hill coefiscient!!!
Pobj2b = addparameter(Kobj2, 'ci',2);
set(Kobj2, 'ParameterVariableNames','keff_PLS');
set(Kobj2, 'ParameterVariableNames','ci')
Thanks
댓글 수: 0
채택된 답변
Arthur Goldsipe
2015년 1월 8일
Hi Ciaran,
The problem is that you're passing the wrong name to addkineticlaw. Instead of 'abskineticlawobj2', use 'reaction_2' with addkineticlaw. (This is the difference between the MATLAB variable name and the Name property of the kinetic law.)
However, you probably don't need to add a kinetic law to the library in the first place. There are two ways of specifying reaction rates in SimBiology. As you've learned, one is by using a kinetic law. That approach lets you create a kinetic law that serves as a template, and then you fill in the species and variable names for each particular reaction. However, you can also just directly set the ReactionRate property of the reaction as follows:
Mobj = sbiomodel('u_PA_parameter_generation'); %create model object
comp_obj = addcompartment(Mobj, 'plasma'); %create compartment object
Robj2 = addreaction(Mobj, 'PLS + Pro_u_PA -> PLS + u_PA'); %create reaction object
Robj2.ReactionRate = 'PLS*Pro_u_PA^ci*keff_PLS'; % Set the reaction rate
Mobj.addparameter('ci', 1.5); % Create and set the value of ci
Mobj.addparameter('keff_PLS', 0.05); % Create and set the value of keff_PLS
The main reason to use a kinetic law instead of just setting the reaction rate is so that you can re-use sort of rate equation in multiple reactions. But in this case, it's probably not worth the extra effort.
-Arthur
추가 답변 (0개)
커뮤니티
더 많은 답변 보기: SimBiology Community
참고 항목
카테고리
Help Center 및 File Exchange에서 Extend Modeling Environment에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!