[r64]: / branches / VisonGame2905 / Display_Escape_PLC / Plc Logic / Application / Function Blocks / Puzzle / VisionGameStateMachine / svnobj  Maximize  Restore  History

Download this file

78 lines (74 with data), 22.0 kB

 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
//---- Client init  ----\\
IF NOT xInit THEN	
	UM				(		sName := 'Normal Operation', 
							dwAllowsLeavingFromStates := PACK_ML.State.Stopped OR PACK_ML.State.Aborted OR PACK_ML.State.Idle, 
		IF SysStrCmp(Client.sCommandToPLC, Client.LockCommands[0]) =  0 THEN		
			//First Lock Function
		ELSIF SysStrCmp(Client.sCommandToPLC, Client.LockCommands[1]) =  0 THEN		
			//Second Lock Function
		ELSIF SysStrCmp(Client.sCommandToPLC, 'UnSuspend') =  0 THEN		
			UnSuspend();
		
	END_CASE
	Client.iCommandToPLC := 0;
	Client.sCommandToPLC := '';
	Client.bReadyToPLC := FALSE;
//---- Client statemachine  ----\\
parser();
TimerPulse();
CASE UM.CurrentState OF
PACK_ML.State.Stopped:
	;
PACK_ML.State.Aborted:
PACK_ML.State.Idle:
PACK_ML.State.Complete :	
PACK_ML.State.Execute :
	CASE Client.Mode OF
		Mode.Mode1: // Target practise simulation
			IF puzzleTimer.iProcess = 25 THEN;
				//SendCommand(Command := CommandType.Media ,Value := 'Padlock K000367');	
			END_IF			
			IF puzzleTimer.iProcess = 75 THEN;
				//
			
	CASE Client.ActualStep OF
					
		ParseMachine (sMETH_InputString := 'Welcome Sailors! You will participate in a training exercise ');
	40:	
		ParseMachine (sMETH_InputString := 'Your object is to Locate the practice target Leopold I of the Belgian navy ');
	60: 
				xHide_Zeeland 	:= FALSE;
				xHide_Groningen := FALSE;	
		Client.ActualStep := Client.ActualStep + 10;
		IF Number_of_Detections = 1 THEN; // only one ship detected.
			THEN; // Lock Target
				pCrosshair.Y := pLeopold.Y - 50;
				xHide_Crosshair := FALSE;
				IF TimerPulse.Q AND iCrosshairSize > 1000 THEN;
					TimerPulse.IN := FALSE;		
			ELSE; // Lock op de sensorwaarneming en geef foutmelding
	StateComplete();
PACK_ML.State.Completing :
PACK_ML.State.Stopping:
END_CASE
IF NOT x_EmergencyGF AND x_EmergencyFF THEN
	Abort();	
Client.ActualState := UM.CurrentState;
Client.Progress := puzzleTimer.iProcess;
	Stop();
{a9ed5b7e-75c5-4651-af16-d2c27e98cb94}
VAR_IN_OUT
END_VAR
	UM	: PACK_ML.UnitMode; 
	messageQueue : MessageQueue;
// 
// Hiding
	xHide_ijkpunt 		: BOOL := TRUE;
	xHide_Text_Top		: BOOL := TRUE;
	xHide_Button1		: BOOL := TRUE;
	xHide_Button3		: BOOL := TRUE;
	xHide_Leopold 		: BOOL := TRUE;
	xHide_Zeeland 		: BOOL := TRUE;
	xHide_Rotterdam 	: BOOL := TRUE;
// communication strings
	sInstructionString2	:  	STRING;
	sButtonString2		:	STRING;
	sTempString2		:	STRING;
// positions ships