Skip to content

Multi mode clean#20

Open
Xuan-1998 wants to merge 44 commits intocommunication-editfrom
multi-mode-clean
Open

Multi mode clean#20
Xuan-1998 wants to merge 44 commits intocommunication-editfrom
multi-mode-clean

Conversation

@Xuan-1998
Copy link
Owner

No description provided.

Xuan Jiang and others added 30 commits July 18, 2024 12:52
…List and Dict general struct, add person struct and transfer point struct
newTrafficVehicleVec.push_back(vehicle);
}

newTrafficPersonVec.push_back(person);

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.

}


if (carType == 2) { //bike car
Copy link
Owner Author

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;
Copy link
Owner Author

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) {
Copy link
Owner Author

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

ushort totalInOutEdges;
uint edge[24];// up to six arms intersection
float nextEvent;
LNode* passengers;
Copy link
Owner Author

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;
Copy link
Owner Author

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_) {
Copy link
Owner Author

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

return const_paths_SP;
}

//merge multi path into one path
Copy link
Owner Author

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.

}
}
std::vector<int> findBuses(
const std::vector<std::vector<int>>& busRoutes,
Copy link
Owner Author

Choose a reason for hiding this comment

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

to be deleted

float totalNumSteps = 0;
float totalCO = 0;

std::ofstream outFile("output_time_diff.csv", std::ios::app);
Copy link
Owner Author

Choose a reason for hiding this comment

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

why we need this?

Copy link
Owner Author

Choose a reason for hiding this comment

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

for travel time

cudaStreamCreate( &streams[i]);
}

// Initialize people and vehicles
Copy link
Owner Author

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) {
Copy link
Owner Author

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?

Copy link
Owner Author

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

// gpuErrchk(cudaMemPrefetchAsync(trafficLights_d, sizeT, 1, streams[1]));

}

Copy link
Owner Author

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(
Copy link
Owner Author

Choose a reason for hiding this comment

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

For bus to Auto

Copy link
Owner Author

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

Copy link
Owner Author

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;
Copy link
Collaborator

@YiboZh YiboZh Aug 25, 2024

Choose a reason for hiding this comment

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

Move to person struct

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;
Copy link
Collaborator

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
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants