summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Drake <joshua.ellis.drake@gmail.com>2022-11-17 20:50:46 -0600
committerJoshua Drake <joshua.ellis.drake@gmail.com>2022-11-17 20:50:46 -0600
commitaeef870dbed6488483dc8dadfdf57858a9d84b7c (patch)
tree3974d2eaf2e50c8108d31c48e21d07f301eb6b73
Initial Commit
-rw-r--r--EVPC.pro44
-rw-r--r--battery.cpp14
-rw-r--r--battery.h50
-rw-r--r--main.cpp12
-rw-r--r--mainwindow.cpp21
-rw-r--r--mainwindow.h24
-rw-r--r--mainwindow.ui475
-rw-r--r--resources/boxout-th.pngbin0 -> 3674 bytes
-rw-r--r--resources/connect.pngbin0 -> 4116 bytes
-rw-r--r--resources/connected.pngbin0 -> 3697 bytes
-rw-r--r--resources/disk.pngbin0 -> 3172 bytes
-rw-r--r--resources/disk_green.pngbin0 -> 2784 bytes
-rw-r--r--resources/gear.pngbin0 -> 9179 bytes
-rw-r--r--resources/icon.pngbin0 -> 20699 bytes
-rw-r--r--resources/play.pngbin0 -> 4235 bytes
-rw-r--r--resources/play_green.pngbin0 -> 3922 bytes
-rw-r--r--resources/play_white.pngbin0 -> 3908 bytes
-rw-r--r--resources/res.qrc14
18 files changed, 654 insertions, 0 deletions
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 <QObject>
+
+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 <QApplication>
+
+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 <QMainWindow>
+
+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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>800</width>
+ <height>600</height>
+ </rect>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>800</width>
+ <height>600</height>
+ </size>
+ </property>
+ <property name="windowTitle">
+ <string>Electric Vehicle Parameter Calculator</string>
+ </property>
+ <property name="windowIcon">
+ <iconset resource="res.qrc">
+ <normaloff>:/img/icon.png</normaloff>:/img/icon.png</iconset>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>30</width>
+ <height>30</height>
+ </size>
+ </property>
+ <widget class="QWidget" name="centralwidget">
+ <property name="minimumSize">
+ <size>
+ <width>800</width>
+ <height>545</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>800</width>
+ <height>545</height>
+ </size>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QTabWidget" name="tabWidget">
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="tabData">
+ <property name="toolTipDuration">
+ <number>-1</number>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <attribute name="title">
+ <string>Data</string>
+ </attribute>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="1" rowspan="2">
+ <widget class="QGroupBox" name="groupElectricalOutputs">
+ <property name="toolTipDuration">
+ <number>-1</number>
+ </property>
+ <property name="title">
+ <string>Outputs</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_4">
+ <item row="1" column="0">
+ <widget class="QLabel" name="labelPeakCurrent">
+ <property name="text">
+ <string>Peak Current:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="lineEditPeakCurrent">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="lineEditWireGauge">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="labelWireWeight">
+ <property name="text">
+ <string>Wire Weight:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="lineEditCellCount">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QLineEdit" name="lineEditWireWeight">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="labelWireGauge">
+ <property name="text">
+ <string>Wire Gauge:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="labelBatteryPackCells">
+ <property name="text">
+ <string>Cell Count:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="labelFuelAmount">
+ <property name="text">
+ <string>Fuel Quantity:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QLineEdit" name="lineEditFuelAmount">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QGroupBox" name="groupElectricalInputs">
+ <property name="title">
+ <string>Electrical Inputs</string>
+ </property>
+ <property name="flat">
+ <bool>false</bool>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_3">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetNoConstraint</enum>
+ </property>
+ <property name="leftMargin">
+ <number>9</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="horizontalSpacing">
+ <number>9</number>
+ </property>
+ <property name="verticalSpacing">
+ <number>0</number>
+ </property>
+ <item row="1" column="0">
+ <widget class="QLabel" name="labelSystemVoltage">
+ <property name="text">
+ <string>System Voltage:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="labelPeakSystemPower">
+ <property name="text">
+ <string>Peak System Power:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="labelBatteryChemistry">
+ <property name="text">
+ <string>Battery Chemistry:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QComboBox" name="comboBoxBatteryChemistry">
+ <property name="editable">
+ <bool>false</bool>
+ </property>
+ <property name="placeholderText">
+ <string notr="true"/>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QDoubleSpinBox" name="spinBoxPeakSystemPower">
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ <property name="buttonSymbols">
+ <enum>QAbstractSpinBox::NoButtons</enum>
+ </property>
+ <property name="decimals">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <double>100000.000000000000000</double>
+ </property>
+ <property name="stepType">
+ <enum>QAbstractSpinBox::DefaultStepType</enum>
+ </property>
+ <property name="value">
+ <double>1000.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QDoubleSpinBox" name="doubleSpinBoxSystemVoltage">
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ <property name="buttonSymbols">
+ <enum>QAbstractSpinBox::NoButtons</enum>
+ </property>
+ <property name="decimals">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <double>1000.000000000000000</double>
+ </property>
+ <property name="value">
+ <double>100.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="labelEstimatedWireLength">
+ <property name="text">
+ <string>Estimated Wire Length:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QDoubleSpinBox" name="doubleSpinBox_2">
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ <property name="buttonSymbols">
+ <enum>QAbstractSpinBox::NoButtons</enum>
+ </property>
+ <property name="decimals">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <double>1000.000000000000000</double>
+ </property>
+ <property name="value">
+ <double>100.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="labelWireMaterial">
+ <property name="text">
+ <string>Wire Material:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QComboBox" name="comboBoxWireMaterial">
+ <property name="placeholderText">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QGroupBox" name="groupBoxMechanical">
+ <property name="title">
+ <string>Mechanical Inputs</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_5">
+ <item row="0" column="0">
+ <widget class="QLabel" name="labelVehicleWeight">
+ <property name="text">
+ <string>Vehicle Weight:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QDoubleSpinBox" name="doubleSpinBoxVehicleWeight">
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ <property name="buttonSymbols">
+ <enum>QAbstractSpinBox::NoButtons</enum>
+ </property>
+ <property name="decimals">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <double>1000.000000000000000</double>
+ </property>
+ <property name="value">
+ <double>100.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="labelRunTime">
+ <property name="text">
+ <string>Run Time:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QDoubleSpinBox" name="doubleSpinBoxRunTime">
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ <property name="buttonSymbols">
+ <enum>QAbstractSpinBox::NoButtons</enum>
+ </property>
+ <property name="showGroupSeparator" stdset="0">
+ <bool>false</bool>
+ </property>
+ <property name="decimals">
+ <number>2</number>
+ </property>
+ <property name="maximum">
+ <double>96.000000000000000</double>
+ </property>
+ <property name="value">
+ <double>8.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="labelEnginePowerSource">
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Engine/Power Source:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QComboBox" name="comboBoxEnginePowerSource"/>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tabPlots">
+ <attribute name="title">
+ <string>Plots</string>
+ </attribute>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QToolBar" name="toolBar">
+ <property name="windowTitle">
+ <string>toolBar</string>
+ </property>
+ <property name="movable">
+ <bool>false</bool>
+ </property>
+ <attribute name="toolBarArea">
+ <enum>TopToolBarArea</enum>
+ </attribute>
+ <attribute name="toolBarBreak">
+ <bool>false</bool>
+ </attribute>
+ <addaction name="actionCapture"/>
+ <addaction name="fileLoad"/>
+ </widget>
+ <action name="fileLoad">
+ <property name="icon">
+ <iconset resource="res.qrc">
+ <normaloff>:/img/boxout-th.png</normaloff>:/img/boxout-th.png</iconset>
+ </property>
+ <property name="text">
+ <string>Load</string>
+ </property>
+ <property name="toolTip">
+ <string>Load Saved Data</string>
+ </property>
+ </action>
+ <action name="actionCapture">
+ <property name="icon">
+ <iconset resource="res.qrc">
+ <normaloff>:/img/disk_green.png</normaloff>
+ <normalon>:/img/disk_green.png</normalon>:/img/disk_green.png</iconset>
+ </property>
+ <property name="text">
+ <string>Capture</string>
+ </property>
+ <property name="toolTip">
+ <string>Save Data</string>
+ </property>
+ </action>
+ </widget>
+ <resources>
+ <include location="res.qrc"/>
+ </resources>
+ <connections/>
+</ui>
diff --git a/resources/boxout-th.png b/resources/boxout-th.png
new file mode 100644
index 0000000..4e69d7d
--- /dev/null
+++ b/resources/boxout-th.png
Binary files differ
diff --git a/resources/connect.png b/resources/connect.png
new file mode 100644
index 0000000..75735f7
--- /dev/null
+++ b/resources/connect.png
Binary files differ
diff --git a/resources/connected.png b/resources/connected.png
new file mode 100644
index 0000000..b24ee6f
--- /dev/null
+++ b/resources/connected.png
Binary files differ
diff --git a/resources/disk.png b/resources/disk.png
new file mode 100644
index 0000000..41e1be9
--- /dev/null
+++ b/resources/disk.png
Binary files differ
diff --git a/resources/disk_green.png b/resources/disk_green.png
new file mode 100644
index 0000000..8c5a1dd
--- /dev/null
+++ b/resources/disk_green.png
Binary files differ
diff --git a/resources/gear.png b/resources/gear.png
new file mode 100644
index 0000000..4434d09
--- /dev/null
+++ b/resources/gear.png
Binary files differ
diff --git a/resources/icon.png b/resources/icon.png
new file mode 100644
index 0000000..9333dec
--- /dev/null
+++ b/resources/icon.png
Binary files differ
diff --git a/resources/play.png b/resources/play.png
new file mode 100644
index 0000000..deff0a7
--- /dev/null
+++ b/resources/play.png
Binary files differ
diff --git a/resources/play_green.png b/resources/play_green.png
new file mode 100644
index 0000000..4799a17
--- /dev/null
+++ b/resources/play_green.png
Binary files differ
diff --git a/resources/play_white.png b/resources/play_white.png
new file mode 100644
index 0000000..ef67ecf
--- /dev/null
+++ b/resources/play_white.png
Binary files 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 @@
+<RCC>
+ <qresource prefix="/img">
+ <file>connect.png</file>
+ <file>connected.png</file>
+ <file>disk.png</file>
+ <file>disk_green.png</file>
+ <file>gear.png</file>
+ <file>icon.png</file>
+ <file>play.png</file>
+ <file>play_green.png</file>
+ <file>play_white.png</file>
+ <file>boxout-th.png</file>
+ </qresource>
+</RCC>