model city
global{
file shape_file_buildings <- file('../includes/building.shp');
file shape_file_roads <- file('../includes/road.shp');
file shape_file_bounds <- file('../includes/bounds.shp');
geometry shape <- envelope(shape_file_roads);
int nb_people <- 100;
int day_time update: time mod 144 ;
int min_work_start <- 36;
int max_work_start <- 60;
int min_work_end <- 84;
int max_work_end <- 132;
float min_speed <- 50.0;
float max_speed <- 100.0;
graph the_graph;
list buildingclusters;
init{
create building from: shape_file_buildings with: [type::string(read ('NATURE'))] {
if type='Industrial' {
color <- rgb('blue');
electricityService s<- electricityService(electricityService) ;
add s to: services;
}
else if type='Residential'{
color <- rgb('red');
}
}
create road from: shape_file_roads ;
the_graph <- as_edge_graph(list(road));
list<building> residential_buildings <- building where (each.type='Residential');
list<building> industrial_buildings <- building where (each.type='Industrial');
buildingclusters <- clustering_DBScan(building, ["rdm"]);