Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
654 changes: 654 additions & 0 deletions main.py

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/CellTable.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#file: --CellTable.py--
6 changes: 6 additions & 0 deletions src/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from .cell import *
from .CellTable import *
from .motor import *
from .pack import *
from .vehicle import *
from .main import *
122 changes: 122 additions & 0 deletions src/cell.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
#file --cell.py--

class cell(object):
name = "empty"
initialVoltage = -1
finalVoltage = -1
ratedVoltage = -1
capacity = -1
maxContinousDischarge = -1
internalResistance = -1
remainingCapacity = -1 #TODO: Rename this
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this been renamed? (Has the todo been complete?) If not, Please complete and update the PR.

usableCapacity = -1
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe put a comment below or above the definitions so other people can understand the difference between these attributes (usable vs remaining) If there is a lot of theoretical calculations and background please add documentation referencing the code


def __init__(self,cellName,ratedVoltage,capacity,peakCurrent,startingVoltage,endingVoltage,resistance,weight):
self.cellName = cellName
self.ratedPotential = ratedVoltage
self.capacity = capacity
self.maxDischarge = peakCurrent
self.intitialPotential = startingVoltage
self.finalPotential = endingVoltage
self.internalResistance = resistance
self.weight = weight
self.remainingCapacity = capacity

@classmethod
def basicCell(self, ratedVoltage, maxAmperage):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of having Empty and basic? Based on the input being a file, can't we take out one of them? The attributes are still the same from what I am seeing

self.cellName = 'empty'
self.intitialPotential = -1
self.finalPotential = -1
self.ratedPotential = -1
self.capacity = -1
self.maxDischarge = -1
self.internalResistance = -1
self.remainingCapacity = -1
self.weight = -1

@classmethod
def emptyCell(self):
self.cellName = 'empty'
self.intitialPotential = -1
self.finalPotential = -1
self.ratedPotential = -1
self.capacity = -1
self.maxDischarge = -1
self.internalResistance = -1
self.remainingCapacity = -1
self.weight = -1
return self

def setCellName(self, name):
self.cellName = name

def setInitialPotential(self, volts):
self.intitialPotential = volts

def setFinalPotential(self, volts):
self.finalPotential = volts

def setRatedPotential(self, volts):
self.ratedPotential = volts

def setCapacity(self, ampHours):
self.capacity = ampHours

def setMaxDischarge(self, amps):
self.maxDischarge = amps

def setInternalResistance(self,ohms):
self.internalResistance = ohms

def setWeight(self, grams):
self.weight = grams

def getCellName(self):
return self.cellName

def getWeight(self):
return self.weight

def getInitialPotential(self):
return self.intitialPotential

def getFinalPotential(self):
return self.finalPotential

def getVoltage(self):
return self.ratedPotential

def getMaxDischarge(self):
return self.maxDischarge

def getCapacity(self):
return self.capacity

def getInternalResistance(self):
return self.internalResistance

def findEnergyDensity(self):
if(FLAGS_ENABLED == 1):
if(self.capacity <= 0):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If capacity is <= 0 then the function should return with the print statement. From looking at this code, it looks like it still does the calculation after printing the statement. (Return a -1 to show that it wasn't possible)

print ('Warning -- Function findEnergyDensity() -- member of class cell -- Capacity must be greater than 0')

energyDensity = self.capacity/self.weight
return energyDensity

def findPowerThermalLoss(self,I):
power = (I^2)*self.internalResistance
return power

def findPowerDensity(self):
#TODO: This will have to be done later, the discharge curve needs to be found with polynomial approximation
return 0

def findUsableCapacity(self):
self.usableCapacity = self.capacity - self.remainingCapacity

def findUsableEnergyDensity(self):
#TODO: This will have to be done later, the discharge curve needs to be found with polynomial approximation
return 0

def toString(self):
return (self.cellName + ', ' + self.ratedPotential + ', ' + self.capacity)
Loading