Get information from Unit Conversion (2024)

53 views (last 30 days)

Show older comments

Elisa on 3 Jul 2024 at 10:33

  • Link

    Direct link to this question

    https://www.mathworks.com/matlabcentral/answers/2134091-get-information-from-unit-conversion

  • Link

    Direct link to this question

    https://www.mathworks.com/matlabcentral/answers/2134091-get-information-from-unit-conversion

Commented: Jeremy Huard about 7 hours ago

Accepted Answer: Jeremy Huard

Hi everyone, I am studying a simbiology model not made by me. In particular, I know that some parameters/species have inconsistent units, I just don't know which ones, since it's a huge model. While the Unit Conversion of Simbiology works perfectly, I'd like to know which parameters have different units; in other words I'd like to have a model with consistent units, that would work without using the unit conversion. It would also be sufficient to have, somehow, a table of the changes in units wrt a 'ground' unit, so that I can change the units manually.

I don't know if that's possible in simbiology and I haven't found any documentation on that.

3 Comments

Show 1 older commentHide 1 older comment

John D'Errico on 3 Jul 2024 at 11:16

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/2134091-get-information-from-unit-conversion#comment_3201391

  • Link

    Direct link to this comment

    https://www.mathworks.com/matlabcentral/answers/2134091-get-information-from-unit-conversion#comment_3201391

Edited: John D'Errico on 3 Jul 2024 at 11:31

Even without any knowledge of the tool, I seriously doubt it is possible. I could be wrong, but I think not. You might suggest it as a feature request, but you don't do that in Answers. Send your idea directly to tech support.

As for having a table of all changes made on the fly by the tool, I think that is even less likely to happen.

Elisa on 3 Jul 2024 at 11:43

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/2134091-get-information-from-unit-conversion#comment_3201416

Yes that's what I thought, but I guess proving the 'middle model' with consistent units could be something doable and it would be extremely useful when developing. Thank you for your quick reply by the way!

John D'Errico on 3 Jul 2024 at 12:24

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/2134091-get-information-from-unit-conversion#comment_3201451

  • Link

    Direct link to this comment

    https://www.mathworks.com/matlabcentral/answers/2134091-get-information-from-unit-conversion#comment_3201451

You got the best possible result, actually, in the sense that you just got a response from someone on the staff. I hope it helps!

Sign in to comment.

Sign in to answer this question.

Accepted Answer

Jeremy Huard on 3 Jul 2024 at 12:13

  • Link

    Direct link to this answer

    https://www.mathworks.com/matlabcentral/answers/2134091-get-information-from-unit-conversion#answer_1480601

  • Link

    Direct link to this answer

    https://www.mathworks.com/matlabcentral/answers/2134091-get-information-from-unit-conversion#answer_1480601

Edited: Jeremy Huard on 3 Jul 2024 at 12:16

Open in MATLAB Online

Hi @Elisa,

I am curious about why you want to turn off unit conversion. Can you please explain the motivation behind it?

As for an implementation, one possible way to convert parameter units with your system of units could be as follows:

% export the model object to the MATLAB workspace from the Model Builder

% and keep Model Builder open

% create dictionary to map current/old units to new ground units

conversiondic = configureDictionary("string","string");

conversiondic("milligram") = "nanogram";

conversiondic("day") = "hour";

conversiondic("milliliter") = "liter";

% get parameter objects with a unit composed with one of the old units

parObj = sbioselect(modelObj,'Type','Parameter','Where','Units','function',...

@(x) contains(x,conversiondic.keys))

% convert units of each parameter

for currentPar=parObj'

oldunit = currentPar.Units;

% convert unit string to ground units

newunit = replace(oldunit,conversiondic.keys,conversiondic.values);

% convert parameter value to new units

sbioconvertunits(currentPar,newunit);

end

parObj

% the changes in units and values of these parameters will now be reflected

% in Model Builder as well.

% you can now keep working in the Model Builder Apps and save your project

4 Comments

Show 2 older commentsHide 2 older comments

Elisa on 3 Jul 2024 at 13:45

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/2134091-get-information-from-unit-conversion#comment_3201541

  • Link

    Direct link to this comment

    https://www.mathworks.com/matlabcentral/answers/2134091-get-information-from-unit-conversion#comment_3201541

Hi @Jeremy Huard I will try your solution for sure! The main reason is that I wanted to perform a identifiability analysis of the model with a MATLAB library (so not integrated in simbiology). I needed to figure out a method for having consistent units after exporting all the necessary info with getequations(). Thank you very much for your quick reply!

Jeremy Huard on 3 Jul 2024 at 14:09

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/2134091-get-information-from-unit-conversion#comment_3201576

  • Link

    Direct link to this comment

    https://www.mathworks.com/matlabcentral/answers/2134091-get-information-from-unit-conversion#comment_3201576

Edited: Jeremy Huard about 6 hours ago

Thanks @Elisa.

Can you share which library? Is it related to your previous post?

I also wonder whether you have tried the Profile Likelihood method for practical parameter identifiability. It can be computed after a fit program using the Confidence Interval step in Model Analyzer or programmatically with sbioparameterci. Would this be an option?

Best,

Jérémy

Elisa about 6 hours ago

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/2134091-get-information-from-unit-conversion#comment_3202641

  • Link

    Direct link to this comment

    https://www.mathworks.com/matlabcentral/answers/2134091-get-information-from-unit-conversion#comment_3202641

Hi @Jeremy Huard, sorry for the late reply. Yes, it's always GenSSI (you can find the link to the repo in the previous post).

The SBML does not a perfect job in exporting the model, since simbiology supports several things that cannot be coded into SBML. I am parsing the result of getequation(), but it has been a pain changing the units of each parameter, I was interested in automating this task.

I've tried using the Profile Likelihood method, but sbioparameterci takes a long time to run (I'm talking > 30 hours), and I've suggested to use GenSSI instead for global and structural identifiability analysis.

Elisa

Jeremy Huard about 5 hours ago

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/2134091-get-information-from-unit-conversion#comment_3202726

  • Link

    Direct link to this comment

    https://www.mathworks.com/matlabcentral/answers/2134091-get-information-from-unit-conversion#comment_3202726

Thanks @Elisa for this info!

Calculating the Profile Likelihood CI can indeed be quite computationally expensive.

If you use the optimization-based method, increasing MaxStep and the Tolerance with a local optimizer might help. You could also try the integration-based method. In both cases parallel computing would help if you have access to the Parallel Computing Toolbox.

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Communities

More Answers in the SimBiology Community

See Also

Categories

Computational BiologySimBiologySimulationScan Parameter Ranges

Find more on Scan Parameter Ranges in Help Center and File Exchange

Tags

  • simbiology
  • unit conversion

Products

  • MATLAB
  • SimBiology

Release

R2023b

Community Treasure Hunt

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

Start Hunting!

An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.


Get information from Unit Conversion (10)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom(English)

Asia Pacific

Contact your local office

Get information from Unit Conversion (2024)
Top Articles
Latest Posts
Article information

Author: Stevie Stamm

Last Updated:

Views: 5759

Rating: 5 / 5 (60 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Stevie Stamm

Birthday: 1996-06-22

Address: Apt. 419 4200 Sipes Estate, East Delmerview, WY 05617

Phone: +342332224300

Job: Future Advertising Analyst

Hobby: Leather crafting, Puzzles, Leather crafting, scrapbook, Urban exploration, Cabaret, Skateboarding

Introduction: My name is Stevie Stamm, I am a colorful, sparkling, splendid, vast, open, hilarious, tender person who loves writing and wants to share my knowledge and understanding with you.