libSBML C API
5.18.0
|
A Parameter_t is used in SBML to define a symbol associated with a value; this symbol can then be used in mathematical formulas in a model. By default, parameters have constant value for the duration of a simulation, and for this reason are called parameters instead of variables in SBML, although it is crucial to understand that SBML parameters represent both concepts. Whether a given SBML parameter is intended to be constant or variable is indicated by the value of its "constant" attribute.
SBML's Parameter_t has a required attribute, "id", that gives the parameter a unique identifier by which other parts of an SBML model definition can refer to it. A parameter can also have an optional "name" attribute of type string
. Identifiers and names must be used according to the guidelines described in the SBML specifications.
The optional attribute "value" determines the value (of type double
) assigned to the parameter. A missing value for "value" implies that the value either is unknown, or to be obtained from an external source, or determined by an initial assignment. The unit of measurement associated with the value of the parameter can be specified using the optional attribute "units". Here we only mention briefly some notable points about the possible unit choices, but readers are urged to consult the SBML specification documents for more information:
In SBML Level 3, there are no constraints on the units that can be assigned to parameters in a model; there are also no units to inherit from the enclosing Model_t object (unlike the case for, e.g., Species_t and Compartment_t).
"substance"
, "time"
, "volume"
, "area"
or "length"
; or the identifier of a new unit defined in the list of unit definitions in the enclosing Model_t structure. There are no constraints on the units that can be chosen from these sets. There are no default units for parameters. The Parameter_t structure has another boolean attribute named "constant" that is used to indicate whether the parameter's value can vary during a simulation. (In SBML Level 3, the attribute is mandatory and must be given a value; in SBML Levels below Level 3, the attribute is optional.) A value of true
indicates the parameter's value cannot be changed by any construct except InitialAssignment_t. Conversely, if the value of "constant" is false
, other constructs in SBML, such as rules and events, can change the value of the parameter.
SBML Level 3 uses a separate object class, LocalParameter_t, for parameters that are local to a Reaction_t's KineticLaw_t. In Levels prior to SBML Level 3, the Parameter_t class is used both for definitions of global parameters, as well as reaction-local parameters stored in a list within KineticLaw_t objects. Parameter_t objects that are local to a reaction (that is, those defined within the KineticLaw_t structure of a Reaction_t) cannot be changed by rules and therefore are implicitly always constant; consequently, in SBML Level 2, parameter definitions within Reaction_t structures should not have their "constant" attribute set to false
.
What if a global parameter has its "constant" attribute set to false
, but the model does not contain any rules, events or other constructs that ever change its value over time? Although the model may be suspect, this situation is not strictly an error. A value of false
for "constant" only indicates that a parameter can change value, not that it must.
As with all other major SBML components, Parameter_t is derived from SBase_t, and the methods defined on SBase_t are available on Parameter_t.
In SBML Level 3 Version 2, many restrictions were lifted requiring only Boolean values in Boolean contexts, and numeric values in numeric contexts. This means that a Parameter_t may now be used as a Boolean, despite canonically having a numeric value. To be consistent, one should always assign it a value of true
or false
, and use it in Boolean contexts exclusively. It would be appropriate to give it an SBO_t value of 602 ('Logical parameter') if one chooses to do this.
Public Member Functions | |
Parameter_t * | Parameter_clone (const Parameter_t *p) |
Creates a deep copy of the given Parameter_t structure. More... | |
Parameter_t * | Parameter_create (unsigned int level, unsigned int version) |
Creates a new Parameter_t structure using the given SBML level and version values. More... | |
Parameter_t * | Parameter_createWithNS (SBMLNamespaces_t *sbmlns) |
Creates a new Parameter_t structure using the given SBMLNamespaces_t structure. More... | |
void | Parameter_free (Parameter_t *p) |
Frees the given Parameter_t structure. More... | |
int | Parameter_getConstant (const Parameter_t *p) |
Takes a Parameter_t structure and returns 1 (true) or 0 (false), depending on the value of the parameter's "constant" attribute. More... | |
UnitDefinition_t * | Parameter_getDerivedUnitDefinition (Parameter_t *p) |
Constructs and returns a UnitDefinition_t structure that expresses the units of this Parameter_t structure. More... | |
const char * | Parameter_getId (const Parameter_t *p) |
Takes a Parameter_t structure and returns its identifier. More... | |
const char * | Parameter_getName (const Parameter_t *p) |
Takes a Parameter_t structure and returns its name. More... | |
const XMLNamespaces_t * | Parameter_getNamespaces (Parameter_t *p) |
Returns a list of XMLNamespaces_t associated with this Parameter_t structure. More... | |
const char * | Parameter_getUnits (const Parameter_t *p) |
Takes a Parameter_t structure and returns its units. More... | |
double | Parameter_getValue (const Parameter_t *p) |
Takes a Parameter_t structure and returns its value. More... | |
int | Parameter_hasRequiredAttributes (Parameter_t *p) |
Predicate returning 1 (true) or 0 (false) depending on whether all the required attributes for this Parameter_t structure have been set. More... | |
void | Parameter_initDefaults (Parameter_t *p) |
Initializes the attributes of this Parameter_t structure to their defaults. More... | |
int | Parameter_isSetConstant (const Parameter_t *p) |
Predicate returning 1 (true) or 0 (false) depending on whether the given Parameter_t structure's constant attribute have been set. More... | |
int | Parameter_isSetId (const Parameter_t *p) |
Predicate returning 1 (true) or 0 (false) depending on whether the given Parameter_t structure's identifier is set. More... | |
int | Parameter_isSetName (const Parameter_t *p) |
Predicate returning 1 (true) or 0 (false) depending on whether the given Parameter_t structure's name is set. More... | |
int | Parameter_isSetUnits (const Parameter_t *p) |
Predicate returning 1 (true) or 0 (false) depending on whether the given Parameter_t structure's units have been set. More... | |
int | Parameter_isSetValue (const Parameter_t *p) |
Predicate returning 1 (true) or 0 (false) depending on whether the given Parameter_t structure's value is set. More... | |
int | Parameter_setConstant (Parameter_t *p, int value) |
Assign the "constant" attribute of a Parameter_t structure. More... | |
int | Parameter_setId (Parameter_t *p, const char *sid) |
Assigns the identifier of a Parameter_t structure. More... | |
int | Parameter_setName (Parameter_t *p, const char *name) |
Assign the name of a Parameter_t structure. More... | |
int | Parameter_setUnits (Parameter_t *p, const char *units) |
Assign the units of a Parameter_t structure. More... | |
int | Parameter_setValue (Parameter_t *p, double value) |
Assign the value of a Parameter_t structure. More... | |
int | Parameter_unsetConstant (Parameter_t *c) |
Unsets the value of the "constant" attribute of the given Parameter_t structure. More... | |
int | Parameter_unsetName (Parameter_t *p) |
Unsets the name of this Parameter_t structure. More... | |
int | Parameter_unsetUnits (Parameter_t *p) |
Unsets the units of this Parameter_t structure. More... | |
int | Parameter_unsetValue (Parameter_t *p) |
Unsets the value of this Parameter_t structure. More... | |
Parameter_t * Parameter_clone | ( | const Parameter_t * | p | ) |
Creates a deep copy of the given Parameter_t structure.
p | the Parameter_t structure to be copied. |
Parameter_t * Parameter_create | ( | unsigned int | level, |
unsigned int | version | ||
) |
Creates a new Parameter_t structure using the given SBML level
and version
values.
level | an unsigned int, the SBML Level to assign to this Parameter_t. |
version | an unsigned int, the SBML Version to assign to this Parameter_t. |
Parameter_t * Parameter_createWithNS | ( | SBMLNamespaces_t * | sbmlns | ) |
Creates a new Parameter_t structure using the given SBMLNamespaces_t structure.
sbmlns | SBMLNamespaces_t, a pointer to an SBMLNamespaces_t structure to assign to this Parameter_t. |
void Parameter_free | ( | Parameter_t * | p | ) |
Frees the given Parameter_t structure.
p | the Parameter_t structure to be freed. |
int Parameter_getConstant | ( | const Parameter_t * | p | ) |
Takes a Parameter_t structure and returns 1
(true) or 0
(false), depending on the value of the parameter's "constant" attribute.
p | the Parameter_t whose constant value is sought. |
nonzero
meaning true and zero
meaning false. UnitDefinition_t * Parameter_getDerivedUnitDefinition | ( | Parameter_t * | p | ) |
Constructs and returns a UnitDefinition_t structure that expresses the units of this Parameter_t structure.
p | the Parameter_t structure whose units are to be returned. |
NULL
is returned. const char * Parameter_getId | ( | const Parameter_t * | p | ) |
Takes a Parameter_t structure and returns its identifier.
p | the Parameter_t structure whose identifier is sought. |
const char * Parameter_getName | ( | const Parameter_t * | p | ) |
Takes a Parameter_t structure and returns its name.
p | the Parameter_t whose name is sought. |
const XMLNamespaces_t * Parameter_getNamespaces | ( | Parameter_t * | p | ) |
Returns a list of XMLNamespaces_t associated with this Parameter_t structure.
p | the Parameter_t structure. |
const char * Parameter_getUnits | ( | const Parameter_t * | p | ) |
Takes a Parameter_t structure and returns its units.
p | the Parameter_t whose units are sought. |
double Parameter_getValue | ( | const Parameter_t * | p | ) |
Takes a Parameter_t structure and returns its value.
p | the Parameter_t whose value is sought. |
double
. int Parameter_hasRequiredAttributes | ( | Parameter_t * | p | ) |
Predicate returning 1
(true) or 0
(false) depending on whether all the required attributes for this Parameter_t structure have been set.
The required attributes for a Parameter_t structure are:
p | the Parameter_t structure to check. |
1
(true) if all the required attributes for this structure have been defined, 0
(false) otherwise. void Parameter_initDefaults | ( | Parameter_t * | p | ) |
Initializes the attributes of this Parameter_t structure to their defaults.
The exact results depends on the SBML Level and Version in use. The cases are currently the following:
true
p | the Parameter_t structure to initialize. |
int Parameter_isSetConstant | ( | const Parameter_t * | p | ) |
Predicate returning 1
(true) or 0
(false) depending on whether the given Parameter_t structure's constant attribute have been set.
p | the Parameter_t structure to query. |
1
(true) if the "constant" attribute of the given Parameter_t structure is set, 0
(false) otherwise. int Parameter_isSetId | ( | const Parameter_t * | p | ) |
Predicate returning 1
(true) or 0
(false) depending on whether the given Parameter_t structure's identifier is set.
p | the Parameter_t structure to query. |
1
(true) if the "id" attribute of the given Parameter_t structure is set, 0
(false) otherwise. int Parameter_isSetName | ( | const Parameter_t * | p | ) |
Predicate returning 1
(true) or 0
(false) depending on whether the given Parameter_t structure's name is set.
p | the Parameter_t structure to query. |
1
(true) if the "name" attribute of the given Parameter_t structure is set, 0
(false) otherwise. int Parameter_isSetUnits | ( | const Parameter_t * | p | ) |
Predicate returning 1
(true) or 0
(false) depending on whether the given Parameter_t structure's units have been set.
p | the Parameter_t structure to query. |
1
(true) if the "units" attribute of the given Parameter_t structure is set, 0
(false) otherwise. int Parameter_isSetValue | ( | const Parameter_t * | p | ) |
Predicate returning 1
(true) or 0
(false) depending on whether the given Parameter_t structure's value is set.
p | the Parameter_t structure to query. |
1
(true) if the "value" attribute of the given Parameter_t structure is set, 0
(false) otherwise.int Parameter_setConstant | ( | Parameter_t * | p, |
int | value | ||
) |
Assign the "constant" attribute of a Parameter_t structure.
p | the Parameter_t structure to set. |
value | the value to assign as the "constant" attribute of the parameter, either zero for false or nonzero for true. |
int Parameter_setId | ( | Parameter_t * | p, |
const char * | sid | ||
) |
Assigns the identifier of a Parameter_t structure.
This makes a copy of the string passed in the parameter sid
.
p | the Parameter_t structure to set. |
sid | the string to use as the identifier. |
sid
of NULL is equivalent to unsetting the "id" attribute. int Parameter_setName | ( | Parameter_t * | p, |
const char * | name | ||
) |
Assign the name of a Parameter_t structure.
This makes a copy of the string passed in as the argument name
.
p | the Parameter_t structure to set. |
name | the string to use as the name. |
int Parameter_setUnits | ( | Parameter_t * | p, |
const char * | units | ||
) |
Assign the units of a Parameter_t structure.
This makes a copy of the string passed in as the argument units
.
p | the Parameter_t structure to set. |
units | the string to use as the identifier of the units to assign. |
int Parameter_setValue | ( | Parameter_t * | p, |
double | value | ||
) |
Assign the value of a Parameter_t structure.
p | the Parameter_t structure to set. |
value | the double value to use. |
int Parameter_unsetConstant | ( | Parameter_t * | c | ) |
Unsets the value of the "constant" attribute of the given Parameter_t structure.
c | the Parameter_t structure. |
int Parameter_unsetName | ( | Parameter_t * | p | ) |
Unsets the name of this Parameter_t structure.
p | the Parameter_t structure whose name is to be unset. |
int Parameter_unsetUnits | ( | Parameter_t * | p | ) |
Unsets the units of this Parameter_t structure.
p | the Parameter_t structure whose units are to be unset. |
int Parameter_unsetValue | ( | Parameter_t * | p | ) |
Unsets the value of this Parameter_t structure.
In SBML Level 1 Version 1, a parameter is required to have a value and therefore this attribute should always be set. In Level 1 Version 2 and beyond, a value is optional, and as such, may or may not be set.
p | the Parameter_t structure whose value is to be unset. |