This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
howtos:toolcoding:unit_of_measure_conversions [2011/06/17 12:44] marcus.williams |
howtos:toolcoding:unit_of_measure_conversions [2011/06/17 15:59] (current) chris.strashok |
||
---|---|---|---|
Line 18: | Line 18: | ||
===== Example ===== | ===== Example ===== | ||
- | For this example we are going be importing fuel consumption data in mpg and converting the output to km/L | + | For this example we are going be importing floor area data in m<sup>2</sup> and converting the output to ft<sup>2</sup> |
First we need to define the required altUom measures in Documenter. | First we need to define the required altUom measures in Documenter. | ||
Line 25: | Line 25: | ||
* Go to the measures tab and click the Add button | * Go to the measures tab and click the Add button | ||
- | {{:howtos:toolcoding:measurestab.gif|}} | + | {{:howtos:toolcoding:measurestab_rev2.gif|}} |
This will open the Measure Information window | This will open the Measure Information window | ||
Line 33: | Line 33: | ||
* Define the new altUom measures as follows: | * Define the new altUom measures as follows: | ||
- | **Mile** \\ | + | **m2** \\ |
Measure Type - Scientific Measure \\ | Measure Type - Scientific Measure \\ | ||
- | Name - mile \\ | + | Name - m2 \\ |
- | SI Signature - m^1 \\ | + | SI Signature - m^2 \\ |
- | Conversion to SI units - 0.000621371 \\ | + | Conversion to SI units - 1 \\ |
- | **US Gallon** | + | **ft2** \\ |
Measure Type - Scientific Measure \\ | Measure Type - Scientific Measure \\ | ||
- | Name - USgallon \\ | + | Name - ft2 \\ |
- | SI Signature - m^3 \\ | + | SI Signature - m^2 \\ |
- | Conversion to SI units - 264.172 \\ | + | Conversion to SI units - 10.7639 \\ |
- | + | ||
- | **Kilometer** | + | |
- | Measure Type - Scientific Measure \\ | + | |
- | Name - km \\ | + | |
- | SI Signature - m^1 \\ | + | |
- | Conversion to SI units - 0.001 \\ | + | |
- | + | ||
- | **Litre** | + | |
- | Measure Type - Scientific Measure \\ | + | |
- | Name - litre \\ | + | |
- | SI Signature - m^3 \\ | + | |
- | Conversion to SI units - 1000 \\ | + | |
Once the altUom's have been created we need to apply them to the shapes of our variables fuelConIn and fuelConOut. | Once the altUom's have been created we need to apply them to the shapes of our variables fuelConIn and fuelConOut. | ||
- | {{:howtos:toolcoding:diagram.gif|}} | + | {{:howtos:toolcoding:diagram_rev1.gif|}} |
- | We will need to set the altUom for the varialbe fuelConIn to mpg and the altUom for the variable fuelConOut to km/L. | + | We will need to set the altUom for the variable floorSpaceIn to m2 and the altUom for the variable floorSpaceOut to ft2. |
To do this: | To do this: | ||
- | * Double click on the variable fuelConIn in the diagram. This will open the Variable Information window. | + | * Double click on the variable floorSpaceIn in the diagram. This will open the Variable Information window. |
* Navigate to the More Shape tab | * Navigate to the More Shape tab | ||
- | {{:howtos:toolcoding:variableinfo2.gif|varible info 2 image}} | + | {{:howtos:toolcoding:variableinfo3.gif|}} |
* Click on the {{:howtos:toolcoding:triangle-button.gif|}} button to access the Units window | * Click on the {{:howtos:toolcoding:triangle-button.gif|}} button to access the Units window | ||
- | {{:howtos:toolcoding:unitswindow.gif|units image}} | + | {{:howtos:toolcoding:unitswindow2_rev1.gif|}} |
- | * Specify mile as the numerator and USgallon as the denominator | + | * Specify m2 as the numerator |
* Click OK to exit the Units window | * Click OK to exit the Units window | ||
* Click Ok to exit the Variable Information window | * Click Ok to exit the Variable Information window | ||
- | Repeat this process for the variable fuelConOut with km as the numerator and litre as the denominator | + | Repeat this process for the variable floorSpaceOut with ft2 as the numerator |
- | * Now we can set fuelConOut equal to fuelConIn in procedure 1 using the following code | + | * Now we can set floorSpaceOut equal to floorSpaceIn in procedure 1 using the following code |
<code> | <code> | ||
- | fuelConOut[vt,t]=fuelConIn[vt,t] | + | floorSpaceOut[fs,t]=floorSpaceIn[fs,t] |
</code> | </code> | ||
- | After [[howtos:model_loading|loading the model from Documenter into SAMM]] and [[howtos:workwithdata:a_simple_import_view|importing the source data]] into SAMM we can see how the source data which is in mpg gets converted to km/l in the target variable in the tables below | + | After [[howtos:model_loading|loading the model from Documenter into SAMM]] and [[howtos:workwithdata:a_simple_import_view|importing the source data]] into SAMM we can see how the source data which is in m<sup>2</sup> gets converted to ft<sup>2</sup> in the target variable in the tables below |
- | **fuelConIn** \\ | + | **floorSpaceIn** \\ |
- | {{:howtos:toolcoding:fuelconin.gif|}} | + | {{:howtos:toolcoding:floorspacein.gif|}} |
- | **fuelConOut** \\ | + | **floorSpaceOut** \\ |
- | {{:howtos:toolcoding:fuelconout.gif|}} | + | {{:howtos:toolcoding:floorspaceout.gif|}} |