summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Drake <joshua.ellis.drake@gmail.com>2022-11-19 04:04:00 -0600
committerJoshua Drake <joshua.ellis.drake@gmail.com>2022-11-19 04:04:00 -0600
commit1321168cb22a76df96d747194fcb91863e4e0659 (patch)
tree772cc08ae6c85bd1a8b527509c3dd88bcc5600dc
parent1ed60cd00cd9fdcc45dab1f81e00dd723858a430 (diff)
Added Wire Class. Program now has some functionality!
-rw-r--r--EVPC.pro6
-rw-r--r--EVPC.pro.user87
-rw-r--r--battery.cpp2
-rw-r--r--battery.h4
-rw-r--r--mainwindow.cpp31
-rw-r--r--mainwindow.h10
-rw-r--r--mainwindow.ui8
-rw-r--r--wire.cpp83
-rw-r--r--wire.h109
9 files changed, 259 insertions, 81 deletions
diff --git a/EVPC.pro b/EVPC.pro
index fc1919d..e85997b 100644
--- a/EVPC.pro
+++ b/EVPC.pro
@@ -11,11 +11,13 @@ CONFIG += c++11
SOURCES += \
battery.cpp \
main.cpp \
- mainwindow.cpp
+ mainwindow.cpp \
+ wire.cpp
HEADERS += \
battery.h \
- mainwindow.h
+ mainwindow.h \
+ wire.h
FORMS += \
mainwindow.ui
diff --git a/EVPC.pro.user b/EVPC.pro.user
index 7dccbb4..2dc6b5d 100644
--- a/EVPC.pro.user
+++ b/EVPC.pro.user
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 4.15.0, 2022-11-18T08:17:03. -->
+<!-- Written by QtCreator 5.0.2, 2022-11-19T04:03:22. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
- <value type="QByteArray">{254b9858-411f-4b26-805e-af190719973f}</value>
+ <value type="QByteArray">{6ed2407f-5854-4365-9f0b-f053a9465641}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -79,7 +79,7 @@
<value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value>
<value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
<value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value>
- <value type="int" key="ClangTools.ParallelJobs">4</value>
+ <value type="int" key="ClangTools.ParallelJobs">6</value>
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
@@ -91,16 +91,16 @@
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="DeviceType">Desktop</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.12.11 MinGW 64-bit</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.12.11 MinGW 64-bit</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.51211.win64_mingw73_kit</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.12.12 MinGW 64-bit</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.12.12 MinGW 64-bit</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.51212.win64_mingw73_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="int" key="EnableQmlDebugging">0</value>
- <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\30720.DITCHWITCH\Desktop\Programming\build-EVPC-Desktop_Qt_5_12_11_MinGW_64_bit-Debug</value>
- <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/30720.DITCHWITCH/Desktop/Programming/build-EVPC-Desktop_Qt_5_12_11_MinGW_64_bit-Debug</value>
+ <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\Josh\Documents\build-EVPC-Desktop_Qt_5_12_12_MinGW_64_bit-Debug</value>
+ <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/Josh/Documents/build-EVPC-Desktop_Qt_5_12_12_MinGW_64_bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@@ -137,8 +137,8 @@
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
- <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\30720.DITCHWITCH\Desktop\Programming\build-EVPC-Desktop_Qt_5_12_11_MinGW_64_bit-Release</value>
- <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/30720.DITCHWITCH/Desktop/Programming/build-EVPC-Desktop_Qt_5_12_11_MinGW_64_bit-Release</value>
+ <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\Josh\Documents\build-EVPC-Desktop_Qt_5_12_12_MinGW_64_bit-Release</value>
+ <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/Josh/Documents/build-EVPC-Desktop_Qt_5_12_12_MinGW_64_bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@@ -177,8 +177,8 @@
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="int" key="EnableQmlDebugging">0</value>
- <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\30720.DITCHWITCH\Desktop\Programming\build-EVPC-Desktop_Qt_5_12_11_MinGW_64_bit-Profile</value>
- <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/30720.DITCHWITCH/Desktop/Programming/build-EVPC-Desktop_Qt_5_12_11_MinGW_64_bit-Profile</value>
+ <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\Josh\Documents\build-EVPC-Desktop_Qt_5_12_12_MinGW_64_bit-Profile</value>
+ <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/Josh/Documents/build-EVPC-Desktop_Qt_5_12_12_MinGW_64_bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@@ -231,75 +231,20 @@
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
- <value type="QString" key="Analyzer.Perf.CallgraphMode">dwarf</value>
- <valuelist type="QVariantList" key="Analyzer.Perf.Events">
- <value type="QString">cpu-cycles</value>
- </valuelist>
- <valuelist type="QVariantList" key="Analyzer.Perf.ExtraArguments"/>
- <value type="int" key="Analyzer.Perf.Frequency">250</value>
- <valuelist type="QVariantList" key="Analyzer.Perf.RecordArguments">
- <value type="QString">-e</value>
- <value type="QString">cpu-cycles</value>
- <value type="QString">--call-graph</value>
- <value type="QString">dwarf,4096</value>
- <value type="QString">-F</value>
- <value type="QString">250</value>
- </valuelist>
- <value type="QString" key="Analyzer.Perf.SampleMode">-F</value>
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
- <value type="int" key="Analyzer.Perf.StackSize">4096</value>
- <value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
- <value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
- <value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
- <value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
- <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
- <value type="QString" key="Analyzer.Valgrind.Callgrind.Arguments"></value>
- <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
- <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
- <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
- <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
- <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
- <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
- <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
- <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
- <value type="QString" key="Analyzer.Valgrind.KCachegrindExecutable">kcachegrind</value>
- <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
- <value type="QString" key="Analyzer.Valgrind.Memcheck.Arguments"></value>
- <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
- <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
- <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
- <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
- <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
- <value type="QString" key="Analyzer.Valgrind.ValgrindArguments"></value>
- <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
- <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
- <value type="int">0</value>
- <value type="int">1</value>
- <value type="int">2</value>
- <value type="int">3</value>
- <value type="int">4</value>
- <value type="int">5</value>
- <value type="int">6</value>
- <value type="int">7</value>
- <value type="int">8</value>
- <value type="int">9</value>
- <value type="int">10</value>
- <value type="int">11</value>
- <value type="int">12</value>
- <value type="int">13</value>
- <value type="int">14</value>
- </valuelist>
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
- <value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/Josh/Documents/EVPC/EVPC.pro</value>
+ <value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">C:/Users/Josh/Documents/EVPC/EVPC.pro</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
+ <value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
+ <value type="QString" key="RunConfiguration.WorkingDirectory.default">C:/Users/Josh/Documents/build-EVPC-Desktop_Qt_5_12_12_MinGW_64_bit-Debug</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
diff --git a/battery.cpp b/battery.cpp
index 5be2fc8..b38a0ac 100644
--- a/battery.cpp
+++ b/battery.cpp
@@ -1,7 +1,7 @@
#include "battery.h"
Battery::Battery() :
- activeBattery(batteries[0]),
+ activeBattery(batteries[LiionPhosphate]),
seriesCells(0),
parallelCells(0),
systemVoltage(0),
diff --git a/battery.h b/battery.h
index 887fb0e..6c0ed44 100644
--- a/battery.h
+++ b/battery.h
@@ -38,6 +38,8 @@ public:
void setSystemVoltage(double voltage);
void setPeakSystemPower(double power);
void changeBatteryChemistry(int name);
+public slots:
+ void calculate(void);
private:
batteryData_t activeBattery;
@@ -49,8 +51,6 @@ private:
float packChargeRate;
float packWeight;
float packEnergy;
-
- void calculate(void);
signals:
};
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 6fb2bf5..44a3a2e 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -8,6 +8,12 @@ MainWindow::MainWindow(QWidget *parent)
{
ui->setupUi(this);
initializeGraphics();
+
+ connect(&m_wire,&Wire::calculation, [&]() {
+ ui->lineEditWireGauge->setText(m_wire.gauge());
+ ui->lineEditWireWeight->setText(QString::number(m_wire.weight()));
+ ui->lineEditPeakCurrent->setText(QString::number(m_wire.peakCurrent()));
+ });
}
MainWindow::~MainWindow()
@@ -18,12 +24,15 @@ MainWindow::~MainWindow()
void MainWindow::on_spinBoxPeakSystemPower_valueChanged(double arg1)
{
-
+ m_wire.setPeakSystemPower(arg1);
+ m_wire.calculate();
+ m_battery.setPeakSystemPower(arg1);
}
void MainWindow :: initializeGraphics()
{
for(auto entry : batteries)ui->comboBoxBatteryChemistry->addItem(entry.name);
+ for(auto entry : wireMaterials)ui->comboBoxWireMaterial->addItem(entry);
}
void MainWindow::on_comboBoxBatteryChemistry_currentIndexChanged(int index)
@@ -37,3 +46,23 @@ void MainWindow::on_actionactionSettings_triggered()
}
+void MainWindow::on_comboBoxWireMaterial_currentIndexChanged(int index)
+{
+ m_wire.setActiveWireType(index);
+ m_wire.calculate();
+}
+
+void MainWindow::on_doubleSpinBoxSystemVoltage_valueChanged(double arg1)
+{
+ m_wire.setSystemVoltage(arg1);
+ m_wire.calculate();
+ m_battery.setSystemVoltage(arg1);
+}
+
+
+void MainWindow::on_doubleSpinBoxEstimatedWireLength_valueChanged(double arg1)
+{
+ m_wire.setWireLength(arg1);
+ m_wire.calculate();
+}
+
diff --git a/mainwindow.h b/mainwindow.h
index 0add526..359faf5 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -3,7 +3,10 @@
#include <QMainWindow>
#include <QSettings>
+#include <QString>
+#include <QComboBox>
#include "battery.h"
+#include "wire.h"
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
@@ -24,8 +27,15 @@ private slots:
void on_actionactionSettings_triggered();
+ void on_comboBoxWireMaterial_currentIndexChanged(int index);
+
+ void on_doubleSpinBoxSystemVoltage_valueChanged(double arg1);
+
+ void on_doubleSpinBoxEstimatedWireLength_valueChanged(double arg1);
+
private:
Battery m_battery;
+ Wire m_wire;
Ui::MainWindow *ui;
void initializeGraphics(void);
diff --git a/mainwindow.ui b/mainwindow.ui
index c7a03c8..0755bb5 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -269,7 +269,7 @@
<enum>QAbstractSpinBox::DefaultStepType</enum>
</property>
<property name="value">
- <double>1000.000000000000000</double>
+ <double>0.000000000000000</double>
</property>
</widget>
</item>
@@ -288,7 +288,7 @@
<double>1000.000000000000000</double>
</property>
<property name="value">
- <double>100.000000000000000</double>
+ <double>0.000000000000000</double>
</property>
</widget>
</item>
@@ -300,7 +300,7 @@
</widget>
</item>
<item row="2" column="1">
- <widget class="QDoubleSpinBox" name="doubleSpinBox_2">
+ <widget class="QDoubleSpinBox" name="doubleSpinBoxEstimatedWireLength">
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
@@ -314,7 +314,7 @@
<double>1000.000000000000000</double>
</property>
<property name="value">
- <double>100.000000000000000</double>
+ <double>0.000000000000000</double>
</property>
</widget>
</item>
diff --git a/wire.cpp b/wire.cpp
new file mode 100644
index 0000000..bc7a7c1
--- /dev/null
+++ b/wire.cpp
@@ -0,0 +1,83 @@
+#include "wire.h"
+#include "QDebug"
+Wire::Wire() :
+ activeWireData(copper[0]),
+ activeWire(wireMaterials[Copper]),
+ systemVoltage(0.0),
+ peakPower(0.0),
+ wireLength(0.0)
+{
+
+}
+
+void Wire::setActiveWireType(int wire)
+{
+ activeWire = wireMaterials[wire];
+}
+
+void Wire::setWireLength(float length)
+{
+ wireLength = length;
+}
+void Wire::setSystemVoltage(double voltage)
+{
+ systemVoltage = voltage;
+}
+
+void Wire::setPeakSystemPower(double power)
+{
+ peakPower = power;
+}
+
+void Wire::calculate()
+{
+ float current = peakPower/systemVoltage;
+ int count = 0;
+ switch (std::distance(wireMaterials, std::find(wireMaterials,wireMaterials+sizeof(wireMaterials),activeWire)))
+ {
+ case Copper:
+{
+ while(current < copper[count].maxCurrent)
+ {
+ activeWireData = copper[count];
+ count++;
+ }
+ break;
+}
+ case Aluminum:
+{
+ break;
+}
+ case Silver:
+{
+ break;
+}
+ case Gold:
+{
+ break;
+}
+ case Tin:
+{
+ break;
+}
+ }
+ qDebug() << activeWireData.AWG;
+ emit calculation();
+}
+
+QString Wire::gauge()
+{
+ return activeWireData.AWG;
+}
+
+double Wire::weight()
+{
+ return (wireLength * activeWireData.weight)/1000.0;
+}
+
+double Wire::peakCurrent()
+{
+ return peakPower/systemVoltage;
+}
+
+
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