diff --git a/Common_FAST.NUM.mlpe b/Common_FAST.NUM.mlpe index e90b924..b5621b3 100644 --- a/Common_FAST.NUM.mlpe +++ b/Common_FAST.NUM.mlpe @@ -1648,7 +1648,7 @@ end --------------------------------------------------------------------- function GetET( sHead, sTcPos, dAxR3) if sHead == 'H1' or sHead == 'H5' or sHead == 'H6' then - return ' E'..sTcPos + return ' E'..sTcPos elseif sHead == 'H2' then return ' ET42' elseif sHead == 'H3' then diff --git a/Common_FAST.mlpe b/Common_FAST.mlpe index fc491b9..0bfafdc 100644 --- a/Common_FAST.mlpe +++ b/Common_FAST.mlpe @@ -152,7 +152,8 @@ function OnSimulDispositionStarting() EmtUnlinkAllRawPartsFromGroups() if EMT.PHASE > 1 then if IsStartOrRestPhase( EMT.PHASE) then - EgtSetAxisPos( 'T', LoadT) + local ParkT = GetParkT() + EgtSetAxisPos( 'T', ParkT) end end end @@ -358,6 +359,8 @@ function OnSimulDispositionStart() EgtOutText( 'Barra non ruotata') end end + -- verifico posizione di carico + local ParkT = GetParkT() -- indice primo grezzo della fase local nOrd = GetPhaseOrd( EMT.PHASE) -- ricerco vettore movimento per i successivi @@ -365,7 +368,7 @@ function OnSimulDispositionStart() local nRawId = EgtGetFirstRawPart() while nRawId do if EgtGetInfo( nRawId, 'ORD', 'i') == nOrd + 1 then - vtMove = Vector3d( - LoadT - EgtGetRawPartBBox( nRawId):getMax():getX(), 0, 0) + vtMove = Vector3d( - ParkT - EgtGetRawPartBBox( nRawId):getMax():getX(), 0, 0) break end nRawId = EgtGetNextRawPart( nRawId) @@ -386,6 +389,8 @@ function OnSimulDispositionStart() end -- altrimenti fase finale, aggancio primo grezzo alla tavola e gli altri in posizione carico al carro Y else + -- verifico posizione di carico + local ParkT = GetParkT() -- indice primo grezzo della fase local nOrd = GetPhaseOrd( EMT.PHASE) -- ricerco vettore movimento per i successivi @@ -393,7 +398,7 @@ function OnSimulDispositionStart() local nRawId = EgtGetFirstRawPart() while nRawId do if EgtGetInfo( nRawId, 'ORD', 'i') == nOrd + 1 then - vtMove = Vector3d( - LoadT - EgtGetRawPartBBox( nRawId):getMax():getX(), 0, 0) + vtMove = Vector3d( - ParkT - EgtGetRawPartBBox( nRawId):getMax():getX(), 0, 0) break end nRawId = EgtGetNextRawPart( nRawId) @@ -1566,6 +1571,16 @@ function GetPhaseRot( nPhase) return ( EgtGetInfo( EgtGetPhaseDisposition( nPhase) or GDB_ID.NULL, 'ROT', 'i') or 0) end +--------------------------------------------------------------------- +function GetParkT() + local dTmp = EgtGetInfo( EMT.DISPID, 'TPOS', 'd') or EgtGetInfo( EMT.DISPID, 'TPARK', 'd') + if dTmp then + return dTmp + else + return LoadT + end +end + --------------------------------------------------------------------- -- *** END GENERAL *** --------------------------------------------------------------------- diff --git a/Common_FAST.mlse b/Common_FAST.mlse index 4880797..dad7b9f 100644 --- a/Common_FAST.mlse +++ b/Common_FAST.mlse @@ -638,13 +638,15 @@ function SpecApplyPath( bPreSplit, bSplitting, bPreCut, bCutting, bUnload, bPreR -- Calcolo dell'ingombro della lavorazione local dDistFront, dDistBack = SpecialCalcMachiningEncumbrance( EMC.MCHID, bPreCut) if not dDistFront or not dDistBack then return end + local dMaxLenLeft = 0 if bPreSplit or bSplitting then - local dDistF = SpecialCalcPhaseEncumbrance( EMC.PHASE + 1) + local dDistF, dDistB, dMaxLF = SpecialCalcPhaseEncumbrance( EMC.PHASE + 1) dDistFront = min( dDistFront, dDistF) local dNextHOVM = EgtGetInfo( EgtGetNextRawPart( nCurrRawId) or GDB_ID.NULL, 'HOVM', 'd') or 0 local dBackOther = b3Tot:getDimX() - b3Raw:getDimX() - MinOther - dNextHOVM EgtOutLog( 'DistBack='..EgtNumToString( dDistBack)..' OtherBack='..EgtNumToString( dBackOther), 3) dDistBack = min( dDistBack, dBackOther) + if bSplitting then dMaxLenLeft = dMaxLF end elseif bPreCut or bCutting then local dDistF = SpecialCalcPhaseEncumbrance( EMC.PHASE + 1) dDistFront = min( dDistFront, dDistF) @@ -709,8 +711,9 @@ function SpecApplyPath( bPreSplit, bSplitting, bPreCut, bCutting, bUnload, bPreR return false end -- eseguo la separazione ( standard o di pezzo ruotato) + EgtOutLog( 'MaxLenLeft=' .. EgtNumToString( dMaxLenLeft, 1), 1) if not IsMid2Phase( EMC.PHASE + 1) then - vCmd = SpecCalcSplit( b3Raw:getDimX()) + vCmd = SpecCalcSplit( b3Raw:getDimX(), dMaxLenLeft) else vCmd = SpecCalcSplitRot( b3Raw:getDimX()) end @@ -823,6 +826,7 @@ function SpecialCalcPhaseEncumbrance( nPhase) -- Deve essere la fase finale di lavorazione di un pezzo (già staccato dal resto della trave) local dDistFront = EMC.LB local dDistBack = EMC.LB + local dMaxLenLeft = 0 -- Salvo lavorazione e utensile correnti, per ripristinarli alla fine local nOrigMchId = EgtGetCurrMachining() local sOrigTool = EgtTdbGetCurrToolParam( MCH_TP.NAME) @@ -847,6 +851,9 @@ function SpecialCalcPhaseEncumbrance( nPhase) if dDistF and dDistB then dDistFront = min( dDistFront, dDistF) dDistBack = min( dDistBack, dDistB) + local dMaxLenL = EMC.LR - dDistF + EgtOutLog( ' MaxLenLeft = ' .. EgtNumToString( dMaxLenL, 1), 3) + dMaxLenLeft = max( dMaxLenLeft, dMaxLenL) end nMchId = EgtGetNextActiveOperation( nMchId) end @@ -855,7 +862,7 @@ function SpecialCalcPhaseEncumbrance( nPhase) if sOrigTool then EgtTdbSetCurrTool( sOrigTool) end if sOrigTool and sOrigHead and nOrigExit then EgtSetCalcTool( sOrigTool, sOrigHead, nOrigExit) end -- Restituisco gli ingombri trovati - return dDistFront, dDistBack + return dDistFront, dDistBack, dMaxLenLeft end --------------------------------------------------------------------- @@ -1329,10 +1336,17 @@ function SpecCalcCarriages( dDistFront, dDistBack, bFixedDelta, bFixedPos) end --------------------------------------------------------------------- -function SpecCalcSplit( dLenRaw) +function SpecCalcSplit( dLenRaw, dMaxLenLeft) local vCmd = {} EgtOutLog( ' *[S]', 1) - table.insert( vCmd, { 0, EgtIf( EMC.VDELTA, 'Split', 'Fall')}) + local bSplit = ( EMC.VDELTA ~= nil) + local ParkT = LoadT + if bSplit then + if dMaxLenLeft + 100 > LoadT then + ParkT = dMaxLenLeft + 300 + end + end + table.insert( vCmd, { 0, EgtIf( bSplit, 'Split', 'Fall')}) -- determino i grezzi da agganciare al carrello Y (sono quelli presenti nella fase successiva dispari) local nNextOddPhase = GetNextStartOrRestPhase( EMC.PHASE) local nRawId = EgtGetFirstRawPart() @@ -1344,20 +1358,26 @@ function SpecCalcSplit( dLenRaw) end -- riporto il carrello Y al carico con il resto della trave local dLDelta = EMC.YDELTA - dLenRaw - table.insert( vCmd, { 1, 'Y', LoadT + dLDelta}) + table.insert( vCmd, { 1, 'Y', ParkT + dLDelta}) table.insert( vCmd, { 21, 0, EMC.VDELTA or 0}) -- imposto subito Y non più attaccato al trave in lavoro EMC.YDELTA = nil -- salvo posizione carrello Y in disposizione del pezzo dopo split local PostDispId = EgtGetPhaseDisposition( EMC.PHASE + 1) if PostDispId then - EgtSetInfo( PostDispId, 'YPOS', LoadT + dLDelta) + if not bSplit then + EgtSetInfo( PostDispId, 'TPOS', ParkT) + else + EgtRemoveInfo( PostDispId, 'TPOS') + EgtSetInfo( PostDispId, 'TPARK', ParkT) + end + EgtSetInfo( PostDispId, 'YPOS', ParkT + dLDelta) end -- salvo posizione grezzo rimasto e posizione carrello Y nella disposizione iniziale del pezzo succ (prossima fase dispari) local NextDispId = EgtGetPhaseDisposition( nNextOddPhase) if NextDispId then - EgtSetInfo( NextDispId, 'TPOS', LoadT) - EgtSetInfo( NextDispId, 'YPOS', LoadT + dLDelta) + EgtSetInfo( NextDispId, 'TPOS', ParkT) + EgtSetInfo( NextDispId, 'YPOS', ParkT + dLDelta) end return vCmd end diff --git a/UpdateLog.txt b/UpdateLog.txt index 61c27f9..ee39f85 100644 --- a/UpdateLog.txt +++ b/UpdateLog.txt @@ -2,6 +2,7 @@ Versione 2.6-- (--/--/2024) - (SIM) Corretto movimento VMILL durante scarico pezzo piccolo a caduta +- (SIM-GEN) Per decidere posizione parcheggio barra dopo separazione, si considera lunghezza coda del pezzo in lavoro per evitare collisioni. Ticket#2168 Versione 2.6k1 (11/11/2024) - (GEN) Aggiunta gestione aggregato a T per NUM