Commit 4fae1e8f authored by ThibautDemare's avatar ThibautDemare

First step to have Short Sea Shipping

parent f3e84050
......@@ -4,7 +4,7 @@ import "Stock.gaml"
species AwaitingStock schedules:[] {
Stock stock;
int stepOrderMade;
date stepOrderMade;
int position;
Building building;
date incomingDate;
......
......@@ -17,6 +17,8 @@ species Building {
date lastVehicleDeparture_river;
list<Vehicle> leavingVehicles_maritime <- []; // Liste des véhicules au départ pour le mode maritime
date lastVehicleDeparture_maritime;
list<Vehicle> leavingVehicles_secondary <- []; // Liste des véhicules au départ pour le mode maritime secondaire
date lastVehicleDeparture_secondary;
list<Commodity> leavingCommodities <- [];
list<Commodity> comingCommodities <- [];
......@@ -30,9 +32,11 @@ species Building {
list<float> nbRoadVehiclesLastSteps <- [0.0];
list<float> nbRiverVehiclesLastSteps <- [0.0];
list<float> nbMaritimeVehiclesLastSteps <- [0.0];
list<float> nbSecondaryVehiclesLastSteps <- [0.0];
list<float> nbRoadQuantitiesLastSteps <- [0.0];
list<float> nbRiverQuantitiesLastSteps <- [0.0];
list<float> nbMaritimeQuantitiesLastSteps <- [0.0];
list<float> nbSecondaryQuantitiesLastSteps <- [0.0];
// Measures of efficiency
// based on time to deliver some goods (originally in the FinalConsignee agent)
......@@ -53,12 +57,18 @@ species Building {
lastVehicleDeparture_river <- vehicle.departureDate;
}
}
else {
else if(networkType = "maritime"){
leavingVehicles <- leavingVehicles_maritime;
if(lastVehicleDeparture_maritime = nil or lastVehicleDeparture_maritime < vehicle.departureDate){
lastVehicleDeparture_maritime <- vehicle.departureDate;
}
}
else {
leavingVehicles <- leavingVehicles_secondary;
if(lastVehicleDeparture_secondary = nil or lastVehicleDeparture_secondary < vehicle.departureDate){
lastVehicleDeparture_secondary <- vehicle.departureDate;
}
}
int i <- 0;
bool notfound <- true;
loop while: i < length(leavingVehicles) and notfound {
......@@ -92,9 +102,12 @@ species Building {
else if(v.networkType = "river"){
nbRiverVehiclesLastSteps[length(nbRiverVehiclesLastSteps)-1] <- nbRiverVehiclesLastSteps[length(nbRiverVehiclesLastSteps)-1] + 1.0;
}
else { // if(v.networkType = "maritime")
else if(v.networkType = "maritime"){
nbMaritimeVehiclesLastSteps[length(nbMaritimeVehiclesLastSteps)-1] <- nbMaritimeVehiclesLastSteps[length(nbMaritimeVehiclesLastSteps)-1] + 1.0;
}
else {
nbSecondaryVehiclesLastSteps[length(nbSecondaryVehiclesLastSteps)-1] <- nbSecondaryVehiclesLastSteps[length(nbSecondaryVehiclesLastSteps)-1] + 1.0;
}
}
action receiveCommodity(Commodity c, string nt){
......@@ -104,9 +117,12 @@ species Building {
else if(nt = "river"){
nbRiverQuantitiesLastSteps[length(nbRiverQuantitiesLastSteps)-1] <- nbRiverQuantitiesLastSteps[length(nbRiverQuantitiesLastSteps)-1] + c.volume;
}
else { // if(nt = "maritime")
else if(nt = "maritime") {
nbMaritimeQuantitiesLastSteps[length(nbMaritimeQuantitiesLastSteps)-1] <- nbMaritimeQuantitiesLastSteps[length(nbMaritimeQuantitiesLastSteps)-1] + c.volume;
}
else {
nbSecondaryQuantitiesLastSteps[length(nbSecondaryQuantitiesLastSteps)-1] <- nbSecondaryQuantitiesLastSteps[length(nbSecondaryQuantitiesLastSteps)-1] + c.volume;
}
if(c.finalDestination = self){
create AwaitingStock number: 1 returns: ast {
self.stepOrderMade <- c.stepOrderMade;
......@@ -154,10 +170,10 @@ species Building {
notfound <- false;
stockBuilding.status <- 0;
stockBuilding.quantity <- stockBuilding.quantity + entering_stock.stock.quantity;
if(entering_stock.stepOrderMade >= 0){
if(entering_stock.stepOrderMade >= starting_date){
// Update lists containing the time to deliver some goods in order to measure the efficiency of the actors
(entering_stock.stock.lp as LogisticsServiceProvider).timeToDeliver <- (entering_stock.stock.lp as LogisticsServiceProvider).timeToDeliver + ((int(time/3600)) - entering_stock.stepOrderMade);
localTimeToBeDeliveredLastDeliveries <- localTimeToBeDeliveredLastDeliveries + ((int(time/3600)) - entering_stock.stepOrderMade);
(entering_stock.stock.lp as LogisticsServiceProvider).timeToDeliver <- (entering_stock.stock.lp as LogisticsServiceProvider).timeToDeliver + (date("now") - entering_stock.stepOrderMade);//((int(time/3600)) - entering_stock.stepOrderMade);
localTimeToBeDeliveredLastDeliveries <- localTimeToBeDeliveredLastDeliveries + (date("now") - entering_stock.stepOrderMade);//((int(time/3600)) - entering_stock.stepOrderMade);
}
}
j <- j + 1;
......
......@@ -9,6 +9,6 @@ species Commodity {
date incomingDate;
string currentNetwork;
Stock stock;
int stepOrderMade;
date stepOrderMade;
float costs;
}
\ No newline at end of file
This diff is collapsed.
......@@ -7,12 +7,14 @@ species ForwardingAgent skills:[TransportOrganizer]{
Transporter transporter_road;
Transporter transporter_maritime;
Transporter transporter_river;
Transporter transporter_secondary;
float colorValue <- -1;
init {
transporter_road <- RoadTransporter[0];
transporter_river <- RiverTransporter[0];
transporter_maritime <- MaritimeTransporter[0];
transporter_secondary <- SecondaryMaritimeTransporter[0];
}
aspect geom {
......
......@@ -24,9 +24,11 @@ global {
// Each road has an attribute giving the speed in km/h
file roads_shapefile <- file(pathBD+"Roads/Road_Network_LH-A/Road_Network_LH-A_lambert93_filtered_attributes.shp");
// The maritime network
// The maritime network betweeen Providers and Le Havre and Antwerp
file maritime_shapefile <- file(pathBD+"Maritime/maritime_lambert93_filtered_attributes.shp");
// The maritime network between Normand ports
file secondary_maritime_shapefile <- file(pathBD+"Maritime/Reseau_maritime_manche_mer_du_nord.shp");
// The river network
// This Shapefile comes from the database made by the ETIS Project. However, we updated it according to this website :
// - http://maps.grade.de/index.htm
......@@ -64,7 +66,8 @@ global {
file terminal_LH_shapefile <- file(pathBD+"Terminals/maritime_terminals_LH.shp");
file terminal_A_shapefile <- file(pathBD+"Terminals/maritime_terminals_A_lambert93.shp");
file river_terminals <- file(pathBD+"Terminals/river_terminals.shp");
file normand_terminals <- file(pathBD+"Terminals/terminaux_normands_secondaires.shp");
// The french regions
// Data comes from :
// Contours des régions françaises sur OpenStreetMap (consulted the 30/11/2018) -> https://www.data.gouv.fr/fr/datasets/contours-des-regions-francaises-sur-openstreetmap/
......@@ -97,6 +100,9 @@ global {
// Maritime
create MaritimeLine from: maritime_shapefile with: [speed::read("speed") as float, length::read("length") as float];
maritime_network <- as_edge_graph(MaritimeLine);
// Secondary Maritime
create SecondaryMaritimeLine from: secondary_maritime_shapefile with: [speed::read("speed") as float, length::read("length") as float];
secondary_network <- as_edge_graph(SecondaryMaritimeLine);
// River
create RiverLine from: river_shapefile with: [speed::read("speed") as float, length::read("length") as float, is_new::read("is_new") as int];
river_network <- as_edge_graph(RiverLine);
......@@ -116,14 +122,17 @@ global {
create RoadTransporter number:1;
create RiverTransporter number:1;
create MaritimeTransporter number:1;
create SecondaryMaritimeTransporter number:1;
// Terminals
// Terminals of LH (they are maritime and river terminals)
create MaritimeRiverTerminal from: terminal_LH_shapefile with: [handling_time_to_road::read("TO_ROAD") as float,
handling_time_to_river::read("TO_RIVER") as float,
handling_time_to_secondary::read("TO_MARITIM") as float,
handling_time_to_maritime::read("TO_MARITIM") as float,
handling_time_from_road::read("FROM_ROAD") as float,
handling_time_from_river::read("FROM_RIVER") as float,
handling_time_from_secondary::read("FROM_MARIT") as float,
handling_time_from_maritime::read("FROM_MARIT") as float
];
// Terminals inside the Seine axis (they are river terminals)
......@@ -140,7 +149,12 @@ global {
handling_time_from_river::read("FROM_RIVER") as float,
handling_time_from_maritime::read("FROM_MARIT") as float
];
// Terminals of Antwerp (they are maritime and river terminals if we have the Canal Seine Nord, otherwise, they are MaritimeTerminal agents)
create SecondaryTerminal from: normand_terminals with: [handling_time_to_road::read("TO_ROAD") as float,
handling_time_to_secondary::read("TO_MARITIM") as float,
handling_time_from_road::read("FROM_ROAD") as float,
handling_time_from_secondary::read("FROM_MARIT") as float
];
// Forwarding agent
create ForwardingAgent number:1 returns:fas;
forwardingAgent <- fas[0];
......@@ -154,7 +168,7 @@ global {
* The following code can be commented or not, depending if the user want to execute the simulation with every Warehouse
* It is mainly used for tests to avoid CPU overload.
*/
int i <- 100;
/*int i <- 100;
list<Warehouse> llsp <- shuffle(Warehouse);
loop while: i < length(llsp) {
Warehouse s <- llsp[i];
......@@ -172,7 +186,7 @@ global {
* The following code can be commented or not, depending if the user want to execute the simulation with every LSP
* It is mainly used for tests to avoid CPU overload.
*/
int i <- 50;
/*int i <- 50;
list<LogisticsServiceProvider> llsp <- shuffle(LogisticsServiceProvider);
loop while: i < length(llsp) {
LogisticsServiceProvider s <- llsp[i];
......@@ -189,7 +203,7 @@ global {
* The following code can be commented or not, depending if the user want to execute the simulation with every FDM
* It is mainly used for tests to avoid CPU overload.
*/
int i <- 50;
int i <- 500;
list<FinalConsignee> lfdm <- shuffle(FinalConsignee);
loop while: i < length(lfdm) {
FinalConsignee s <- lfdm[i];
......@@ -232,9 +246,11 @@ global {
// We initialyse the networks but this time for the forwarding agent so he can compute multi-modal shortest paths
ask forwardingAgent {
do add_mode network:road_network mode:'road' nodes:
buildingOfFDM + (Warehouse as list) + (MaritimeTerminal as list) + (RiverTerminal as list) + (MaritimeRiverTerminal as list);
buildingOfFDM + (Warehouse as list) + (SecondaryTerminal as list) + (RiverTerminal as list) + (MaritimeRiverTerminal as list);
do add_mode network:maritime_network mode:'maritime' nodes:
(Provider as list) + (MaritimeTerminal as list) + (MaritimeRiverTerminal as list);
(Provider as list) + (MaritimeRiverTerminal as list);
do add_mode network:secondary_network mode:'secondary' nodes:
(SecondaryTerminal as list) + (MaritimeRiverTerminal as list);
do add_mode network:river_network mode:'river' nodes:
(RiverTerminal as list) + (MaritimeRiverTerminal as list);
}
......@@ -250,13 +266,13 @@ global {
}
ask RegionObserver{
ask ((Building as list) + (Warehouse as list) + (MaritimeTerminal as list) + (RiverTerminal as list) + (MaritimeRiverTerminal as list)) inside self {
ask ((Building as list) + (Warehouse as list) + (SecondaryTerminal as list) + (RiverTerminal as list) + (MaritimeRiverTerminal as list)) inside self {
myself.buildings <+ self;
}
ask ((FinalConsignee as list)) inside self {
myself.fcs <+ self;
}
ask ((MaritimeRiverTerminal as list) + ((RiverTerminal as list) as list) + (MaritimeTerminal as list)) inside self {
ask ((MaritimeRiverTerminal as list) + ((RiverTerminal as list) as list) + (SecondaryTerminal as list)) inside self {
myself.terminals <+ self;
}
}
......
......@@ -3,6 +3,7 @@ model Networks
global {
graph road_network;
graph maritime_network;
graph secondary_network;
graph river_network;
}
......@@ -66,6 +67,10 @@ species MaritimeLine parent:Network {
string col <- "blue";
}
species SecondaryMaritimeLine parent:Network {
string col <- "blue";
}
species RiverLine parent:Network {
string col <- "green";
int is_new;
......
......@@ -248,27 +248,33 @@ global {
float sumRoadVehicle;
float sumRiverVehicle;
float sumMaritimeVehicle;
float sumSecondaryVehicle;
float shareRoadVehicle;
float shareRiverVehicle;
float shareMaritimeVehicle;
float shareSecondaryVehicle;
// Share by quantities of goods
float sumQuantities;
float sumRoadQuantities;
float sumRiverQuantities;
float sumMaritimeQuantities;
float sumSecondaryQuantities;
float shareRoadQuantities;
float shareRiverQuantities;
float shareMaritimeQuantities;
float shareSecondaryQuantities;
reflex averageModeShare {
sumVehicle <- 0.0;
sumRoadVehicle <- 0.0;
sumRiverVehicle <- 0.0;
sumMaritimeVehicle <- 0.0;
sumSecondaryVehicle <- 0.0;
sumQuantities <- 0.0;
sumRoadQuantities <- 0.0;
sumRiverQuantities <- 0.0;
sumMaritimeQuantities <- 0.0;
sumSecondaryQuantities <- 0.0;
ask RegionObserver {
ask myself {
......@@ -282,22 +288,26 @@ global {
shareRoadVehicle <- sumRoadVehicle / sumVehicle;
shareRiverVehicle <- sumRiverVehicle / sumVehicle;
shareMaritimeVehicle <- sumMaritimeVehicle / sumVehicle;
shareSecondaryVehicle <- sumSecondaryVehicle / sumVehicle;
}
else {
shareRoadVehicle <- 0.0;
shareRiverVehicle <- 0.0;
shareMaritimeVehicle <- 0.0;
shareSecondaryVehicle <- 0.0;
}
if(sumQuantities > 0) {
shareRoadQuantities <- sumRoadQuantities / sumQuantities;
shareRiverQuantities <- sumRiverQuantities / sumQuantities;
shareMaritimeQuantities <- sumMaritimeQuantities / sumQuantities;
shareSecondaryQuantities <- sumSecondaryQuantities / sumQuantities;
}
else {
shareRoadQuantities <- 0;
shareRiverQuantities <- 0;
shareMaritimeQuantities <- 0;
shareSecondaryQuantities <- 0;
}
}
......@@ -307,11 +317,13 @@ global {
sumRoadVehicleRO <- 0.0;
sumRiverVehicleRO <- 0.0;
sumMaritimeVehicleRO <- 0.0;
sumSecondaryVehicleRO <- 0.0;
sumQuantitiesRO <- 0.0;
sumRoadQuantitiesRO <- 0.0;
sumRiverQuantitiesRO <- 0.0;
sumMaritimeQuantitiesRO <- 0.0;
sumSecondaryQuantitiesRO <- 0.0;
int j <- 0;
loop while: j < length(buildings) {
......@@ -370,6 +382,23 @@ global {
i <- i + 1;
}
// Secondary
i <- 0;
loop while: i < length(b.nbSecondaryVehiclesLastSteps) {
sumVehicle <- sumVehicle + b.nbSecondaryVehiclesLastSteps[i];
sumSecondaryVehicle <- sumSecondaryVehicle + b.nbSecondaryVehiclesLastSteps[i];
sumVehicleRO <- sumVehicleRO + b.nbSecondaryVehiclesLastSteps[i];
sumSecondaryVehicleRO <- sumSecondaryVehicleRO + b.nbSecondaryVehiclesLastSteps[i];
sumQuantities <- sumQuantities + b.nbSecondaryQuantitiesLastSteps[i];
sumSecondaryQuantities <- sumSecondaryQuantities + b.nbSecondaryQuantitiesLastSteps[i];
sumQuantitiesRO <- sumQuantitiesRO + b.nbSecondaryQuantitiesLastSteps[i];
sumSecondaryQuantitiesRO <- sumSecondaryQuantitiesRO + b.nbSecondaryQuantitiesLastSteps[i];
i <- i + 1;
}
j <- j + 1;
}
......@@ -377,44 +406,53 @@ global {
shareRoadVehicleRO <- sumRoadVehicleRO / sumVehicleRO;
shareRiverVehicleRO <- sumRiverVehicleRO / sumVehicleRO;
shareMaritimeVehicleRO <- sumMaritimeVehicleRO / sumVehicleRO;
shareSecondaryVehicleRO <- sumSecondaryVehicleRO / sumVehicleRO;
}
else {
shareRoadVehicleRO <- 0.0;
shareRiverVehicleRO <- 0.0;
shareMaritimeVehicleRO <- 0.0;
shareSecondaryVehicleRO <- 0.0;
}
if(sumQuantitiesRO > 0) {
shareRoadQuantitiesRO <- sumRoadQuantitiesRO / sumQuantitiesRO;
shareRiverQuantitiesRO <- sumRiverQuantitiesRO / sumQuantitiesRO;
shareMaritimeQuantitiesRO <- sumMaritimeQuantitiesRO / sumQuantitiesRO;
shareSecondaryQuantitiesRO <- sumSecondaryQuantitiesRO / sumQuantitiesRO;
}
else {
shareRoadQuantitiesRO <- 0.0;
shareRiverQuantitiesRO <- 0.0;
shareMaritimeQuantitiesRO <- 0.0;
shareSecondaryQuantitiesRO <- 0.0;
}
}
}
action cleanNbVehiclesQuantitiesLastSteps {
ask ((Building as list) + (Warehouse as list) + (MaritimeTerminal as list) + (RiverTerminal as list) + (MaritimeRiverTerminal as list)) {
ask ((Building as list) + (Warehouse as list) + (SecondaryTerminal as list) + (RiverTerminal as list) + (MaritimeRiverTerminal as list)) {
if(cycle > -1){
remove index: 0 from: nbRoadVehiclesLastSteps;
remove index: 0 from: nbRiverVehiclesLastSteps;
remove index: 0 from: nbMaritimeVehiclesLastSteps;
remove index: 0 from: nbSecondaryVehiclesLastSteps;
remove index: 0 from: nbRoadQuantitiesLastSteps;
remove index: 0 from: nbRiverQuantitiesLastSteps;
remove index: 0 from: nbMaritimeQuantitiesLastSteps;
remove index: 0 from: nbSecondaryQuantitiesLastSteps;
}
nbRoadVehiclesLastSteps <+ 0;
nbRiverVehiclesLastSteps <+ 0;
nbMaritimeVehiclesLastSteps <+ 0;
nbSecondaryVehiclesLastSteps <+ 0;
nbRoadQuantitiesLastSteps <+ 0;
nbRiverQuantitiesLastSteps <+ 0;
nbMaritimeQuantitiesLastSteps <+ 0;
nbSecondaryQuantitiesLastSteps <+ 0;
}
}
......@@ -424,11 +462,13 @@ global {
sumLeavingRoadVehicleRO <- 0.0;
sumLeavingRiverVehicleRO <- 0.0;
sumLeavingMaritimeVehicleRO <- 0.0;
sumLeavingSecondaryVehicleRO <- 0.0;
sumLeavingQuantitiesRO <- 0.0;
sumLeavingRoadQuantitiesRO <- 0.0;
sumLeavingRiverQuantitiesRO <- 0.0;
sumLeavingMaritimeQuantitiesRO <- 0.0;
sumLeavingSecondaryQuantitiesRO <- 0.0;
int j <- 0;
loop while: j < length(terminals) {
......@@ -438,6 +478,7 @@ global {
sumLeavingRoadVehicleRO <- sumLeavingRoadVehicleRO + length(t.leavingVehicles_road);
sumLeavingRiverVehicleRO <- sumLeavingRiverVehicleRO + length(t.leavingVehicles_river);
sumLeavingMaritimeVehicleRO <- sumLeavingMaritimeVehicleRO + length(t.leavingVehicles_maritime);
sumLeavingSecondaryVehicleRO <- sumLeavingSecondaryVehicleRO + length(t.leavingVehicles_secondary);
ask t.leavingVehicles_maritime {
myself.sumLeavingQuantitiesRO <- myself.sumLeavingQuantitiesRO + self.scheduledTransportedVolume;
......@@ -453,6 +494,11 @@ global {
myself.sumLeavingQuantitiesRO <- myself.sumLeavingQuantitiesRO + self.scheduledTransportedVolume;
myself.sumLeavingRiverQuantitiesRO <- myself.sumLeavingRiverQuantitiesRO + self.scheduledTransportedVolume;
}
ask t.leavingVehicles_secondary {
myself.sumLeavingQuantitiesRO <- myself.sumLeavingQuantitiesRO + self.scheduledTransportedVolume;
myself.sumLeavingSecondaryQuantitiesRO <- myself.sumLeavingSecondaryQuantitiesRO + self.scheduledTransportedVolume;
}
j <- j + 1;
}
......@@ -460,22 +506,26 @@ global {
shareLeavingRoadVehicleRO <- sumLeavingRoadVehicleRO / sumLeavingVehicleRO;
shareLeavingRiverVehicleRO <- sumLeavingRiverVehicleRO / sumLeavingVehicleRO;
shareLeavingMaritimeVehicleRO <- sumLeavingMaritimeVehicleRO / sumLeavingVehicleRO;
shareLeavingSecondaryVehicleRO <- sumLeavingSecondaryVehicleRO / sumLeavingVehicleRO;
}
else {
shareLeavingRoadVehicleRO <- 0.0;
shareLeavingRiverVehicleRO <- 0.0;
shareLeavingMaritimeVehicleRO <- 0.0;
shareLeavingSecondaryVehicleRO <- 0.0;
}
if(sumLeavingQuantitiesRO > 0) {
shareLeavingRoadQuantitiesRO <- sumLeavingRoadQuantitiesRO / sumLeavingQuantitiesRO;
shareLeavingRiverQuantitiesRO <- sumLeavingRiverQuantitiesRO / sumLeavingQuantitiesRO;
shareLeavingMaritimeQuantitiesRO <- sumLeavingMaritimeQuantitiesRO / sumLeavingQuantitiesRO;
shareLeavingSecondaryQuantitiesRO <- sumLeavingSecondaryQuantitiesRO / sumLeavingQuantitiesRO;
}
else {
shareLeavingRoadQuantitiesRO <- 0.0;
shareLeavingRiverQuantitiesRO <- 0.0;
shareLeavingMaritimeQuantitiesRO <- 0.0;
shareLeavingSecondaryQuantitiesRO <- 0.0;
}
}
}
......@@ -750,9 +800,9 @@ global {
to: CSVFolderPath + date_simu_starts + "_average_costs" + params + ".csv" type: text rewrite: false;
save "" + ((time/3600.0) as int) + ";" + nbHavre + ";" + nbAntwerp
to: CSVFolderPath + date_simu_starts + "_competition_between_LH_Antwerp" + params + ".csv" type: text rewrite: false;
save "" + ((time/3600.0) as int) + ";" + sumRoadVehicle + ";" + sumRiverVehicle + ";" + sumMaritimeVehicle
save "" + ((time/3600.0) as int) + ";" + sumRoadVehicle + ";" + sumRiverVehicle + ";" + sumMaritimeVehicle + ";" + sumSecondaryVehicle
to: CSVFolderPath + date_simu_starts + "_share_transport_mode" + params + ".csv" type: text rewrite: false;
save "" + ((time/3600.0) as int) + ";" + sumRoadQuantities + ";" + sumRiverQuantities + ";" + sumMaritimeQuantities
save "" + ((time/3600.0) as int) + ";" + sumRoadQuantities + ";" + sumRiverQuantities + ";" + sumMaritimeQuantities + ";" + sumSecondaryQuantities
to: CSVFolderPath + date_simu_starts + "_share_transport_mode_quantities" + params + ".csv" type: text rewrite: false;
do saveShareTransportModeRegion(params, "Basse-Normandie");
......@@ -795,15 +845,15 @@ global {
loop while: i < length(RegionObserver) and notfound {
if(RegionObserver[i].name = n){
sr <- RegionObserver[i];
save "" + ((time/3600.0) as int) + ";" + sr.sumRoadVehicleRO + ";" + sr.sumRiverVehicleRO + ";" + sr.sumMaritimeVehicleRO
save "" + ((time/3600.0) as int) + ";" + sr.sumRoadVehicleRO + ";" + sr.sumRiverVehicleRO + ";" + sr.sumMaritimeVehicleRO + ";" + sr.sumSecondaryVehicleRO
to: CSVFolderPath + date_simu_starts + "_share_transport_mode_" + n + params + ".csv" type: text rewrite: false;
save "" + ((time/3600.0) as int) + ";" + sr.sumRoadQuantitiesRO + ";" + sr.sumRiverQuantitiesRO + ";" + sr.sumMaritimeQuantitiesRO
save "" + ((time/3600.0) as int) + ";" + sr.sumRoadQuantitiesRO + ";" + sr.sumRiverQuantitiesRO + ";" + sr.sumMaritimeQuantitiesRO + ";" + sr.sumSecondaryQuantitiesRO
to: CSVFolderPath + date_simu_starts + "_share_transport_mode_quantities_" + n + params + ".csv" type: text rewrite: false;
notfound <- false;
save "" + ((time/3600.0) as int) + ";" + sr.sumLeavingRoadVehicleRO + ";" + sr.sumLeavingRiverVehicleRO + ";" + sr.sumLeavingMaritimeVehicleRO
save "" + ((time/3600.0) as int) + ";" + sr.sumLeavingRoadVehicleRO + ";" + sr.sumLeavingRiverVehicleRO + ";" + sr.sumLeavingMaritimeVehicleRO + ";" + sr.sumLeavingSecondaryVehicleRO
to: CSVFolderPath + date_simu_starts + "_share_leaving_vehicles_per_transport_mode_" + n + params + ".csv" type: text rewrite: false;
save "" + ((time/3600.0) as int) + ";" + sr.sumLeavingRoadQuantitiesRO + ";" + sr.sumLeavingRiverQuantitiesRO + ";" + sr.sumLeavingMaritimeQuantitiesRO
save "" + ((time/3600.0) as int) + ";" + sr.sumLeavingRoadQuantitiesRO + ";" + sr.sumLeavingRiverQuantitiesRO + ";" + sr.sumLeavingMaritimeQuantitiesRO + ";" + sr.sumLeavingSecondaryQuantitiesRO
to: CSVFolderPath + date_simu_starts + "_share_leaving_quantities_per_transport_mode_" + n + params + ".csv" type: text rewrite: false;
notfound <- false;
}
......
......@@ -10,6 +10,6 @@ species Order schedules: [] {
int position;// The position in the supply chain
FinalConsignee fdm; // The FDM who posseses these goods
Stock reference; // a reference to the stock which suffer of stock shortage
int stepOrderMade; // when does the order has been made
date stepOrderMade; // when does the order has been made
string strategy;
}
\ No newline at end of file
......@@ -16,6 +16,8 @@ species RegionObserver {
float shareRiverVehicleRO <- 0.0;
float sumMaritimeVehicleRO <- 0.0;
float shareMaritimeVehicleRO <- 0.0;
float sumSecondaryVehicleRO <- 0.0;
float shareSecondaryVehicleRO <- 0.0;
float sumVehicleRO;
// Share by quantity of goods
......@@ -25,6 +27,8 @@ species RegionObserver {
float shareRiverQuantitiesRO <- 0.0;
float sumMaritimeQuantitiesRO <- 0.0;
float shareMaritimeQuantitiesRO <- 0.0;
float sumSecondaryQuantitiesRO <- 0.0;
float shareSecondaryQuantitiesRO <- 0.0;
float sumQuantitiesRO;
// Share by number of vehicle leaving terminals
......@@ -34,6 +38,8 @@ species RegionObserver {
float shareLeavingRiverVehicleRO <- 0.0;
float sumLeavingMaritimeVehicleRO <- 0.0;
float shareLeavingMaritimeVehicleRO <- 0.0;
float sumLeavingSecondaryVehicleRO <- 0.0;
float shareLeavingSecondaryVehicleRO <- 0.0;
float sumLeavingVehicleRO;
// Share by quantity of goods leaving terminals
......@@ -43,6 +49,8 @@ species RegionObserver {
float shareLeavingRiverQuantitiesRO <- 0.0;
float sumLeavingMaritimeQuantitiesRO <- 0.0;
float shareLeavingMaritimeQuantitiesRO <- 0.0;
float sumLeavingSecondaryQuantitiesRO <- 0.0;
float shareLeavingSecondaryQuantitiesRO <- 0.0;
float sumLeavingQuantitiesRO;
// Share of FC by origin port
......
......@@ -71,7 +71,7 @@ species SupplyChainElement schedules: [] {
self.position <- myself.position;
self.reference <- stock;
self.logisticsServiceProvider <- myself.supplyChain.logisticsServiceProvider;
self.stepOrderMade <- int(time/3600);
self.stepOrderMade <- date("now");//int(time/3600);
self.strategy <- myself.supplyChain.logisticsServiceProvider.costsPathStrategy;
}
return o[0];
......
......@@ -14,16 +14,16 @@ species Terminal parent:Building{
}
}
species MaritimeTerminal parent:Terminal{
float handling_time_to_maritime;
float handling_time_from_maritime;
species SecondaryTerminal parent:Terminal{
float handling_time_to_secondary;
float handling_time_from_secondary;
string col <- "red";
reflex manageMaritimeComingCommodities {
reflex manageSecondaryComingCommodities {
int i <- 0;
loop while:i<length(comingCommodities) {
if(comingCommodities[i].currentNetwork = 'maritime' and
comingCommodities[i].incomingDate + handling_time_from_maritime#hour >= current_date
if(comingCommodities[i].currentNetwork = 'secondary' and
comingCommodities[i].incomingDate + handling_time_from_secondary#hour >= current_date
){
leavingCommodities <+ comingCommodities[i];
remove index:i from:comingCommodities;
......@@ -38,8 +38,7 @@ species MaritimeTerminal parent:Terminal{
if(nt = "road"){
return handling_time_from_road;
}
// else : nt = "maritime"
return handling_time_from_maritime;
return handling_time_from_secondary;
}
}
......@@ -75,6 +74,8 @@ species RiverTerminal parent:Terminal{
species MaritimeRiverTerminal parent:Terminal {
float handling_time_to_maritime;
float handling_time_from_maritime;
float handling_time_to_secondary;
float handling_time_from_secondary;
float handling_time_to_river;
float handling_time_from_river;
string col <- "red";
......@@ -93,7 +94,22 @@ species MaritimeRiverTerminal parent:Terminal {
}
}
}
reflex manageSecondaryComingCommodities {
int i <- 0;
loop while:i<length(comingCommodities) {
if(comingCommodities[i].currentNetwork = 'secondary' and
comingCommodities[i].incomingDate + handling_time_from_secondary#hour >= current_date
){
leavingCommodities <+ comingCommodities[i];
remove index:i from:comingCommodities;
}
else{
i <- i + 1;
}
}
}
reflex manageRiverComingCommodities {
int i <- 0;
loop while:i<length(comingCommodities) {
......@@ -116,6 +132,9 @@ species MaritimeRiverTerminal parent:Terminal {
if(nt = "maritime"){
return handling_time_from_maritime;
}
if(nt = "secondary"){
return handling_time_from_secondary;
}
// else : nt = "river"
return handling_time_from_river;
}
......
......@@ -35,9 +35,17 @@ species RiverTransporter parent: Transporter {
float volumeKilometersCosts <- RoadTransporter[0].volumeKilometersCosts / 2.0;
}
species MaritimeTransporter parent: Transporter {
string networkType <- "maritime";