Thank you. I won't bother you with common C++ programming issues in future. But I think I have encountered an error that is related to multiple files where pred has been introduced.
As you suggested, I printed the pred->getID() in MSCFModel_Wiedemann::followSpeed() function before the return statement:
MSCFModel_Wiedemann::followSpeed(const MSVehicle* const veh, double /* speed */, double gap2pred, double predSpeed, double /*predMaxDecel*/, const MSVehicle* const pred) const {
std::cout << " pred ID=" << pred->getID();
return _v(veh, predSpeed, gap2pred);
}
With this change (and build) I ran a simulation where the ego vehicle starts from a ramp and enters a highway. Initially there was no pred vehicle so nothing was printed. When the ego vehicle approached the highway, the pred vehicle on the highway was pred1 until time step 42 (see attached image). However, at this time another vehicle (pred2) was passing the ego vehicle. This means that in time step 43 (or the end of 42), the pred2 becomes the pred vehicle. But the simulation throws an error at the end of time step 42.
I suspect this is because of the change in pred->getID(). But in the simulation it is expected that pred vehicle could change at any time.
Can you please help me fix this?