perform unit conversion -pg电子麻将胡了
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 to | object: compileoptions (in configset object) |
| data type | boolean |
| data values |
|
| access | read/write |
note
simbiology uses units including empty units in association
with dimensionalanalysis and unitconversion features.
when
dimensionalanalysisandunitconversionare bothfalse, 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
dimensionalanalysisistrueandunitconversionisfalse, units (if not empty) must have consistent dimensions so that simbiology can perform dimensional analysis. however, the units are not converted.when
unitconversionis set totrue(which requiresdimensionalanalysisto betrue), 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 todimensionless.
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)wheretis the time in hour andyis 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, wheretimeis the simulation time,t0is a parameter defined as 1.0 hour,s0is a parameter defined as 1.0 mole/liter, ands1is the concentration of a species in mole/liter. note thattimeands1do not have to be in the same units ast0ands0, but they must be dimensionally consistent. for example, thetimeands1units 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.
import a model.
modelobj = sbmlimport('oscillator')simbiology model - oscillator model components: models: 0 parameters: 0 reactions: 42 rules: 0 species: 23retrieve the
configsetobject 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: trueretrieve the
compileoptionsobject.optionsobj = get(configsetobj,'compileoptions') compile settings: unitconversion: false dimensionalanalysis: trueassign a value of false to
unitconversion.set(optionsobj,'unitconversion', true)
see also
, , ,