%%%
  VERSION: 1
  LANGUAGE: ENGLISH
%%%

MODULE SWUSRF (SYSMODULE)

! ----------------
! $Revision: 1.4 $ 
! ----------------
! Copyright (c) ABB Robotics Products AB 1995  All rights reserved
!

!---------------------------------------
! G L O B A L  D A T A
!--------------------------------------- 

CONST string Version_SWUSRF := "4.1.0";
! Description: 
! CONST string Version_XXXXXXXX := "1.2.3";
!
!          XXXXXXXX - Module name
!                 1 - version number  (changed of SEROP) 
!                 2 - revision number (changed of SEROP)
!                 3 - revision number (for external use)

PERS spotdata spot1 := [1, 1, 1, 1];
PERS gundata gun1 := [1, 4, TRUE, TRUE, 0, 0, 20000, 20000,
                       0.050, 0.050, 0.050, 0.050, 0, 0, 0, 0, 0];
PERS tooldata toolg1 := [TRUE, [[0, 0, 0], [1, 0, 0, 0]],
                          [-1, [0, 0, 0],[1, 0, 0, 0], 0, 0, 0]];
PERS bool sw_inpos  := FALSE;
VAR num sw_close_corr := 100;

FUNC num sw_close_time (spotdata spot, gundata gun)
! return value is < 0 in case of error
  VAR num close_time;
  TEST spot.gun_pressure
  CASE 1:
    close_time := gun.close_time1;
  CASE 2:
    close_time := gun.close_time2;
  CASE 3:
    close_time := gun.close_time3;
  CASE 4:
    close_time := gun.close_time4;
  DEFAULT:
    close_time := -1;
  ENDTEST
  return close_time;
ENDFUNC

!*********************
!  Service routines  *
!*********************

PROC sw_service_cg()
  VAR num input_key;

! Service when pressure not reached
  TPErase;
  TPReadFK input_key,"sw_service_cg not prepared.","","","","","Return";
  TEST input_key
  CASE 5:
  DEFAULT:
  ENDTEST
ENDPROC

PROC sw_service_og()
  VAR num input_key;

! Service when gun open timeout
  TPErase;
  TPReadFK input_key,"sw_service_og not prepared.","","","","","Return";
  TEST input_key
  CASE 5:
  DEFAULT:
  ENDTEST
ENDPROC

PROC sw_service_wf()
  VAR num input_key;

! Service when weld_ready timeout.
  TPErase;
  TPReadFK input_key,"sw_service_wf not prepared.","","","","","Return";
  TEST input_key     
  CASE 5:   
  DEFAULT:
  ENDTEST
ENDPROC

ENDMODULE
