Reputation: 15
I've created an agent parameter which saves travel time of lorries in my model. I would get these values (one for each lorries agent) in a Excel file. How can I do? I've uploaded a pic in which you can see on the right the focused parameter of which get value for each agent.
Upvotes: 0
Views: 305
Reputation: 1636
First of all, it is better to define these types of data as variables, not parameters.
If you want to write the values of tempo_viaggio
at the end of the simulation into an Excel file, do the following:
Drag and drop ExcelFile object, link it to the file that you would like to write to:
You need to define a variable to keep the travel times information in the Main agent. As an example below:
In the course of the simulation, populate the variable as following inside the Tir
agent:
main.travelTime.add(this.tempo_viaggio);
At the end of the simulation, write this information into an Excel File.
for (int i=0; i<travelTime.size();i++)
{
Double z = ((Double) travelTime.get(i));
excelFileOutput.setCellValue(z, 1, i+2, 2); //value,sheetName or number, row, column
}
Upvotes: 1