fix conversion factors for psi and ksi

This commit is contained in:
wmayer
2018-03-31 15:43:16 +02:00
parent 1365cf8adf
commit 8e0a6cb832
3 changed files with 17 additions and 20 deletions

View File

@@ -272,17 +272,17 @@ Quantity Quantity::KiloNewton (1e+6 ,Unit(1,1,-2));
Quantity Quantity::MegaNewton (1e+9 ,Unit(1,1,-2));
Quantity Quantity::MilliNewton (1.0 ,Unit(1,1,-2));
Quantity Quantity::Pascal (0.001 ,Unit(-1,1,-2)); // Pascal (kg/m*s^2 or N/m^2)
Quantity Quantity::Pascal (0.001 ,Unit(-1,1,-2)); // Pascal (kg/m/s^2 or N/m^2)
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::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)
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)
Quantity Quantity::PSI (0.145038 ,Unit(-1,1,-2)); // pounds/in^2
Quantity Quantity::KSI (145.038 ,Unit(-1,1,-2)); // 1000 x pounds/in^2
Quantity Quantity::PSI (6.894744825494,Unit(-1,1,-2)); // pounds/in^2
Quantity Quantity::KSI (6894.744825494,Unit(-1,1,-2)); // 1000 x pounds/in^2
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)

View File

@@ -182,9 +182,9 @@ PyObject* QuantityPy::getValueAs(PyObject *args)
PyErr_Clear();
char* string;
if (PyArg_ParseTuple(args,"et", "utf-8", &string)) {
QString qstr = QString::fromUtf8(string);
PyMem_Free(string);
quant = Quantity::parse(qstr);
QString qstr = QString::fromUtf8(string);
PyMem_Free(string);
quant = Quantity::parse(qstr);
}
}

View File

@@ -114,17 +114,17 @@ QString UnitsSchemaImperial1::schemaTranslate(const Quantity &quant, double &fac
factor = 0.45359237;
}
else if (unit == Unit::Pressure) {
if (UnitValue < 145.038) {// psi is the smallest
if (UnitValue < 6894.744) {// psi is the smallest
unitString = QString::fromLatin1("psi");
factor = 0.145038;
factor = 6.894744825494;
}
else if (UnitValue < 145038) {
else if (UnitValue < 6894744.825) {
unitString = QString::fromLatin1("ksi");
factor = 145.038;
factor = 6894.744825494;
}
else { // bigger then 1000 ksi -> psi + scientific notation
unitString = QString::fromLatin1("psi");
factor = 0.145038;
factor = 6.894744825494;
}
}
else if (unit == Unit::Velocity) {
@@ -180,16 +180,13 @@ QString UnitsSchemaImperialDecimal::schemaTranslate(const Base::Quantity& quant,
factor = 0.45359237;
}
else if (unit == Unit::Pressure) {
if (UnitValue < 145.038) {// psi is the smallest
if (UnitValue < 6894.744) {// psi is the smallest
unitString = QString::fromLatin1("psi");
factor = 0.145038;
//}else if(UnitValue < 145038){
// unitString = QString::fromLatin1("ksi");
// factor = 145.038;
factor = 6.894744825494;
}
else { // bigger then 1000 ksi -> psi + scientific notation
unitString = QString::fromLatin1("psi");
factor = 0.145038;
factor = 6.894744825494;
}
}
else if (unit == Unit::Velocity) {