Skip to content
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

[question] trips.json schema and 1000 stepSize attribute #33

Open
kuanb opened this issue Jan 23, 2020 · 1 comment
Open

[question] trips.json schema and 1000 stepSize attribute #33

kuanb opened this issue Jan 23, 2020 · 1 comment
Labels
question Further information is requested

Comments

@kuanb
Copy link

kuanb commented Jan 23, 2020

I can see in the src how each trip in trips.json is assembled:

trip-simulator/src/agent.js

Lines 183 to 184 in a1497e6

trip_duration: this.path.duration / 1000,
trip_distance: this.path.distance * 1000,

Where does the 1000 constant in the denominator come from? I think it's related to the stepSize from the simulation being hardcoded to 1000:

this.stepSize = 1000;

If so, are the trip_duration and trip_distance values the in seconds and meters, respectively?

I ask because I'd assume the time would converted /60 (min) /360 (hrs), so wondering where the 1000 is coming from.

Same question roughly with distance value.

@kuanb
Copy link
Author

kuanb commented Jan 23, 2020

this.path = await this.simulation.route(this.location, destination);

OSRM returns a duration float, in seconds. You factor rate * time and then factor by 1000 to get distance in meters since rate in kmph.

So that would be total distance covered, right? And, if so, then why re-divide by 1000 only to compute duration for completed trip?

I feel like I am missing just one step in the logic as I am reading through it 🤔

@morganherlocker morganherlocker added the question Further information is requested label Jan 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants