Replies: 1 comment
-
Dear,
My Problem for Module #3 <#3>
For your first issue, it could come from the connectivity of your road
network.
I would advise you to clean the road network (using the dedicated model in
the model library)
For the second issue, the point is that the color produced is transparent,
so the agents disappear...
rgb color <- rgb(min([255, colorValue]),max ([0, 255 - colorValue]),0)
update: rgb(min([255, colorValue]));
I advise you to change rgb(min([255, colorValue])) into the definition of a
color using 3 parameters.
Best regards
Benoit
Le mer. 26 mars 2025 à 16:54, aerickgd ***@***.***> a écrit :
… Hello! I was practicing GAMA for my thesis and I came across a few
important problems
My Problem for Module #3 <#3>
In this case, while I was testing this in my practice study area, I
noticed that the people agents do not follow the residential and industrial
attributes that were assigned to the buildings, some go to the industrial
buildings but others stay in the residential building for the whole day and
vice versa
My Problem for Module #4 <#4>
I decided to proceed even though I am having problems with Module 3 then,
I encountered a problem, the road suddenly went missing right after the
simulation starts it's a huge problem, I'll attach recordings to
demonstrate my problems
https://github.com/user-attachments/assets/11726eaa-5ae8-4840-a389-2709bcd2aba4
Here is the code
model tryroadtraffic
global{
file shape_file_buildings <- file("../includes/PSAU BUILDING.shp");
file shape_file_roads <- file("../includes/psauroadfinal.shp");
geometry shape <- envelope(shape_file_roads);
float step <- 10 #m;
date starting_date <- date("2025-03-25-00-00-00");
int nb_people <- 100;
int min_work_start <- 6;
int max_work_start <- 8;
int min_work_end <- 16;
int max_work_end <- 18;
float min_speed <- 1.0 #km / #h;
float max_speed <- 5.0 #km / #h;
graph the_graph;
init {
create building from: shape_file_buildings with: [type::read ("TYPE")]{
if type="I" {
color <- #blue ;
}
}
create road from: shape_file_roads ;
map<road,float> weights_map <- road as_map (each:: (each.destruction_coeff * each.shape.perimeter));
the_graph <- as_edge_graph(road);
list<building> residential_buildings <- building where (each.type="R");
list<building> industrial_buildings <- building where (each.type="I");
create people number: nb_people {
speed <- rnd(min_speed, max_speed);
start_work <- rnd(min_work_start, max_work_start);
end_work <- rnd(min_work_end, max_work_end);
living_place <- one_of(residential_buildings);
working_place <- one_of(industrial_buildings);
objective <- "resting";
location <- any_location_in(living_place);
}
}
}
species building {
string type;
rgb color <- #gray;
aspect base {
draw shape color: color;
}
}
species road {
float destruction_coeff <- rnd(1.0,2.0) max: 2.0;
int colorValue <- int(255*(destruction_coeff -1)) update:
int(255*(destruction_coeff-1));
rgb color <- rgb(min([255, colorValue]),max ([0, 255 - colorValue]),0)
update: rgb(min([255, colorValue]));
aspect base {
draw shape color: color;
}
}
species people skills: [moving]{
rgb color <- #magenta;
building living_place <- nil;
building working_place <- nil;
int start_work ;
int end_work ;
string objective ;
point the_target <- nil;
reflex time_to_work when: current_date.hour = start_work and objective = "resting"{
objective <- "working" ;
the_target <- any_location_in (working_place);
}
reflex time_to_go_home when: current_date.hour = end_work and objective = "working"{
objective <- "resting" ;
the_target <- any_location_in (living_place);
}
reflex move when: the_target != nil {
do goto target: the_target on: the_graph ;
if the_target = location {
the_target <- nil;
}
}
aspect base {
draw circle(10) color: color border: #black;
}
}
experiment pisaw_traffic type: gui {
parameter "Shapefile for buildings:" var: shape_file_buildings category:
"GIS" ;
parameter "Shapefile for roads:" var: shape_file_roads category: "GIS" ;
parameter "Number of Peeps:" var: nb_people category: "People" ;
parameter "Earliest Work" var: min_work_start category: "People" min: 2
max: 8 ;
parameter "Latest Work" var: max_work_start category: "People" min: 8 max:
12 ;
parameter "Earliest End Work" var: min_work_end category: "People" min: 12
max: 16 ;
parameter "Latest End Work" var: max_work_end category: "People" min: 16
max: 23 ;
parameter "minimal speed" var: min_speed category: "People" min: 0.1
#km/#h;
parameter "maximal speed" var: max_speed category: "People" max: 10 #km/#h;
output {
display city_display type:2d {
species building aspect: base;
species road aspect: base;
species people aspect: base;
}
}
}
I'll attach the shapefiles I used for this simulation
https://drive.google.com/drive/folders/1SdTnNuN1cfe5UKQjGjwIMBT7aotR6G9l?usp=sharing
—
Reply to this email directly, view it on GitHub
<#449>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAL3WSSYV5KNW3UZVRK6O632WJ2LRAVCNFSM6AAAAABZZ2K7GWVHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZYGEZTAOJSGU>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello! I was practicing GAMA for my thesis and I came across a few important problems
My Problem for Module #3
In this case, while I was testing this in my practice study area, I noticed that the people agents do not follow the residential and industrial attributes that were assigned to the buildings, some go to the industrial buildings but others stay in the residential building for the whole day and vice versa
My Problem for Module #4
I decided to proceed even though I am having problems with Module 3 then, I encountered a problem, the road suddenly went missing right after the simulation starts it's a huge problem, I'll attach recordings to demonstrate my problems
2025-03-26.17-46-17.mp4
Here is the code
model tryroadtraffic
`global{
file shape_file_buildings <- file("../includes/PSAU BUILDING.shp");
file shape_file_roads <- file("../includes/psauroadfinal.shp");
geometry shape <- envelope(shape_file_roads);
float step <- 10 #m;
date starting_date <- date("2025-03-25-00-00-00");
int nb_people <- 100;
int min_work_start <- 6;
int max_work_start <- 8;
int min_work_end <- 16;
int max_work_end <- 18;
float min_speed <- 1.0 #km / #h;
float max_speed <- 5.0 #km / #h;
graph the_graph;
}
species building {
string type;
rgb color <- #gray;
}
species road {
float destruction_coeff <- rnd(1.0,2.0) max: 2.0;
int colorValue <- int(255*(destruction_coeff -1)) update: int(255*(destruction_coeff-1));
rgb color <- rgb(min([255, colorValue]),max ([0, 255 - colorValue]),0) update: rgb(min([255, colorValue]));
species people skills: [moving]{
rgb color <- #magenta;
building living_place <- nil;
building working_place <- nil;
int start_work ;
int end_work ;
string objective ;
point the_target <- nil;
experiment pisaw_traffic type: gui {
parameter "Shapefile for buildings:" var: shape_file_buildings category: "GIS" ;
parameter "Shapefile for roads:" var: shape_file_roads category: "GIS" ;
parameter "Number of Peeps:" var: nb_people category: "People" ;
parameter "Earliest Work" var: min_work_start category: "People" min: 2 max: 8 ;
parameter "Latest Work" var: max_work_start category: "People" min: 8 max: 12 ;
parameter "Earliest End Work" var: min_work_end category: "People" min: 12 max: 16 ;
parameter "Latest End Work" var: max_work_end category: "People" min: 16 max: 23 ;
parameter "minimal speed" var: min_speed category: "People" min: 0.1 #km/#h;
parameter "maximal speed" var: max_speed category: "People" max: 10 #km/#h;
}`
I'll attach the shapefiles I used for this simulation
https://drive.google.com/drive/folders/1SdTnNuN1cfe5UKQjGjwIMBT7aotR6G9l?usp=sharing
Beta Was this translation helpful? Give feedback.
All reactions