// set up the traffic source
if (roadInput.isSetTrafficSource()) {
final org.movsim.autogen.TrafficSource trafficSourceData = roadInput.getTrafficSource();
AbstractTrafficSource trafficSource = null;
if (trafficSourceData.isSetInflow()) {
InflowTimeSeries inflowTimeSeries = new InflowTimeSeries(trafficSourceData.getInflow());
trafficSource = new TrafficSourceMacro(composition, roadSegment, inflowTimeSeries);
} else if (trafficSourceData.isSetInflowFromFile()) {
trafficSource = new TrafficSourceMicro(composition, roadSegment);
MicroInflowFileReader reader = new MicroInflowFileReader(trafficSourceData.getInflowFromFile(),
roadSegment.laneCount(), timeOffsetMillis, routing, (TrafficSourceMicro) trafficSource);
reader.readData();
}
if (trafficSource != null) {
if (trafficSourceData.isLogging()) {
trafficSource.setRecorder(new FileTrafficSourceData(roadSegment.userId()));
}
roadSegment.setTrafficSource(trafficSource);
}
}
// set up the traffic sink
if (roadInput.isSetTrafficSink()) {
createParkingSink(roadInput.getTrafficSink(), roadSegment);
}
// set up simple ramp with dropping mechanism
if (roadInput.isSetSimpleRamp()) {
org.movsim.autogen.SimpleRamp simpleRampData = roadInput.getSimpleRamp();
InflowTimeSeries inflowTimeSeries = new InflowTimeSeries(simpleRampData.getInflow());
SimpleRamp simpleRamp = new SimpleRamp(composition, roadSegment, simpleRampData, inflowTimeSeries);
if (simpleRampData.isLogging()) {
simpleRamp.setRecorder(new FileTrafficSourceData(roadSegment.userId()));
}
roadSegment.setSimpleRamp(simpleRamp);