Commit b8a48b0a authored by clivings's avatar clivings
Browse files

Added Scenario C. NOTE: Scenario B AV %s are not quite the same as what

TP5 gave us. The difference is not much in 2030 and 2040 (only .02% in
2030, and about 1.21% in 2040) but it is a full 7.49% in 2050! Shall I
correct these values?
parent 33ac078a
......@@ -314,6 +314,181 @@ public class AssignPrivatAVs {
person.getAttributes().putAttribute("carAvail", "never");
}
} else if (ASTRA_Scenario.equals("C")&& year >= 2050){
//TODO reduce amount of agents who have car available "always" and "sometimes" compared to ASTRA Scenario A,
// in accordance with what TP5 gives us! So change at which value of r the first condition will be true.
if(carAvailability.equals(string1)|| carAvailability.equals(string2)){
double r = random.nextDouble();
if (r <= 0.4419) {//produces "true" 44.19% of the time
//if they are part of this lucky percentage, they have "decided" to keep their/purchase a car, else...
person.getAttributes().putAttribute("carAvail", carAvailability);
} else { //...else they have "decided" to give up their/not purchase a car! They've converted to the sharing economy!
person.getAttributes().putAttribute("carAvail", "never");
}
}
carAvailability = (String) person.getAttributes().getAttribute("carAvail");
//now, for the agents that still have cars, aka whose attribute "carAvail" still equals "always" or "sometimes"...
//let us assign which one of them has a car capable of autonomous operation...
if(carAvailability.equals(string1)|| carAvailability.equals(string2)){
double r = random.nextDouble();
//TODO change percentages to match what TP5 gives us for ASTRA Scenario B!
// these agents still have good ol' conventional cars....
if (r <= 0.4426) {//produces "true" 44.26% of the time
person.getAttributes().putAttribute(AV_AVAILABILITY_ATTRIBUTE,"car");
person.getAttributes().putAttribute("carAvail", carAvailability);
//currently only differentiating between conventional vehicles and "highly automated, highly networked" vehicles
//thus these next to bits of code are commented out...
/*} else if (r <= 0.66) {//produces "true" 65.91% of the time: because the first step took 42.05% of the agents already,
// then this step will only consider the next 23.86% of agents
person.getAttributes().putAttribute(AV_AVAILABILITY_ATTRIBUTE,"prav3");
person.getAttributes().putAttribute("carAvail", "never");
} else if (r <= 0.82){
person.getAttributes().putAttribute(AV_AVAILABILITY_ATTRIBUTE,"prav4");
person.getAttributes().putAttribute("carAvail", "never");
*/
//now, for the other lucky few, they now will have an autonomous vehicle
//we also specify that agents never have BOTH a conventional car and an autonomous vehicle
} else {
person.getAttributes().putAttribute(AV_AVAILABILITY_ATTRIBUTE,"prav5");
person.getAttributes().putAttribute("carAvail", "never");
}
} else { // make sure that those agents who "never" have a car available also do not have an private av available,and to
// prevent "null" exceptions from Java, which occur when a variable, such as the attribute "prAvAvail" don't have a value
person.getAttributes().putAttribute(AV_AVAILABILITY_ATTRIBUTE,"noPrav");
person.getAttributes().putAttribute("carAvail", "never");
}
} else if (ASTRA_Scenario.equals("C")&& year >= 2040){
//TODO reduce amount of agents who have car available "always" and "sometimes" compared to ASTRA Scenario A,
// in accordance with what TP5 gives us! So change at which value of r the first condition will be true.
if(carAvailability.equals(string1)|| carAvailability.equals(string2)){
double r = random.nextDouble();
if (r <= 0.8752) {//produces "true" 87.52% of the time
//if they are part of this lucky percentage, they have "decided" to keep their/purchase a car, else...
person.getAttributes().putAttribute("carAvail", carAvailability);
} else { //...else they have "decided" to give up their/not purchase a car! They've converted to the sharing economy!
person.getAttributes().putAttribute("carAvail", "never");
}
}
carAvailability = (String) person.getAttributes().getAttribute("carAvail");
//now, for the agents that still have cars, aka whose attribute "carAvail" still equals "always" or "sometimes"...
//let us assign which one of them has a car capable of autonomous operation...
if(carAvailability.equals(string1)|| carAvailability.equals(string2)){
double r = random.nextDouble();
//TODO change percentages to match what TP5 gives us for ASTRA Scenario B!
// these agents still have good ol' conventional cars....
if (r <= 0.8626) {//produces "true" 86.26% of the time
person.getAttributes().putAttribute(AV_AVAILABILITY_ATTRIBUTE,"car");
person.getAttributes().putAttribute("carAvail", carAvailability);
//currently only differentiating between conventional vehicles and "highly automated, highly networked" vehicles
//thus these next to bits of code are commented out...
/*} else if (r <= 0.66) {//produces "true" 65.91% of the time: because the first step took 42.05% of the agents already,
// then this step will only consider the next 23.86% of agents
person.getAttributes().putAttribute(AV_AVAILABILITY_ATTRIBUTE,"prav3");
person.getAttributes().putAttribute("carAvail", "never");
} else if (r <= 0.82){
person.getAttributes().putAttribute(AV_AVAILABILITY_ATTRIBUTE,"prav4");
person.getAttributes().putAttribute("carAvail", "never");
*/
//now, for the other lucky few, they now will have an autonomous vehicle
//we also specify that agents never have BOTH a conventional car and an autonomous vehicle
} else {
person.getAttributes().putAttribute(AV_AVAILABILITY_ATTRIBUTE,"prav5");
person.getAttributes().putAttribute("carAvail", "never");
}
} else { // make sure that those agents who "never" have a car available also do not have an private av available,and to
// prevent "null" exceptions from Java, which occur when a variable, such as the attribute "prAvAvail" don't have a value
person.getAttributes().putAttribute(AV_AVAILABILITY_ATTRIBUTE,"noPrav");
person.getAttributes().putAttribute("carAvail", "never");
}
} else if (ASTRA_Scenario.equals("C")&& year >= 2030){
//TODO reduce amount of agents who have car available "always" and "sometimes" compared to ASTRA Scenario A,
// in accordance with what TP5 gives us! So change at which value of r the first condition will be true.
//According to the projections of TP5 (TUM and Gruner), private car ownership in 2030 in this "extreme" scenario will be
// 100.000569% of what it is in 2030 in the A or "business as usual scenario". So the same, really.
//Thus, no current car "owners" will "give up" their cars.
/* if(carAvailability.equals(string1)|| carAvailability.equals(string2)){
double r = random.nextDouble();
if (r <= 0.9886) {//produces "true" 94.70% of the time
//if they are part of this lucky percentage, they have "decided" to keep their/purchase a car, else...
person.getAttributes().putAttribute("carAvail", carAvailability);
} else { //...else they have "decided" to give up their/not purchase a car! They've converted to the sharing economy!
person.getAttributes().putAttribute("carAvail", "never");
}
}
carAvailability = (String) person.getAttributes().getAttribute("carAvail");*/
//now, for the agents that still have cars, aka whose attribute "carAvail" still equals "always" or "sometimes"...
//let us assign which one of them has a car capable of autonomous operation...
if(carAvailability.equals(string1)|| carAvailability.equals(string2)){
double r = random.nextDouble();
//TODO change percentages to match what TP5 gives us for ASTRA Scenario B!
// these agents still have good ol' conventional cars....
if (r <= 0.9847) {//produces "true" 98.47% of the time
person.getAttributes().putAttribute(AV_AVAILABILITY_ATTRIBUTE,"car");
person.getAttributes().putAttribute("carAvail", carAvailability);
//currently only differentiating between conventional vehicles and "highly automated, highly networked" vehicles
//thus these next to bits of code are commented out...
/*} else if (r <= 0.66) {//produces "true" 65.91% of the time: because the first step took 42.05% of the agents already,
// then this step will only consider the next 23.86% of agents
person.getAttributes().putAttribute(AV_AVAILABILITY_ATTRIBUTE,"prav3");
person.getAttributes().putAttribute("carAvail", "never");
} else if (r <= 0.82){
person.getAttributes().putAttribute(AV_AVAILABILITY_ATTRIBUTE,"prav4");
person.getAttributes().putAttribute("carAvail", "never");
*/
//now, for the other lucky few, they now will have an autonomous vehicle
//we also specify that agents never have BOTH a conventional car and an autonomous vehicle
} else {
person.getAttributes().putAttribute(AV_AVAILABILITY_ATTRIBUTE,"prav5");
person.getAttributes().putAttribute("carAvail", "never");
}
} else { // make sure that those agents who "never" have a car available also do not have an private av available,and to
// prevent "null" exceptions from Java, which occur when a variable, such as the attribute "prAvAvail" don't have a value
person.getAttributes().putAttribute(AV_AVAILABILITY_ATTRIBUTE,"noPrav");
person.getAttributes().putAttribute("carAvail", "never");
}
} else if (ASTRA_Scenario.equals("C")&& year <= 2030){
if(carAvailability.equals(string1)|| carAvailability.equals(string2)){
person.getAttributes().putAttribute(AV_AVAILABILITY_ATTRIBUTE,"car");
person.getAttributes().putAttribute("carAvail", carAvailability);
} else { // make sure that those agents who "never" have a car available also do not have an private av available,and to
// prevent "null" exceptions from Java, which occur when a variable, such as the attribute "prAvAvail" don't have a value
person.getAttributes().putAttribute(AV_AVAILABILITY_ATTRIBUTE,"noPrav");
person.getAttributes().putAttribute("carAvail", "never");
}
} else {
System.out.println("Error: Scenario must be A, B, or C");
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment