vCalc units are implemented in objects known as Amounts. Amounts have a value, an associate unit and a powerful set of functions. Parameters are designated as Amounts (having units) in the Equation Editor Algorithm Tab in both the algorithm code and in the user input UI where you can designate units for the input parameters.
To create an input parameter, you have to define a parameter using the ".args" extension. See the following example:
def h = args.h //create an input parameter named h
def w = args.w //create an input parameter named w
Once you've entered the two lines of code, vCalc's Equation Editor will pop-up two lines at the bottom of the algorithm with options associated with the input parameters (h and w in the example above). In the Input Parameter window, you can select units for the parameter. You can select a specific class (e.g. length) and unit type (e.g. meters), or you can select "Any" from a class and the default will be used. In any case, the user can toggle to different units in the class (i.e. to compatible units)
Now that you have parameter that are amounts, you have a lot of functions you can employ. These include the following:
The list of units are as follows:
| Quantity Type= | Std Unit | Named Units | |||||
|---|---|---|---|---|---|---|---|
| Acceleration | m/s² | m/s², ft/s², grav | |||||
| Amount Of Substance | mol | mol, atom, osmole | |||||
| Angle | rad | rad, centiradian, °, grade, ', rev, \" | |||||
| Angular Acceleration | rad/s² | rad/s², rad/h², rad/min², °/h², °/min², °/s² | |||||
| Angular Velocity | rad/s | rad/s, rad/day, rad/h, rad/min, °/day, °/h, °/min, °/s, rev/s, rpm, rev/h, rev/day | |||||
| Area | m² | m², µm², mm², cm², km², in², ft², yd², mi², acre, a, ha | |||||
| Catalytic Activity | kat | kat | |||||
| Concentration | mol/m3 | mol/m3, mol/L | |||||
| Data Amount | bit | bit, Mb, byte, KB, MB, GB,TB,PB | |||||
| Data Rate | bit/s | bit/s, bit/min, bit/day, MB/s, Mb/min, Mb/h, Mb/day, bytes/s, byte/min, byte/h, byte/day, KB/s, KB/min, KB/h, KB/day, MB/s, MB/min, MB/h, MB/day, GB/s, GB/min, GB/h, GB/h, GB/day, TB/s, TB/min, TB/h, TB/day, PB/s, PB/min, PB/h, PB/day | |||||
| Dimensionless | %, dB (''real'' may be used as alias for empty string unit) | ||||||
| Duration | s | s, µs, ns, ms, min, h, day, week, month, year, decade, century, day_sidereal, year_calendar, year_sidereal | |||||
| Dynamic Viscosity | ''P·s'' | kg/(m·s), g/(cm·s) | |||||
| Electric Capacitance | F | F, pF, µF, mF, kF | |||||
| Electric Charge | C | C, Fr, Fd, e | |||||
| Electric Conductance | S | S | |||||
| Electric Current | A | Gi, A, mA, µA, nA | |||||
| Electric Field | N/C | N/C, kgf/C, lbf/C, V/m, V/ft, V/in | |||||
| Electric Inductance | H | H, mH, nH | |||||
| Electric Potential | V | V | |||||
| Electric Resistance | Ω | Ω,mΩ,kΩ | "Ohm" | ||||
| Energy | J | J, ft_lbf, mJ, W_s, N_m, kWh, MWh, GWh, TWh, feV, neV, µeV, meV, keV, MeV, peV, hartree, erg, eV, cal, kcal, Mcal, BTU | |||||
| Enthalpy | J/mol | J/mol, kJ/mol, BTU/mol, eV/mol, erg/mol | |||||
| Fluid Resistance | Pa·s/L | Pa·s/L, Pa·min/L, Pa·s/mL, Pa·min/mL, Pa·s/m³, Pa·min/m³, Pa·s/cm³, Pa·min/cm³, mmHg·s/L, mmHg·min/L, mmHg·s/mL, mmHg·min/mL, mmHg·s/cm³, mmHg·min/cm³ | |||||
| Force | N | N, dyn, kgf, lbf, tonne_force, short_ton_force, long_ton_force | |||||
| Frequency | Hz | Hz, kHz, MHz, GHz, THz, PHz, Ehz, perSec, perMin, perHr, perDay, perWk, perYr | |||||
| Heat Capacity | J/K | J/K, J/℃, J/°F | |||||
| Illuminance | lx | lx, La, W/cm2, W/m2 | |||||
| Kinematic Viscosity | ''m²/s'' | cm²/s | |||||
| Length | m | m, nm, µm, mm, cm, km, in, ft, yd, mi, nmi, Å, mil, pixel, pt, foot_survey_us, fathom, au, light_second, light_munite, light_hour, light_day, ly, pc, kly, Mpc | |||||
| Length per Volume | mpg | mpg,km/L | |||||
| Luminous Flux | lm | lm | |||||
| Luminous Intensity | cd | cd | |||||
| Magnetic Field Strength | A/m | A/m | |||||
| Magnetic Flux | Wb | Wb, Mx | |||||
| Magnetic Flux Density | T | G, T | |||||
| Mass | kg | kg, mg, g, oz, lb, ton_us, t, ton_uk, me, u, gr, ct, dwt, troy_ounce, Earth_Mass, Jupiter_Mass, Solar_Mass | |||||
| Mass Flow Rate | kg/s | kg/s, kg/min, kg/h, g/s, lb/s, lb/min, lb/h | |||||
| Molar Mass | g/mol | g/mol, kg/mol, kg/kmol, mg/mol, oz/mol, lb/mol | |||||
| Moment of Inertia | kg·m² | kg·m², g·m², lb·ft², oz·in² | |||||
| Momentum | kg⋅m/s | kg⋅m/s | |||||
| Money | USD | USD, AUD, BRL, CAD, CHF, CNY, EUR, GBP, INR, JPY, MXN, RUB, ZAR | |||||
| Money per Area | USD/in2 | USD/in2, USD/ft2, USD/yd2, EUR/cm², EUR/m², EUR/km², GBP/cm², GBP/m², GBP/km², JPY/cm², JPY/m², JPY/km², INR/cm², INR/m², INR/km², CNY/cm², CNY/m², CNY/km², RUB/cm², RUB/m², RUB/km² | |||||
| Money Per Energy | USD/J | USD/J, USD/kWh, USD/MWh, USD/GWh, USD/TWh, EUR/kWh, EUR/MWh, EUR/GWh, EUR/TWh, INR/kWh, INR/MWh, INR/GWh, INR/TWh, RUB/kWh, RUB/MWh, RUB/GWh, RUB/TWh | |||||
| Money Per Length | USD/in | USD/in, USD/ft, USD/mi, EUR/cm, EUR/m, EUR/km, GBP/cm, GBP/m, GBP/km, JPY/cm, JPY/m, JPY/km, INR/cm, INR/m, INR/km, CNY/cm, CNY/m, CNY/km, RUB/cm, RUB/m, RUB/km | |||||
| Money Per Mass | USD/oz | USD/oz, USD/lb, USD/ton_us, EUR/g, EUR/kg, EUR/t, GBP/g, GBP/kg, GBP/t, CAD/g, CAD/kg, JPY/g, JPY/kg, JPY/t, INR/g, INR/kg, INR/t, CNY/g, CNY/kg, CNY/t, RUB/g, RUB/kg, RUB/t | |||||
| Money Per Time | USD/h | USD/s, USD/min, USD/h, USD/day, CAD/s, CAD/min, CAD/h, CAD/day, EUR/s, EUR/min, EUR/h, EUR/day, GBP/s, GBP/min, GBP/h, GBP/day, MXN/s, MXN/min, MXN/h, MXN/day, JPY/s, JPY/min, JPY/h, JPY/day, INR/s, INR/min, INR/h, INR/day, CNY/s, CNY/min, CNY/h, CNY/day, RUB/s, RUB/min, RUB/h, RUB/day | |||||
| Money Per Volume | USD/oz_liquid | SD/oz_liquid, USD/qt, USD/gal, USD/ft³, USD/bbl, CAD/cL, CAD/L, CAD/m³, CAD/bbl, EUR/cL, EUR/L, EUR/m³, EUR/bbl, GBP/cL, GBP/L, GBP/m³, GBP/bbl, MXN/cL, MXN/L, MXN/m³, MXN/bbl, JPY/cL, JPY/L, JPY/m³, JPY/bbl, INR/cL, INR/L, INR/m³, INR/bbl, CNY/cL, CNY/L, CNY/m³, CNY/bbl, RUB/cL, RUB/L, RUB/m³, RUB/bbl | |||||
| Permeability | d | d, md, µd | |||||
| Power | W | W, hp, mW, kW, MW, GW, TW, BTU/h | |||||
| Pressure | Pa | Pa, mPa, kPa, MPa, mmHg, inHg, mbar, bar, atm, N/mm², N/cm², lbf/in² | |||||
| Radiation Dose Absorbed | Gy | rem, Sv, Gy, rd | |||||
| Radiation Dose Effective | Sv | rem, Sv, Gy, rd | |||||
| Radioactive Activity | Bq | Bq, Ci | |||||
| Solid Angle | sr | sr, sphere | |||||
| Stress | N/m2 | N/m², N/cm², N/mm², kN/cm², kN/mm², psi_stress, lbf/ft², short_ton_force/in², short_ton_force/ft², long_ton_force/in², long_ton_force/ft² | |||||
| Surface Energy | N/m | N/m, lbf/in, lbf/ft | |||||
| Temperature | K | °R, K, °F, ℃ | |||||
| Torque | ''N·m'' | J, erg, eV, ft_lbf, mJW_s, N_m, kWh, MWh, GWh, TWh, feV, neV, μeV, meV, keV, MeV, peV, hartree, cal, kcal, Mcal, BTU | |||||
| Velocity | m/s | m/s, m/min, mm/s, cm/s, km/s, km/min, km/h, mph, in/s, in/min, in/h, ft/s, ft/min, ft/h, kn, Mach, c | |||||
| Volume | m³ | gallon_uk, oz_liquid_uk, km³, mi³, ft³, gallon_dry_us, L, km3, bu, mm³, gal, yd³, m³, mm³, in³, cm³, mL, oz_liquid, ac⋅ft, smidgen, pinch, dash, tsp, tbsp, cup, pint, qt, drop, bbl | |||||
| Volumetric Density | kg/m³ | kg/m³, lb/ft³, g/cm³, t/m³, ton_us/yd³, oz/in³, g/mL, kg/L, g/m³ | |||||
| Volumetric Flow Rate | m³/s | m³/s, L/s, L/min, L/h, mL/s, mL/min, mL/h, qt/s, qt/min, qt/h, gal/s, gal/min, gal/h, drop/min, bbl/min, bbl/h, bbl/day, ft³/min, ft³/h, ft³/day, m³/min, m³/h, m³/day |
All SI Units are labeled only by their standard symbol (e.g. ''Meter'' is labeled as ''m'', with the exception of the following additional labels intended to ease ascii use.
| System ID | Label | Notes | |||||
| SI.OHM | Ohm | may be used in place of ''Ω'' | |||||
| SI.CELSIUS | Celsius | may be used in place of ''°C'' or ''℃'' |
Additionally, as discussed above in SI Prefixes, it is valid to reference any SI unit with a standard SI prefix attached.
| System ID | Label | ||||
| NonSI.PERCENT | % | ||||
| NonSI.DECIBEL | dB | ||||
| NonSI.G | grav | ||||
| NonSI.ATOM | atom | ||||
| NonSI.REVOLUTION | rev | ||||
| NonSI.DEGREE_ANGLE | ° | ||||
| NonSI.DEGREE_ANGLE | degree_angle | ||||
| NonSI.MINUTE_ANGLE | ' | ||||
| NonSI.SECOND_ANGLE | \" | ||||
| NonSI.CENTIRADIAN | centiradian | ||||
| NonSI.GRADE | grade | ||||
| NonSI.ARE | a | ||||
| NonSI.HECTARE | ha | ||||
| NonSI.BYTE | byte | ||||
| NonSI.MINUTE | min | ||||
| NonSI.HOUR | h | ||||
| NonSI.DAY | day | ||||
| NonSI.WEEK | week | ||||
| NonSI.YEAR | year | ||||
| NonSI.MONTH | month | ||||
| NonSI.DAY_SIDEREAL | day_sidereal | ||||
| NonSI.YEAR_SIDEREAL | year_sidereal | ||||
| NonSI.YEAR_CALENDAR | year_calendar | ||||
| NonSI.E | e | ||||
| NonSI.FARADAY | Fd | ||||
| NonSI.FRANKLIN | Fr | ||||
| NonSI.GILBERT | Gi | ||||
| NonSI.ERG | erg | ||||
| NonSI.ELECTRON_VOLT | eV | ||||
| SI.KILO(NonSI.ELECTRON_VOLT) | keV | ||||
| SI.MEGA(NonSI.ELECTRON_VOLT) | MeV | ||||
| SI.GIGA(NonSI.ELECTRON_VOLT) | GeV | ||||
| NonSI.LAMBERT | La | ||||
| NonSI.FOOT | ft | ||||
| NonSI.FOOT_SURVEY_US | foot_survey_us |
| System ID | Label | ||||
| FATHOM | fathom | ||||
| BUSHEL | bu | ||||
| QUART_US | qt | ||||
| PINT_US | pint | ||||
| CUP | cup | ||||
| TABLESPOON | tbsp | ||||
| TEASPOON | tsp | ||||
| DASH | dash | ||||
| PINCH | pinch | ||||
| SMIDGEN | smidgen | ||||
| CARAT | ct | ||||
| GRAIN | gr | ||||
| TROY_OUNCE | troy_ounce | ||||
| PENNY_WEIGHT | dwt | ||||
| BTU | BTU | ||||
| HARTREE | hartree | ||||
| HARTREE | E_h | ||||
| CAL | cal | ||||
| TONNE_FORCE | tonne_force | ||||
| LONG_TON_FORCE | long_ton_force | ||||
| SHORT_TON_FORCE | short_ton_force | ||||
| PER_SEC | perSec | ||||
| PER_MIN | perMin | ||||
| PER_HOUR | perHr | ||||
| PER_DAY | perDay | ||||
| PER_WEEK | perWk | ||||
| PER_YEAR | perYr | ||||
| BPM | BPM | ||||
| REV_PER_MIN | rpm | ||||
| ACRE | acre | ||||
| MIL | mil | ||||
| KILOLIGHTYEAR | kly | ||||
| MILLIBAR | mbar | ||||
| DARCY | d | ||||
| MICRODARCY | µd | ||||
| MILLIDARCY | md | ||||
| MILLIOHM | mOhm | ||||
| KILOOHM | kOhm | ||||
| SI.MICRO(SI.METER) | microm | ||||
| NonSI.DEGREE_ANGLE | degree_angle | ||||
| Dimensionless.UNIT | (empty string) or "real" |