Units
Units are at the heart of Insight Maker. The flows into a stock should have the same units as the contents of that stock. Similarly, you should be able to specify the units for the different variables and converters in your model.
Insight Maker allows you to enforce units using its unit mechanisms. As you construct your model, you may define the units for the different parts of your model. For instance, you may add a stock representing a lake with units of Cubic Meters. You may have a river flowing into the lake with units of Cubic Meters per Second. When you run a simulation, Insight Maker will check to make sure that the units you have defined are consistent. If they are not consistent (for instance you try to subtract a number with units of Meters from one with units of Liters) Insight Maker will display an error and terminate the simulation.
When you define a number in Insight Maker, it is automatically defined as Unitless. When the value of a valued primitive (stock, flow, variable, or converter) whose units are defined is referenced elsewhere in your model, Insight Maker will evaluate its equation. If the result of this evaluation is a Unitless number, Insight Maker will then assign the units of that primitive to the value. If, however, the value is not Unitless and the units conflict with the primitive’s units, then an error will be displayed.
Defining Values With Units
You may define a number with specified units in your equations using a special, curly-bracket notation:
Unit names are case-insensitive, and singular and plural forms are equivalent, so {1 meter}, {1 Meter}, and {1 Meters} all mean the same thing:
Automatic Unit Conversion
Insight Maker automatically converts between compatible units in calculations. When you add or subtract quantities, the result is expressed in the units of the left-hand value:
Subtraction works the same way, converting the right-hand value before subtracting it:
Conversion also applies to comparisons, so quantities can be compared regardless of the units they are expressed in:
Compound Units
Units can be combined with *, /, and ^ to form compound units like speeds, flow rates, and areas. When you multiply or divide quantities, their units multiply and divide too:
Units cancel algebraically. Dividing a volume by a flow rate yields a time. This is how long it takes to fill a 2,000 liter tank at 25 liters per minute:
Multiplying a rate by a time yields a quantity:
Dividing a compound unit by a plain number leaves the unit untouched:
Exponents work on units as well. Squaring a length produces an area, and taking a square root halves the unit exponents:
Compound units are tracked symbolically through any calculation. For example, multiplying a mass by an acceleration produces a force (this result, kilograms meters/second², is the definition of a Newton):
When a multiplication or division combines quantities from different unit systems, Insight Maker may express the result in canonical base units rather than the units you typed. The result is correct, but it may not be displayed in the units you expect:
That result, 16,093.44 meters, is exactly 10 miles. The "Converting and Removing Units" section below shows how to convert it back to the units you want.
Incompatible Units
When an equation combines incompatible units, Insight Maker reports an error rather than computing a meaningless result. During a simulation, that error stops the run:
Adding a plain, unitless number to a value with units is also an error, as Insight Maker cannot know what units the plain number was meant to have. The error message suggests the likely fix:
Some functions are only defined for unitless values. Logarithms, exponentials, and trigonometric functions such as Ln, Log, Exp, Sin, and Cos will report an error if given a value with units:
Custom Units
Insight Maker comes with a large number of units built-in (see the reference table at the bottom of this page). But you are not limited to them: any name you use in the curly-bracket notation automatically becomes a custom unit. This lets you model quantities in whatever terms your system uses, such as products, patients, tickets, or animals:
Custom units participate fully in compound units and cancellation:
Distinct custom units are not interchangeable:
Because unrecognized names silently become new custom units, a misspelled built-in unit creates a separate, incompatible unit rather than an error where you defined it. Here Metre (a misspelling of the built-in Meter) becomes its own custom unit, so the addition fails:
If you see an "incompatible units" error you didn't expect, check the unit names in the error message for typos.
Converting and Removing Units
Sometimes you need a plain number, either for a function that requires unitless input or to report a ratio. Dividing two quantities with the same dimensions produces a unitless result, which makes division a natural way to both convert and strip units:
Units and Functions
Most mathematical functions work naturally with units:
Aggregation functions such as Mean, Max, Min, and Sum convert their arguments to compatible units before combining them:
Functions that are mathematically defined only for pure numbers (Ln, Log, Exp, and the trigonometric functions) report an error when given units. Use RemoveUnits to convert such values explicitly first.
Units and Vectors
Units and vectors follow the normal vector arithmetic logic:
Built-in Units
The following units are built into Insight Maker, organized by the quantity they measure. All names are case-insensitive and may be written in singular or plural form. Units within a category convert automatically; units from different categories do not mix (except through multiplication and division).
| Category | Units |
|---|---|
| Length | Millimeters, Centimeters, Meters, Kilometers, Inches, Feet, Yards, Miles |
| Area | Square Millimeters, Square Centimeters, Square Meters, Square Kilometers, Hectares, Square Inches, Square Feet, Square Yards, Square Miles, Acres |
| Volume | Cubic Millimeters, Cubic Centimeters, Cubic Meters, Cubic Kilometers, Liters, Fluid Ounces, Quarts, Gallons, Acre Feet |
| Time | Seconds, Minutes, Hours, Days, Weeks, Months, Quarters, Years |
| Mass | Milligrams, Grams, Kilograms, Tonnes, Ounces, Pounds, Tons |
| Speed & Acceleration | Meters per Second, Meters per Second Squared, Feet per Second, Feet per Second Squared, Miles per Hour, Miles per Hour Squared, Kilometers per Hour, Kilometers per Hour Squared |
| Flow Rates | Liters per Second, Cubic Meters per Second, Gallons per Second, Gallons per Minute, Pounds per Second, Kilograms per Second |
| Power | Watts, Kilowatts, Megawatts, Gigawatts |
| Energy | Joules, Kilojoules, Calories, Kilocalories, BTUs |
| Electrical | Amperes, Coulombs, Volts, Millivolts, Kilovolts, Farads |
| Force | Newtons, Pounds Force |
| Pressure | Pascals, Kilopascals, Bars, Atmospheres, Pounds per Square Inch |
| Currency | Dollars, Euros (plus rates such as Dollars per Year) |
| Angle | Degrees, Radians |
| Quantity | Atoms, Molecules |
Compound forms of any of these can always be written directly in the curly-bracket notation, such as {5 Kilograms/Day}, {100 Dollars/Month}, or {9.8 Meters/Second^2}. As described above, any name not in this table defines a custom unit.
