Skip to content

Commit

Permalink
Merge pull request #231 from msmobility/nkuehnel_branch
Browse files Browse the repository at this point in the history
occupation times to mito in minutes
  • Loading branch information
nkuehnel authored Sep 24, 2019
2 parents ee93b5c + 3ed579a commit 8a2b93d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class ConstructionModelImpl extends AbstractModel implements Construction
private int currentYear = -1;



private float betaForZoneChoice;
private float priceIncreaseForNewDwelling;

Expand Down Expand Up @@ -110,6 +111,8 @@ public Collection<ConstructionEvent> getEventsForCurrentYear(int year) {
}

DwellingType[] sortedDwellingTypes = findOrderOfDwellingTypes(dataContainer);
int unrealizedDemandCounter = 0;

for (DwellingType dt : sortedDwellingTypes) {
int dto = dwellingTypes.indexOf(dt);
for (int region : geoData.getRegions().keySet()) {
Expand Down Expand Up @@ -150,11 +153,18 @@ public Collection<ConstructionEvent> getEventsForCurrentYear(int year) {
for (int i = 1; i <= unrealizedDwellings; i++) {
int zone = allocateUnrealizedDemandInDifferentRegion(realEstate, dt, dto,
avePriceByTypeAndZone, avePriceByTypeAndRegion, utilitiesByDwellingTypeByZone);
events.add(createNewDwelling(realEstate, aveSizeByTypeAndRegion, avePriceByTypeAndZone,
avePriceByTypeAndRegion, dt, dto, region, zone));

if(zone > -1) {
events.add(createNewDwelling(realEstate, aveSizeByTypeAndRegion, avePriceByTypeAndZone,
avePriceByTypeAndRegion, dt, dto, region, zone));
} else {
unrealizedDemandCounter++;
}
}
}
}
logger.warn("There have been " + unrealizedDemandCounter + " dwellings that could not be built " +
"due to lack of developable land.");
return events;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ private void convertSchools(DataSet dataSet, DataContainer dataContainer) {
coordinate = zone.getRandomCoord();
}
MitoSchool mitoSchool = new MitoSchool(zones.get(school.getZoneId()), coordinate, school.getId());
mitoSchool.setStartTime_min((int) (school.getStartTimeInSeconds() / 60.));
mitoSchool.setEndTime_min((int) ((school.getStartTimeInSeconds() + school.getStudyTimeInSeconds()) / 60.));
zone.addSchoolEnrollment(school.getOccupancy());
dataSet.addSchool(mitoSchool);
}
Expand Down Expand Up @@ -127,8 +129,8 @@ private MitoPerson convertToMitoPp(PersonMuc person, DataSet dataSet, DataContai
coordinate = zone.getRandomCoord();
}
mitoOccupation = new MitoJob(zone, coordinate, job.getId());
mitoOccupation.setStartTime(job.getStartTimeInSeconds());
mitoOccupation.setEndTime(job.getStartTimeInSeconds() + job.getWorkingTimeInSeconds());
mitoOccupation.setStartTime_min((int) (job.getStartTimeInSeconds() / 60.));
mitoOccupation.setEndTime_min((int) ((job.getStartTimeInSeconds() + job.getWorkingTimeInSeconds()) / 60.));
}
break;
case UNEMPLOYED:
Expand Down

0 comments on commit 8a2b93d

Please sign in to comment.