From aeef870dbed6488483dc8dadfdf57858a9d84b7c Mon Sep 17 00:00:00 2001 From: Joshua Drake Date: Thu, 17 Nov 2022 20:50:46 -0600 Subject: Initial Commit --- EVPC.pro | 44 +++++ battery.cpp | 14 ++ battery.h | 50 +++++ main.cpp | 12 ++ mainwindow.cpp | 21 +++ mainwindow.h | 24 +++ mainwindow.ui | 475 +++++++++++++++++++++++++++++++++++++++++++++++ resources/boxout-th.png | Bin 0 -> 3674 bytes resources/connect.png | Bin 0 -> 4116 bytes resources/connected.png | Bin 0 -> 3697 bytes resources/disk.png | Bin 0 -> 3172 bytes resources/disk_green.png | Bin 0 -> 2784 bytes resources/gear.png | Bin 0 -> 9179 bytes resources/icon.png | Bin 0 -> 20699 bytes resources/play.png | Bin 0 -> 4235 bytes resources/play_green.png | Bin 0 -> 3922 bytes resources/play_white.png | Bin 0 -> 3908 bytes resources/res.qrc | 14 ++ 18 files changed, 654 insertions(+) create mode 100644 EVPC.pro create mode 100644 battery.cpp create mode 100644 battery.h create mode 100644 main.cpp create mode 100644 mainwindow.cpp create mode 100644 mainwindow.h create mode 100644 mainwindow.ui create mode 100644 resources/boxout-th.png create mode 100644 resources/connect.png create mode 100644 resources/connected.png create mode 100644 resources/disk.png create mode 100644 resources/disk_green.png create mode 100644 resources/gear.png create mode 100644 resources/icon.png create mode 100644 resources/play.png create mode 100644 resources/play_green.png create mode 100644 resources/play_white.png create mode 100644 resources/res.qrc diff --git a/EVPC.pro b/EVPC.pro new file mode 100644 index 0000000..2cfb74e --- /dev/null +++ b/EVPC.pro @@ -0,0 +1,44 @@ +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +CONFIG += c++11 + +# You can make your code fail to compile if it uses deprecated APIs. +# In order to do so, uncomment the following line. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +SOURCES += \ + battery.cpp \ + main.cpp \ + mainwindow.cpp + +HEADERS += \ + battery.h \ + mainwindow.h + +FORMS += \ + mainwindow.ui + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target + +RESOURCES += \ + res.qrc \ + resources/res.qrc + +DISTFILES += \ + res.rc \ + resources/boxout-th.png \ + resources/connect.png \ + resources/connected.png \ + resources/disk.png \ + resources/disk_green.png \ + resources/gear.png \ + resources/icon.png \ + resources/play.png \ + resources/play_green.png \ + resources/play_white.png \ + resources/res.rc diff --git a/battery.cpp b/battery.cpp new file mode 100644 index 0000000..e91b05f --- /dev/null +++ b/battery.cpp @@ -0,0 +1,14 @@ +#include "battery.h" + +Battery::Battery() : + activeBattery(batteries[0]), + seriesCells(0), + parallelCells(0) +{ + +} + +void Battery::changeBatteryChemistry(int name) +{ + activeBattery= batteries[name]; +} diff --git a/battery.h b/battery.h new file mode 100644 index 0000000..c1b7a86 --- /dev/null +++ b/battery.h @@ -0,0 +1,50 @@ +#ifndef BATTERY_H +#define BATTERY_H + +#include + +typedef struct batteryData { + QString name; + double nominalVoltage; + double specificEnergy; // Wh/Kg + float cellDischargeRate; + float cellChargeRate; +}batteryData_t; + +static const batteryData_t batteries[] +{ + {.name = "Li-ion Phosphate", .nominalVoltage = 3.3, .specificEnergy = 105.0, .cellDischargeRate = 30, .cellChargeRate = 10}, + {.name = "Li-ion Manganese", .nominalVoltage = 3.7, .specificEnergy = 125.0, .cellDischargeRate = 30, .cellChargeRate = 10}, + {.name = "Li-ion Cobalt", .nominalVoltage = 3.6, .specificEnergy = 200.0, .cellDischargeRate = 2, .cellChargeRate = 1}, + {.name = "NiMH", .nominalVoltage = 1.2, .specificEnergy = 90.0, .cellDischargeRate = 5, .cellChargeRate = 0.5}, + {.name = "NiCd", .nominalVoltage = 1.2, .specificEnergy = 60.0, .cellDischargeRate = 20, .cellChargeRate = 1}, +}; +enum batteryNames +{ + LiionPhosphate = 0, + LiionManganese, + LiionCobalt, + NiMH, + NICd, +}; + +class Battery : public QObject +{ + Q_OBJECT +public: + Battery(); +private: + void changeBatteryChemistry(int name); + + batteryData_t activeBattery; + int seriesCells; + int parallelCells; + float packDischargeRate; + float packChargeRate; + float packWeight; + float packEnergy; +signals: + +}; + +#endif // BATTERY_H diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..32130e2 --- /dev/null +++ b/main.cpp @@ -0,0 +1,12 @@ +#include "mainwindow.h" + +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + a.setWindowIcon(QIcon("img/icon.png")); + MainWindow w; + w.show(); + return a.exec(); +} diff --git a/mainwindow.cpp b/mainwindow.cpp new file mode 100644 index 0000000..93464f0 --- /dev/null +++ b/mainwindow.cpp @@ -0,0 +1,21 @@ +#include "mainwindow.h" +#include "ui_mainwindow.h" + +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent) + , ui(new Ui::MainWindow) +{ + ui->setupUi(this); +} + +MainWindow::~MainWindow() +{ + delete ui; +} + + +void MainWindow::on_spinBoxPeakSystemPower_valueChanged(double arg1) +{ + +} + diff --git a/mainwindow.h b/mainwindow.h new file mode 100644 index 0000000..9fb7515 --- /dev/null +++ b/mainwindow.h @@ -0,0 +1,24 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +QT_BEGIN_NAMESPACE +namespace Ui { class MainWindow; } +QT_END_NAMESPACE + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(QWidget *parent = nullptr); + ~MainWindow(); + +private slots: + void on_spinBoxPeakSystemPower_valueChanged(double arg1); + +private: + Ui::MainWindow *ui; +}; +#endif // MAINWINDOW_H diff --git a/mainwindow.ui b/mainwindow.ui new file mode 100644 index 0000000..e82ca53 --- /dev/null +++ b/mainwindow.ui @@ -0,0 +1,475 @@ + + + MainWindow + + + + 0 + 0 + 800 + 600 + + + + + 800 + 600 + + + + Electric Vehicle Parameter Calculator + + + + :/img/icon.png:/img/icon.png + + + Qt::LeftToRight + + + + 30 + 30 + + + + + + 800 + 545 + + + + + 800 + 545 + + + + + + + 0 + + + + -1 + + + Qt::LeftToRight + + + Data + + + + + + -1 + + + Outputs + + + + + + Peak Current: + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + + + + Qt::AlignCenter + + + true + + + + + + + + 0 + 0 + + + + Qt::AlignCenter + + + true + + + + + + + Wire Weight: + + + + + + + + 0 + 0 + + + + Qt::AlignCenter + + + true + + + + + + + + 0 + 0 + + + + Qt::AlignCenter + + + true + + + + + + + Wire Gauge: + + + + + + + Cell Count: + + + + + + + Fuel Quantity: + + + + + + + + 0 + 0 + + + + true + + + + + + + + + + Electrical Inputs + + + false + + + + QLayout::SetNoConstraint + + + 9 + + + 0 + + + 9 + + + 0 + + + + + System Voltage: + + + + + + + Peak System Power: + + + + + + + Battery Chemistry: + + + + + + + false + + + + + + + + + + Qt::AlignCenter + + + QAbstractSpinBox::NoButtons + + + 1 + + + 100000.000000000000000 + + + QAbstractSpinBox::DefaultStepType + + + 1000.000000000000000 + + + + + + + Qt::AlignCenter + + + QAbstractSpinBox::NoButtons + + + 1 + + + 1000.000000000000000 + + + 100.000000000000000 + + + + + + + Estimated Wire Length: + + + + + + + Qt::AlignCenter + + + QAbstractSpinBox::NoButtons + + + 1 + + + 1000.000000000000000 + + + 100.000000000000000 + + + + + + + Wire Material: + + + + + + + + + + + + + + + + + Mechanical Inputs + + + + + + Vehicle Weight: + + + + + + + Qt::AlignCenter + + + QAbstractSpinBox::NoButtons + + + 1 + + + 1000.000000000000000 + + + 100.000000000000000 + + + + + + + Run Time: + + + + + + + Qt::AlignCenter + + + QAbstractSpinBox::NoButtons + + + false + + + 2 + + + 96.000000000000000 + + + 8.000000000000000 + + + + + + + QFrame::NoFrame + + + <html><head/><body><p>Engine/Power Source:</p></body></html> + + + + + + + + + + + + + + Plots + + + + + + + + + toolBar + + + false + + + TopToolBarArea + + + false + + + + + + + + :/img/boxout-th.png:/img/boxout-th.png + + + Load + + + Load Saved Data + + + + + + :/img/disk_green.png + :/img/disk_green.png:/img/disk_green.png + + + Capture + + + Save Data + + + + + + + + diff --git a/resources/boxout-th.png b/resources/boxout-th.png new file mode 100644 index 0000000..4e69d7d Binary files /dev/null and b/resources/boxout-th.png differ diff --git a/resources/connect.png b/resources/connect.png new file mode 100644 index 0000000..75735f7 Binary files /dev/null and b/resources/connect.png differ diff --git a/resources/connected.png b/resources/connected.png new file mode 100644 index 0000000..b24ee6f Binary files /dev/null and b/resources/connected.png differ diff --git a/resources/disk.png b/resources/disk.png new file mode 100644 index 0000000..41e1be9 Binary files /dev/null and b/resources/disk.png differ diff --git a/resources/disk_green.png b/resources/disk_green.png new file mode 100644 index 0000000..8c5a1dd Binary files /dev/null and b/resources/disk_green.png differ diff --git a/resources/gear.png b/resources/gear.png new file mode 100644 index 0000000..4434d09 Binary files /dev/null and b/resources/gear.png differ diff --git a/resources/icon.png b/resources/icon.png new file mode 100644 index 0000000..9333dec Binary files /dev/null and b/resources/icon.png differ diff --git a/resources/play.png b/resources/play.png new file mode 100644 index 0000000..deff0a7 Binary files /dev/null and b/resources/play.png differ diff --git a/resources/play_green.png b/resources/play_green.png new file mode 100644 index 0000000..4799a17 Binary files /dev/null and b/resources/play_green.png differ diff --git a/resources/play_white.png b/resources/play_white.png new file mode 100644 index 0000000..ef67ecf Binary files /dev/null and b/resources/play_white.png differ diff --git a/resources/res.qrc b/resources/res.qrc new file mode 100644 index 0000000..22ddb8f --- /dev/null +++ b/resources/res.qrc @@ -0,0 +1,14 @@ + + + connect.png + connected.png + disk.png + disk_green.png + gear.png + icon.png + play.png + play_green.png + play_white.png + boxout-th.png + + -- cgit v1.2.3