Eclipse CD5405 Manuel d'utilisateur Page 12

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 23
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 11
range, indicating that either the sensor failed or the data got corrupted in some way
between the sensor and when it was read by the process.
To define a postrequisite, we first define a leaf step and name it Check S. With Check S
selected, go to the Interfaces view and pull down the Add menu. Select Add Message/
Exception. In the window that comes up, select Exception and enter
streamDischarge.OutOfRangeException as the parameter type.
Next select the Read S step and go to the Bindings view in the right column. Select Post-
Requisite. Then click on the … to the right of Unconnected. Select Step and enter Check S
as the step.name. Click the Select button next to the Failure exception type field and enter
streamDischarge.OutOfRangeException as the exception name. Then click OK. The triangle
to the right of Read S in the main process window should turn red.
Modify the simulator script to throw the exception. Add the following to your jsim file.
Place this after the Posted rule and before the Started rule. JSim rules are selected based
on the order in which they appear in the file. This rule will be selected when the Check S
starts, while the existing started rule serves as a default that is used for all other steps.
This rule uses a JSim script to define the steps behavior. Each time that Check S is started,
the next entry in the script is used to control its behavior. The rule shown here indicates
that Check S was complete successfully the first time it is started, but will terminate,
throwing the OutOfRangeException the second time. After that, all the actions in the script
will be used up, so the Check S step will then use the default rule.
<step name="Check S">
<started>
<script>
<group>
<complete>
<fixed value="1" />
</complete>
</group>
<group>
<terminate>
<exception type="streamDischarge.OutOfRangeException" />
<fixed value="1" />
</terminate>
</group>
</script>
</started>
</step>
For this script to work, we need to modify the process so that it reads in more than one S
value. To do this, we will change the “cardinality” on the edge from Get Q Dataset to Build
Q to 2. This means that the Build Q step will loop. For our purposes, it is sufficient for it to
loop twice, so we will set the cardinality to 2.
To do this, select the connector between Get Q Dataset and Build Q. In the Properties view
at the top right, select Cardinality. Click on the … that appears. Click other for both the
lower bound and upper bound and add 2 for each value. This will cause Build Q (and all its
substeps) to be repeated exactly twice.
Define a handler where control should go when the exception occurs and attach
the handler to the correct place in the process. When we encounter a bad S value, it
Vue de la page 11
1 2 ... 7 8 9 10 11 12 13 14 15 16 17 ... 22 23

Commentaires sur ces manuels

Pas de commentaire