From c7c72fd86c9f115467e518e79465844760eedec2 Mon Sep 17 00:00:00 2001
From: aschwinn <al.schwinn@gsi.de>
Date: Tue, 30 May 2017 17:14:16 +0200
Subject: [PATCH] Bug 1381 - Add control on naming of FESA generated
 RT/Server-Actions

---
 silecs-model/src/xml/DesignSchema.xsd | 277 ++++++++++++++++----------
 1 file changed, 167 insertions(+), 110 deletions(-)

diff --git a/silecs-model/src/xml/DesignSchema.xsd b/silecs-model/src/xml/DesignSchema.xsd
index 6e53ecd..a11029e 100644
--- a/silecs-model/src/xml/DesignSchema.xsd
+++ b/silecs-model/src/xml/DesignSchema.xsd
@@ -91,8 +91,10 @@ along with this program.  If not, see http://www.gnu.org/licenses/.-->
 					</xs:annotation>
 					<xs:complexType>
 					    <xs:sequence>
-					       <xs:element name="Description" type="xs:string" minOccurs="0"/>
-                           <xs:element name="Block" type="BlockType" maxOccurs="unbounded"/>
+                           <xs:element name="Setting-Block" type="Setting-BlockType" minOccurs="0" maxOccurs="unbounded"/>
+                           <xs:element name="Acquisition-Block" type="Acquisition-BlockType" minOccurs="0" maxOccurs="unbounded"/>
+                           <xs:element name="Command-Block" type="Command-BlockType" minOccurs="0" maxOccurs="unbounded"/>
+                           <xs:element name="Description" type="xs:string" minOccurs="0"/>
 						</xs:sequence>
 						<xs:attribute name="name" type="SilecsClassNameType" use="required"/>
 						<xs:attribute name="version" type="VersionType" use="required"/>
@@ -132,19 +134,39 @@ along with this program.  If not, see http://www.gnu.org/licenses/.-->
 		</xs:complexType>
 	</xs:element>
 
+
+<xs:complexType name="FesaCodegenType-ServerOnly">
+    <xs:sequence>
+    </xs:sequence>
+</xs:complexType>
+    
+<xs:complexType name="FesaBlockCodegenConfigType">
+    <xs:sequence>
+        <xs:element name="Server" minOccurs="0">
+	        <xs:complexType>
+		       <xs:attribute name="fesaPropertyName" type="BlockNameType" use="required">
+			        <xs:annotation>
+			            <xs:appinfo>Defines the name of the generated Fesa-Property.</xs:appinfo>
+			        </xs:annotation>
+		       </xs:attribute>
+		    </xs:complexType>
+        </xs:element>
+        <xs:element name="RealTime" minOccurs="0">
+            <xs:complexType>
+               <xs:attribute name="fesaRTActionName" type="BlockNameType" use="required">
+                    <xs:annotation>
+                        <xs:appinfo>Defines the name of the generated Fesa-RT-Action.</xs:appinfo>
+                    </xs:annotation>
+               </xs:attribute>
+            </xs:complexType>
+        </xs:element>
+    </xs:sequence>
+</xs:complexType>
+            
 <xs:complexType name="BlockType">
 	<xs:sequence>
 	    <xs:element name="Description" type="xs:string" minOccurs="0"/>
-	    <xs:element name="Register" type="RegisterType" maxOccurs="unbounded">
-	        <xs:annotation>
-	            <xs:appinfo>
-	                <doc>
-	                    The Register is the elementary component of the SILECS data model.
-	                    &lt;br&gt;Each variable has a unique name in the scope of the class (including all blocks).
-	                </doc>
-	            </xs:appinfo>
-	        </xs:annotation>
-	    </xs:element>
+	    <xs:element name="Fesa-Codegen-Config" type="FesaBlockCodegenConfigType" minOccurs="0"/>
 	</xs:sequence>
 	<xs:attribute name="name" type="BlockNameType" use="required">
 	    <xs:annotation>
@@ -154,30 +176,68 @@ along with this program.  If not, see http://www.gnu.org/licenses/.-->
 	        </xs:appinfo>
 	    </xs:annotation>
 	</xs:attribute>
-	<xs:attribute name="mode" use="required">
-	    <xs:annotation>
-	        <xs:documentation>Defines the access-mode of the block and finally of its related variables.</xs:documentation>
-	    </xs:annotation>
-	    <xs:simpleType>
-	        <xs:restriction base="xs:string">
-	            <xs:enumeration value="READ-ONLY"/>
-	            <xs:enumeration value="WRITE-ONLY"/>
-	            <xs:enumeration value="READ-WRITE"/>
-	        </xs:restriction>
-	    </xs:simpleType>
-	</xs:attribute>
-	<xs:attribute name="generateFesaProperty" type="xs:boolean" use="required">
-	    <xs:annotation>
-	        <xs:appinfo>
-	            Defines if the code-generation will generate a FESA-Property and the related Actions/Events/etc for this block
-	        </xs:appinfo>
-	    </xs:annotation>
-	</xs:attribute>
-	<xs:attribute name="fesaPropertyName" type="BlockNameType" use="optional">
-	    <xs:annotation>
-	        <xs:appinfo>Defines the name of the generated Fesa-Property. If not set, the Blockname will be used.</xs:appinfo>
-	    </xs:annotation>
-	</xs:attribute>
+</xs:complexType>
+
+<xs:complexType name="Setting-BlockType">
+    <xs:complexContent>
+        <xs:extension base="BlockType">
+	        <xs:sequence>
+		        <xs:element name="Setting-Register" type="Setting-RegisterType" minOccurs="0" maxOccurs="unbounded">
+		            <xs:annotation>
+		                <xs:appinfo>
+		                    <doc>PLC Register which can be setted and read back by Silecs. The PLC should not modify it's value.</doc>
+		                </xs:appinfo>
+		            </xs:annotation>
+		        </xs:element>
+                <xs:element name="Volatile-Register" type="Volatile-RegisterType" minOccurs="0" maxOccurs="unbounded">
+                    <xs:annotation>
+                        <xs:appinfo>
+                            <doc>PLC Register which can be set by both, Silecs and the PLC</doc>
+                        </xs:appinfo>
+                    </xs:annotation>
+                </xs:element>
+	        </xs:sequence>
+        </xs:extension>
+    </xs:complexContent>
+</xs:complexType>
+
+<xs:complexType name="Acquisition-BlockType">
+    <xs:complexContent>
+        <xs:extension base="BlockType">
+             <xs:sequence>
+                <xs:element name="Acquisition-Register" type="Acquisition-RegisterType" minOccurs="0" maxOccurs="unbounded">
+                    <xs:annotation>
+                        <xs:appinfo>
+                            <doc>PLC Register which is only read out by Silecs</doc>
+                        </xs:appinfo>
+                    </xs:annotation>
+                </xs:element>
+            </xs:sequence>
+        </xs:extension>
+    </xs:complexContent>
+</xs:complexType>
+
+<xs:complexType name="Command-BlockType">
+    <xs:complexContent>
+        <xs:extension base="BlockType">
+             <xs:sequence>
+                <xs:element name="Setting-Register" type="Setting-RegisterType" minOccurs="0" maxOccurs="unbounded">
+                    <xs:annotation>
+                        <xs:appinfo>
+                            <doc>PLC Register which can be setted by Silecs. The PLC should not modify it's value.</doc>
+                        </xs:appinfo>
+                    </xs:annotation>
+                </xs:element>
+                <xs:element name="Volatile-Register" type="Volatile-RegisterType" minOccurs="0" maxOccurs="unbounded">
+                    <xs:annotation>
+                        <xs:appinfo>
+                            <doc>PLC Register which can be set by both, Silecs and the PLC</doc>
+                        </xs:appinfo>
+                    </xs:annotation>
+                </xs:element>
+            </xs:sequence>
+        </xs:extension>
+    </xs:complexContent>
 </xs:complexType>
 
 <xs:complexType name="RegisterType">
@@ -253,28 +313,6 @@ along with this program.  If not, see http://www.gnu.org/licenses/.-->
             </xs:appinfo>
         </xs:annotation>
     </xs:attribute>
-    <xs:attribute name="synchro" use="required">
-        <xs:annotation>
-            <xs:appinfo>
-                <doc>
-                    initial value or processing value of persistent data must be up-to-date each time a connection is established. 
-                    &lt;br/&gt;SILECS library supports automatic synchronization.
-                    &lt;ul&gt;
-                        &lt;li&gt;MASTER:  PLC overwrites FEC register values. &lt;/li&gt;
-                        &lt;li&gt;SLAVE: FEC overwrites PLC register values. &lt;/li&gt;
-                        &lt;li&gt;NONE: no automatic synchronization performed. (volatile data) &lt;/li&gt;
-                    &lt;/ul&gt;
-                </doc>
-            </xs:appinfo>
-        </xs:annotation>
-        <xs:simpleType>
-            <xs:restriction base="xs:string">
-                <xs:enumeration value="MASTER"/>
-                <xs:enumeration value="SLAVE"/>
-                <xs:enumeration value="NONE"/>
-            </xs:restriction>
-        </xs:simpleType>
-    </xs:attribute>
     <xs:attribute name="array-dim1" type="DimensionType" use="optional" default="1">
         <xs:annotation>
             <xs:appinfo>
@@ -316,58 +354,77 @@ along with this program.  If not, see http://www.gnu.org/licenses/.-->
     </xs:attribute>
 </xs:complexType>
 
+<xs:complexType name="Acquisition-RegisterType">
+    <xs:complexContent>
+        <xs:extension base="RegisterType">
+        </xs:extension>
+    </xs:complexContent>
+</xs:complexType>
+<xs:complexType name="Setting-RegisterType">
+    <xs:complexContent>
+        <xs:extension base="RegisterType">
+        </xs:extension>
+    </xs:complexContent>
+</xs:complexType>
+<xs:complexType name="Volatile-RegisterType">
+    <xs:complexContent>
+        <xs:extension base="RegisterType">
+        </xs:extension>
+    </xs:complexContent>
+</xs:complexType>
                                     
-	<xs:simpleType name="BlockNameType"> 
-		<xs:restriction base="xs:string">
-			<xs:minLength value="1"/>
-			<xs:maxLength value="30"/>
-			<!-- Siemens Support bezüglich der maximalen Zeichenlänge für PLC- Tags : S7-300/1200/1500er bei 128 Zeichen -->
-			<!-- FESA PropertyNames have max. 30 characters. Since For each Block a prop is generated, we have to use this limit -->
-			<xs:pattern value="[_A-Za-z]+[_A-Za-z0-9]*"/>
-		</xs:restriction>
-	</xs:simpleType>
-	<xs:simpleType name="RegisterNameType">
-		<xs:restriction base="xs:string">
-			<xs:minLength value="1"/>
-			<xs:maxLength value="60"/>
-			<!-- FESA Fields have max. 60 characters. Since For each Register a field is generated, we have to use this limit -->
-			<xs:pattern value="[_A-Za-z]+[_A-Za-z0-9]*"/>
-		</xs:restriction>
-	</xs:simpleType>
-	<xs:simpleType name="FormatType">
-		<xs:restriction base="xs:string">
-			<xs:enumeration value="uint8"/>
-			<xs:enumeration value="int8"/>
-			<xs:enumeration value="uint16"/>
-			<xs:enumeration value="int16"/>
-			<xs:enumeration value="uint32"/>
-			<xs:enumeration value="int32"/>
-			<xs:enumeration value="uint64"/>
-			<xs:enumeration value="int64"/>
-			<xs:enumeration value="float32"/>
-			<xs:enumeration value="float64"/>
-			<xs:enumeration value="string"/>
-			<xs:enumeration value="date"/>
-			<xs:enumeration value="char"/>
-			<xs:enumeration value="byte"/>
-			<xs:enumeration value="word"/>
-			<xs:enumeration value="dword"/>
-			<xs:enumeration value="int"/>
-			<xs:enumeration value="dint"/>
-			<xs:enumeration value="real"/>
-			<xs:enumeration value="dt"/>
-		</xs:restriction>
-	</xs:simpleType>
+<xs:simpleType name="BlockNameType"> 
+	<xs:restriction base="xs:string">
+		<xs:minLength value="1"/>
+		<xs:maxLength value="30"/>
+		<!-- Siemens Support bezüglich der maximalen Zeichenlänge für PLC- Tags : S7-300/1200/1500er bei 128 Zeichen -->
+		<!-- FESA PropertyNames have max. 30 characters. Since For each Block a prop is generated, we have to use this limit -->
+		<xs:pattern value="[_A-Za-z]+[_A-Za-z0-9]*"/>
+	</xs:restriction>
+</xs:simpleType>
+<xs:simpleType name="RegisterNameType">
+	<xs:restriction base="xs:string">
+		<xs:minLength value="1"/>
+		<xs:maxLength value="60"/>
+		<!-- FESA Fields have max. 60 characters. Since For each Register a field is generated, we have to use this limit -->
+		<xs:pattern value="[_A-Za-z]+[_A-Za-z0-9]*"/>
+	</xs:restriction>
+</xs:simpleType>
+<xs:simpleType name="FormatType">
+	<xs:restriction base="xs:string">
+		<xs:enumeration value="uint8"/>
+		<xs:enumeration value="int8"/>
+		<xs:enumeration value="uint16"/>
+		<xs:enumeration value="int16"/>
+		<xs:enumeration value="uint32"/>
+		<xs:enumeration value="int32"/>
+		<xs:enumeration value="uint64"/>
+		<xs:enumeration value="int64"/>
+		<xs:enumeration value="float32"/>
+		<xs:enumeration value="float64"/>
+		<xs:enumeration value="string"/>
+		<xs:enumeration value="date"/>
+		<xs:enumeration value="char"/>
+		<xs:enumeration value="byte"/>
+		<xs:enumeration value="word"/>
+		<xs:enumeration value="dword"/>
+		<xs:enumeration value="int"/>
+		<xs:enumeration value="dint"/>
+		<xs:enumeration value="real"/>
+		<xs:enumeration value="dt"/>
+	</xs:restriction>
+</xs:simpleType>
+
+<xs:simpleType name="DimensionType">
+	<xs:restriction base="xs:unsignedInt">
+		<xs:minInclusive value="1"/>
+	</xs:restriction>
+</xs:simpleType>
+<xs:simpleType name="LengthType">
+	<xs:restriction base="xs:unsignedInt">
+		<xs:minInclusive value="2"/>
+		<xs:maxInclusive value="254"/>
+	</xs:restriction>
+</xs:simpleType>
 
-	<xs:simpleType name="DimensionType">
-		<xs:restriction base="xs:unsignedInt">
-			<xs:minInclusive value="1"/>
-		</xs:restriction>
-	</xs:simpleType>
-	<xs:simpleType name="LengthType">
-		<xs:restriction base="xs:unsignedInt">
-			<xs:minInclusive value="2"/>
-			<xs:maxInclusive value="254"/>
-		</xs:restriction>
-	</xs:simpleType>
 </xs:schema>
-- 
GitLab