Is it possible to create custom (species-specific) conversion factors in Simbiology?

조회 수: 2 (최근 30일)
Is there a way to create custom (species-specific) conversion factors in SimBiology that can be used by 'unit conversion' to automatically convert dosing units, so that, for example, I can enter a dose in grams for a species with units 'molarity'?
  댓글 수: 2
Jeremy Huard
Jeremy Huard 2021년 4월 12일
편집: Jeremy Huard 2021년 4월 13일
Hi Shalla,
can you tell us more about the context: do you want to run simulations only or is it in the context of data fitting?
If you only want to run simulations, you could use a parameterized dose. The appoach is shown in the Scale Dose Amount by Body Weight example. For you specific use case you would:
  1. create parameters MolecularWeight, doseMole, doseGram
  2. create an initial assignment rule doseMole = doseGram*MolecularWeight
  3. create a dose with doseMole as its amount
Best regards,
Jérémy
Edit: I had switched doseMole and doseGram in the above steps. It's now corrected.
Rae K.
Rae K. 2021년 4월 12일
편집: Rae K. 2021년 9월 10일
Hi Jérémy,
In my case I'm using this for data fitting, and specifically I'd like to create the doses from a groupedData object.
When creating doses from groupedData objects, the 'TargetName' ('doseGram') is required to be a species, which seems okay because because I can still make a 'doseMole' parameter with an initial assignment which does the conversion, and add a dose with 'doseMole' as its amount. But, with 'sbiofit', I don't know how to force this new dose to be applied in addition to the doses created from my groupedData object.
Thanks for your time with this

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

채택된 답변

Jeremy Huard
Jeremy Huard 2021년 4월 21일
Hi Shalla,
In this case, the easiest way is to :
  1. import your experimental data as a table
  2. add a column that divides the dose amount in gram by the molecular weight
  3. convert the table to a groupedData object
  4. call the method createDoses on the groupedData object
With this approach the molecular weight won't be a parameter of the SimBiology model but will be a parameter defined in your script/function to run the fit instead.
There is a way to make this conversion happen automatically in the model itself but it is not trivial. What you suggested with the initial assignment + dose would not work unfortunately. Initial and repeated assignments are evaluated first to get the initial conditions and only then doses are applied. So your doseAmount parameter would remain zero.
The solution I came up with involves the use of events. This has the advantage of working fine even in the case of repeated doses within the same group.
I have attached a working example developed in R2021a in the SimBiology Apps. Please have a look at the program Program_events.
Edit: Please note that this example is for bolus dose only. It won't work if your dataset contains a rate column.
However, if you run the fit using a script, you don’t necessarily need to add those the events and extra species/parameters to the SimBiology project file. You can do it temporarily in the script. Here is the code you would need:
% temporary compartment and species
compObj = addcompartment(modelObj, "comp_temp",1,"Unit","liter");
addspecies(compObj,"speciesGram",0,"Unit","gram");
% parameters
addparameter(modelObj,"molecularWeight",80,"Unit","gram/mole");
addparameter(modelObj,"zeroGram",0,"Unit","gram");
% in the following I will assume the species in Mole you want to dose is
% comp.speciesMole
eventFcn = ["comp.speciesMole = comp.speciesMole + comp_temp.speciesGram/molecularWeight"; % dose event
"comp_temp.speciesGram = zeroGram"]; % reset the speciesGram right after dosing to make avaialble for repeated doses
addevent(modelObj,"time > 0",eventFcn); % need to handle doses at time=0 separately becuase events are not triggered at time=0
addevent(modelObj,"comp_temp.speciesGram > zeroGram",eventFcn);
I hope this helps.
Best regards,
Jérémy

추가 답변 (0개)

커뮤니티

더 많은 답변 보기:  SimBiology Community

카테고리

Help CenterFile Exchange에서 Perform Sensitivity Analysis에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by