CellML Discussion List

Text archives Help


[cellml-discussion] Finding the units associated with a variable


Chronological Thread 
  • From: ak.miller at auckland.ac.nz (Andrew Miller)
  • Subject: [cellml-discussion] Finding the units associated with a variable
  • Date: Fri, 26 May 2006 15:57:37 +1200

David Nickerson wrote:

>Looks ok to me. would something like variableUnits be more appropriate?
>
>
It is already on the variable interface, so that is implied. That name
might also suggest that the units themselves are variable, and confuse
people.

>Do you need to have both attributes? Seems given the name it should be
>pretty easy to get the units from the parent component or model, or
>given the units you can query it for its name.
>
>
We definitely need the name, because it could be a built-in unit.

I think that the other attribute will be useful too (although the code
generation doesn't use it, as it needs to support the builtin units).
Everything you can do with the API can be done directly using the DOM,
but the point of the API is to make it easier to use CellML, not to
provide any functionality which is not already available through the
DOM. We already have other similar attribute pairs, e.g. for finding
variables or components in connections. BTW note that this attribute is
read-write, so it is not just about getting the name, but also setting
that attribute. Being able to do v.unitsElement = someUnit; rather than
v.unitsName = someUnit.name; is slightly more convenient, and more
importantly, it checks that someUnit is in the right component/model in
order to allow the assignment, and raises an exception otherwise.

Best regards,
Andrew Miller

>Andre.
>
>
>Andrew Miller wrote:
>
>
>>Andrew Miller wrote:
>>
>>
>>
>>>Hi all,
>>>
>>>The CellML API doesn't seem to provide a way to get the units associated
>>>with a variable (either the name or the Units object).
>>>
>>>I propose we add the following to the CellMLVariable interface...
>>>
>>> /**
>>> * The name of the units this CellMLVariable is in. This is the value of
>>> * the units attribute.
>>> */
>>> attribute CellMLAttributeString unitsName;
>>>
>>> /**
>>> * The Units element which is referenced from this variable. This
>>>must be
>>> * in either the component or the model. It will be an ImportUnits
>>>for units
>>> * imported into the component.
>>> */
>>> attribute Units units;
>>>
>>>
>>>
>>>
>>My apologies, this is invalid IDL, because you cannot have an identifier
>>which differs from a type only by case. Perhaps unitsElement; would be okay?
>>
>>Best regards,
>>Andrew Miller
>>
>>_______________________________________________
>>cellml-discussion mailing list
>>cellml-discussion at cellml.org
>>http://www.cellml.org/mailman/listinfo/cellml-discussion
>>
>>
>_______________________________________________
>cellml-discussion mailing list
>cellml-discussion at cellml.org
>http://www.cellml.org/mailman/listinfo/cellml-discussion
>
>





Archive powered by MHonArc 2.6.18.

Top of page