<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

	<!-- Editor: Thomas Nicolai, VSP, Berlin Institute of Technology (TU Berlin) -->
	<!-- This xml schema contains xml definitions used for MATSim4UrbanSim -->
	
	<!-- root element -->
	<xs:element name="matsim4urbansim_config" type="matsim4urbansim_configType"/>
	<!-- root elemet definition -->
	<xs:complexType name="matsim4urbansim_configType">
		<xs:sequence>
			<xs:element name="matsim_config" type="matsim_configType" minOccurs="1" 
				maxOccurs="1"/>
			<xs:element name="matsim4urbansim" type="matsim4urbansimType" minOccurs="1" 
				maxOccurs="1"/>
		</xs:sequence>
	</xs:complexType>
	
	<!-- MATSim to UrbanSim integration element definition -->
	<xs:complexType name="matsim4urbansimType">
		<xs:sequence>
			<!-- general parameters -->
			<xs:element name="populationSamplingRate" type="xs:double"/>
			<xs:element name="year" type="xs:nonNegativeInteger"/>
			<xs:element name="opusHome" type="xs:token"/>
			<xs:element name="opusDataPath" type="xs:token"/>
			<xs:element name="matsim4opus" type="xs:token"/>
			<xs:element name="matsim4opusConfig" type="xs:token"/>
			<xs:element name="matsim4opusOutput" type="xs:token"/>
			<xs:element name="matsim4opusTemp" type="xs:token"/>
			<xs:element name="customParameter" type="xs:token"/>
			
			<!-- matsim data to compute parameters -->
			<xs:element name="zone2ZoneImpedance" type="xs:boolean"/>
			<xs:element name="agentPerfomance" type="xs:boolean"/>
			<xs:element name="zoneBasedAccessibility" type="xs:boolean"/>
			<xs:element name="parcelBasedAccessibility" type="xs:boolean"/>
			
			<!-- backup parameter -->
			<xs:element name="backupRunData" type="xs:boolean"/>
		</xs:sequence>
	</xs:complexType>
	
	<!-- MATSim config element definition -->
	<xs:complexType name="matsim_configType">
		<xs:sequence>
			<!-- accessibility parameters -->
			<xs:element name="cellSize" type="xs:nonNegativeInteger"/>
			<xs:element name="accessibilityComputationAreaFromShapeFile" type="xs:boolean"/>
			<xs:element name="accessibilityComputationAreaFromBoundingBox" type="xs:boolean"/>
			<xs:element name="accessibilityComputationAreaFromNetwork" type="xs:boolean"/>
			<xs:element name="studyAreaBoundaryShapeFile" type="fileType" minOccurs="1" 
				maxOccurs="1"/>
			<xs:element name="boundingBoxTop" type="xs:double"/>
			<xs:element name="boundingBoxLeft" type="xs:double"/>
			<xs:element name="boundingBoxRight" type="xs:double"/>
			<xs:element name="boundingBoxBottom" type="xs:double"/>
			
			<!-- urbansim zone random location distribution parameters -->
			<xs:element name="urbansimZoneRandomLocationDistributionByRadius" type="xs:double"/>
			<xs:element name="urbansimZoneRandomLocationDistributionByShapeFile" type="xs:token"/>
			
			<!-- commonn parameters -->
		    <xs:element name="external_matsim_config" type="fileType" minOccurs="1" 
				maxOccurs="1"/>
			<xs:element name="network" type="fileType" minOccurs="1" 
				maxOccurs="1"/>
			<xs:element name="warmStartPlansFile" type="fileType" minOccurs="1" 
				maxOccurs="1"/>
			<xs:element name="useHotStart" type="xs:boolean"/>
			<xs:element name="hotStartPlansFile" type="fileType" minOccurs="1" 
				maxOccurs="1"/>
			
			<!-- plan calc score parameters -->
			<xs:element name="activityType_0" type="xs:token"/>
			<xs:element name="activityType_1" type="xs:token"/>
			<xs:element name="homeActivityTypicalDuration" type="xs:nonNegativeInteger"/>
			<xs:element name="workActivityTypicalDuration" type="xs:nonNegativeInteger"/>
			<xs:element name="workActivityOpeningTime" type="xs:nonNegativeInteger"/>
			<xs:element name="workActivityLatestStartTime" type="xs:nonNegativeInteger"/>
			
			<!-- matsim parameters --> 
			<xs:element name="firstIteration" type="xs:nonNegativeInteger"/>
			<xs:element name="lastIteration" type="xs:nonNegativeInteger"/>
		</xs:sequence>
	</xs:complexType>
	
	<!-- file element definition -->
	<xs:complexType name="fileType">
		<xs:sequence>
			<xs:element name="inputFile" type="xs:token"/>
		</xs:sequence>
	</xs:complexType>

</xs:schema>