[App] [Base] Add missing Property classes for all Units (#6717)

- Add missing Property classes for all Units
- Add missing units to unit calculator, as well as some missing string representations
- also change units used for dynamic viscosity to the customary Pa*s
This commit is contained in:
Oliver Oxtoby
2023-02-26 16:28:28 +02:00
committed by GitHub
parent 94f3a476a9
commit 9d5ab79a4c
8 changed files with 1231 additions and 11 deletions

View File

@@ -480,8 +480,8 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact
factor = 1.0;
}
else if (unit == Unit::DynamicViscosity) {
unitString = QString::fromLatin1("kg/(mm*s)");
factor = 1.0;
unitString = QString::fromLatin1("Pa*s");
factor = 0.001;
}
else if (unit == Unit::KinematicViscosity) {
if (UnitValue < 1e3) {
@@ -493,6 +493,102 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact
factor = 1e6;
}
}
else if (unit == Unit::VolumeFlowRate) {
if (UnitValue < 1e3) {
unitString = QString::fromLatin1("mm^3/s");
factor = 1.0;
}
else if (UnitValue < 1e6) {
unitString = QString::fromLatin1("ml/s");
factor = 1e3;
}
else if (UnitValue < 1e9) {
unitString = QString::fromLatin1("l/s");
factor = 1e6;
}
else {
unitString = QString::fromLatin1("m^3/s");
factor = 1e9;
}
}
else if (unit == Unit::DissipationRate) {
unitString = QString::fromLatin1("m^2/s^3");
factor = 1e6;
}
else if (unit == Unit::InverseLength) {
if (UnitValue < 1e-6) { // smaller than 0.001 1/km -> scientific notation
unitString = QString::fromLatin1("1/mm");
factor = 1;
}
else if (UnitValue < 1e-3) {
unitString = QString::fromLatin1("1/km");
factor = 1e-6;
}
else if (UnitValue < 1) {
unitString = QString::fromLatin1("1/m");
factor = 1e-3;
}
else if (UnitValue < 1e3) {
unitString = QString::fromLatin1("1/mm");
factor = 1;
}
else if(UnitValue < 1e6) {
unitString = QString::fromUtf8("\xC2\xB5m");
factor = 1e3;
}
else if(UnitValue < 1e9) {
unitString = QString::fromLatin1("1/nm");
factor = 1e6;
}
else { // bigger than 1000 1/nm -> scientific notation
unitString = QString::fromLatin1("1/mm");
factor = 1;
}
}
else if (unit == Unit::InverseArea) {
if (UnitValue < 1e-15) { // smaller than 0.001 1/km^2 -> scientific notation
unitString = QString::fromLatin1("1/mm^2");
factor = 1;
}
else if (UnitValue < 1e-9) {
unitString = QString::fromLatin1("1/km^2");
factor = 1e-12;
}
else if (UnitValue < 1e-3) {
unitString = QString::fromLatin1("1/m^2");
factor = 1e-6;
}
else if (UnitValue < 1e-1) {
unitString = QString::fromLatin1("1/cm^2");
factor = 1e-2;
}
else {
unitString = QString::fromLatin1("1/mm^2");
factor = 1;
}
}
else if (unit == Unit::InverseVolume) {
if (UnitValue < 1e-9) { // smaller than 0.001 1/m^3 -> scientific notation
unitString = QString::fromLatin1("1/mm^3");
factor = 1;
}
else if (UnitValue < 1e-6) {
unitString = QString::fromLatin1("1/m^3");
factor = 1e-9;
}
else if (UnitValue < 1e-3) {
unitString = QString::fromLatin1("1/l^3");
factor = 1e-6;
}
else if (UnitValue < 1) {
unitString = QString::fromLatin1("1/ml");
factor = 1e-3;
}
else {
unitString = QString::fromLatin1("1/mm^3");
factor = 1;
}
}
else {
// default action for all cases without special treatment:
unitString = quant.getUnit().getString();