add the following units:
- mmol - ml - bar - mbar - kJ - kWh - eV - C - T - F (p, n, u, m) - H (n, u, m)
This commit is contained in:
@@ -168,6 +168,7 @@ EXPO [eE][-+]?[0-9]+
|
||||
"km" COUNTCHARS; yylval.quantity.scaler = Quantity::KiloMetre; yylval.quantity.unitStr = yytext; return UNIT; // kilo meter
|
||||
|
||||
"l" COUNTCHARS; yylval.quantity.scaler = Quantity::Liter; yylval.quantity.unitStr = yytext; return UNIT; // Liter dm^3
|
||||
"ml" COUNTCHARS; yylval.quantity.scaler = Quantity::MilliLiter; yylval.quantity.unitStr = yytext; return UNIT; // milli Liter
|
||||
|
||||
"ug" COUNTCHARS; yylval.quantity.scaler = Quantity::MicroGram; yylval.quantity.unitStr = yytext; return UNIT; // micro gram
|
||||
"\xC2\xB5g" COUNTCHARS; yylval.quantity.scaler = Quantity::MicroGram; yylval.quantity.unitStr = yytext; return UNIT; // micro gram
|
||||
@@ -191,6 +192,7 @@ EXPO [eE][-+]?[0-9]+
|
||||
"uK" COUNTCHARS; yylval.quantity.scaler = Quantity::MicroKelvin; yylval.quantity.unitStr = yytext; return UNIT; // Kelvin
|
||||
|
||||
"mol" COUNTCHARS; yylval.quantity.scaler = Quantity::Mole; yylval.quantity.unitStr = yytext; return UNIT; // Mole (internal standard amount of substance)
|
||||
"mmol" COUNTCHARS; yylval.quantity.scaler = Quantity::MilliMole; yylval.quantity.unitStr = yytext; return UNIT; // milli Mole
|
||||
|
||||
"cd" COUNTCHARS; yylval.quantity.scaler = Quantity::Candela; yylval.quantity.unitStr = yytext; return UNIT; // Candela (internal standard luminous intensity)
|
||||
|
||||
@@ -203,8 +205,6 @@ EXPO [eE][-+]?[0-9]+
|
||||
"yd" COUNTCHARS; yylval.quantity.scaler = Quantity::Yard; yylval.quantity.unitStr = yytext; return UNIT; // yard
|
||||
"mi" COUNTCHARS; yylval.quantity.scaler = Quantity::Mile; yylval.quantity.unitStr = yytext; return UNIT; // mile
|
||||
|
||||
|
||||
|
||||
"lb" COUNTCHARS; yylval.quantity.scaler = Quantity::Pound; yylval.quantity.unitStr = yytext; return UNIT; // pound
|
||||
"lbm" COUNTCHARS; yylval.quantity.scaler = Quantity::Pound; yylval.quantity.unitStr = yytext; return UNIT; // pound
|
||||
"oz" COUNTCHARS; yylval.quantity.scaler = Quantity::Ounce; yylval.quantity.unitStr = yytext; return UNIT; // ounce
|
||||
@@ -223,6 +223,9 @@ EXPO [eE][-+]?[0-9]+
|
||||
"MPa" COUNTCHARS; yylval.quantity.scaler = Quantity::MegaPascal; yylval.quantity.unitStr = yytext; return UNIT; // Pascal
|
||||
"GPa" COUNTCHARS; yylval.quantity.scaler = Quantity::GigaPascal; yylval.quantity.unitStr = yytext; return UNIT; // Pascal
|
||||
|
||||
"bar" COUNTCHARS; yylval.quantity.scaler = Quantity::Bar; yylval.quantity.unitStr = yytext; return UNIT; // Bar
|
||||
"mbar" COUNTCHARS; yylval.quantity.scaler = Quantity::MilliBar; yylval.quantity.unitStr = yytext; return UNIT; // milli Bar
|
||||
|
||||
"Torr" COUNTCHARS; yylval.quantity.scaler = Quantity::Torr; yylval.quantity.unitStr = yytext; return UNIT; // portion of Pascal ( 101325/760 )
|
||||
"mTorr" COUNTCHARS; yylval.quantity.scaler = Quantity::mTorr; yylval.quantity.unitStr = yytext; return UNIT; //
|
||||
"uTorr" COUNTCHARS; yylval.quantity.scaler = Quantity::yTorr; yylval.quantity.unitStr = yytext; return UNIT; //
|
||||
@@ -234,11 +237,35 @@ EXPO [eE][-+]?[0-9]+
|
||||
"W" COUNTCHARS; yylval.quantity.scaler = Quantity::Watt; yylval.quantity.unitStr = yytext; return UNIT; // Watt (kg*m^2/s^3)
|
||||
"VA" COUNTCHARS; yylval.quantity.scaler = Quantity::VoltAmpere; yylval.quantity.unitStr = yytext; return UNIT; // VoltAmpere (kg*m^2/s^3)
|
||||
|
||||
"V" COUNTCHARS; yylval.quantity.scaler = Quantity::Volt; yylval.quantity.unitStr = yytext; return UNIT; // Volt (kg*m^2/A/s^3)
|
||||
"kV" COUNTCHARS; yylval.quantity.scaler = Quantity::KiloVolt; yylval.quantity.unitStr = yytext; return UNIT; // Kilo Volt
|
||||
"mV" COUNTCHARS; yylval.quantity.scaler = Quantity::MilliVolt; yylval.quantity.unitStr = yytext; return UNIT; // Milli Volt
|
||||
|
||||
"C" COUNTCHARS; yylval.quantity.scaler = Quantity::Coulomb; yylval.quantity.unitStr = yytext; return UNIT; // Coulomb (A*s)
|
||||
|
||||
"T" COUNTCHARS; yylval.quantity.scaler = Quantity::Tesla; yylval.quantity.unitStr = yytext; return UNIT; // Tesla (kg/s^2/A)
|
||||
|
||||
"F" COUNTCHARS; yylval.quantity.scaler = Quantity::Farad; yylval.quantity.unitStr = yytext; return UNIT; // Farad (s^4*A^2/m^2/kg)
|
||||
"mF" COUNTCHARS; yylval.quantity.scaler = Quantity::MilliFarad; yylval.quantity.unitStr = yytext; return UNIT; // Milli Farad
|
||||
"\xC2\xB5F" COUNTCHARS; yylval.quantity.scaler = Quantity::MicroFarad; yylval.quantity.unitStr = yytext; return UNIT; // Micro Farad
|
||||
"uF" COUNTCHARS; yylval.quantity.scaler = Quantity::MicroFarad; yylval.quantity.unitStr = yytext; return UNIT; // Micro Farad
|
||||
"nF" COUNTCHARS; yylval.quantity.scaler = Quantity::NanoFarad; yylval.quantity.unitStr = yytext; return UNIT; // Nano Farad
|
||||
"pF" COUNTCHARS; yylval.quantity.scaler = Quantity::PicoFarad; yylval.quantity.unitStr = yytext; return UNIT; // Pico Farad
|
||||
|
||||
"H" COUNTCHARS; yylval.quantity.scaler = Quantity::Henry; yylval.quantity.unitStr = yytext; return UNIT; // Henry (kg*m^2/s^2/A^2)
|
||||
"mH" COUNTCHARS; yylval.quantity.scaler = Quantity::MilliHenry; yylval.quantity.unitStr = yytext; return UNIT; // Milli Henry
|
||||
"\xC2\xB5H" COUNTCHARS; yylval.quantity.scaler = Quantity::MicroHenry; yylval.quantity.unitStr = yytext; return UNIT; // Micro Henry
|
||||
"uH" COUNTCHARS; yylval.quantity.scaler = Quantity::MicroHenry; yylval.quantity.unitStr = yytext; return UNIT; // Micro Henry)
|
||||
"nH" COUNTCHARS; yylval.quantity.scaler = Quantity::NanoHenry; yylval.quantity.unitStr = yytext; return UNIT; // Nano Henry
|
||||
|
||||
"J" COUNTCHARS; yylval.quantity.scaler = Quantity::Joule; yylval.quantity.unitStr = yytext; return UNIT; // Joule (kg*m^2/s^2)
|
||||
"kJ" COUNTCHARS; yylval.quantity.scaler = Quantity::KiloJoule; yylval.quantity.unitStr = yytext; return UNIT; // kilo Joule
|
||||
"Nm" COUNTCHARS; yylval.quantity.scaler = Quantity::NewtonMeter; yylval.quantity.unitStr = yytext; return UNIT; // N*m = Joule
|
||||
"VAs" COUNTCHARS; yylval.quantity.scaler = Quantity::VoltAmpereSecond; yylval.quantity.unitStr = yytext; return UNIT; // V*A*s = Joule
|
||||
"CV" COUNTCHARS; yylval.quantity.scaler = Quantity::WattSecond; yylval.quantity.unitStr = yytext; return UNIT; //
|
||||
"Ws" COUNTCHARS; yylval.quantity.scaler = Quantity::WattSecond; yylval.quantity.unitStr = yytext; return UNIT; // W*s = Joule
|
||||
"kWh" COUNTCHARS; yylval.quantity.scaler = Quantity::KiloWattHour; yylval.quantity.unitStr = yytext; return UNIT; // 1 kWh = 3.6e6 J
|
||||
"eV" COUNTCHARS; yylval.quantity.scaler = Quantity::ElectronVolt; yylval.quantity.unitStr = yytext; return UNIT; // 1 eV = 1.602176634e-19 J
|
||||
|
||||
"\xC2\xB0" COUNTCHARS; yylval.quantity.scaler = Quantity::Degree; yylval.quantity.unitStr = yytext; return UNIT; // degree (internal standard angle)
|
||||
"deg" COUNTCHARS; yylval.quantity.scaler = Quantity::Degree; yylval.quantity.unitStr = yytext; return UNIT; // degree (internal standard angle)
|
||||
|
||||
@@ -638,6 +638,7 @@ App.Units.DeciMetre = App.Units.Quantity('dm')
|
||||
App.Units.Metre = App.Units.Quantity('m')
|
||||
App.Units.KiloMetre = App.Units.Quantity('km')
|
||||
|
||||
App.Units.MilliLiter = App.Units.Quantity('ml')
|
||||
App.Units.Liter = App.Units.Quantity('l')
|
||||
|
||||
App.Units.MicroGram = App.Units.Quantity('ug')
|
||||
@@ -659,6 +660,7 @@ App.Units.Kelvin = App.Units.Quantity('K')
|
||||
App.Units.MilliKelvin = App.Units.Quantity('mK')
|
||||
App.Units.MicroKelvin = App.Units.Quantity('uK')
|
||||
|
||||
App.Units.MilliMole = App.Units.Quantity('mmol')
|
||||
App.Units.Mole = App.Units.Quantity('mol')
|
||||
|
||||
App.Units.Candela = App.Units.Quantity('cd')
|
||||
@@ -684,6 +686,9 @@ App.Units.KiloPascal = App.Units.Quantity('kPa')
|
||||
App.Units.MegaPascal = App.Units.Quantity('MPa')
|
||||
App.Units.GigaPascal = App.Units.Quantity('GPa')
|
||||
|
||||
App.Units.MilliBar = App.Units.Quantity('mbar')
|
||||
App.Units.Bar = App.Units.Quantity('bar')
|
||||
|
||||
App.Units.PoundForce = App.Units.Quantity().PoundForce
|
||||
App.Units.Torr = App.Units.Quantity().Torr
|
||||
App.Units.mTorr = App.Units.Quantity().mTorr
|
||||
@@ -696,16 +701,35 @@ App.Units.Watt = App.Units.Quantity('W')
|
||||
App.Units.VoltAmpere = App.Units.Quantity('VA')
|
||||
|
||||
App.Units.Volt = App.Units.Quantity('V')
|
||||
App.Units.MilliVolt = App.Units.Quantity('mV')
|
||||
App.Units.KiloVolt = App.Units.Quantity('kV')
|
||||
|
||||
App.Units.Coulomb = App.Units.Quantity('C')
|
||||
|
||||
App.Units.Tesla = App.Units.Quantity('T')
|
||||
|
||||
App.Units.PicoFarad = App.Units.Quantity('pF')
|
||||
App.Units.NanoFarad = App.Units.Quantity('nF')
|
||||
App.Units.MicroFarad = App.Units.Quantity('uF')
|
||||
App.Units.MilliFarad = App.Units.Quantity('mF')
|
||||
App.Units.Farad = App.Units.Quantity('F')
|
||||
|
||||
App.Units.NanoHenry = App.Units.Quantity('nH')
|
||||
App.Units.MicroHenry = App.Units.Quantity('uH')
|
||||
App.Units.MilliHenry = App.Units.Quantity('mH')
|
||||
App.Units.Henry = App.Units.Quantity('H')
|
||||
|
||||
App.Units.Joule = App.Units.Quantity('J')
|
||||
App.Units.KiloJoule = App.Units.Quantity('kJ')
|
||||
App.Units.NewtonMeter = App.Units.Quantity('Nm')
|
||||
App.Units.VoltAmpereSecond = App.Units.Quantity('VAs')
|
||||
App.Units.WattSecond = App.Units.Quantity('Ws')
|
||||
App.Units.KiloWattHour = App.Units.Quantity('kWh')
|
||||
App.Units.ElectronVolt = App.Units.Quantity('eV')
|
||||
|
||||
App.Units.MPH = App.Units.Quantity('mi/h')
|
||||
App.Units.KMH = App.Units.Quantity('km/h')
|
||||
|
||||
|
||||
App.Units.Degree = App.Units.Quantity('deg')
|
||||
App.Units.Radian = App.Units.Quantity('rad')
|
||||
App.Units.Gon = App.Units.Quantity('gon')
|
||||
@@ -730,8 +754,12 @@ App.Units.Velocity = App.Units.Unit(1,0,-1)
|
||||
App.Units.Acceleration = App.Units.Unit(1,0,-2)
|
||||
App.Units.Temperature = App.Units.Unit(0,0,0,0,1)
|
||||
|
||||
App.Units.ElectricCurrent = App.Units.Unit(0,0,0,1)
|
||||
App.Units.ElectricPotential = App.Units.Unit(2,1,-3,-1)
|
||||
App.Units.ElectricCurrent = App.Units.Unit(0,0,0,1)
|
||||
App.Units.ElectricPotential = App.Units.Unit(2,1,-3,-1)
|
||||
App.Units.ElectricCharge = App.Units.Unit(0,0,1,1)
|
||||
App.Units.MagneticFluxDensity = App.Units.Unit(0,1,-2,-1)
|
||||
App.Units.ElectricalCapacitance = App.Units.Unit(-2,-1,4,2)
|
||||
App.Units.ElectricalInductance = App.Units.Unit(2,1,-2,-2)
|
||||
App.Units.AmountOfSubstance = App.Units.Unit(0,0,0,0,0,1)
|
||||
App.Units.LuminousIntensity = App.Units.Unit(0,0,0,0,0,0,1)
|
||||
|
||||
|
||||
@@ -246,7 +246,8 @@ Quantity Quantity::DeciMetre (100.0 ,Unit(1));
|
||||
Quantity Quantity::Metre (1.0e3 ,Unit(1));
|
||||
Quantity Quantity::KiloMetre (1.0e6 ,Unit(1));
|
||||
|
||||
Quantity Quantity::Liter (1000000.0 ,Unit(3));
|
||||
Quantity Quantity::MilliLiter (1000.0 ,Unit(3));
|
||||
Quantity Quantity::Liter (1.0e6 ,Unit(3));
|
||||
|
||||
Quantity Quantity::Hertz (1.0 ,Unit(0,0,-1));
|
||||
Quantity Quantity::KiloHertz (1.0e3 ,Unit(0,0,-1));
|
||||
@@ -272,6 +273,7 @@ Quantity Quantity::Kelvin (1.0 ,Unit(0,0,0,0,1));
|
||||
Quantity Quantity::MilliKelvin (0.001 ,Unit(0,0,0,0,1));
|
||||
Quantity Quantity::MicroKelvin (0.000001 ,Unit(0,0,0,0,1));
|
||||
|
||||
Quantity Quantity::MilliMole (0.001 ,Unit(0,0,0,0,0,1));
|
||||
Quantity Quantity::Mole (1.0 ,Unit(0,0,0,0,0,1));
|
||||
|
||||
Quantity Quantity::Candela (1.0 ,Unit(0,0,0,0,0,0,1));
|
||||
@@ -299,6 +301,9 @@ Quantity Quantity::KiloPascal (1.00 ,Unit(-1,1,-2));
|
||||
Quantity Quantity::MegaPascal (1000.0 ,Unit(-1,1,-2));
|
||||
Quantity Quantity::GigaPascal (1e+6 ,Unit(-1,1,-2));
|
||||
|
||||
Quantity Quantity::MilliBar (0.1 ,Unit(-1,1,-2));
|
||||
Quantity Quantity::Bar (100.0 ,Unit(-1,1,-2)); // 1 bar = 100 kPa
|
||||
|
||||
Quantity Quantity::Torr (101.325/760.0 ,Unit(-1,1,-2)); // Torr is a defined fraction of Pascal (kg/m/s^2 or N/m^2)
|
||||
Quantity Quantity::mTorr (0.101325/760.0,Unit(-1,1,-2)); // Torr is a defined fraction of Pascal (kg/m/s^2 or N/m^2)
|
||||
Quantity Quantity::yTorr (0.000101325/760.0 ,Unit(-1,1,-2)); // Torr is a defined fraction of Pascal (kg/m/s^2 or N/m^2)
|
||||
@@ -309,12 +314,32 @@ Quantity Quantity::KSI (6894.744825494,Unit(-1,1,-2)); // 1000 x po
|
||||
Quantity Quantity::Watt (1e+6 ,Unit(2,1,-3)); // Watt (kg*m^2/s^3)
|
||||
Quantity Quantity::VoltAmpere (1e+6 ,Unit(2,1,-3)); // VoltAmpere (kg*m^2/s^3)
|
||||
|
||||
Quantity Quantity::Volt (1e+6 ,Unit(2,1,-3,-1)); // Volt (kg*m^2/A/s^3)
|
||||
Quantity Quantity::Volt (1e+6 ,Unit(2,1,-3,-1)); // Volt (kg*m^2/A/s^3)
|
||||
Quantity Quantity::MilliVolt (1e+3 ,Unit(2,1,-3,-1));
|
||||
Quantity Quantity::KiloVolt (1e+9 ,Unit(2,1,-3,-1));
|
||||
|
||||
Quantity Quantity::Joule (1e+6 ,Unit(2,1,-2)); // Joule (kg*m^2/s^2)
|
||||
Quantity Quantity::NewtonMeter (1e+6 ,Unit(2,1,-2)); // Joule (kg*m^2/s^2)
|
||||
Quantity Quantity::VoltAmpereSecond (1e+6 ,Unit(2,1,-2)); // Joule (kg*m^2/s^2)
|
||||
Quantity Quantity::WattSecond (1e+6 ,Unit(2,1,-2)); // Joule (kg*m^2/s^2)
|
||||
Quantity Quantity::Coulomb (1.0 ,Unit(0,0,1,1)); // Coulomb (A*s)
|
||||
|
||||
Quantity Quantity::Tesla (1.0 ,Unit(0,1,-2,-1)); // Tesla (kg/s^2/A)
|
||||
|
||||
Quantity Quantity::PicoFarad (1e-18 ,Unit(-2,-1,4,2));
|
||||
Quantity Quantity::NanoFarad (1e-15 ,Unit(-2,-1,4,2));
|
||||
Quantity Quantity::MicroFarad (1e-12 ,Unit(-2,-1,4,2));
|
||||
Quantity Quantity::MilliFarad (1e-9 ,Unit(-2,-1,4,2));
|
||||
Quantity Quantity::Farad (1e-6 ,Unit(-2,-1,4,2)); // Farad (s^4*A^2/m^2/kg)
|
||||
|
||||
Quantity Quantity::NanoHenry (1e-3 ,Unit(2,1,-2,-2));
|
||||
Quantity Quantity::MicroHenry (1.0 ,Unit(2,1,-2,-2));
|
||||
Quantity Quantity::MilliHenry (1e+3 ,Unit(2,1,-2,-2));
|
||||
Quantity Quantity::Henry (1e+6 ,Unit(2,1,-2,-2)); // Henry (kg*m^2/s^2/A^2)
|
||||
|
||||
Quantity Quantity::Joule (1e+6 ,Unit(2,1,-2)); // Joule (kg*m^2/s^2)
|
||||
Quantity Quantity::KiloJoule (1e+9 ,Unit(2,1,-2));
|
||||
Quantity Quantity::NewtonMeter (1e+6 ,Unit(2,1,-2)); // Joule (kg*m^2/s^2)
|
||||
Quantity Quantity::VoltAmpereSecond (1e+6 ,Unit(2,1,-2)); // Joule (kg*m^2/s^2)
|
||||
Quantity Quantity::WattSecond (1e+6 ,Unit(2,1,-2)); // Joule (kg*m^2/s^2)
|
||||
Quantity Quantity::KiloWattHour (3.6e+12 ,Unit(2,1,-2)); // 1 kWh = 3.6e6 J
|
||||
Quantity Quantity::ElectronVolt (1.602176634e-13 ,Unit(2,1,-2)); // 1 eV = 1.602176634e-19 J
|
||||
|
||||
Quantity Quantity::KMH (277.778 ,Unit(1,0,-1)); // km/h
|
||||
Quantity Quantity::MPH (447.04 ,Unit(1,0,-1)); // Mile/h
|
||||
|
||||
@@ -187,6 +187,7 @@ public:
|
||||
static Quantity KiloMetre;
|
||||
|
||||
static Quantity Liter;
|
||||
static Quantity MilliLiter;
|
||||
|
||||
static Quantity Hertz;
|
||||
static Quantity KiloHertz;
|
||||
@@ -212,6 +213,7 @@ public:
|
||||
static Quantity MilliKelvin;
|
||||
static Quantity MicroKelvin;
|
||||
|
||||
static Quantity MilliMole;
|
||||
static Quantity Mole;
|
||||
|
||||
static Quantity Candela;
|
||||
@@ -239,6 +241,9 @@ public:
|
||||
static Quantity MegaPascal;
|
||||
static Quantity GigaPascal;
|
||||
|
||||
static Quantity Bar;
|
||||
static Quantity MilliBar;
|
||||
|
||||
static Quantity Torr;
|
||||
static Quantity mTorr;
|
||||
static Quantity yTorr;
|
||||
@@ -250,11 +255,31 @@ public:
|
||||
static Quantity VoltAmpere;
|
||||
|
||||
static Quantity Volt;
|
||||
static Quantity MilliVolt;
|
||||
static Quantity KiloVolt;
|
||||
|
||||
static Quantity Coulomb;
|
||||
|
||||
static Quantity Tesla;
|
||||
|
||||
static Quantity Farad;
|
||||
static Quantity MilliFarad;
|
||||
static Quantity MicroFarad;
|
||||
static Quantity NanoFarad;
|
||||
static Quantity PicoFarad;
|
||||
|
||||
static Quantity Henry;
|
||||
static Quantity MilliHenry;
|
||||
static Quantity MicroHenry;
|
||||
static Quantity NanoHenry;
|
||||
|
||||
static Quantity Joule;
|
||||
static Quantity KiloJoule;
|
||||
static Quantity NewtonMeter;
|
||||
static Quantity VoltAmpereSecond;
|
||||
static Quantity WattSecond;
|
||||
static Quantity KiloWattHour;
|
||||
static Quantity ElectronVolt;
|
||||
|
||||
static Quantity KMH;
|
||||
static Quantity MPH;
|
||||
|
||||
@@ -53,7 +53,8 @@ CGRP '\,'[0-9][0-9][0-9]
|
||||
"m" yylval = Quantity::Metre; return UNIT; // metre
|
||||
"km" yylval = Quantity::KiloMetre; return UNIT; // kilo meter
|
||||
|
||||
"l" yylval = Quantity::Liter; return UNIT; // Liter dm^3
|
||||
"l" yylval = Quantity::Liter; return UNIT; // Liter (dm^3)
|
||||
"ml" yylval = Quantity::MilliLiter; return UNIT; // milli Liter
|
||||
|
||||
"Hz" yylval = Quantity::Hertz; return UNIT; // Hertz
|
||||
"kHz" yylval = Quantity::KiloHertz; return UNIT; // Kilo Hertz
|
||||
@@ -82,6 +83,7 @@ CGRP '\,'[0-9][0-9][0-9]
|
||||
"uK" yylval = Quantity::MicroKelvin; return UNIT; // Kelvin
|
||||
|
||||
"mol" yylval = Quantity::Mole; return UNIT; // Mole (internal standard amount of substance)
|
||||
"mmol" yylval = Quantity::Mole; return UNIT; // Milli Mole
|
||||
|
||||
"cd" yylval = Quantity::Candela; return UNIT; // Candela (internal standard luminous intensity)
|
||||
|
||||
@@ -94,8 +96,6 @@ CGRP '\,'[0-9][0-9][0-9]
|
||||
"yd" yylval = Quantity::Yard; return UNIT; // yard
|
||||
"mi" yylval = Quantity::Mile; return UNIT; // mile
|
||||
|
||||
|
||||
|
||||
"lb" yylval = Quantity::Pound; return UNIT; // pound
|
||||
"lbm" yylval = Quantity::Pound; return UNIT; // pound
|
||||
"oz" yylval = Quantity::Ounce; return UNIT; // ounce
|
||||
@@ -114,6 +114,9 @@ CGRP '\,'[0-9][0-9][0-9]
|
||||
"MPa" yylval = Quantity::MegaPascal; return UNIT; // Pascal
|
||||
"GPa" yylval = Quantity::GigaPascal; return UNIT; // Pascal
|
||||
|
||||
"bar" yylval = Quantity::Bar; return UNIT; // 1 bar = 100 kPa
|
||||
"mbar" yylval = Quantity::MilliBar; return UNIT; // Milli Bar
|
||||
|
||||
"Torr" yylval = Quantity::Torr; return UNIT; // portion of Pascal ( 101325/760 )
|
||||
"mTorr" yylval = Quantity::mTorr; return UNIT; //
|
||||
"uTorr" yylval = Quantity::yTorr; return UNIT; //
|
||||
@@ -123,15 +126,38 @@ CGRP '\,'[0-9][0-9][0-9]
|
||||
"ksi" yylval = Quantity::KSI; return UNIT; // 1000 x pounds/in^2
|
||||
|
||||
"W" yylval = Quantity::Watt; return UNIT; // Watt (kg*m^2/s^3)
|
||||
"mW" yylval = Quantity::Watt; return UNIT; // Milli Watt
|
||||
"VA" yylval = Quantity::VoltAmpere; return UNIT; // VoltAmpere (kg*m^2/s^3)
|
||||
|
||||
"V" yylval = Quantity::Volt; return UNIT; // Volt (kg*m^2/A/s^3)
|
||||
"kV" yylval = Quantity::KiloVolt; return UNIT; // Kilo Volt
|
||||
"mV" yylval = Quantity::MilliVolt; return UNIT; // Milli Volt
|
||||
|
||||
"C" yylval = Quantity::Coulomb; return UNIT; // Coulomb (A*s)
|
||||
|
||||
"T" yylval = Quantity::Tesla; return UNIT; // Tesla (kg/s^2/A)
|
||||
|
||||
"F" yylval = Quantity::Farad; return UNIT; // Farad (s^4*A^2/m^2/kg)
|
||||
"mF" yylval = Quantity::MilliFarad; return UNIT; // Milli Farad
|
||||
"\xC2\xB5F" yylval = Quantity::MicroFarad; return UNIT; // Micro Farad
|
||||
"uF" yylval = Quantity::MicroFarad; return UNIT; // Micro Farad
|
||||
"nF" yylval = Quantity::NanoFarad; return UNIT; // Nano Farad
|
||||
"pF" yylval = Quantity::PicoFarad; return UNIT; // Pico Farad
|
||||
|
||||
"H" yylval = Quantity::Henry; return UNIT; // Henry (kg*m^2/s^2/A^2)
|
||||
"mH" yylval = Quantity::MilliHenry; return UNIT; // Milli Henry
|
||||
"\xC2\xB5H" yylval = Quantity::MicroHenry; return UNIT; // Micro Henry
|
||||
"uH" yylval = Quantity::MicroHenry; return UNIT; // Micro Henry
|
||||
"nH" yylval = Quantity::NanoHenry; return UNIT; // Nano Henry
|
||||
|
||||
"J" yylval = Quantity::Joule; return UNIT; // Joule (kg*m^2/s^2)
|
||||
"kJ" yylval = Quantity::KiloJoule; return UNIT; // Kilo Joule
|
||||
"Nm" yylval = Quantity::NewtonMeter; return UNIT; // N*m = Joule
|
||||
"VAs" yylval = Quantity::VoltAmpereSecond; return UNIT; // V*A*s = Joule
|
||||
"CV" yylval = Quantity::WattSecond; return UNIT; //
|
||||
"Ws" yylval = Quantity::WattSecond; return UNIT; // W*s = Joule
|
||||
"kWh" yylval = Quantity::KiloWattHour; return UNIT; // 1 kWh = 3.6e6 J
|
||||
"eV" yylval = Quantity::ElectronVolt; return UNIT; // 1 eV = 1.602176634e-19 J
|
||||
|
||||
"\xC2\xB0" yylval = Quantity::Degree; return UNIT; // degree (internal standard angle)
|
||||
"deg" yylval = Quantity::Degree; return UNIT; // degree (internal standard angle)
|
||||
|
||||
@@ -439,6 +439,10 @@ QString Unit::getTypeString(void) const
|
||||
if(*this == Unit::Temperature ) return QString::fromLatin1("Temperature");
|
||||
if(*this == Unit::ElectricCurrent ) return QString::fromLatin1("ElectricCurrent");
|
||||
if(*this == Unit::ElectricPotential ) return QString::fromLatin1("ElectricPotential");
|
||||
if(*this == Unit::ElectricCharge ) return QString::fromLatin1("ElectricCharge");
|
||||
if(*this == Unit::MagneticFluxDensity ) return QString::fromLatin1("MagneticFluxDensity");
|
||||
if(*this == Unit::ElectricalCapacitance ) return QString::fromLatin1("ElectricalCapacitance");
|
||||
if(*this == Unit::ElectricalInductance ) return QString::fromLatin1("ElectricalInductance");
|
||||
if(*this == Unit::AmountOfSubstance ) return QString::fromLatin1("AmountOfSubstance");
|
||||
if(*this == Unit::LuminousIntensity ) return QString::fromLatin1("LuminousIntensity");
|
||||
if(*this == Unit::Pressure ) return QString::fromLatin1("Pressure");
|
||||
@@ -478,6 +482,10 @@ Unit Unit::Temperature(0,0,0,0,1);
|
||||
|
||||
Unit Unit::ElectricCurrent(0,0,0,1);
|
||||
Unit Unit::ElectricPotential(2,1,-3,-1);
|
||||
Unit Unit::ElectricCharge(0,0,1,1);
|
||||
Unit Unit::MagneticFluxDensity(0,1,-2,-1);
|
||||
Unit Unit::ElectricalCapacitance(-2,-1,4,2);
|
||||
Unit Unit::ElectricalInductance(2,1,-2,-2);
|
||||
Unit Unit::AmountOfSubstance(0,0,0,0,0,1);
|
||||
Unit Unit::LuminousIntensity(0,0,0,0,0,0,1);
|
||||
|
||||
|
||||
@@ -110,6 +110,10 @@ public:
|
||||
|
||||
static Unit ElectricCurrent;
|
||||
static Unit ElectricPotential;
|
||||
static Unit ElectricCharge;
|
||||
static Unit MagneticFluxDensity;
|
||||
static Unit ElectricalCapacitance;
|
||||
static Unit ElectricalInductance;
|
||||
static Unit AmountOfSubstance;
|
||||
static Unit LuminousIntensity;
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact
|
||||
|
||||
// now do special treatment on all cases seems necessary:
|
||||
if (unit == Unit::Length) { // Length handling ============================
|
||||
if (UnitValue < 0.000000001) {// smaller then 0.001 nm -> scientific notation
|
||||
if (UnitValue < 0.000000001) {// smaller than 0.001 nm -> scientific notation
|
||||
unitString = QString::fromLatin1("mm");
|
||||
factor = 1.0;
|
||||
}
|
||||
@@ -76,7 +76,7 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact
|
||||
unitString = QString::fromLatin1("km");
|
||||
factor = 1000000.0;
|
||||
}
|
||||
else { // bigger then 1000 km -> scientific notation
|
||||
else { // bigger than 1000 km -> scientific notation
|
||||
unitString = QString::fromLatin1("mm");
|
||||
factor = 1.0;
|
||||
}
|
||||
|
||||
@@ -175,8 +175,76 @@ QString UnitsSchemaMKS::schemaTranslate(const Quantity &quant, double &factor, Q
|
||||
factor = 1000000;
|
||||
}
|
||||
else if (unit == Unit::ElectricPotential) {
|
||||
unitString = QString::fromLatin1("V");
|
||||
factor = 1000000;
|
||||
if (UnitValue < 1.0) {
|
||||
unitString = QString::fromLatin1("mV");
|
||||
factor = 1e3;
|
||||
}
|
||||
if (UnitValue < 1e3) {
|
||||
unitString = QString::fromLatin1("V");
|
||||
factor = 1e6;
|
||||
}
|
||||
if (UnitValue < 1e6) {
|
||||
unitString = QString::fromLatin1("kV");
|
||||
factor = 1e9;
|
||||
}
|
||||
}
|
||||
else if (unit == Unit::ElectricCharge) {
|
||||
unitString = QString::fromLatin1("C");
|
||||
factor = 1.0;
|
||||
}
|
||||
else if (unit == Unit::MagneticFluxDensity) {
|
||||
unitString = QString::fromLatin1("T");
|
||||
factor = 1.0;
|
||||
}
|
||||
else if (unit == Unit::ElectricalCapacitance) {
|
||||
if (UnitValue < 1e-15) {
|
||||
unitString = QString::fromLatin1("pF");
|
||||
factor = 1e-18;
|
||||
}
|
||||
else if (UnitValue < 1e-12) {
|
||||
unitString = QString::fromLatin1("nF");
|
||||
factor = 1e-15;
|
||||
}
|
||||
else if (UnitValue < 1e-9) {
|
||||
unitString = QString::fromUtf8("µF");
|
||||
factor = 1e-12;
|
||||
}
|
||||
else if (UnitValue < 1e-6) {
|
||||
unitString = QString::fromLatin1("mF");
|
||||
factor = 1e-9;
|
||||
}
|
||||
else {
|
||||
unitString = QString::fromLatin1("F");
|
||||
factor = 1e-6;
|
||||
}
|
||||
}
|
||||
else if (unit == Unit::ElectricalInductance) {
|
||||
if (UnitValue < 1e-6) {
|
||||
unitString = QString::fromLatin1("nH");
|
||||
factor = 1e-3;
|
||||
}
|
||||
else if (UnitValue < 1e-3) {
|
||||
unitString = QString::fromUtf8("µH");
|
||||
factor = 1.0;
|
||||
}
|
||||
else if (UnitValue < 1.0) {
|
||||
unitString = QString::fromLatin1("mH");
|
||||
factor = 1e3;
|
||||
}
|
||||
else {
|
||||
unitString = QString::fromLatin1("H");
|
||||
factor = 1e6;
|
||||
}
|
||||
}
|
||||
else if (unit == Unit::Work) {
|
||||
if (UnitValue < 1e3) {
|
||||
unitString = QString::fromLatin1("J");
|
||||
factor = 1e6;
|
||||
}
|
||||
else {
|
||||
unitString = QString::fromLatin1("kJ");
|
||||
factor = 1e9;
|
||||
}
|
||||
}
|
||||
else if (unit == Unit::SpecificEnergy) {
|
||||
unitString = QString::fromLatin1("m^2/s^2");
|
||||
|
||||
Reference in New Issue
Block a user