Drill Simulator by fjwuxn

VIEWS: 6 PAGES: 9

									  Drill Simulator




Institutsbericht I18/2001
   (Technical Report)
     December 2001
      Stéphane Klein
1.     Purpose
The Drill Simulator has been developped to show the possibilities of the SIPN Editor [Frey et
al. 2001] (I.L. code generation, Online visualisation) without having to transport a large
system like the Fischertechnik manufacturing line [Testbed], [Maas and Frey 2001] also
available at the Logical Control Lab of the Institute.
In this example, no real actuators were wanted so sensors have been replaced by push buttons
and switches, and actuators by LEDs. Figure 1 shows a picture of the developed Drill
Simulator.




                                 Figure 1.   Drill Simulator
2.     Input and Output signals
The simulator works on an IPC and the programs have been developed using the SIPN Editor.
Nevertheless, the input and output signals have to be defined prior to every design. Table 1
and Table 2 summarize the 8 signals used to let the simulator work.

       Absolute      Symbolic address                            Explanation
        address
      I0.0         start_button              start of the drilling cycle
      I0.1         part_in_position          part is in the position to be drilled (switch)
      I0.2         lower_position            drilling head is at the lower limit
      I0.3         upper_position            drilling head is at the upper limit
                                      Table 1.   Input signals

       Absolute      Symbolic address                            Explanation
       address
      Q0.0         active                    part is being drilled (green)
      Q0.1         motor                     drilling motor is ON (red)
      Q0.2         move_down                 drilling head moves down (red)
      Q0.3         move_up                   drilling head moves up (red)
                                   Table 2.      Output signals




3.     Formal Specification
To simulate the behavior of an automated drilling station, following expectations have been
formulated:
   - when there is a part in position and the Start button is pressed, the drill operates,
   - a drilling operation stands out of moving the drill down until the lower limit is
      reached and then moving the drill up,
   - the drilling motor is ON during moving the drill down and up,
   - a light (Active) blinks during the drilling cycle,
   - the drilled part has to be removed before a new drilling cycle is enabled.

According to this expected behavior, a formal model has been designed using Signal
Interpreted Petri Nets (SIPN) [Frey 2001]. The SIPN is structured in two hierarchical levels.
In the upper level (Figure 2), the blinking signal is generated (Light On in place P2 and Off in
place P3 with an activation time of 200 ms for each place) and the effective drilling cycle is
called (Subnet of place P4). To fulfill the expectation that a part has to be removed before a
new drilling cycle is enabled, place P5 where no actions are done has been introduced. After a
cycle has finished (i.e. the cycle in P4 has been completed), a token is generated in place P5.
This token can only be moved to P1 and then allow a new cycle to begin if the part has been
removed (firing condition of T5: Drilled part removed, ~I0.1).
In the second hierarchical level (Figure 3), the drilling cycle is described. When the subnet is
set active, a token is generated in place P41 and transition T41 fires immediately. The drilling
motor is then turned on (Q0.1 = 1 in place P42) and the drill head is moved down (Q0.2 = 1 in
place P43). When the lower limit is reached (I0.2 = 1), i.e. the push button is pressed,
transition T43 fires and the drill moves up (Q0.3 = 1 in place P44) until the upper limit is
reached (I0.3 = 1, transition T44). After this position has been reached, places P42 and P44
are set inactive and place P45 is set active until transition T4 in the upper level is validated
and it fires.




                                 Figure 2.   General structure




                             Figure 3.   Second hierarchical level.
4.     IL Program
From those SIPN, the SIPN Editor allows an automatic generation of Instruction List code
that can be downloaded on every industrial PC. As for the SIPN model, we can see that the
generated code is organized as a hierarchical structure. The hierarchical place of the main
SIPN is translated in a Function Block. Hence two Pogramm Organisation Entities (POE) are
generated during the translation. The first one (Main.poe, Figure 4) stands for the translation
of the upper hierarchical level whereas the second one (FB1.poe, Figure 5) stands for the
subnet of place P4.

PROGRAM Main
VAR
     PV_1 : BOOL        := TRUE ;           (*   P1 *)
     PV_2 : BOOL        := FALSE ;          (*   P2 *)
     PV_3 : BOOL        := FALSE ;          (*   P3 *)
     PV_4 : BOOL        := FALSE ;          (*   P4 *)
     PV_4_FB    :       FB_1;               (*   FB for P4 *)
     PV_5 : BOOL        := FALSE ;          (*   P5 *)
     T_1 : TON;                             (*   Timer for P2 --> T2 *)
     T_2 : TON;                             (*   Timer for P3 --> T3 *)
     PCK_0 : BYTE       := 1;               (*   Packed place variable *)
END_VAR

VAR_GLOBAL
     start_button          at %IX0.0 : bool                 ;
     part_in_position      at %IX0.1 : bool                 ;
     lower_position        at %IX0.2 : bool                 ;
     upper_position        at %IX0.3 : bool                 ;
     active                at %QX0.0 : bool                 ;
     motor                 at %QX0.1 : bool                 ;
     move_down             at %QX0.2 : bool                 ;
     move_up               at %QX0.3 : bool                 ;
END_VAR
     CAL T_1 (IN:=PV_2, PT:=T#200ms)
     CAL T_2 (IN:=PV_3, PT:=T#200ms)
(****** Transition T1 ******)
l_0: LD    PV_1       (* pre place P1 *)
     ANDN PV_4        (* post place P4 *)
     ANDN PV_2        (* post place P2 *)
     JMPCN l_1
     AND part_in_position
     AND start_button
     JMPCN l_1
     R     PV_1       (* pre place P1 *)
     S     PV_4       (* post place P4 *)
     S     PV_2       (* post place P2 *)
     (* Update packed place variables *)
     LD    PCK_0
     AND 254
     OR    10
     ST    PCK_0
(****** Transition T2 ******)
l_1: LD    PV_2      (* pre place P2 *)
     ANDN PV_3       (* post place P3 *)
     AND T_1.Q       (* t(P2) >= 200ms *)
     JMPCN l_2
     R     PV_2      (* pre place P2 *)
     S     PV_3      (* post place P3 *)
     (* Update packed place variables *)
     LD    PCK_0
     AND 253
     OR    4
     ST    PCK_0
     CAL   T_1 (IN:=FALSE, PT:=T#200ms)
(****** Transition T3 ******)
l_2: LD    PV_3      (* pre place P3 *)
     ANDN PV_2       (* post place P2 *)
     AND T_2.Q       (* t(P3) >= 200ms *)
     JMPCN l_3
     R     PV_3      (* pre place P3 *)
     S     PV_2      (* post place P2 *)
     (* Update packed place variables *)
     LD    PCK_0
     AND 251
     OR    2
     ST    PCK_0
     CAL T_2 (IN:=FALSE, PT:=T#200ms)
(****** Transition T4 ******)
l_3: LD    PV_4      (* pre place P4 *)
     AND PV_4_FB.Q (* P4 subnet finished *)
     AND PV_3        (* pre place P3 *)
     ANDN PV_5       (* post place P5 *)
     JMPCN l_4
     R     PV_4      (* pre place P4 *)
     CALC PV_4_FB(IN:=FALSE)
     R     PV_3      (* pre place P3 *)
     S     PV_5      (* post place P5 *)
     (* Update packed place variables *)
     LD    PCK_0
     AND 243
     OR    16
     ST    PCK_0
     CAL T_2 (IN:=FALSE, PT:=T#200ms)
(****** Transition T5 ******)
l_4: LD    PV_5      (* pre place P5 *)
     ANDN PV_1       (* post place P1 *)
     JMPCN l_5
     ANDN part_in_position
     JMPCN l_5
     R     PV_5      (* pre place P5 *)
     S     PV_1      (* post place P1 *)
     (* Update packed place variables *)
     LD    PCK_0
     AND 239
     OR    1
     ST    PCK_0
(****** Place P1 ******)
l_5: LD    PV_1
     JMPCN l_6
     R     active
     R     motor
     R     move_down
     R     move_up
(****** Place P2 ******)
l_6: LD    PV_2
     JMPCN l_7
     S     active
(****** Place P3 ******)
l_7: LD    PV_3
     JMPCN l_8
     R     active
(****** Place P4 ******)
l_8: LD    PV_4
     JMPCN l_9
     CAL PV_4_FB(IN:=TRUE)

(****** Place P5 ******)
l_9: LD    PV_5
     JMPCN l_10
     R     active
     R     motor
     R     move_down
     R     move_up
l_10: RET
END_PROGRAM
                    Figure 4.   I.L. Code for the main SIPN (Main.poe)


FUNCTION_BLOCK FB_1
VAR_INPUT
     IN   : BOOL;
END_VAR
VAR_OUTPUT
     Q    : BOOL := FALSE ;   (* P45 *)
END_VAR
VAR
     FB_INIT   : BOOL := TRUE;
     PV_1 : BOOL := FALSE ;   (* P41 *)
     PV_2 : BOOL := FALSE ;   (* P42 *)
     PV_3 : BOOL := FALSE ;   (* P43 *)
     PV_4 : BOOL := FALSE ;   (* P44 *)
     PCK_0     : BYTE := 0;   (* Packed place variable *)
END_VAR
VAR_EXTERNAL
     start_button        : bool ;
     part_in_position    : bool ;
     lower_position      : bool ;
     upper_position      : bool ;
     active              : bool ;
     motor               : bool ;
     move_down           : bool ;
     move_up             : bool ;
END_VAR
     LDN IN
     JMPCN     init
     S    FB_INIT
     R    PV_1
     R    PV_2
     R    PV_3
     R    PV_4
     R    Q
     (* Reset packed place variables *)
     LD   0
     ST   PCK_0
     RET
init:
     LD   FB_INIT
     JMPCN     start
     R    FB_INIT
     S    PV_1
     (* Initialize packed place variables *)
     LD   1
     ST   PCK_0
start:
(****** Transition T41 ******)
l_0: LD   PV_1           (* pre place P41 *)
     ANDN PV_2           (* post place P42 *)
     ANDN PV_3           (* post place P43 *)
     JMPCN     l_1
     R    PV_1           (* pre place P41 *)
     S    PV_2           (* post place P42 *)
     S    PV_3           (* post place P43 *)
     (* Update packed place variables *)
     LD   PCK_0
     AND 254
     OR   6
     ST   PCK_0

(****** Transition T43 ******)
l_1: LD   PV_3           (* pre place P43 *)
     ANDN PV_4           (* post place P44 *)
     JMPCN     l_2
     AND lower_position
     JMPCN     l_2
     R    PV_3           (* pre place P43 *)
     S    PV_4           (* post place P44 *)
     (* Update packed place variables *)
     LD   PCK_0
     AND 251
     OR   8
     ST   PCK_0
(****** Transition T44 ******)
l_2: LD   PV_2           (* pre place P42 *)
     AND PV_4            (* pre place P44 *)
     ANDN Q              (* post place P45 *)
     JMPCN     l_3
     AND upper_position
     JMPCN     l_3
     R    PV_2           (* pre place P42 *)
     R    PV_4           (* pre place P44 *)
     S    Q              (* post place P45 *)
     (* Update packed place variables *)
     LD   PCK_0
     AND 245
     OR   16
     ST   PCK_0

(****** Place P41 ******)
     (* nothing happens here *)
(****** Place P42 ******)
l_3: LD   PV_2
     JMPCN     l_4
     S    motor
(****** Place P43 ******)
l_4: LD   PV_3
     JMPCN     l_5
     S    move_down

(****** Place P44 ******)
l_5: LD   PV_4
     JMPCN     l_6
     R    move_down
     S    move_up

(****** Place P45 ******)
l_6: LD   Q
     JMPCN     l_7
     R    motor
     R    move_up

l_7: RET
END_FUNCTION_BLOCK (* FB_1 *)
                  Figure 5.   I.L. Code of the second hierarchical level (FB1.poe)




5.     Conclusion
The Drill Simulator has been developed at the Logical Control Lab. of the institute of
Automatic Control in order to show the possibilities of the SIPN Editor. This small platform
is easily transportable and does not require a heavy installation to work.
 This platform is used for two more reasons. First it allows students to develop and implement
their first SIPN before they finally develop hugger SIPN for a larger manufacturing line.
Second, it is very useful to perform verification and validation. These formal methods have a
very important potential but due to the state explosion, they are limited to smaller systems.



6.     References
[Maas and Frey 2001] Maas, H.; Frey, G. : Documentation and Control Scenarios for a Flexible
  Manufacturing Line. Technical Report I17/2001, Institute of Automatic Control, University of
  Kaiserslautern, Dec. 2001.
[Frey 2001] Frey, G.: SIPN, Hierarchical SIPN, and Extensions. Technical Report I19/2001, Institute
   of Automatic Control, University of Kaiserslautern, Dec. 2001.
[Frey et al. 2001] Frey, G.; Minas, M.; John, K.-H.: Integration von Petrinetzen in den
   Steuerungsentwurf nach IEC61131. Proceedings of the SPS/IPC/Drives 2001, Nürnberg
   (Germany), pp. 197-205, Nov. 2001.
[Testbed] University of Michigan http://www-personal.engin.umich.edu/~tilbury/testbed/

								
To top