Open damaohu2664 opened 1 year ago
Yes. Typically, what you refer would be reflected in the output plans. Additionally, each agents trips are outputed into a trips.csv file, as well. However, MATSim needs some initial trajectory (or a choice set of multiple trajectories) for each agent as input. The initial input can then be mutated, depending on the replanning algorithms that you assign. I recommend reading (at least the first part(s)) of the MATSim book and especially the User Guide (here, see for example Section 2.3.1)
Sorry, my previous statement may not have been expressed clearly. What I want is not a simple trip output, but a complete trajectory data (similar to GPS data)
In that case, MATSim is able to give the detailed trajectory of agents via the event output. You probably need to write an event handler to extract those data
Can you tell me in more detail. Do I need to write some more code based on the original code to add this feature?
Yes that is possible. And if you even want intermediate positions on links (remember that events only are thrown for entering and leaving links), you can use the SnapshotWriter interface. Depending on your settings in the QSimConfigGroup (trafficDynamics
and Snapshotstyle
) you get trajectories reflecting congestion patterns.
Here is some code using this infrastructure that I used some years ago. It filtered for agents within a bounding box and dumped out their trajectories but only for those en route and excluding transit drivers. It's applied here.
No, you don't. But you should have a brief understanding about the MATSim software itself and its output. I suggest you start with the user guide suggested by @tschlenther , and once you have obtained the data, you can process it with any data processing software that you prefer. For instance, I use a lot of R when analysing our MATSim output
be aware that writing snapshots can use a lot of time and potentially memory. Make up your mind on the temporal resolution and the spatial dimensions that you want and need, first. In the example linked above, I filtered not only for a spation bounding box but for a time period of 2h, as well. However, i dumped out agents position for every simulation second. You might need less than that
The code you have shown can achieve trajectory output (one trajectory point per few seconds), but it may be worth noting that running takes up a lot of time and memory. Am I correct in my understanding? Is it okay to just put the code in the trafficDynamicsSnapshotstyle directory and run it? Do I still need to change some parameters in the config.xml file?
I am a newcomer who has just started learning Matsim and I hope to simulate the trajectory data of some agent individuals throughout the day according to a fixed activity pattern. Can I achieve this function?