summaryrefslogtreecommitdiff
path: root/wire.h
diff options
context:
space:
mode:
Diffstat (limited to 'wire.h')
-rw-r--r--wire.h109
1 files changed, 109 insertions, 0 deletions
diff --git a/wire.h b/wire.h
new file mode 100644
index 0000000..c54eed0
--- /dev/null
+++ b/wire.h
@@ -0,0 +1,109 @@
+#ifndef WIRE_H
+#define WIRE_H
+
+#include <QObject>
+#include <QString>
+#include <algorithm>
+
+typedef struct wireData {
+ QString AWG;
+ double diameter;
+ double resistance; // Ohms/1000ft.
+ double maxCurrent;
+ float weight; // lb/1000ft.
+}wireData_t;
+
+static const wireData_t copper[]
+{
+ {.AWG = "OOOO", .diameter = 0.46, .resistance = 0.04901, .maxCurrent = 260, .weight = 640.5},
+ {.AWG = "OOO", .diameter = 0.4096, .resistance = 0.0618, .maxCurrent = 225, .weight = 507.9},
+ {.AWG = "OO", .diameter = 0.3648, .resistance = 0.07793, .maxCurrent = 195, .weight = 402.8},
+ {.AWG = "0", .diameter = 0.3249, .resistance = 0.09827, .maxCurrent = 170, .weight = 319.5},
+ {.AWG = "1", .diameter = 0.2893, .resistance = 0.1239, .maxCurrent = 145, .weight = 253.5},
+ {.AWG = "2", .diameter = 0.2576, .resistance = 0.1563, .maxCurrent = 130, .weight = 200.9},
+ {.AWG = "3", .diameter = 0.2294, .resistance = 0.1970, .maxCurrent = 115, .weight = 159.3},
+ {.AWG = "4", .diameter = 0.2043, .resistance = 0.2485, .maxCurrent = 95, .weight = 126.4},
+ {.AWG = "5", .diameter = 0.1819, .resistance = 0.3133, .maxCurrent = 87, .weight = 100.2},
+ {.AWG = "6", .diameter = 0.1620, .resistance = 0.3951, .maxCurrent = 75, .weight = 79.46},
+ {.AWG = "7", .diameter = 0.1443, .resistance = 0.4982, .maxCurrent = 67, .weight = 63.02},
+ {.AWG = "8", .diameter = 0.1285, .resistance = 0.6282, .maxCurrent = 55, .weight = 46.97},
+ {.AWG = "9", .diameter = 0.1144, .resistance = 0.7921, .maxCurrent = 50, .weight = 39.63},
+ {.AWG = "10", .diameter = 0.1019, .resistance = 0.9989, .maxCurrent = 40, .weight = 31.43},
+ {.AWG = "11", .diameter = 0.0907, .resistance = 1.260, .maxCurrent = 37, .weight = 24.92},
+ {.AWG = "12", .diameter = 0.0808, .resistance = 1.588, .maxCurrent = 30, .weight = 19.77},
+ {.AWG = "13", .diameter = 0.0720, .resistance = 2.003, .maxCurrent = 28, .weight = 15.68},
+ {.AWG = "14", .diameter = 0.0641, .resistance = 2.525, .maxCurrent = 25, .weight = 12.43},
+ {.AWG = "15", .diameter = 0.0571, .resistance = 3.184, .maxCurrent = 24, .weight = 9.858},
+ {.AWG = "16", .diameter = 0.0508, .resistance = 4.016, .maxCurrent = 22, .weight = 7.818},
+ {.AWG = "17", .diameter = 0.0453, .resistance = 5.064, .maxCurrent = 19, .weight = 6.20},
+ {.AWG = "18", .diameter = 0.0403, .resistance = 6.385, .maxCurrent = 16, .weight = 4.917},
+ {.AWG = "19", .diameter = 0.0359, .resistance = 8.051, .maxCurrent = 14, .weight = 3.899},
+ {.AWG = "20", .diameter = 0.0320, .resistance = 10.15, .maxCurrent = 11, .weight = 3.092},
+ {.AWG = "21", .diameter = 0.0285, .resistance = 12.80, .maxCurrent = 9, .weight = 2.452},
+ {.AWG = "22", .diameter = 0.0253, .resistance = 16.14, .maxCurrent = 7, .weight = 1.945},
+ {.AWG = "23", .diameter = 0.0226, .resistance = 20.36, .maxCurrent = 4.7, .weight = 1.542},
+ {.AWG = "24", .diameter = 0.0201, .resistance = 25.67, .maxCurrent = 3.5, .weight = 1.233},
+ {.AWG = "25", .diameter = 0.0179, .resistance = 32.37, .maxCurrent = 2.7, .weight = 0.9699},
+ {.AWG = "26", .diameter = 0.0159, .resistance = 40.81, .maxCurrent = 2.2, .weight = 0.7692},
+ {.AWG = "27", .diameter = 0.0142, .resistance = 51.47, .maxCurrent = 1.7, .weight = 0.6100},
+ {.AWG = "28", .diameter = 0.0126, .resistance = 64.90, .maxCurrent = 1.4, .weight = 0.4837},
+ {.AWG = "29", .diameter = 0.0113, .resistance = 81.84, .maxCurrent = 1.2, .weight = 0.3863},
+ {.AWG = "30", .diameter = 0.0100, .resistance = 103.2, .maxCurrent = 0.86, .weight = 0.3042},
+ {.AWG = "31", .diameter = 0.00893, .resistance = 130.1, .maxCurrent = 0.7, .weight = 0.2413},
+ {.AWG = "32", .diameter = 0.00795, .resistance = 164.1, .maxCurrent = 0.53, .weight = 0.1913},
+ {.AWG = "33", .diameter = 0.00708, .resistance = 206.9, .maxCurrent = 0.43, .weight = 0.1517},
+ {.AWG = "34", .diameter = 0.00630, .resistance = 260.9, .maxCurrent = 0.33, .weight = 0.1203},
+ {.AWG = "35", .diameter = 0.00561, .resistance = 329.0, .maxCurrent = 0.27, .weight = 0.09542},
+ {.AWG = "36", .diameter = 0.00500, .resistance = 414.8, .maxCurrent = 0.21, .weight = 0.07567},
+ {.AWG = "37", .diameter = 0.00445, .resistance = 523.1, .maxCurrent = 0.17, .weight = 0.06001},
+ {.AWG = "38", .diameter = 0.00397, .resistance = 659.6, .maxCurrent = 0.13, .weight = 0.044759},
+ {.AWG = "39", .diameter = 0.00353, .resistance = 831.8, .maxCurrent = 0.11, .weight = 0.03744},
+ {.AWG = "40", .diameter = 0.00314, .resistance = 1049, .maxCurrent = 0.09, .weight = 0.02993}
+};
+
+static const QString wireMaterials[]
+{
+ "Copper",
+ "Aluminum",
+ "Silver",
+ "Gold",
+ "Tin",
+};
+enum wireNames
+{
+ Copper = 0,
+ Aluminum,
+ Silver,
+ Gold,
+ Tin,
+};
+class Wire : public QObject
+{
+ Q_OBJECT
+public:
+ Wire();
+ void setActiveWireType(int wire);
+ void setWireLength(float length);
+ void setSystemVoltage(double voltage);
+ void setPeakSystemPower(double power);
+
+ QString gauge(void);
+ double weight(void);
+ double peakCurrent(void);
+public slots:
+ void calculate(void);
+private:
+ wireData_t activeWireData;
+ QString activeWire;
+ double systemVoltage;
+ double peakPower;
+ double wireLength;
+
+ void determineGauge(void);
+
+signals:
+ void calculation(void);
+
+};
+
+#endif // WIRE_H