Key Unit Concepts
Understanding Units
Last updated
Understanding Units
Last updated
Units allow you to ensure that are consistent.
As a simple example, it is logically incorrect to sum together two which have a different unit.
Adding a Variable in
GBP
to a Variable inUSD
has no real meaning. If you attempt to do this, Models will warn you that it cannot determine the resulting Unit, which will prompt you to correct the Calculation. One of the two Variables should first be converted to the other currency, before summing, using an exchange rate Variable, with UnitGBP/USD
or vice versa.
Non-additive operations, such as multiplication, transform Units.
Multiplying an exchange rate with Unit
GBP/USD
by a Variable with UnitUSD
results in a Variable with UnitGBP
.Squaring a Variable will raise the Unit to a power of 2: e.g., Distance in
metre
multiplied by itself will result in a Variable with Unitmetre^2
Models will automatically derive the Units of your Calculations and tell you the resulting Unit, or display a warning if the Unit is not as expected.
Just like and other Taglo concepts, Units are based on . Each Unit component (e.g. GBP, USD, metre) is itself an .
When you create a new type of Unit, you simply create a new Abstract Tag.
Use the Short Name property of a Tag to determine how the Tag will be displayed within a Unit (e.g., the metre
Tag has a Short Name of m
).
Unit inheritance analysis is available from Version 0.1.4.0 of Models
Because Units are based on Tags, they have access to all of the relationships you have created between Tags. This allows Models to make more intelligent inferences about the output Unit of a Calculation.
However, if the
Apple
andBanana
Tags both have a third tag,Fruit
as a common parent Tag, Models can infer that the Calculation is addingFruit
together, rather than Apples and Bananas, resulting in an output Unit ofFruit
.
The above example will be represented in the Variable view as in the screenshot below. When a Variable is reliant on inheritance to calculate or correctly match its Unit, as is the case for Total Fruit below, Models will show a warning (1), in the Variable.
Many Units are Compound Units: for example, the exchange rate GBP/USD
. In Taglo, we refer to each component of the Unit as a Unit Part.
As you read more about working in Models, you will see how these concepts are used to enable powerful functionality.
Read on to learn how to create Units.
For instance, if you have a Variable with Unit Apple
, and a second Variable with Unit Banana
, you should not ordinarily sum these Variables together, as explained , and Models will warn you about it if you do.
Unit inheritance can be enabled/disabled in the wizard, as shown below. Open the settings wizard from the Model Settings bar, and select or deselect the Allow Unit inheritance option (1) as required.
In the next section, , you will learn how editing each Unit Part adds functionality to Taglo software.
Units help you achieve logical consistency in your calculations. Models allows you to add extra time and contextual detail to your Units, which provide useful information about how the and in your Model should be treated.
For instance, work by automatically applying context Tags to the underlying Unit of a Variable.