################################################################################
#
# This file is a textual description of a Grafcet model which can be analysed
# by Teloco sofware (TEst of LOgic COntrollers) developped in LURPA. 
#                                     http://www.lurpa.ens-cachan.fr/isa/teloco/
#
################################################################################
#
# Introductory remark :
# - All character after character '#' is not taken into account
#
# A description contains two blocks :
# - <INFO> ... </INFO>         (Optional block)
# - <GRAFCET> ... </GRAFCET>   (Compulsory block)
# 
# Block <INFO> ... </INFO> contains three parts :
# - AuthorDescription      Compulsory
# - DateDescription        Optional
# - optionalComment        Optional
#
# AuthorDescription := 'Author' ':' Word Word
#   DateDescription := 'Date' ':' DigitDigit '/'  DigitDigit '/' DigitDigit
#   OptionalComment := '(*' Any Character except 'return' '*)'      
#
# Bloc <GRAFCET> ... </GRAFCET> contains three blocks :
# - <INPUTS> ... </INPUTS>     (Compulsory block)
# - <OUTPUTS> ... </OUTPUTS>   (Compulsory block)
# - <CHARTS> ... </CHARTS>     (Compulsory block)
#
# Bloc <INPUTS> ... </INPUTS> contains the descriptions of all inputs.
# InputDescription := InputName OptionalComment ';'
#
# Bloc <OUTPUTS> ... </OUTPUTS> contains the description of all outputs.
#   OutputDescription := OutputName OptionalComment ';'
#
# Bloc <CHARTS> ... </CHARTS> contains the description of all charts.
#   ChartDescription := PartialDescription | ExpansionDescription
#
# A partialDescription is a bloc 
# <PARTIAL Name = ChartName > ... </PARTIAL> contains three blocks :
# - <STEPS> ... </STEPS>     (Compulsory block)
# - <TRANSITIONS> ... </TRANSITIONS>   (Compulsory block)
# - <ACTIONS> ... </ACTIONS>     (Optional block)
#
# In a chart, bloc <STEPS> ... </STEPS> contains the description of all 
# steps included in the chart.
#   StepDescription := Step | InitialStep | MacroStep
#              Step := StepName OptionalComment ';'
#       InitialStep := StepName ':' 'Initial' OptionalComment ';'
#         MacroStep := StepName ':' 'Macro-step' OptionalComment ';'
#
#  Bloc <TRANSITIONS> ... </TRANSITIONS> contains the description of all 
#  transitions included in the chart.
#    TransitionDescription := TransitionName ':' FromSteps ':' ToSteps 
#                              ':' ConditionTransition ';'
#       FromSteps := Empty | Steps
#         ToSteps := Empty | Steps
#           Steps := StepName | StepName ',' Steps
#
# ConditionTransition := BooleanExpression
#   BooleanExpression := Variable | Negation | Sum | Product 
#                          | '(' BooleanExpression ')'
#            Variable := InputName | StepName  
#            Negation := '/' ( Variable | '(' BooleanExpression ')' )
#                 Sum := BooleanExpression  '+' BooleanExpression
#             Product := BooleanExpression  '.' BooleanExpression
#
#  Bloc <ACTIONS> ... </ACTIONS> contains the description of all actions
#  included in the chart.
#    ActionDescription :=  ContinuousAction | ConditionalAction | StoredAction
#     ContinuousAction := ActionName ':' 'Continuous' ':' StepName 
#                         ':' OutputName ';'
#    ConditionalAction := ActionName ':' 'Continuous' ':' StepName 
#                         ':' OutputName ':' Condition ';'
#         StoredAction := ActionName ':' 'Stored' ':' StepName ':' OutputName
#                ':' ('Set' | 'Reset') ':' ( 'Activation' | 'Desactivation') ';'
#            Condition := BooleanExpression
#
#  A ExpansionDescription is a bloc 
#  <EXPANSION Name = ChartName > ... </EXPANSION> contains three blocks :
#  - <STEPS> ... </STEPS>     (Compulsory block)
#  - <TRANSITIONS> ... </TRANSITIONS>   (Compulsory block)
#  - <ACTIONS> ... </ACTIONS>     (Optional block)
#
# In an expansion, bloc <STEPS> ... </STEPS> contains the description of all 
# steps included in the chart. 
# The first element is the description of the Entry step.
# The last element is the description of the Exit step.
#   EntryStep := StepName ':' 'Entry step' OptionalComment ';'
#    ExitStep := StepName ':' 'Exit step' OptionalComment ';'
# The others elements are as presented in StepDescription.
#
################################################################################

<INFO>
  Author : Julien PROVOST (* LURPA, ENS Cachan *)
  Date : 05/01/10
</INFO>

<GRAFCET>

<INPUTS>
  on ;
  a ;
  b ;
  z ;
  up ;
  dw ;
  v ;
  CS ;
  TD ;
</INPUTS>

<OUTPUTS>
 ILR ;
 ILG ;
 ILO ;
 VA ;
 VB ;
 VC ;
 BM ;
 MR ;
 TMm ;
 TMp ;
</OUTPUTS>

<CHARTS>

<PARTIAL Name = ModeDeMarche >

<STEPS>
  A1 : Initial ;
  F1 ;
  A3 ;
</STEPS>

<TRANSITIONS>
  t1 : A1 : F1 : on ;
  t2 : F1 : A3 : /on ;
  t3 : A3 : A1 : X1 ;
</TRANSITIONS>

<ACTIONS>
  As1 : Continuous : A1 : ILR ;
  As2 : Continuous : F1 : ILG : /X1 ;
  as3 : Continuous : A3 : ILO ;
</ACTIONS>

</PARTIAL>

<PARTIAL Name = Production >

<STEPS>
  1 : Initial ;
  M20 : Macro-step ;
  M30 : Macro-step ;
  M40 : Macro-step ;
</STEPS>

<TRANSITIONS>
  t4 : 1 : M20, M30 : CS./a./b.z.up./dw.XF1 ;
  t5 : M20, M30 : M40 : /v ;
  t6 : M40 : 1 : =1 ;
</TRANSITIONS>

</PARTIAL>

<EXPANSION Name = M20 >

<STEPS>
  E20 : Entry step ;
  21 ;
  22 ;
  S20 : Exit step ;
</STEPS>

<TRANSITIONS>
  t20 : E20 : 21 : a./b./z ;
  t21 : 21 : 22 : /a.b./z ;
  t22 : 22 : S20 : /a./b.z ;
</TRANSITIONS>

<ACTIONS>
  As20 : Continuous : E20 : VA : /a ;
  As21 : Continuous : 21 : VB : /b ;
  As22 : Continuous : 22 : VC : /z ;
</ACTIONS>

</EXPANSION>

<EXPANSION Name = M30 >

<STEPS>
  E30 : Entry step ;
  31 ;
  32 ;
  S30 : Exit step ;
</STEPS>

<TRANSITIONS>
  t30 : E30 : 31 : TD ;
  t31 : 31 : 32 : /TD ;
  t32 : 32 : S30 : TD ;
</TRANSITIONS>

<ACTIONS>
  As30 : Stored : E30 : BM : Set : Activation ;
  As31 : Stored : 32  : BM : Reset : Desactivation ;
</ACTIONS>

</EXPANSION>

<EXPANSION Name = M40 >

<STEPS>
  E40 : Entry step ;
  41 ;
  42 ;
  S40 : Exit step ;
</STEPS>

<TRANSITIONS>
  t40 : E40 : 41 : v ;
  t41 : 41 : 42 : /up.dw ;
  t42 : 42 : S40 : up./dw ;
</TRANSITIONS>

<ACTIONS>
  As40 : Continuous : E40 : MR ;
  As41 : Continuous : 41 : TMp ;
  As42 : Continuous : 41 : MR  ;
  As43 : Continuous : 42 : TMm ;
</ACTIONS>

</EXPANSION>

</CHARTS>

</GRAFCET>
