Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagexml
titleXML schema for PowerSupply (…/config/CDB/schemas/PowerSupply.xsd)
linenumberstrue
<xs:schema targetNamespace="urn:schemas-cosylab-com:PowerSupply:1.0"
           xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns="urn:schemas-cosylab-com:PowerSupply:1.0"
           xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0"
           xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" 
           elementFormDefault="qualified" 
           attributeFormDefault="unqualified">
<xs:import namespace="urn:schemas-cosylab-com:CDB:1.0" schemaLocation="CDB.xsd"/>
<xs:import namespace="urn:schemas-cosylab-com:BACI:1.0" schemaLocation="BACI.xsd"/>
<xs:complexType name="PowerSupplyType">
  <xs:sequence>
        
    <xs:element name="current" type="baci:RWdouble"/>
   
    <xs:element name="readback" type="baci:ROdouble"/>
    
    <xs:element name="status" >
      <xs:complexType>
        <xs:complexContent>
          <xs:restriction base="baci:ROpattern">
            <xs:attribute name="resolution" type="xs:int" use="optional" 
                                default="511" />
            <xs:attribute name="bitDescription" type="xs:string" use="optional" 
                               default="On,Remote,Sum Failure,External Interlock,
                               DC Overcurrent,Phase Failure,Not Ready,State 
                               Inconsistent,Ramping"/>
            <xs:attribute name="whenSet" type="xs:string" use="optional" 
                               default="3, 2, 0, 0, 0, 0, 1, 1, 1"/>
            <xs:attribute name="whenCleared" type="xs:string" use="optional" 
                               default="2, 3, 3, 3, 3, 3, 3, 3, 3"/>
          </xs:restriction>
        </xs:complexContent>
      </xs:complexType>
    </xs:element>
       
  </xs:sequence>
  <xs:attribute name="id" type="xs:int" use="optional" default="0"/>
</xs:complexType>
<xs:element name="PowerSupply" type="PowerSupplyType"/>
</xs:schema>


1 & 3

This is the namespace we will be using for PowerSupply. It is arbitrary but should include the name of the Component.

4-5

The namespace that was used for BACI and CDB. These urns are not arbitrary and can be found by looking in $ACSROOT/config/CDB/schemas/*.

8-9

Please see 4-5.

10-38

These rows describe the type of the record in the xml file. The user is free to customize this complex type in order to add specific information (see CDB documentation for further information about this issue).

13-15

Here we just specify that current is of type RWdouble and readback is a ROdouble. Nothing else needs to be specified because these are simple types already defined in BACI.xsd.

17-34

Since status is a ROpattern (which is a complex type), minimal attributes have been specified in BACI.xsd. Because of this, it is necessary to specify a pattern or enum's attributes since they will not change for any Component instantiated from this schema.

39

We specify that the xml contain one record of the same name of the component. The type of the record is PowerSupplyType defined above (see 10-38)


The xml files are parsed against their schema definition. In PowerSupply.xsd the PowerSupply is defined to be of PowerSupplyType. By customizing the PowerSupplyType, the PowerSupply.xml will be accordingly different. If the developer would add some custom field to the configuration of the power supply, in the PowerSupply.xml file, he also has to change its schema definition. We suggest having a look on the CDB documentation about that. The acsexmplFilterWheel shows an example of a customized xsd/xml for a generic filter wheel.

Code Block
languagexml
titleComponent information ($ACS_CDB/CDB/MACI/Components/Components.xml).
linenumberstrue
<?xml version="1.0" encoding="utf-8"?>
<Components xmlns="urn:schemas-cosylab-com:COBs:1.0"
      xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" 
      xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

      <_ Name="TEST_PS_1"	
          Code="acsexmplPowerSupplyImpl"	
         Type="IDL:alma/PS/PowerSupply:1.0" 
         Container="bilboContainer"/>

      <_ Name="TEST_PS_2"
         Code="acsexmplPSOptimized"	
         Type="IDL:alma/PS/PowerSupply:1.0"
         Container="bilboContainer2"/>
      
</Components>

This xml file describes the deployment information for components.

2

The namespace used by MACI Components as defined in $ACSROOT/config/CDB/schemas/maciCOB.xsd

3-4

Please see 4-5 of the schema.

7-10
&
12-15

We must specify Component information used by Manager for each Component instance in the Configuration Database. That is, if we want to be able to use two PowerSupply objects named TEST_PS_1 and TEST_PS_2: entries containing the name of the PowerSupply shared library, Container that will instantiate each object, etc must exist in Components.xml

7

Name of the Component instance, which is also the name of the XML file containing the configuration data for said Component instance.

8

Specify the name of the Power Supply shared library that will be loaded by Container here.

9

Location of Power Supply's IDL interface within the interface repository. PS corresponds to the module name the PowerSupply interface is located within (inside acsexmplPowerSupply.idl). PowerSupply is simply the name of the interface to be used and 1.0 is version number of that interface.

10

The name of the Container, which will activate this CORBA object.

12-15

Notice we have specified acsexmplPSOptimized, which is a shared library for Power Supply that has been compiled with all optimizations turned on (or even the source code for PowerSupply could be optimized). This is useful when you have a real-time system where every clock cycle counts, but for development you wouldn't normally want to deal with the extra compile time. Finally, note that TEST_PS_2's Container is different from TEST_PS_1. Use this when you want to take CPU overhead off of one Container (i.e., PC) and place it on another.

In this example we want to override some of the default values. One way to obtain that is to define a schema derived from the PowerSupply type. Another way might be that of customizing the xml definition. In this example we prefer to define a new schema as the same changes will be automatically propagated to all the power supply components.
We have defined the following schema that extends the PowerSupply.xsd Here you can find only a parte of the whole file. You can find the complete file in $ACS_CDB/CDB/schemas/TestPowerSupplyACS.xsd.. 1

Code Block
languagexml
linenumberstrue
<?xml version="1.0" encoding="UTF-8"?>

...


<xs:schema targetNamespace="urn:schemas-cosylab-com:TestPowerSupplyACS:1.0"

...

  
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="urn:schemas-cosylab-com:TestPowerSupplyACS:1.0"

...

 
xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" xmlns:baci="urn:schemas-cosylab-com:BACI:1.0"

...

 
xmlns:powerSupply="urn:schemas-cosylab-com:PowerSupply:1.0" elementFormDefault="qualified"

...

 
attributeFormDefault="unqualified">

...


     <xs:import namespace="urn:schemas-cosylab-com:CDB:1.0" schemaLocation="CDB.xsd"/>

...


     <xs:import namespace="urn:schemas-cosylab-com:BACI:1.0" schemaLocation="BACI.xsd"/>

...


     <xs:import namespace="urn:schemas-cosylab-com:PowerSupply:1.0" schemaLocation="PowerSupply.xsd"/>

...


     <xs:complexType name="TestPowerSupplyACS">

...


             <xs:complexContent>
                     <xs:restriction base="powerSupply:PowerSupply">

...


                            <xs:sequence>
                                     <xs:element name="current">

...


                                             <xs:complexType>
                                                     <xs:complexContent>
                                                             <xs:restriction base="baci:RWdouble">
                                                                     <xs:attribute name="description" type="xs:string" use="optional" default="

...

-"/>
                                                                     <xs:attribute name="format" type="xs:

...

string" use="optional" default="

...

%9.4f"/>
                                                                     <xs:attribute name="units" type="xs:

...

string" use="optional"

...

 default="

...

A"/>
                                                                     <xs:attribute name="resolution" type="xs:

...

int" use="optional"

...

 default="

...

65535"/>
                                                                     <xs:attribute name="default_timer_trig" type="xs:double" use="optional"

...

 
                                   default="

...

1.0"/>

...


                                                                     <xs:attribute name="min_timer_trig" type="xs:double" use="optional"

...

 
                                   default="0.

...

001"/>
                                                                     <xs:attribute name="min_delta_

...

trig" type="xs:double" use="optional" 
                                   default="0.

...

01526"/>
                                                                     <xs:attribute name="default_value" type="xs:double" use="optional"

...

 
                                   default="0.0"/>
                                                                     <xs:attribute name="graph_min" type="xs:double" use="optional" default="0"/>
                                                                     <xs:attribute name="graph_max" type="xs:double" use="optional" 
                                   default="1000.0"/>
                                                                     <xs:attribute name="min_step" type="xs:double" use="optional" 
                                   default="0.01526"/>
                                                                     <xs:attribute name="min_value" type="xs:double" use="optional" default="0.0"/>
                                                                     <xs:attribute name="max_value" type="xs:double" use="optional" 
                                   default="1000.0"/>
                                                             </xs:restriction>
                                                     </xs:complexContent>
                                             </xs:complexType>
                                     </xs:element>
   ........

...


     </xs:complexType>

...


     <xs:element name="TestPowerSupplyACS" type="TestPowerSupplyACS"/>

...


</xs:schema>


2 & 26

The schema defines the TestPowerSupplyACS

7-8

Import the CDB and the BACI schemas

9

Import the PowerSupply schema that we will extend.

10-43

Define the type TestPowerSupplyACS

12

Define the TestPowerSupplyACS to be of PowerSupply type

14-41

Define the current property

17

The current property is a RWdouble property

18-37

Redefine all the attributes of the property.

44

Define the xml element to be of the type defined here (we use the same name for both the elment and the type here but they can be different as shown in the PowerSupply.xsd)

...