-
Notifications
You must be signed in to change notification settings - Fork 1
Refarctoring #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Refarctoring #2
Changes from all commits
07d0c2c
ac4f28d
179975b
4977fbf
011f5f3
6ba0646
22dd0bb
b937586
07bf6e9
c5cd29f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| #file: --CellTable.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 * |
| 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 | ||
| usableCapacity = -1 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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): | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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): | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) | ||
There was a problem hiding this comment.
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.