[r13]: / branches / PackMLState / Main_Escape_PLC / Plc Logic / Application / Function Blocks / Puzzle / BalastTankPuzzleStateMachine / svnobj  Maximize  Restore  History

Download this file

104 lines (101 with data), 22.4 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
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
ChildObjectGuids
AddAttributeSubsequent
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, 'UnSuspend') =  0 THEN		
			UnSuspend();
		
	END_CASE
	Client.iCommandToPLC := 0;
	Client.sCommandToPLC := '';
	Client.bReadyToPLC := FALSE;
CASE UM.CurrentState OF
PACK_ML.State.Stopped:
	;
PACK_ML.State.Aborted:
PACK_ML.State.Idle:
PACK_ML.State.Complete :	
PACK_ML.State.Execute :
	IF CMMT_ST.AxisError THEN
		Abort();
		RETURN;
	END_IF
    // However, for screens we have Y as positive below. For this reason, 
    // the Y values are inverted to get the expected results.
    //final double deltaY = (p1.y - p2.y);
    //final double deltaX = (p2.x - p1.x);
	//CMMT_ST_Rotery_Boot_MoveAbsolute.Position:= targetPositionBoat ;
	//CMMT_ST_Rotery_Boot_MoveAbsolute.Execute:=TRUE;
	BoatAngle :=  targetPositionBoat;
	CASE Client.ActualStep OF		
		0:	
			CASE Client.Mode OF
				Mode.Mode1:
					CASE Client.Level OF
						Level.Beginner:	
							speed := 100;						
						Level.Placeholder1:
							speed := 200;
						Level.Intermediate:
							speed := 300;
						Level.Placeholder2:
							speed := 400;
						Level.Advanced:
							speed := 500;
					END_CASE
					Client.ActualStep := 100;
					executeBoat := TRUE;
				Mode.Mode2:					
					Client.ActualStep := 200;
				Mode.Mode3:					
					Client.ActualStep := 300;				 	
						
			END_CASE		
		100:
			bMove := CMMT_ST.MoveAbsolute(Position:= 50 , 
				Velocity:= speed, 
				Acceleration:= 500, 
				Deceleration:= 500, 
				Jerk:= 1000, 
				ErrorID=> , 
			IF bMove THEN
			END_IF
			IF CMMT_ST.TargetReached THEN
		102:
		103:
			END_IF		
		300:
	END_CASE	
	CMMT_ST_Rotery_Boot_MoveAbsolute.Execute:=FALSE;	
	CMMT_ST.ResetHalt();
PACK_ML.State.Starting :
				Client.ActualStep := 100;			
				Client.ActualStep := 10;				
			IF NOT CMMT_ST.HomingValid THEN
				Client.ActualStep := 300;				
			enable := CMMT_ST.EnableDrive();
				Client.ActualStep := 0;
		110:
			IF home THEN				
		120:
				Client.ActualStep := 10;	
PACK_ML.State.Completing :
PACK_ML.State.Aborting :
	StateComplete();
	CASE Client.ActualStep OF
			StopBoat.Execute := TRUE;
			Client.ActualStep := 10;
			IF BoatStatus.Stopping AND LinearStatus.Stopping THEN;
				StopBoat.Execute := FALSE;
		20:
			IF CMMT_ST.AxisError THEN
			Client.ActualStep := 0;			
Client.ActualState := UM.CurrentState;
	 //Emergency Abort.
END_IF*)
puzzleTimer(xStartTimer := UM.CurrentState = PACK_ML.State.Execute ,xPauseTimer := ,xStopTimer:= NOT (UM.CurrentState = PACK_ML.State.Execute),tMaxPuzzleTime := Client.Duration);
IF puzzleTimer.iProcess >= 100 THEN	
// couple axis to functionblocks here
StopLinear (Axis := CMMT_ST);