main content

perform unit conversion -凯发k8网页登录

perform unit conversion

description

the unitconversion property specifies whether to perform unit conversion for the model before simulation. it is a property of the compileoptions object. compileoptions holds the model's compile time options and is the object property of the configset object.

when unitconversion is set to true, the simbiology® software converts the matching physical quantities to one consistent unit system in order to resolve them. this conversion is in preparation for correct simulation, but species amounts are returned in the user-specified units.

for example, consider a reaction a b —> c. using mass action kinetics the reaction rate is defined as a*b*k where k is the rate constant of the reaction. if you specify that initial amounts of a and b are 0.01m and 0.005m respectively, then units of k are 1/(m*second). if you specify k with another equivalent unit definition, for example, 1/((molecules/liter)*second), unitconversion occurs after dimensionalanalysis.

unit conversion requires dimensional analysis. if dimensionalanalysis is off, and you turn unitconversion on, then dimensionalanalysis is turned on automatically. if unitconversion is on and you turn off dimensionalanalysis, then unitconversion is turned off automatically.

if unitconversion fails, then you see an error when you simulate (sbiosimulate).

if unitconversion is set to false, the simulation uses the given object values.

characteristics

applies toobject: compileoptions (in configset object)
data typeboolean
data values

true or false. default value is false.

accessread/write

note

simbiology uses units including empty units in association with dimensionalanalysis and unitconversion features.

  • when dimensionalanalysis and unitconversion are both false, units are not used. however, simbiology still performs a minimum level of dimensional analysis to decide whether a reaction rate is in dimensions of amount/time or concentration/time.

  • when dimensionalanalysis is true and unitconversion is false, units (if not empty) must have consistent dimensions so that simbiology can perform dimensional analysis. however, the units are not converted.

  • when unitconversion is set to true (which requires dimensionalanalysis to be true), simbiology performs a dimensional analysis and converts everything to consistent units. hence, you must specify consistent units, and no units can be empty. if you have a dimensionless parameter, you must still set its unit to dimensionless.

tip

if you have a custom function and unitconversion is on, follow the recommendation below.

  • non-dimensionalize the parameters that are passed to the function if they are not already dimensionless.

    suppose you have a custom function defined as y = f(t) where t is the time in hour and y is the concentration of a species in mole/liter. when you use this function in your model to define a repeated assignment rule for instance, define it as: s1 = f(time/t0)*s0, where time is the simulation time, t0 is a parameter defined as 1.0 hour, s0 is a parameter defined as 1.0 mole/liter, and s1 is the concentration of a species in mole/liter. note that time and s1 do not have to be in the same units as t0 and s0, but they must be dimensionally consistent. for example, the time and s1 units can be set to minute and picomole/liter, respectively.

examples

this example shows how to retrieve and set unitconversion from the default true to false in the default configuration set in a model object.

  1. import a model.

    modelobj = sbmlimport('oscillator')
    simbiology model - oscillator 
       model components:
         models:            0
         parameters:        0
         reactions:         42
         rules:             0
         species:           23
    
  2. retrieve the configset object of the model object.

    configsetobj = getconfigset(modelobj)
     configuration settings - default (active)
         solvertype:           ode15s
         stoptime:             10.000000
       solveroptions:
         absolutetolerance:    1.000000e-006
         relativetolerance:    1.000000e-003
       runtimeoptions:
         statestolog:          all
       compileoptions:
         unitconversion:       false
         dimensionalanalysis:  true
  3. retrieve the compileoptions object.

    optionsobj = get(configsetobj,'compileoptions')
    compile settings:
         unitconversion:       false
         dimensionalanalysis:  true
  4. assign a value of false to unitconversion.

     set(optionsobj,'unitconversion', true)

see also

, , ,

网站地图