Skip to content
This repository has been archived by the owner on Feb 5, 2023. It is now read-only.

Manualsim backend #5

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Manualsim backend #5

wants to merge 10 commits into from

Conversation

cng123
Copy link
Contributor

@cng123 cng123 commented May 27, 2017

No description provided.

EmceeEscher and others added 9 commits May 13, 2017 15:17
…le (still needs testing, does not support multiple laps yet, breaks if speed is set to constant for the whole route)

- Added function to make graphs change for each change in speed profile (sim is fast enough to do in real-time instead of a button)
- Thinking of removing a redundant wrapper class (speed report is redundant. All its fields are basically fields of sim result (another wrapper class) and the sim result itself)
@cng123 cng123 requested review from dustxd and EmceeEscher May 27, 2017 19:04
Copy link
Contributor

@EmceeEscher EmceeEscher left a comment

Choose a reason for hiding this comment

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

had a few questions, but it looks good for the most part

List<SimFrame> resultFrames = new ArrayList<SimFrame>(); //list of sim frames
//idea is to use runSimV2 for every part of the route where the car travels at constant speed until the speed change
//the point with the different speed would be the last point, and the point after would be the start of the next simulation
GeoCoord start = routeToTraverse.getTrailMarkers().get(1); //first point of the simulation (need to ask why its 1, running point 0 to 1 is always a fail)
Copy link
Contributor

Choose a reason for hiding this comment

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

this is something we should deal with eventually, but not necessarily right now. I know there are some issues related to the sim if you give the first point 0 speed (right now we default to giving the speed as 1 km/h for the first point I think). There's probably some divide by 0 error somewhere that we should deal with, but it's not a high priority.

//if there is, run a simulation and update list of sim frames, new start speed, new start point, start time and car status using results
if (Math.abs(manualSpeedProfile.get(start).get(i) - manualSpeedProfile.get(routeToTraverse.getTrailMarkers().get(point_index)).get(i)) > 0.000001 ||
point_index == routeToTraverse.getTrailMarkers().size()) {
end = routeToTraverse.getTrailMarkers().get(point_index);
Copy link
Contributor

Choose a reason for hiding this comment

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

does this work if we hit the point_index == routeToTraverse.getTrailMarkers().size() condition in the if statement? wouldn't that be out of bounds?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The for loop makes sure that does not happen

//min charge is set to 0. Since speeds are decided by users and no adjustments will be made, we let the simulation use up all the charge
//for each runSimV2 call. We assume that if the cannot make it through without conserving charge for the next runSimV2 call (giving a non-zero
//value for min charge), it will not make it through if charge is conserved (may need to change for single lap routes, definitely needs tweaking for
//for multiple laps)
Copy link
Contributor

Choose a reason for hiding this comment

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

what kind of tweaking do you think will be necessary for multiple laps?

//that needs to be removed in speed profile)
if(!result.wasRunSuccessful()) {
System.err.println("Car cannot make it through the route with selected speeds");
for (int removed_point = routeToTraverse.getTrailMarkers().size() - 1; (!end.equals(removed_point) && removed_point >= 0);removed_point--) {
Copy link
Contributor

Choose a reason for hiding this comment

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

what is !end.equals(removed_point) checking for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it checks for the last point that was the parameter for the failed runSimV2() call. The loop removes all the points after the failed call in the speedprofile, so the graph shows speeds until it runs out of charge.

lastCarReported = result.getFinalTelemData();
resultFrames.addAll(result.getListOfFrames()); // add sim frames to list
totalTime += result.getTravelTime();
}*/
Copy link
Contributor

Choose a reason for hiding this comment

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

if you don't think we need this commented out code anymore, please remove it. If we need it back we can go through our git history

@@ -199,7 +303,7 @@ public SpeedReport getSpeedReport(long startTime, int lapNum, double startingVel
int pointsPerSubChunk = (chunkEnd - chunkStart + 1) / subchunksPerForecast;
int remainder = (chunkEnd - chunkStart + 1) % subchunksPerForecast;

for (int i = chunkStart; i < chunkEnd; i += pointsPerSubChunk ) {
for (int i = chunkStart; i <= chunkEnd; i += pointsPerSubChunk ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

what does this change do?

@@ -4,7 +4,7 @@
import java.text.SimpleDateFormat;
import java.util.*;

import jdk.nashorn.internal.objects.Global;
//import jdk.nashorn.internal.objects.Global;
Copy link
Contributor

Choose a reason for hiding this comment

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

if we don't need this import we should delete it

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants