@JvmStatic fun main(args: Array<String>) { var matrixFilename: String? = null var coordinateFilename: String? = null var externalZonesFilename: String? = null var networkFilename: String? = null var plansFilename: String? = null var populationFraction: Double? = null require(args.size == 6) { "Wrong number of arguments" } matrixFilename = args[0] coordinateFilename = args[1] externalZonesFilename = args[2] networkFilename = args[3] plansFilename = args[4] populationFraction = args[5].toDouble() val list: MutableList<String?> = ArrayList() try { val br: BufferedReader = sun.security.util.IOUtils.getBufferedReader(externalZonesFilename) try { var line: String? = null while (br.readLine().also { line = it } != null) { list.add(line) } } finally { br.close() } } catch (e: FileNotFoundException) { e.printStackTrace() } catch (e: IOException) { e.printStackTrace() } val mdm = MyDemandMatrix() mdm.readLocationCoordinates(coordinateFilename, 2, 0, 1) mdm.parseMatrix(matrixFilename, "Saturn", "Saturn model received for Sanral project") val sc: Scenario = mdm.generateDemand(list, Random(5463), populationFraction, "car") val nr = NetworkReaderMatsimV1(sc.getNetwork()) nr.readFile(networkFilename) val xy = XY2Links(sc.getNetwork(), null) xy.run(sc.getPopulation()) val pw = PopulationWriter(sc.getPopulation(), sc.getNetwork()) pw.write(plansFilename) }
Class to generate plans files from the Saturn OD-matrices provided by Sanral 's modelling consultant , Alan Robinson .