-
Notifications
You must be signed in to change notification settings - Fork 24
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
Multi mode clean #20
base: communication-edit
Are you sure you want to change the base?
Multi mode clean #20
Conversation
…List and Dict general struct, add person struct and transfer point struct
…nto multi-mode-clean
newTrafficVehicleVec.push_back(vehicle); | ||
} | ||
|
||
newTrafficPersonVec.push_back(person); |
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.
Add dep_time
into the vehicles. whether bus or auto.
@@ -213,6 +213,12 @@ void BPMTrafficPerson::randomPerson(int p, BTrafficPeople &people, | |||
people.T[p] = 2.0f + 3.0f * (((float)qrand()) / RAND_MAX); //time heading 2.0-3s | |||
} | |||
|
|||
|
|||
if (carType == 2) { //bike car |
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.
@Luze, what's this for? Did you add this when we need a bike? Should we delete this for now? AFAIK our simulation is not using this cpp file
// } | ||
//} | ||
|
||
return all_od_pairs_sets; |
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.
Does this include both bus routes and vehicle routes?
|
||
} | ||
|
||
for (size_t i = 0; i < busRoutes.size(); ++i) { |
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.
@SLZ0106 This should be reading trip ID, and use the new bus_shcedule file Junzhe
LivingCity/traffic/b18EdgeData.h
Outdated
ushort state; | ||
ushort stateLine; | ||
ushort totalInOutEdges; | ||
uint edge[24];// up to six arms intersection | ||
float nextEvent; | ||
LNode* passengers; |
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.
Should be changed into Dnode @YiboZh
struct B18TrafficPerson{ | ||
int id; | ||
Node* transferPoints; //should take which bus line and drop at which intersection | ||
float time_departure; |
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.
TODO: This will be put into Dnode, so it will be deleted here @YiboZh
std::vector<std::array<abm::graph::vertex_t, 2>> all_od_pairs_without_mode; | ||
all_modes.reserve(all_od_pairs_.size()); | ||
all_od_pairs_without_mode.reserve(all_od_pairs_.size()); | ||
for (const auto& od_pair_with_mode : all_od_pairs_) { |
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.
all_modes will be used for replacing mode in .cu while running simulation
@@ -277,7 +365,21 @@ const std::vector<abm::graph::edge_id_t> B18TrafficSP::loadPrevPathsFromFile( | |||
return const_paths_SP; | |||
} | |||
|
|||
//merge multi path into one path |
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.
TODO: When we are outputting the things from the simulator, we need to change the things to be output in people and route file.
@@ -204,14 +218,37 @@ void savePaths(const std::vector<personPath>& paths, const std::string& filename | |||
file << personPathToString(path) << "\n"; | |||
} | |||
} | |||
std::vector<int> findBuses( | |||
const std::vector<std::vector<int>>& busRoutes, |
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.
to be deleted
@@ -539,11 +599,22 @@ void B18TrafficSimulator::simulateInGPU(const int ngpus, const int numOfPasses, | |||
float totalNumSteps = 0; | |||
float totalCO = 0; | |||
|
|||
std::ofstream outFile("output_time_diff.csv", std::ios::app); |
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.
why we need this?
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.
for travel time
@@ -183,6 +243,73 @@ void b18InitCUDA_n( | |||
for(int i = 0; i < ngpus; i++){ | |||
cudaStreamCreate( &streams[i]); | |||
} | |||
|
|||
// Initialize people and vehicles |
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.
newTrafficPersonVec.push_back(person); | ||
} | ||
|
||
for (size_t i = 0; i < busRoutes.size(); ++i) { |
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.
vehicle and how it will follow its route?
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.
TODO: Auto follows original path, bus follows bus route @YiboZh
@@ -296,6 +421,22 @@ void b18InitCUDA_n( | |||
// gpuErrchk(cudaMemPrefetchAsync(trafficLights_d, sizeT, 1, streams[1])); | |||
|
|||
} | |||
|
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.
Dnode要初始化departure time
} | ||
|
||
/*Add transfer function to simulate people change from a bus to another bus*/ | ||
__device__ void transferToNewVehicle( |
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.
For bus to Auto
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.
TODO: new vehicle's bus should be initialized outside kernal
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.
potential solution: get route from person struct
Node* passengers; // a list of persons, key is the intersection id, value is the list of persons to drop off | ||
|
||
//save travel time | ||
float time_diff; |
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.
Move to person struct
@@ -2097,10 +2491,11 @@ void b18SimulateTrafficCUDA(float currentTime, | |||
cudaSetDevice(i); | |||
int numPeople_gpu = vehicles_vec[i]->size(); | |||
LC::B18TrafficVehicle* vehicles_ptr = thrust::raw_pointer_cast((*vehicles_vec[i]).data()); | |||
LC::B18TrafficPerson* person_ptr = trafficPerson_d; |
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.
person_vec
|
||
struct B18TrafficPerson{ | ||
int id; | ||
Node* transferPoints; //should take which bus line and drop at which intersection |
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.
Add num_step to this property to track travel time.
To be fix: init the first segment of trip in transfer point to save travel time
No description provided.