=================
The calxml format
=================
This format, based on XML allows to represent a complete system and all its necessary parameters.
Basics
======
The principle of the calxml format is to declare objects to describe the hardware.
For example if you want to describe an arduino module named ard1 with a parameter named frequency with value 50 and an ip address of 10.220.0.97, you have to write :
.. code-block:: xml
50
10.220.0.97
Note that the parameters contains the name of the object. It has to be like that for calxml to know which parameter is for what object.
Arborescence
============
Very often, the hardware is organized following a tree structure and must be initialized following this organization. In order to reflect this state, objects can be declared in a tree way :
.. code-block:: xml
value1
value2
value3
This way cmod will know in wich order it should initialized this hardware. See the :doc:`configuration module ` for details.
Default values
==============
Calxml uses a file describing all the possible parameters of the system and also a default value for each. Therefore, if the default value is adecuate for your application, you can skip its declaration.
Note that if you use a parameter name that has no default value, an error will occur.
Shared parameters
=================
If you want to declare several modules with the same values for a parameter, you have the possibility to share the declaration between the different hardware.
For example :
.. code-block:: xml
value1
value2
value2
The value2 is shared by the two slave_hw modules. You have the possibility to declare it before the defininition of the two modules :
.. code-block:: xml
value1
value2
This format is more compact. This is why every parameter has to contain the name of its referring object.
Implicit declaration
====================
In order to get an even more compact format. We can replace the declaration of the modules by just their number (if no specific parameter is needed).
Let's rewrite again the previous example :
.. code-block:: xml
value1
2
value2
the "nb" parameter tells the system that two slave_hw are implicitly declared. They will use the default or previously declared parameters.
In that case, they will be named slave_hw_1_1 and slave_hw_1_2. The first 1 refers to the mhw_1 number.
Use of module name in values
============================
When the name of the modules follows the rule: module_x_y_z where x in the grandparent, y is the parent and z is the number of the module itself, the numbers x, y and z are accessible for use in a value of a parameter.
For example, a configuration file has 22 acquisition pc's. Each of them has an IP address which is successive starting on 10.220.0.100. In order to declare it in the most compact way, the following code can be used:
.. code-block:: xml
22
10.220.0.${100+nd2}
The delimiters `${}` will tell calxml to evaluate whats inside, first replacing all substrings `ndi` and `nxi` (where `i` is a number) by the i^th number on its name. Then, for acqpc_1_4, calxml would evaluate 100+4, i.e. it will have an ip=10.220.0.104. When `nx` is used, the result of the evaluation is converted to hexadecimal value, without the leading "0x". This variant can be used for successive MAC addresses.
The disabled attribute
======================
It happens very often that some hardware is unavailable on a test bench. In that case, a disabled attributes can be set to the value "true". During the phases, it will be ignored.
The detector
============
The global file has to cope with the XML specification :
- XML header
- only one object in the file
This is why we have to begin the file with a header like
.. code-block:: xml
All the declaration has to be enclosed in a single object. We choose to call it "detector".
.. code-block:: xml
put all hardware declaration here
The domain
==========
As Pyrame is a distributed system, it is necessary that calxml know where to find the modules. That's why the hardware declaration can be grouped under "domain" tags.
.. code-block:: xml
put all hardware declaration belonging to this machine here
The domain_ip parameter specify the IP address of the machine. This address must be accessible by all other machine (beware the NAT).
A real example
==============
This is a real example describing the SiW-Ecal prototype for future ILC distributed on two machines.
.. code-block:: xml
4
PP
skiroc2
0
10.220.0.4
00:0a:35:01:fe:02
em2
1
2
3
pulse
10
4
0
undef
0.09
min
min
ag_33500(channel=1,bus=tcp(host=10.220.0.3,port=5025))
10.220.0.2
00:0a:35:01:fe:03
em2
1
2
3