User Tools

Site Tools


howtos:toolcoding:unit_of_measure_conversions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
howtos:toolcoding:unit_of_measure_conversions [2010/01/21 21:24]
deryn.crockett created
howtos:toolcoding:unit_of_measure_conversions [2011/06/17 15:59] (current)
chris.strashok
Line 1: Line 1:
-In some cases, you may want to display model data in units of measure that are different than how they are stored in the model. ​ TOOL can handle unit of measure conversions provided that the user defines the new measure in Documenter and properly specifies the unit of measure when defining the shape of a variable. ​ The general steps to implement unit of measure conversions are:+====== Unit of Measure Conversions ======
  
-  ​- Define relevant measures in Documenter+There are two unit of measure parameters included with every TOOL object: the SI unit of measure (SIuom) and the alternate unit of measure (altUom).  
 + 
 +SIUom is the "​base"​ unit for the data, used for storage, calculations and interactions with other objects. 
 + 
 +altUom is the display and input unit of measure that will be used anytime you interact with the data. Interacting would include: the display tools like table, and graph, entering data manually through these tools, and direct assignment in code in views. Each altUom should be setup in the measures table (see measures tab in Documenter) to specify how the conversion to the related SIUom should be done. 
 + 
 +TOOL can handle unit of measure conversions across multiple objects seamlessly provided that the user defines the new measure in Documenter and properly specifies the unit of measure when defining the shape of a variable. ​ The general steps to implement unit of measure conversions are: 
 + 
 +  ​- Define relevant ​altUom ​measures in Documenter ​
   - Specify a unit of measure (altUom) for the source variable shape that matches the unit of measure of the source data   - Specify a unit of measure (altUom) for the source variable shape that matches the unit of measure of the source data
   - Create a target variable with the same shape as the source variable but with the desired unit of measure (altUom)   - Create a target variable with the same shape as the source variable but with the desired unit of measure (altUom)
Line 8: Line 16:
 The target variable will be displayed in the desired unit of measure. The target variable will be displayed in the desired unit of measure.
  
-** ADD EXAMPLE ​**+===== Example ===== 
 + 
 +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. 
 + 
 +To do this: 
 +  ​Go to the measures tab and click the Add button 
 + 
 +{{:​howtos:​toolcoding:​measurestab_rev2.gif|}} 
 + 
 +This will open the Measure Information window 
 + 
 +{{:​howtos:​toolcoding:​measureinfo.gif|}} 
 + 
 +  ​Define the new altUom measures as follows: 
 + 
 +**m2** \\ 
 +Measure Type - Scientific Measure \\ 
 +Name - m2 \\ 
 +SI Signature - m^2 \\ 
 +Conversion to SI units - 1 \\ 
 + 
 +**ft2** \\ 
 +Measure Type - Scientific Measure \\ 
 +Name - ft2 \\ 
 +SI Signature - m^2 \\ 
 +Conversion to SI units - 10.7639 \\ 
 + 
 +Once the altUom'​s have been created we need to apply them to the shapes of our variables fuelConIn and fuelConOut. 
 + 
 +{{:​howtos:​toolcoding:​diagram_rev1.gif|}} 
 + 
 +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: 
 +  * Double click on the variable floorSpaceIn in the diagram. This will open the Variable Information window. 
 +  * Navigate to the More Shape tab 
 + 
 +{{:​howtos:​toolcoding:​variableinfo3.gif|}} 
 + 
 +  * Click on the {{:​howtos:​toolcoding:​triangle-button.gif|}} button to access the Units window 
 + 
 +{{:​howtos:​toolcoding:​unitswindow2_rev1.gif|}} 
 + 
 +  * Specify m2 as the numerator 
 +  * Click OK to exit the Units window 
 +  * Click Ok to exit the Variable Information window 
 + 
 +Repeat this process for the variable floorSpaceOut with ft2 as the numerator 
 + 
 +  * Now we can set floorSpaceOut equal to floorSpaceIn in procedure 1 using the following code 
 + 
 +<​code>​ 
 + 
 +floorSpaceOut[fs,​t]=floorSpaceIn[fs,​t] 
 + 
 +</​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 m<​sup>​2</​sup>​ gets converted to ft<​sup>​2</​sup>​ in the target variable in the tables below 
 + 
 +**floorSpaceIn** \\ 
 +{{:​howtos:​toolcoding:​floorspacein.gif|}} 
 + 
 +**floorSpaceOut** \\ 
 +{{:​howtos:​toolcoding:​floorspaceout.gif|}} 
howtos/toolcoding/unit_of_measure_conversions.1264109048.txt.gz · Last modified: 2010/01/21 21:24 by deryn.crockett