QCalc.Units.Examples

Examples

Information

Extends from Icons.ExamplesPackage (Icon for packages containing runnable examples (from MSL 3.2.1)).

Package Contents

Name Description
QCalc.Units.Examples.Evaluate Evaluate Evaluate the values assigned to constants and units
QCalc.Units.Examples.Display Display Demonstrate the display units for the quantities
QCalc.Units.Examples.ExampleModel ExampleModel Model that uses all of the quantities

QCalc.Units.Examples.Evaluate QCalc.Units.Examples.Evaluate

Evaluate the values assigned to constants and units

Information

This model may be used to calculate the values of the constants and units.

For more information, please see the documentation for the Units package.

Extends from QCalc.Icons.Example (Icon for runnable examples (from MSL 3.2.1)).

Modelica definition

model Evaluate "Evaluate the values assigned to constants and units" import QCalc; extends QCalc.Icons.Example; // ------------------------------------------------------------------------- // Mathematical constants final constant Q.Number pi=QCalc.Units.pi "pi"; // ------------------------------------------------------------------------- // Base physical constants final constant Q.Wavenumber R_inf=QCalc.Units.R_inf "Rydberg constant"; final constant Q.Velocity c=QCalc.Units.c "speed of light"; final constant Q.MagneticFluxReciprocal k_J=QCalc.Units.k_J "Josephson constant"; final constant Q.MagneticFluxSpecific R_K=QCalc.Units.R_K "von Klitzing constant"; final constant Q.Number k_F=QCalc.Units.k_F "Faraday constant"; final constant Q.Number R=QCalc.Units.R "gas constant"; final constant Q.LengthSpecificMassSpecific k_Aprime=QCalc.Units.k_Aprime "modified Ampere constant"; // ------------------------------------------------------------------------- // Derived physical constants final constant Q.MagneticFlux Phi_0=QCalc.Units.Phi_0 "magnetic flux quantum (&Phi;<sub>0</sub>)"; final constant Q.Conductance G_0=QCalc.Units.G_0 "conductance quantum"; final constant Q.Amount e=QCalc.Units.e "elementary charge"; final constant Q.MomentumRotational h=QCalc.Units.h "Planck constant"; final constant Q.AmountReciprocal N_A=QCalc.Units.N_A "Avogadro constant"; final constant Q.Amount k_B=QCalc.Units.k_B "Boltzmann constant"; final constant Q.Angle cyc=QCalc.Units.cyc "cycle"; final constant Q.PowerArea c_1=QCalc.Units.c_1 "first radiation constant"; final constant Q.PotentialPerWavenumber c_2=QCalc.Units.c_2 "second radiation constant"; final constant Q.MagneticFluxReciprocal c_3_f=QCalc.Units.c_3_f "Wien frequency displacement constant"; final constant Q.PotentialPerWavenumber c_3_lambda=QCalc.Units.c_3_lambda "Wien wavelength displacement constant"; final constant Q.PowerAreicPerPotential4 sigma=QCalc.Units.sigma "Stefan-Boltzmann constant"; final constant Q.Energy Ry=QCalc.Units.Ry "Rydberg energy"; final constant Q.Energy Ha=QCalc.Units.Ha "Hartree energy"; final constant Q.Temperature T_H=QCalc.Units.T_H "Hartree temperature"; // ------------------------------------------------------------------------- // Mathematical relations final constant Q.Angle rad=QCalc.Units.rad "radian"; // ------------------------------------------------------------------------- // Empirical relations final constant Q.Length m=QCalc.Units.m "metre"; final constant Q.Time s=QCalc.Units.s "second"; final constant Q.MagneticFlux Wb=QCalc.Units.Wb "weber"; final constant Q.Conductance S=QCalc.Units.S "siemens"; final constant Q.Amount mol=QCalc.Units.mol "mole"; final constant Q.Potential K=QCalc.Units.K "kelvin"; // ------------------------------------------------------------------------- // SI units decoupled from the base constants final constant Q.LuminousIntensity cd=QCalc.Units.cd "candela"; // ------------------------------------------------------------------------- // SI base units [BIPM2006, Table 1] and intermediate units final constant Q.Frequency Hz=QCalc.Units.Hz "hertz"; final constant Q.Potential V=QCalc.Units.V "volt"; final constant Q.Current A=QCalc.Units.A "ampere"; final constant Q.Amount C=QCalc.Units.C "coulomb"; final constant Q.Energy J=QCalc.Units.J "joule"; final constant Q.Velocity2 Gy=QCalc.Units.Gy "gray"; final constant Q.Mass kg=QCalc.Units.kg "kilogram "; final constant Q.Mass g=QCalc.Units.g "gram "; // ------------------------------------------------------------------------- // SI derived units with special names and symbols [BIPM2006, Table 3] final constant Q.Angle2 sr=QCalc.Units.sr "steradian"; final constant Q.Power lm=QCalc.Units.lm "lumen"; final constant Q.Power W=QCalc.Units.W "watt"; final constant Q.Force N=QCalc.Units.N "newton"; final constant Q.Pressure Pa=QCalc.Units.Pa "pascal"; final constant Q.MagneticFluxAreic T=QCalc.Units.T "tesla"; final constant Q.PowerAreic lx=QCalc.Units.lx "lux"; final constant Q.Capacitance F=QCalc.Units.F "farad"; final constant Q.Resistance ohm=QCalc.Units.ohm "ohm"; final constant Q.Inductance H=QCalc.Units.H "henry"; final constant Q.Current kat=QCalc.Units.kat "katal"; final constant Q.Velocity2 Sv=QCalc.Units.Sv "sievert"; final constant Q.TimeReciprocal Bq=QCalc.Units.Bq "becquerel"; // ------------------------------------------------------------------------- // Non-SI units accepted for use with SI units [BIPM2006, Table 6] final constant Q.Time min=QCalc.Units.min "minute"; final constant Q.Time hr=QCalc.Units.hr "hour"; final constant Q.Time d=QCalc.Units.d "day"; final constant Q.Angle deg=QCalc.Units.deg "degree"; final constant Q.Volume L=QCalc.Units.L "liter"; // ------------------------------------------------------------------------- // Other non-SI units [BIPM2006, Table 8] final constant Q.Acceleration g_0=QCalc.Units.g_0 "standard gravity"; final constant Q.Length cm=QCalc.Units.cm "centimetre"; final constant Q.Volume cc=QCalc.Units.cc "cubic centimetre"; final constant Q.PressureLineic Hg=QCalc.Units.Hg "force per volume of mercury under standard gravity"; final constant Q.Length mm=QCalc.Units.mm "millimetre"; final constant Q.Pressure mmHg=mm*Hg "millimetre of mercury"; final constant Q.Pressure kPa=QCalc.Units.kPa "kilopascal"; final constant Q.Pressure bar=QCalc.Units.bar "bar"; final constant Q.Area b=QCalc.Units.b "barn"; final constant Q.Length angstrom=QCalc.Units.angstrom "angstrom"; final constant Q.Length nmi=QCalc.Units.nmi "nautical mile"; final constant Q.Velocity kn=QCalc.Units.kn "knot"; // ------------------------------------------------------------------------- // Non-SI units associated with the CGS and the CGS-Gaussian system of units // [BIPM2006, Table 9] final constant Q.Acceleration Gal=QCalc.Units.Gal "gal"; final constant Q.Force dyn=QCalc.Units.dyn "dyne"; final constant Q.Energy erg=QCalc.Units.erg "erg"; final constant Q.Pressure Ba=QCalc.Units.Ba "barye"; final constant Q.Viscosity P=QCalc.Units.P "poise"; final constant Q.Diffusivity St=QCalc.Units.St "stokes"; final constant Q.Luminance sb=QCalc.Units.sb "stilb"; final constant Q.Illuminance ph=QCalc.Units.ph "phot"; final constant Q.Current abA=QCalc.Units.abA "abampere"; final constant Q.Amount abC=QCalc.Units.abC "abcoloumb"; final constant Q.Potential abV=QCalc.Units.abV "abvolt"; final constant Q.MagneticFlux Mx=QCalc.Units.Mx "maxwell"; final constant Q.MagneticFluxAreic Gs=QCalc.Units.Gs "gauss"; final constant Q.MagneticFlux pole=QCalc.Units.pole "unit pole"; final constant Q.MagneticFieldAux Oe=QCalc.Units.Oe "oersted"; final constant Q.Capacitance abF=QCalc.Units.abF "abfarad"; final constant Q.Resistance abohm=QCalc.Units.abohm "abohm"; final constant Q.Inductance abH=QCalc.Units.abH "abhenry"; // ------------------------------------------------------------------------- // Constants related to Ampere's force law constant Q.LengthSpecificMassSpecific k_A=QCalc.Units.k_A "Ampere constant"; constant Q.PermittivityReciprocal k_C=QCalc.Units.k_C "Coulomb constant"; final constant Q.Permittivity epsilon_0=QCalc.Units.epsilon_0 "electric constant"; final constant Q.Permeability mu_0=QCalc.Units.mu_0 "magnetic constant "; final constant Q.Resistance Z_0=QCalc.Units.Z_0 "characteristic impedance of vacuum"; final constant Q.Angle alpha=QCalc.Units.alpha "fine-structure constant"; final constant Q.Length a_0=QCalc.Units.a_0 "Bohr radius"; final constant Q.Wavelength lambda_e=QCalc.Units.lambda_e "electron Compton wavelength"; final constant Q.WavelengthVelocity kappa=QCalc.Units.kappa "quantum of circulation"; final constant Q.MassSpecific m_e=QCalc.Units.m_e "specific electron rest mass"; final constant Q.LengthSpecific r_e=QCalc.Units.r_e "specific classical electron radius"; final constant Q.MagneticDipoleMoment mu_B=QCalc.Units.mu_B "Bohr magneton"; final constant Q.Mass M_e=QCalc.Units.M_e "mass of an electron"; final constant Q.Time t_H=QCalc.Units.t_H "Hartree time"; final constant Q.Length l_n=QCalc.Units.l_n "natural unit of length"; final constant Q.Time t_n=QCalc.Units.t_n "natural unit of time"; // ------------------------------------------------------------------------- // Other final constant Q.Time y=QCalc.Units.y "Julian year"; final constant Q.Length ly=QCalc.Units.ly "light year"; final constant Q.Length au=QCalc.Units.au "astronomical unit"; final constant Q.Length pc=QCalc.Units.pc "parsec"; final constant Q.Pressure atm=QCalc.Units.atm "atmosphere"; final constant Q.Pressure Torr=QCalc.Units.Torr "torr"; final constant Q.Energy Wh=QCalc.Units.Wh "watt hour"; final constant Q.Energy eV=QCalc.Units.eV "electron volt"; final constant Q.Angle2 sp=QCalc.Units.sp "spat"; final constant Q.Frequency rpm=QCalc.Units.rpm "revolution per minute"; final constant Q.Number '%'=QCalc.Units.'%' "percent"; final constant Q.MagnetomotiveForce AT=QCalc.Units.AT "ampere-turn"; final constant Q.Area D=QCalc.Units.D "darcy"; final constant Q.Mass u=QCalc.Units.u "unified atomic mass unit"; final constant Q.Concentration M=QCalc.Units.M "molar"; end Evaluate;

QCalc.Units.Examples.Display QCalc.Units.Examples.Display

Demonstrate the display units for the quantities

QCalc.Units.Examples.Display

Information

Extends from Icons.Example (Icon for runnable examples (from MSL 3.2.1)).

Modelica definition

model Display "Demonstrate the display units for the quantities" extends Icons.Example; ExampleModel doubleClickMe; end Display;

QCalc.Units.Examples.ExampleModel QCalc.Units.Examples.ExampleModel

Model that uses all of the quantities

Information

Extends from Icons.Block (Basic graphical layout of input/output block (from MSL 3.2.1)).

Parameters

TypeNameDefaultDescription
AccelerationAcceleration1*GalAcceleration [ L/T2]
AmountAmount1*molAmount [ N]
AmountReciprocalAmountReciprocal1/CReciprocal of amount [ 1/N]
AngleAngle1*radAngle [ A]
Angle2Angle21*srSolid angle [ A2]
AreaArea1*bArea [ L2]
CapacitanceCapacitance1*FCapacitance [ N2.T2/(L2.M)]
ConcentrationConcentration1*MConcentration [ N/L3]
ConductanceConductance1*SConductance [ N2.T/(L2.M)]
CurrentCurrent1*ACurrent [ N/T]
DiffusivityDiffusivity1*StDiffusivity [ L2/T]
EnergyEnergy1*JEnergy [ L2.M/T2]
ForceForce1*NForce [ L.M/T2]
FrequencyFrequency1*HzFrequency [ A/T]
IlluminanceIlluminance1*lmIlluminance [ J.A2]
InductanceInductance1*HInductance [ L2.M/N2]
LengthLength1*mLength [ L]
LengthSpecificLengthSpecific1*m/CSpecific length [ L/N]
LengthSpecificMassSpecificLengthSpecificMassSpecific1*H/mSpecific length times specific mass [ L.M/N2]
LuminanceLuminance1*sbLuminance [ J/L2]
LuminousEmittanceLuminousEmittance1*lxLuminous emittance [ J.A2/L2]
LuminousIntensityLuminousIntensity1*cdLuminous intensity [ J]
MagneticDipoleMomentMagneticDipoleMoment1*J/TMagnetic dipole moment [ A.L2.N/T]
MagneticFieldAuxMagneticFieldAux1*AT/mAuxiliary magnetic field [ A.N/(L.T)]
MagneticFluxMagneticFlux1*WbMagnetic flux [ L2.M/(A.N.T)]
MagneticFluxAreicMagneticFluxAreic1*TAreic magnetic flux [ M/(A.N.T)]
MagneticFluxReciprocalMagneticFluxReciprocal1/WbReciprocal of magnetic flux [ A.N.T/(L2.M)]
MagneticFluxSpecificMagneticFluxSpecific1*Wb/CSpecific magnetic flux [ L2.M/(A.N2.T)]
MagnetomotiveForceMagnetomotiveForce1*ATMagnetomotive force [ A.N/T]
MassMass1*kgMass [ M]
MassSpecificMassSpecific1*g/molSpecific mass [ M/N]
MomentumRotationalMomentumRotational1*J/HzRotational momentum [ L2.M/(A.T)]
NumberNumber1Number [ 1]
PermeabilityPermeability1*Wb/(AT*m)Permeability [ L.M/(A2.N2)]
PermittivityPermittivity1*F/mPermittivity [ N2.T2/(L3.M)]
PermittivityReciprocalPermittivityReciprocal1*m/FReciprocal of permittivity [ L3.M/(N2.T2)]
PotentialPotential1*VPotential [ L2.M/(N.T2)]
PotentialPerWavenumberPotentialPerWavenumber1*V*m/radPotential per wavenumber [ L3.M/(A.N.T2)]
PowerPower1*WPower [ L2.M/T3]
PowerAreaPowerArea1*W*m^2Power times area [ L4.M/T3]
PowerAreicPowerAreic1*W/m^2Areic power [ M/T3]
PowerAreicPerPotential4PowerAreicPerPotential41*W/(m^2*K^4)Areic power per 4th power of potential [ N4.T5/(L8.M3)]
PressurePressure1*PaPressure [ M/(L.T2)]
PressureLineicPressureLineic1*Pa/mLineic pressure [ M/(L2.T2)]
ResistanceResistance1*ohmResistance [ L2.M/(N2.T)]
TimeTime1*sTime [ T]
TimeReciprocalTimeReciprocal1*BqReciprocal of time [ 1/T]
VelocityVelocity1*m/sVelocity [ L/T]
Velocity2Velocity21*SvSquared velocity [ L2/T2]
ViscosityViscosity1*Pa*s/1Viscosity [ M/(L.T)]
VolumeVolume1*m^3Volume [ L3]
WavelengthWavelength1*m/cycWavelength [ L/A]
WavelengthVelocityWavelengthVelocity1*m^2/(cyc*s)Wavelength times velocity [ L2/(A.T)]
WavenumberWavenumber1*cyc/mWavenumber [ A/L]

Modelica definition

model ExampleModel "Model that uses all of the quantities" extends Icons.Block; // Generated from QCalc/Resources/quantities.xlsx, 2014-8-22 parameter Q.Acceleration Acceleration=1*Gal "Acceleration"; parameter Q.Amount Amount=1*mol "Amount"; parameter Q.AmountReciprocal AmountReciprocal=1/C "Reciprocal of amount"; parameter Q.Angle Angle=1*rad "Angle"; parameter Q.Angle2 Angle2=1*sr "Solid angle"; parameter Q.Area Area=1*b "Area"; parameter Q.Capacitance Capacitance=1*F "Capacitance"; parameter Q.Concentration Concentration=1*M "Concentration"; parameter Q.Conductance Conductance=1*S "Conductance"; parameter Q.Current Current=1*A "Current"; parameter Q.Diffusivity Diffusivity=1*St "Diffusivity"; parameter Q.Energy Energy=1*J "Energy"; parameter Q.Force Force=1*N "Force"; parameter Q.Frequency Frequency=1*Hz "Frequency"; parameter Q.Illuminance Illuminance=1*lm "Illuminance"; parameter Q.Inductance Inductance=1*H "Inductance"; parameter Q.Length Length=1*m "Length"; parameter Q.LengthSpecific LengthSpecific=1*m/C "Specific length"; parameter Q.LengthSpecificMassSpecific LengthSpecificMassSpecific=1*H/m "Specific length times specific mass"; parameter Q.Luminance Luminance=1*sb "Luminance"; parameter Q.LuminousEmittance LuminousEmittance=1*lx "Luminous emittance"; parameter Q.LuminousIntensity LuminousIntensity=1*cd "Luminous intensity"; parameter Q.MagneticDipoleMoment MagneticDipoleMoment=1*J/T "Magnetic dipole moment"; parameter Q.MagneticFieldAux MagneticFieldAux=1*AT/m "Auxiliary magnetic field"; parameter Q.MagneticFlux MagneticFlux=1*Wb "Magnetic flux"; parameter Q.MagneticFluxAreic MagneticFluxAreic=1*T "Areic magnetic flux"; parameter Q.MagneticFluxReciprocal MagneticFluxReciprocal=1/Wb "Reciprocal of magnetic flux"; parameter Q.MagneticFluxSpecific MagneticFluxSpecific=1*Wb/C "Specific magnetic flux"; parameter Q.MagnetomotiveForce MagnetomotiveForce=1*AT "Magnetomotive force"; parameter Q.Mass Mass=1*kg "Mass"; parameter Q.MassSpecific MassSpecific=1*g/mol "Specific mass"; parameter Q.MomentumRotational MomentumRotational=1*J/Hz "Rotational momentum"; parameter Q.Number Number=1 "Number"; parameter Q.Permeability Permeability=1*Wb/(AT*m) "Permeability"; parameter Q.Permittivity Permittivity=1*F/m "Permittivity"; parameter Q.PermittivityReciprocal PermittivityReciprocal=1*m/F "Reciprocal of permittivity"; parameter Q.Potential Potential=1*V "Potential"; parameter Q.PotentialPerWavenumber PotentialPerWavenumber=1*V*m/rad "Potential per wavenumber"; parameter Q.Power Power=1*W "Power"; parameter Q.PowerArea PowerArea=1*W*m^2 "Power times area"; parameter Q.PowerAreic PowerAreic=1*W/m^2 "Areic power"; parameter Q.PowerAreicPerPotential4 PowerAreicPerPotential4=1*W/(m^2*K^4) "Areic power per 4th power of potential"; parameter Q.Pressure Pressure=1*Pa "Pressure"; parameter Q.PressureLineic PressureLineic=1*Pa/m "Lineic pressure"; parameter Q.Resistance Resistance=1*ohm "Resistance"; parameter Q.Time Time=1*s "Time"; parameter Q.TimeReciprocal TimeReciprocal=1*Bq "Reciprocal of time"; parameter Q.Velocity Velocity=1*m/s "Velocity"; parameter Q.Velocity2 Velocity2=1*Sv "Squared velocity"; parameter Q.Viscosity Viscosity=1*Pa*s/1 "Viscosity"; parameter Q.Volume Volume=1*m^3 "Volume"; parameter Q.Wavelength Wavelength=1*m/cyc "Wavelength"; parameter Q.WavelengthVelocity WavelengthVelocity=1*m^2/(cyc*s) "Wavelength times velocity"; parameter Q.Wavenumber Wavenumber=1*cyc/m "Wavenumber"; // -------- end from QCalc/Resources/quantities.xlsx end ExampleModel;