File: input_file.rst

package info (click to toggle)
scram 0.16.2-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 8,016 kB
  • sloc: xml: 120,766; cpp: 23,966; python: 1,256; ansic: 100; makefile: 9
file content (117 lines) | stat: -rw-r--r-- 3,689 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
###########
Input Files
###########

SCRAM uses XML input files to describe analysis.
One model per run is assumed.
See :ref:`xml_tools` for more convenient writing and reading of XML input files.

The input file format follows
the Open-PSA Model Exchange Format ([MEF]_) version 2.0d or later.
The extensive description is given in the above format documentation by Open-PSA,
and input files should be straightforward to create and understand.
However, not all Open-PSA formatting is supported,
and some additional assumptions/restrictions are made by SCRAM.
See :ref:`opsa_support` for the format description
and current implementation with differences.

In addition to the XML format,
the :ref:`Aralia_format` is supported indirectly.


Encodings
=========

- UTF-8
- UTF-16
- other encodings supported by `GNOME XML Parser`_ on the given platform.

.. _GNOME XML Parser: http://xmlsoft.org/encoding.html


Steps in XML Input Validation
=============================

#. Several input files to describe one model.

    - The first file must define the name, label, and attributes of the model.
      This information about models in the other input files is ignored without a warning,
      which allows reuse of files with analysis constructs from other models.

#. XML input file validation against the `RELAX NG`_ :ref:`schema`.
#. The validation assumptions/requirements:

    - Construct names and references are case-sensitive.
    - Leading and trailing whitespace characters are trimmed.
    - Names and references should conform to the MEF recommendations.
    - Public names must be unique globally,
      and private names must be unique locally within containers.
    - References are followed according to the public and private roles
      described in the Open-PSA MEF section
      *IV.3.2. Solving Name Conflicts: Public versus Private Elements*.

#. Additional validation of fault trees and values of parameters:

    - Each gate or formula must have the correct number of arguments.
    - A duplicate argument in Boolean formulas or gates is an error.
    - Values of expressions and parameters must be valid, i.e., non-negative for probabilities.
    - All events must be explicitly defined for probability calculations.

#. Error messages (with a file name, line numbers, types of errors):

    - Report a cyclic tree (gates or event tree branches).
    - Report a cyclic parameter with expressions.
    - Report a cyclic rule with instructions.
    - Report missing element descriptions.
    - Report an error if an event or a construct is being redefined.

#. Warnings for potential errors:

    - Unused model constructs:

        * Primary events
        * Parameters
        * Event trees
        * Initiating events or event groups
        * Functional events, branches, sequences, rules
        * Extern functions and libraries


.. _schema:

Validation Schemas
==================

- `RELAX NG Schema <https://github.com/rakhimov/scram/blob/master/share/input.rng>`_


.. _Aralia_format:

Aralia Input Format
===================

A more convenient format than the XML for writing simple fault trees
utilizes a shorter notation for gates, operators (``&``, ``|``, ``@``, ``~``, ``^``), and events
to create a collection of Boolean formulas.
The Aralia format can be converted into the XML format with `this script`_.

.. _this script:
    https://github.com/open-psa/translators/blob/master/aralia.py


Input File Examples
===================

Fault Tree Input File
---------------------

.. literalinclude:: example/input.xml
    :language: xml


Aralia Version
--------------

.. literalinclude:: example/aralia_input.txt

.. _RELAX NG: http://relaxng.org/