diff --git a/Common_PF1250.TPA.mlpe b/Common_PF1250.TPA.mlpe index db16418..e9e585f 100644 --- a/Common_PF1250.TPA.mlpe +++ b/Common_PF1250.TPA.mlpe @@ -292,10 +292,15 @@ function OnDispositionEnd() EmitRemark( 'PART UNLOAD') end for i = 1, #EMT.MDCHAR do - EmitMoveDataChars( EMT.MDCHAR[i]) - if EMT.MDCHAR[i].Y1 then EMT.CHY_ON = true end - if EMT.MDCHAR[i].V1 then EMT.V1POS = EMT.MDCHAR[i].V1 end - if EMT.MDCHAR[i].V2 then EMT.V2POS = EMT.MDCHAR[i].V2 end + -- Se è un'istruzione del piano ferma pezzo + if EMT.MDCHAR[i].StopBeamStat then + EmitStopBeam( EMT.MDCHAR[i]) + else + EmitMoveDataChars( EMT.MDCHAR[i]) + if EMT.MDCHAR[i].Y1 then EMT.CHY_ON = true end + if EMT.MDCHAR[i].V1 then EMT.V1POS = EMT.MDCHAR[i].V1 end + if EMT.MDCHAR[i].V2 then EMT.V2POS = EMT.MDCHAR[i].V2 end + end end if #EMT.MDCHAR > 0 then local nMoveType = EgtIf( EMT.CHY_ON, 3, 2) @@ -508,7 +513,12 @@ function OnMachiningEnd() end end for i = 1, #EMT.MDCHAR do - EmitMoveDataChars( EMT.MDCHAR[i]) + -- Se è un'istruzione del piano ferma pezzo + if EMT.MDCHAR[i].StopBeamStat then + EmitStopBeam( EMT.MDCHAR[i]) + else + EmitMoveDataChars( EMT.MDCHAR[i]) + end end if #EMT.MDCHAR > 0 then if EMT.AUXTYPE == 'S' then @@ -2063,18 +2073,41 @@ function PrepareUnload( sCmd, nInd) -- non interessa elseif Cmd[1] == '1' then if Cmd[2] == 'Y2' then - -- se non è ultima fase e non è fase successiva a scarico su carico c'è una barra sulla pinza Y1 local bBarOnY = ( EMT.PHASE < EgtGetPhaseCount() and not IsEnd2Phase( EMT.PHASE)) - local nFinStatY2 = EgtIf( Cmd[4] == 'NoWaitUnload', -84, -1) - local MDChar = { Y2=tonumber(Cmd[3]), V2=ParkV2, IniStatY2=1, FinStatY2=nFinStatY2, BeamVise=EgtIf( bBarOnY, 1, 0), MovType=EgtIf( EMT.CHY_ON, 3, 2)} - table.insert( EMT.MDCHAR, MDChar) + -- Se scarico in linea con abbassamento piano ferma pezzo allo scarico + if Cmd[4] == 'UnBrakeBeam' then + -- Muove carrello aperto e lo chiude + local MDChar = { Y2=tonumber(Cmd[3]), V2=ParkV2, IniStatY2=1, FinStatY2=-1, BeamVise=EgtIf( bBarOnY, 1, 0), MovType=EgtIf( EMT.CHY_ON, 3, 2)} + table.insert( EMT.MDCHAR, MDChar) + -- Abbassa ferma pezzo + local MDStopBeam = { StopBeamStat=2} + table.insert( EMT.MDCHAR, MDStopBeam) + -- Se non è ultima fase e non è fase successiva a scarico su carico c'è una barra sulla pinza Y1 + else + local nFinStatY2 = EgtIf( Cmd[4] == 'NoWaitUnload', -84, -1) + local MDChar = { Y2=tonumber(Cmd[3]), V2=ParkV2, IniStatY2=1, FinStatY2=nFinStatY2, BeamVise=EgtIf( bBarOnY, 1, 0), MovType=EgtIf( EMT.CHY_ON, 3, 2)} + table.insert( EMT.MDCHAR, MDChar) + end end elseif Cmd[1] == '2' then if Cmd[4] == 'Y2' then - -- se non è ultima fase c'è una barra sulla pinza Y1 local bBarOnY = ( EMT.PHASE < EgtGetPhaseCount() and not IsEnd2Phase( EMT.PHASE)) - local MDChar = { Y2=tonumber(Cmd[5]), IniStatY1=EgtIf( bBarOnY, -1, 1), FinStatY1=EgtIf( bBarOnY, -1, 1), IniStatY2=-1, FinStatY2=1, IniStatV2=1, BeamVise=2, MovType=EgtIf( EMT.CHY_ON, 3, 2)} - table.insert( EMT.MDCHAR, MDChar) + -- Se scarico in linea con alzata piano ferma pezzo allo scarico + if Cmd[6] == 'BrakeBeam' then + -- Muove carrello e lo mantiene in presa + local MDChar = { Y2=tonumber(Cmd[5]), IniStatY1=EgtIf( bBarOnY, -1, 1), FinStatY1=EgtIf( bBarOnY, -1, 1), IniStatY2=-1, FinStatY2=-1, IniStatV2=1, BeamVise=2, MovType=EgtIf( EMT.CHY_ON, 3, 2)} + table.insert( EMT.MDCHAR, MDChar) + -- Alza ferma pezzo + local MDStopBeam = { StopBeamStat=1} + table.insert( EMT.MDCHAR, MDStopBeam) + -- Ribadisce le quote del carrello appena mosso e Apre la pinza + MDChar = { Y2=tonumber(Cmd[5]), IniStatY1=EgtIf( bBarOnY, -1, 1), FinStatY1=EgtIf( bBarOnY, -1, 1), IniStatY2=-1, FinStatY2=1, IniStatV2=1, BeamVise=2, MovType=EgtIf( EMT.CHY_ON, 3, 2)} + table.insert( EMT.MDCHAR, MDChar) + -- se non è ultima fase c'è una barra sulla pinza Y1 + else + local MDChar = { Y2=tonumber(Cmd[5]), IniStatY1=EgtIf( bBarOnY, -1, 1), FinStatY1=EgtIf( bBarOnY, -1, 1), IniStatY2=-1, FinStatY2=1, IniStatV2=1, BeamVise=2, MovType=EgtIf( EMT.CHY_ON, 3, 2)} + table.insert( EMT.MDCHAR, MDChar) + end end elseif Cmd[1] == '3' then -- non interessa @@ -3026,6 +3059,15 @@ function EmitMoveWaitHead( nHead) MyOutput( sOut) end +--------------------------------------------------------------------- +-- Emette i movimenti di esecuzione movimenti trave e alzata o discesa del piano ferma pezzo +function EmitStopBeam( MoData) + EmitMoveStartChars(2) + EmitMoveWaitChars(2) + if MoData.StopBeamStat then sOut = 'M125 P2=' .. EgtNumToString( MoData.StopBeamStat, 0) end + MyOutput( sOut) +end + --------------------------------------------------------------------- function EmitMoveDataChars( MoData) local sOut = 'M111' diff --git a/Common_PF1250.mlse b/Common_PF1250.mlse index 4011ba8..c4d14c6 100644 --- a/Common_PF1250.mlse +++ b/Common_PF1250.mlse @@ -1372,30 +1372,34 @@ function SpecCalcUnload() table.insert( vCmd, { 11, 0}) EMC.CNT = nil end - -- Se scarico in "linea" - if MinBeamLenUnloadInLine and EMC.LB >= MinBeamLenUnloadInLine then - local dY2MoveMax = MinY2 - local dTMove = dY2MoveMax - EMC.Y2DELTA - local dBeamTailY2 = dY2MoveMax + ( EMC.LB - EMC.Y2DELTA) - ( EMC.TCING or 0) - table.insert( vCmd, { 2, 'T', dTMove, 'Y2', dY2MoveMax}) - -- apro la morsa - table.insert( vCmd, { 12, 0}) - if dBeamTailY2 >= ( dY2MoveMax + ( EMC.TCING or 0)) then - dTMove = dY2MoveMax - EMC.LB + ( EMC.TCING or 0) - -- riporto il carrello in home - table.insert( vCmd, { 1, 'Y2', dBeamTailY2}) - -- chiudo la morsa - table.insert( vCmd, { 12, 1}) - -- finisco scarico trave - table.insert( vCmd, { 2, 'T', dTMove, 'Y2', dY2MoveMax}) - EgtOutLog( ' Y2PosF=' .. EgtNumToString( dY2MoveMax), 1) - end -- Se non supero la lunghezza massima di scarico, sposto il pezzo in posizione di scarico - elseif bStdUl then + if bStdUl then local dFinT = EgtIf( EMC.LB < MaxLenSmT, UnloadSmT, UnloadT) - EMC.LB local dFinY2 = dFinT + EMC.Y2DELTA - table.insert( vCmd, { 2, 'T', dFinT, 'Y2', dFinY2}) + local dBeamTailY2 = dFinY2 + ( EMC.LB - EMC.Y2DELTA) - ( EMC.TCING or 0) + -- Se scarico in linea scrivo una nota in più per l'attivazione del piano ferma pezzo (M125) + if MinBeamLenUnloadInLine and EMC.LB >= MinBeamLenUnloadInLine then + table.insert( vCmd, { 2, 'T', dFinT, 'Y2', dFinY2, 'BrakeBeam'}) + else + table.insert( vCmd, { 2, 'T', dFinT, 'Y2', dFinY2}) + end EgtOutLog( ' Y2PosF=' .. EgtNumToString( dFinY2), 1) + -- Se scarico in "linea" + if MinBeamLenUnloadInLine and EMC.LB >= MinBeamLenUnloadInLine then + -- apro la morsa + table.insert( vCmd, { 12, 0}) + local dY2MoveMax = MinY2 + if dBeamTailY2 >= ( dY2MoveMax + ( EMC.TCING or 0)) then + local dTMove = dY2MoveMax - EMC.LB + ( EMC.TCING or 0) + -- riporto il carrello in fondo alla trave + table.insert( vCmd, { 1, 'Y2', dBeamTailY2, 'UnBrakeBeam'}) + -- chiudo la morsa + table.insert( vCmd, { 12, 1}) + -- finisco scarico trave + table.insert( vCmd, { 2, 'T', dTMove, 'Y2', dY2MoveMax}) + EgtOutLog( ' Y2PosF=' .. EgtNumToString( dY2MoveMax), 1) + end + end else table.insert( vCmd, { 1, 'Y2', MaxY2}) end @@ -2531,7 +2535,7 @@ function SpecOutputCmds( vCmd, bEnd) EgtSetInfo( EMC.PATHID, sKey, sInfo) -- movimento di 2 assi elseif Cmd[1] == 2 then - local sInfo = '2,'..Cmd[2]..','..EgtNumToString( Cmd[3],3)..','..Cmd[4]..','..EgtNumToString( Cmd[5],3)..EgtIf( Cmd[6], ',*', '') + local sInfo = '2,'..Cmd[2]..','..EgtNumToString( Cmd[3],3)..','..Cmd[4]..','..EgtNumToString( Cmd[5],3)..EgtIf( Cmd[6], ','..tostring(Cmd[6]), '') EgtSetInfo( EMC.PATHID, sKey, sInfo) -- movimento di 3 assi elseif Cmd[1] == 3 then