Creating a Prefixed Unit Based On QUDV Library

Today (Feb 23, 2012), I was asked by a customer about the way to add SI prefixes to a unit. My customer knows that it is possible to create a new unit, but he or she does not know how to include the information that the new unit is related to the references unit with some multiplier.

I wondered that I have not seen the information about using the QUDV library in any of my SysML books. It seem to be a missing part of them. So, I decided to write this article by hoping that it will help other SysML users to gain more understanding about such library.

The SysML v1.2 Specification [1] has provided the information about quantities, units, dimension and value types in Annex C.5. However, the specification does not provide any examples about using the prefixed unit and other conversion based unit sub-types. This article will show the way to create a prefixed unit which has information about its reference unit and the multiplier.


Figure 1 -- QUDV model of Units and QuantityKinds

A unit element in SysML is an InstanceSpecification applied with the <<Unit>> stereotype. I have seen this stereotype in the SysML Specification since I started using the SysML. However, there is one problem in using this stereotype in SysML v1.1 and earlier versions. The specification said that the stereotype must be applied to an InstanceSpecification, but it did not specify the classifier of the InstanceSpecification. Thus, the QUDV library have been introduced since SysML v1.2 for solving this ambiguous case. A unit should be an InstanceSpecification of Unit block's sub-types (Unit block is an abstract block. So, it cannot be instantiated).

From the QUDV model in Figure 1, there are 6 Unit block's sub-types which can be instantiated, including SimpleUnit, DerivedUnit, PrefixedUnit, LinearConversionUnit, AffineConversionUnit and GeneralConversionUnit (ConversionBasedUnit is also an abstract block). Here, the PrefixedUnit will be used as an example. More information about other Unit block's sub-types can be found in the OMG SysML v1.2 Specification, Annex C.5.

From the Figure 1, the PrefixedUnit have associated with the Prefix block. So, the InstanceSpecification of Prefix block must be created first. Figure 2 shows the milli:Prefix which is an InstanceSpecification of Prefix block. It has three slots which their defining features are the three attributes of Prefix block. The scale multiplier of our create unit can be specified as a value of factor slot (Here we use factor = 0.001).

After the InstanceSpecification of Prefix block has been created, then we will create an InstanceSpecification of PrefixedUnit block, milliAmpere:PrefixedUnit. Specify its slot values as shown in Figure 2, the reference unit (base unit) can be specified as a value of referenceUnit slot.  In this example, this slot value is ampere. It has been defined in the SI Definition of QUDV library provided by OMG (as a machine readable format).

Finally, apply <<Unit>> stereotype to milliAmpere:PrefixedUnit and specify the tagged value of quantityKind tag definition. This tagged value must be the same as the value of quantityKind slot.


Figure 2 -- Shows a prefixed unit, milliAmpere, with its slot values and tagged value.

At this point, a new prefixed unit, milliAmpere:PrefixedUnit, have been defined completely based on QUDV library. The reference unit (base unit) is ampere and the prefix multiplier is 0.001. The steps of creating this prefixed unit can be applied to create other kinds of unit. I hope everyone who have read this article, will gain more understanding about the unit in QUDV and enjoy using SysML  :)

References:
[1] "OMG Systems Modeling Language (OMG SysML™) version 1.2" [Electronic]



Kritsana Uttamang, PhD.

Analyst Manager / SysML Domain Expert
No Magic Inc.





Comments

Popular posts from this blog

Simple Clock Modeling with SysML

Decomposing Ports and Connectors with Association Blocks

A Common Misunderstanding in Using Connectors