Index: xssim/trunk/src/test/rewolucja/schemas/example/coolemall/example4.xml
===================================================================
--- xssim/trunk/src/test/rewolucja/schemas/example/coolemall/example4.xml	(revision 349)
+++ xssim/trunk/src/test/rewolucja/schemas/example/coolemall/example4.xml	(revision 350)
@@ -5,59 +5,27 @@
 	<resources>
 		<description>
-        This short example presents how to describe computing resource location.
-        Simulated architecture consists of data center with 2 racks named rack1 and rack2, respectively.
-        Location of rack1 is defined using vector (4, 0, 2), while rack2 using vector (6, 0, 2)
-		Rack1 contains 2 computing nodes - node11 and node12. Appropriate coordinates for node11 are (0, 0, 0)
-		and for node12 (0, 1, 0). Rack2 contains 2 computing nodes named node21 and node22. Their location is defined as follows:
-		(0, 0, 0) for node21 and (1, 0, 0) for node22.
-		Using 3 coordinates allows to express location in various ways. It can be interpreted as a absolute placement in 3D, as well as the
-		relative position according to the parent computing resource. Moreover, it is possible to define only the arrangement of
-		the computing resources by increasing only the value of one coordinate.
-		In the following example, racks location is defined using relative positions (with respect to the data center), while
-		for nodes the order of appearance is specified (with additional direction in which the order tends
-		(node12 is located after node11 and placed above it, while node22 is located on the right side of node21)
-		It has to be stressed that simulator only stores the location parameters and does not process them. Hence, their interpretation should be done by user.
+		The goal of this example is to introduce the templates usage. 
+		It focuses on showing that appropriate templates may be included on various computing resource levels and moreover can be formed using other templates.
+		Simulated architecture consists of data center with 2 racks named rack1 and rack2 respectively.
+		Rack1 contains 2 computing nodes - node11 and node12, described in common way.
+		Nodes in rack2 are defined using template. Node21 refers to template modelNodeA and, 
+		thus will be created with respect to the specification given in that template (node will have 4 processors with speed 2).
+		Node22 contains 8 processors which definition is included in modeProcessorB template.
 		</description>
 		<computingResource class="DataCenter" name="dataCenter">
 			<computingResource class="Rack" name="rack1">
-				<location>
-					<horizontal>4</horizontal>
-					<vertical>0</vertical>
-					<depth>2</depth>
-				</location>
 				<computingResource class="ComputingNode" name="node11">
-					<location>
-						<horizontal>0</horizontal>
-						<vertical>0</vertical>
-						<depth>0</depth>
-					</location>
 				</computingResource>
 				<computingResource class="ComputingNode" name="node12">
-					<location>
-						<horizontal>0</horizontal>
-						<vertical>1</vertical>
-						<depth>0</depth>
-					</location>
 				</computingResource>
 			</computingResource>	
 			<computingResource class="Rack" name="rack2">
-				<location>
-					<horizontal>6</horizontal>
-					<vertical>0</vertical>
-					<depth>2</depth>
-				</location>
 				<computingResource class="ComputingNode" name="node21">
-					<location>
-						<horizontal>0</horizontal>
-						<vertical>0</vertical>
-						<depth>0</depth>
-					</location>
+					<templateId>modelNodeA</templateId>
 				</computingResource>
 				<computingResource class="ComputingNode" name="node22">
-					<location>
-						<horizontal>1</horizontal>
-						<vertical>0</vertical>
-						<depth>0</depth>
-					</location>
+					<computingResource class="Processor" count="8">
+						<templateId>modelProcessorB</templateId>
+					</computingResource>
 				</computingResource>
 			</computingResource>
@@ -72,3 +40,26 @@
 		</scheduler>
 	</resources>
+	
+	<templates>
+		<description>
+		There are two processor templates named modelProcessorA (with cpu speed 2) and modelProcessorB (with cpu speed 1).
+		There is also one computing node template denoted as modelNodeA, which contains 4 processors that refer to modelProcessorA template.
+		That means that the given processors will be created according to the characteristics defined in template modelProcessorA (they will have speed equal 2).
+		</description>
+		<computingResourceTemplate class="ComputingNode" name="modelNodeA">
+			<computingResource class="Processor" count="4">
+				<templateId>modelProcessorA</templateId>
+			</computingResource>
+		</computingResourceTemplate>	
+		<computingResourceTemplate class="Processor" name="modelProcessorA">
+			<parameter name="speed">
+				<value>2</value>
+			</parameter>
+		</computingResourceTemplate>
+		<computingResourceTemplate class="Processor" name="modelProcessorB">
+			<parameter name="speed">
+				<value>1</value>
+			</parameter>
+		</computingResourceTemplate>
+	</templates>
 </environment>
Index: xssim/trunk/src/test/rewolucja/schemas/example/coolemall/example5.xml
===================================================================
--- xssim/trunk/src/test/rewolucja/schemas/example/coolemall/example5.xml	(revision 350)
+++ xssim/trunk/src/test/rewolucja/schemas/example/coolemall/example5.xml	(revision 350)
@@ -0,0 +1,367 @@
+<environment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+	xsi:noNamespaceSchemaLocation="../../XSSimResSchema.xsd">
+
+	
+	<!-- CoolEmAll testbed description -->
+	<resources>
+		<computingResource class="Rack" name="rack">
+			<resourceUnit class="Storage">
+				<amount unit="MB">4915200</amount>
+				<parameter name=""></parameter>
+			</resourceUnit>
+			<parameter name="PSU">
+				<property name="powerUsage">
+					<value unit="W">180</value>
+				</property>
+			</parameter>
+			<computingResource class="RECS" name="recs1">
+				<location>
+					<horizontal>0</horizontal>
+					<vertical>0</vertical>
+					<depth>0</depth>
+				</location>
+				<computingResource class="ComputingNode" count="18">
+					<resourceUnit class="Memory">
+						<amount unit="MB">16384</amount>
+					</resourceUnit>
+					<profile>
+						<powerProfile>
+							<powerStates>
+								<powerState>
+									<name>ON</name>
+									<powerUsage unit="W">400</powerUsage>
+								</powerState>
+								<powerState>
+									<name>OFF</name>
+									<powerUsage unit="W">0</powerUsage>
+								</powerState>
+							</powerStates>
+						</powerProfile>
+					</profile>
+					<computingResource class="Processor" type="i7">
+						<parameter name="speed">
+							<value>2</value>
+						</parameter>
+						<profile>
+							<powerProfile>
+								<parameter name="pState">
+									<property name="name">
+										<value>P0</value>
+									</property>	
+									<property name="frequency">
+										<value unit="Hz">3600</value>
+									</property>		
+									<property name="voltage">
+										<value unit="V">1.4</value>
+									</property>
+									<property name="powerUsage">
+										<value unit="W">103</value>
+									</property>						
+								</parameter>
+								<parameter name="pState">
+									<property name="name">
+										<value>P1</value>
+									</property>	
+									<property name="frequency">
+										<value unit="H`">3400</value>
+									</property>		
+									<property name="voltage">
+										<value unit="V">1.35</value>
+									</property>
+									<property name="powerUsage">
+										<value unit="W">94</value>
+									</property>						
+								</parameter>
+								<parameter name="pState">
+									<property name="name">
+										<value>P2</value>
+									</property>	
+									<property name="frequency">
+										<value unit="Hz">3200</value>
+									</property>		
+									<property name="voltage">
+										<value unit="V">1.3</value>
+									</property>
+									<property name="powerUsage">
+										<value unit="W">85</value>
+									</property>						
+								</parameter>
+								<parameter name="pState">
+									<property name="name">
+										<value>P3</value>
+									</property>	
+									<property name="frequency">
+										<value unit="H`">3000</value>
+									</property>		
+									<property name="voltage">
+										<value unit="V">1.25</value>
+									</property>
+									<property name="powerUsage">
+										<value unit="W">76</value>
+									</property>						
+								</parameter>		
+							</powerProfile>
+						</profile>
+						<computingResource class="Core" count="4"/>
+					</computingResource>
+				</computingResource>
+			</computingResource>
+			<computingResource class="RECS" name="recs2">
+				<location>
+					<horizontal>0</horizontal>
+					<vertical>1</vertical>
+					<depth>0</depth>
+				</location>
+				<computingResource class="ComputingNode" count="18">
+					<resourceUnit class="Memory">
+						<amount unit="MB">4096</amount>
+					</resourceUnit>
+										<profile>
+						<powerProfile>
+							<powerStates>
+								<powerState>
+									<name>ON</name>
+									<powerUsage unit="W">360</powerUsage>
+								</powerState>
+								<powerState>
+									<name>OFF</name>
+									<powerUsage unit="W">0</powerUsage>
+								</powerState>
+							</powerStates>
+						</powerProfile>
+					</profile>
+					<computingResource class="Processor" type="Atom">
+						<profile>
+							<powerProfile>
+								<parameter name="pState">
+									<property name="name">
+										<value>P0</value>
+									</property>	
+									<property name="frequency">
+										<value unit="Hz">1100</value>
+									</property>		
+									<property name="voltage">
+										<value unit="V">1.16</value>
+									</property>
+									<property name="powerUsage">
+										<value unit="W">45</value>
+									</property>						
+								</parameter>
+								<parameter name="pState">
+									<property name="name">
+										<value>P1</value>
+									</property>	
+									<property name="frequency">
+										<value unit="H`">1000</value>
+									</property>		
+									<property name="voltage">
+										<value unit="V">1.14</value>
+									</property>
+									<property name="powerUsage">
+										<value unit="W">40</value>
+									</property>						
+								</parameter>
+								<parameter name="pState">
+									<property name="name">
+										<value>P2</value>
+									</property>	
+									<property name="frequency">
+										<value unit="Hz">900</value>
+									</property>		
+									<property name="voltage">
+										<value unit="V">1.12</value>
+									</property>
+									<property name="powerUsage">
+										<value unit="W">35</value>
+									</property>						
+								</parameter>
+								<parameter name="pState">
+									<property name="name">
+										<value>P3</value>
+									</property>	
+									<property name="frequency">
+										<value unit="H`">800</value>
+									</property>		
+									<property name="voltage">
+										<value unit="V">1.1</value>
+									</property>
+									<property name="powerUsage">
+										<value unit="W">30</value>
+									</property>						
+								</parameter>		
+							</powerProfile>
+						</profile>
+						<computingResource class="Core" count="2"/>
+					</computingResource>
+				</computingResource>
+			</computingResource>
+			<computingResource class="RECS" name="recs3">
+				<location>
+					<horizontal>0</horizontal>
+					<vertical>2</vertical>
+					<depth>0</depth>
+				</location>
+				<computingResource class="ComputingNode" count="18">
+					<resourceUnit class="Memory">
+						<amount unit="MB">2048</amount>
+					</resourceUnit>
+					<profile>
+						<powerProfile>
+							<powerStates>
+								<powerState>
+									<name>ON</name>
+									<powerUsage unit="W">300</powerUsage>
+								</powerState>
+								<powerState>
+									<name>OFF</name>
+									<powerUsage unit="W">0</powerUsage>
+								</powerState>
+							</powerStates>
+						</powerProfile>
+					</profile>
+					<computingResource class="Processor" type="AMD Fusion">
+						<profile>
+							<powerProfile>
+								<parameter name="pState">
+									<property name="name">
+										<value>P0</value>
+									</property>	
+									<property name="frequency">
+										<value unit="Hz">1000</value>
+									</property>		
+									<property name="voltage">
+										<value unit="V">1.15</value>
+									</property>
+									<property name="powerUsage">
+										<value unit="W">30</value>
+									</property>						
+								</parameter>
+								<parameter name="pState">
+									<property name="name">
+										<value>P1</value>
+									</property>	
+									<property name="frequency">
+										<value unit="H`">866</value>
+									</property>		
+									<property name="voltage">
+										<value unit="V">1.1</value>
+									</property>
+									<property name="powerUsage">
+										<value unit="W">25</value>
+									</property>						
+								</parameter>		
+							</powerProfile>
+						</profile>
+						<computingResource class="Core" count="2"/>
+					</computingResource>
+				</computingResource>
+			</computingResource>
+			<computingResource class="RECS" name="recs4">
+			 	<location>
+					<horizontal>0</horizontal>
+					<vertical>3</vertical>
+					<depth>0</depth>
+				</location>
+				<computingResource class="ComputingNode" count="18">
+					<resourceUnit class="Memory">
+						<amount unit="MB">2048</amount>
+					</resourceUnit>
+					<profile>
+						<powerProfile>
+							<powerStates>
+								<powerState>
+									<name>ON</name>
+									<powerUsage unit="W">100</powerUsage>
+								</powerState>
+								<powerState>
+									<name>HIBERNATE</name>
+									<powerUsage unit="W">20</powerUsage>
+								</powerState>
+								<powerState>
+									<name>OFF</name>
+									<powerUsage unit="W">0</powerUsage>
+								</powerState>
+							</powerStates>
+						</powerProfile>
+					</profile>
+					<computingResource class="Processor" type="ARM">
+						<profile>
+							<powerProfile>
+								<parameter name="pState">
+									<property name="name">
+										<value>P0</value>
+									</property>	
+									<property name="frequency">
+										<value unit="Hz">1000</value>
+									</property>		
+									<property name="voltage">
+										<value unit="V">1.05</value>
+									</property>
+									<property name="powerUsage">
+										<value unit="W">6</value>
+									</property>						
+								</parameter>
+								<parameter name="pState">
+									<property name="name">
+										<value>P1</value>
+									</property>	
+									<property name="frequency">
+										<value unit="H`">866</value>
+									</property>		
+									<property name="voltage">
+										<value unit="V">1.01</value>
+									</property>
+									<property name="powerUsage">
+										<value unit="W">4</value>
+									</property>						
+								</parameter>		
+							</powerProfile>
+						</profile>
+						<computingResource class="Core"/>
+					</computingResource>
+				</computingResource>
+			</computingResource>
+		</computingResource>
+
+		<scheduler class="Cluster" name="cluster">
+			<schedulingPlugin>
+				<name>FCFSLocalSchedulingPlugin</name>
+			</schedulingPlugin>		
+			<managedComputingResources include="false">
+				<resourceName>rack</resourceName>
+			</managedComputingResources>
+		</scheduler>
+
+	</resources>
+	
+	<templates>
+		<computingResourceTemplate class="RESC" name="recs">
+			<profile>
+				<airThroughputProfile>
+					<airThroughputStates>
+						<airThroughputState>
+							<name>off</name>
+							<value unit="m3/h">0</value>
+							<powerUsage unit="W">0</powerUsage>
+						</airThroughputState>
+						<airThroughputState>
+							<name>low</name>
+							<value unit="m3/h">20</value>
+							<powerUsage unit="W">10</powerUsage>
+						</airThroughputState>
+						<airThroughputState>
+							<name>medium</name>
+							<value unit="m3/h">25</value>
+							<powerUsage unit="W">11</powerUsage>
+						</airThroughputState>
+						<airThroughputState>
+							<name>high</name>
+							<value unit="m3/h">30</value>
+							<powerUsage unit="W">12</powerUsage>
+						</airThroughputState>
+					</airThroughputStates>
+				</airThroughputProfile>
+			</profile>
+		</computingResourceTemplate>
+	</templates>
+</environment>
Index: xssim/trunk/src/test/rewolucja/schemas/example/coolemall/example2.xml
===================================================================
--- xssim/trunk/src/test/rewolucja/schemas/example/coolemall/example2.xml	(revision 349)
+++ xssim/trunk/src/test/rewolucja/schemas/example/coolemall/example2.xml	(revision 350)
@@ -43,5 +43,5 @@
 									<transition>
 										<to>ON</to>
-										<powerUsage unit="watts">40</powerUsage>
+										<powerUsage unit="W">40</powerUsage>
 										<time unit="s">60</time>
 									</transition>
@@ -50,5 +50,5 @@
 						</powerProfile>
 						<!-- Definition of computing node air throughput profile (for instance fan related with the given node)
-						Fan can operate in the 4 states, characterized by name, air flow value and power draw.
+						There are 4 states, characterized by name, air flow value and power draw.
 						 -->
 						<airThroughputProfile>
Index: xssim/trunk/src/test/rewolucja/schemas/example/coolemall/example3.xml
===================================================================
--- xssim/trunk/src/test/rewolucja/schemas/example/coolemall/example3.xml	(revision 349)
+++ xssim/trunk/src/test/rewolucja/schemas/example/coolemall/example3.xml	(revision 350)
@@ -1,83 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <environment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 	xsi:noNamespaceSchemaLocation="../../XSSimResSchema.xsd">
-
 	
-	<!-- CoolEmAll testbed description -->
 	<resources>
-		<computingResource class="Rack" name="rack">
-			<resourceUnit class="Storage">
-				<amount unit="MB">4915200</amount>
-				<parameter name=""></parameter>
-			</resourceUnit>
-			<parameter name="PSU">
-				<property name="powerUsage">
-					<value>180</value>
-				</property>
-			</parameter>
-			<computingResource class="RECS" name="recs1">
+		<description>
+        This short example presents how to describe computing resource location.
+        Simulated architecture consists of data center with 2 racks named rack1 and rack2, respectively.
+        Location of rack1 is defined using vector (4, 0, 2), while rack2 using vector (6, 0, 2)
+		Rack1 contains 2 computing nodes - node11 and node12. Appropriate coordinates for node11 are (0, 0, 0)
+		and for node12 (0, 1, 0). Rack2 contains 2 computing nodes named node21 and node22. Their location is defined as follows:
+		(0, 0, 0) for node21 and (1, 0, 0) for node22.
+		Using 3 coordinates allows to express location in various ways. It can be interpreted as a absolute placement in 3D, as well as the
+		relative position according to the parent computing resource. Moreover, it is possible to define only the arrangement of
+		the computing resources by increasing only the value of one coordinate.
+		In the following example, racks location is defined using relative positions (with respect to the data center), while
+		for nodes the order of appearance is specified (with additional direction in which the order tends
+		(node12 is located after node11 and placed above it, while node22 is located on the right side of node21)
+		It has to be stressed that simulator only stores the location parameters and does not process them. Hence, their interpretation should be done by user.
+		</description>
+		<computingResource class="DataCenter" name="dataCenter">
+			<computingResource class="Rack" name="rack1">
 				<location>
-					<horizontal>0</horizontal>
+					<horizontal>4</horizontal>
 					<vertical>0</vertical>
-					<depth>0</depth>
+					<depth>2</depth>
 				</location>
-				<computingResource class="ComputingNode" count="18">
-					<resourceUnit class="Memory">
-						<amount unit="MB">16384</amount>
-					</resourceUnit>
-					<computingResource class="Processor" type="i7">
-						<parameter name="speed">
-							<value>2</value>
-						</parameter>
-						<computingResource class="Core" count="4"/>
-					</computingResource>
+				<computingResource class="ComputingNode" name="node11">
+					<location>
+						<horizontal>0</horizontal>
+						<vertical>0</vertical>
+						<depth>0</depth>
+					</location>
+				</computingResource>
+				<computingResource class="ComputingNode" name="node12">
+					<location>
+						<horizontal>0</horizontal>
+						<vertical>1</vertical>
+						<depth>0</depth>
+					</location>
+				</computingResource>
+			</computingResource>	
+			<computingResource class="Rack" name="rack2">
+				<location>
+					<horizontal>6</horizontal>
+					<vertical>0</vertical>
+					<depth>2</depth>
+				</location>
+				<computingResource class="ComputingNode" name="node21">
+					<location>
+						<horizontal>0</horizontal>
+						<vertical>0</vertical>
+						<depth>0</depth>
+					</location>
+				</computingResource>
+				<computingResource class="ComputingNode" name="node22">
+					<location>
+						<horizontal>1</horizontal>
+						<vertical>0</vertical>
+						<depth>0</depth>
+					</location>
 				</computingResource>
 			</computingResource>
-			<computingResource class="RECS" name="recs2">
-				<location>
-					<horizontal>0</horizontal>
-					<vertical>1</vertical>
-					<depth>0</depth>
-				</location>
-				<computingResource class="ComputingNode" count="18">
-					<resourceUnit class="Memory">
-						<amount unit="MB">4096</amount>
-					</resourceUnit>
-					<computingResource class="Processor" type="Atom">
-						<computingResource class="Core" count="2"/>
-					</computingResource>
-				</computingResource>
-			</computingResource>
-			<computingResource class="RECS" name="recs3">
-				<location>
-					<horizontal>0</horizontal>
-					<vertical>2</vertical>
-					<depth>0</depth>
-				</location>
-				<computingResource class="ComputingNode" count="18">
-					<resourceUnit class="Memory">
-						<amount unit="MB">2048</amount>
-					</resourceUnit>
-					<computingResource class="Processor" type="AMD Fusion">
-						<computingResource class="Core" count="2"/>
-					</computingResource>
-				</computingResource>
-			</computingResource>
-			<computingResource class="RECS" name="recs4">
-			 	<location>
-					<horizontal>0</horizontal>
-					<vertical>3</vertical>
-					<depth>0</depth>
-				</location>
-				<computingResource class="ComputingNode" count="18">
-					<resourceUnit class="Memory">
-						<amount unit="MB">2048</amount>
-					</resourceUnit>
-					<computingResource class="Processor" type="ARM">
-						<computingResource class="Core"/>
-					</computingResource>
-				</computingResource>
-			</computingResource>
-		</computingResource>
-
+		</computingResource>	
 		<scheduler class="Cluster" name="cluster">
 			<schedulingPlugin>
@@ -85,8 +68,7 @@
 			</schedulingPlugin>		
 			<managedComputingResources include="false">
-				<resourceName>rack</resourceName>
+				<resourceName>dataCenter</resourceName>
 			</managedComputingResources>
 		</scheduler>
-
 	</resources>
 </environment>
