-
Notifications
You must be signed in to change notification settings - Fork 7
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
feat: Implement function to calcualte charge cost #204
Conversation
To be done later:
For context please go to: #203 |
|
||
var epsilon float64 = 0.00000001 | ||
|
||
func floatEquals(a, b float64) bool { |
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.
We really need to find/implement a floatEquals
package. There're too many places want to use it.
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.
Yes, and location
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.
- How about adding
common
package inintegration/oasis
? ForfloatEquals
, we add it intoutil.go
. Search this from other repository, one sample isgo-gl/mathgl/mathgl32/util
- For
Location
, add tocommontypes
under common package. - Later if they are needed by external package, could be moved to
integration
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.
Not only oasis
need it, but also other packages. What if create a integration/util
package for the floatEquals
, and a integration/map
package for the Location
? The Location
here is for general purpose, if some special usage(e.g., Coordinate
in osrm
) just create their owns.
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.
Ok, will put it to integration
. Will make floatEqual
to there and change the calling in this pull.
For Location
and make other places calling floatEqual
will make it in future pull. Recorded here: #211
// 1 hour charge to 60% of max energy | ||
// 2 hour charge to 80%, means from 60% ~ 80% need 1 hour | ||
// 4 hour charge to 100%, means from 80% ~ 100% need 2 hours | ||
func (f *fakeChargingStrategyCreator) EvaluateCost(arrivalEnergy float64, targetState ChargingStatus) ChargingCost { |
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.
targetState
or targetStatus
, which one would be better?
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.
Keep them consistency is most important, keep the name targetState
here.
issue: #143
ChargeStrategy
creates several charge solutions via functionCreateChargingStrategies
, which means charge battery to a certain certain energy level.EvaluateCost
to calculate cost needed, such as time, money, etc.chargeTime
Tasklist
Requirements / Relations