diff --git a/Common-FAST.NUM.mlpe b/Common-FAST.NUM.mlpe index a7db40c..021a682 100644 --- a/Common-FAST.NUM.mlpe +++ b/Common-FAST.NUM.mlpe @@ -617,10 +617,6 @@ function OnRapid() EMT.ZMAX = true end end - if not EMT.LOAD then - local sOut = string.gsub( string.gsub( EMT.MCHNAME..'/'..EMT.TOOL, '%(', '-'), '%)', '-') - EmtOutput( '( *** ' .. sOut .. ' *** )') - end -- primo posizionamento local MyZHome = EgtGetAxisHomePos( 'Z') @@ -631,6 +627,13 @@ function OnRapid() ' B' .. EmtLenToString( EMT.R2pp, 3) .. ' C' .. EmtLenToString( EMT.R1pp, 3) .. ' EE' .. EgtIf( bZmax, '3', '4') .. EMT.PREVsEL .. EMT.PREVsER .. EMT.PREVsET .. EMT.PREVsES EmtOutput( sOutPreMove) + EmtOutput( 'G101 ET1001') + EmtOutput( 'G101 ET2001') + end + + if not EMT.LOAD then + local sOut = string.gsub( string.gsub( EMT.MCHNAME..'/'..EMT.TOOL, '%(', '-'), '%)', '-') + EmtOutput( '( *** ' .. sOut .. ' *** )') end -- ricavo i dati per la lavorazione @@ -646,6 +649,8 @@ function OnRapid() local sOutPreMove = 'G101' .. ' X' .. EmtLenToString( -SafeXRotAxes, 3) .. ' Z' .. EmtLenToString( MyZHome, 3) .. EmtGetAxis( 'R2') .. EmtGetAxis( 'R1') .. sEE .. sEL .. sER .. sET .. sES EmtOutput( sOutPreMove) + EmtOutput( 'G101 ET1001') + EmtOutput( 'G101 ET2001') end EmtResetPrev() -- se sono su pezzi alti e movimento da emettere, per sicurezza a Z massima diff --git a/Common-FAST.NUM_PLUS.mlpe b/Common-FAST.NUM_PLUS.mlpe index 1eed103..80db2db 100644 --- a/Common-FAST.NUM_PLUS.mlpe +++ b/Common-FAST.NUM_PLUS.mlpe @@ -646,10 +646,7 @@ function OnRapid() EMT.PREVTOOL = EMT.TOOL end end - if not EMT.LOAD then - local sOut = string.gsub( string.gsub( EMT.MCHNAME..'/'..EMT.TOOL, '%(', '-'), '%)', '-') - EmtOutput( '( *** ' .. sOut .. ' *** )') - end + -- primo posizionamento local MyZHome = EgtGetAxisHomePos( 'Z') local bZmax = ( #EMT.AUXSTR > 0 or EMT.TOOL ~= EMT.PREVTOOL or EMT.L3 > -1) @@ -659,6 +656,13 @@ function OnRapid() ' B' .. EmtLenToString( EMT.R2pp, 3) .. ' C' .. EmtLenToString( EMT.R1pp, 3) .. ' EE' .. EgtIf( bZmax, '3', '4') .. EMT.PREVsEL .. EMT.PREVsER .. EMT.PREVsET .. EMT.PREVsES EmtOutput( sOutPreMove) + EmtOutput( 'G101 ET1001') + EmtOutput( 'G101 ET2001') + end + + if not EMT.LOAD then + local sOut = string.gsub( string.gsub( EMT.MCHNAME..'/'..EMT.TOOL, '%(', '-'), '%)', '-') + EmtOutput( '( *** ' .. sOut .. ' *** )') end -- ricavo i dati per la lavorazione @@ -674,6 +678,8 @@ function OnRapid() local sOutPreMove = 'G101' .. ' X' .. EmtLenToString( -SafeXRotAxes, 3) .. ' Z' .. EmtLenToString( MyZHome, 3) .. EmtGetAxis( 'R2') .. EmtGetAxis( 'R1') .. sEE .. sEL .. sER .. sET .. sES EmtOutput( sOutPreMove) + EmtOutput( 'G101 ET1001') + EmtOutput( 'G101 ET2001') end EmtResetPrev() -- se sono su pezzi alti e movimento da emettere, per sicurezza a Z massima diff --git a/Common-FAST.TPA.mlpe b/Common-FAST.TPA.mlpe index 72d31da..6228985 100644 --- a/Common-FAST.TPA.mlpe +++ b/Common-FAST.TPA.mlpe @@ -206,19 +206,12 @@ function OnDispositionEnd() local HTrave = EMT.HT local STrave = EMT.ST local HOverM = EMT.HOVM + -- calcolo dati pinze - local MinAccPinze = 0.3 - local MaxAccPinze = 4 - local KgMtCubo= 550 -- densità legno in Kg / metro cubo - local Massa = ( HTrave * STrave * LBarra * KgMtCubo ) / 1000000000 - local FMaxPinze = EMT.FMAXPINZE - local ForzaAtrito = 700 / 2 -- Serve per regolare P32 (700 valore reale pistone) - local TempoAcc = ( ( Massa * FMaxPinze) / ( 60 * ForzaAtrito) / 1000) - if ( TempoAcc < MinAccPinze) then TempoAcc = MinAccPinze end - if ( TempoAcc > MaxAccPinze) then TempoAcc = MaxAccPinze end - local AccPinze = FMaxPinze / ( 60 * TempoAcc) - local RidFeed = 100 / Massa * 100 - if ( RidFeed > 100) then RidFeed = 100 end + local TempAccPinze, TempMinAccPinze, RidFeed = CalcDinamicaPinze( HTrave, STrave, LBarra) + local TempAccPinz1, TempMinAccPinz1, RidFeed1 = CalcDinamicaPinze( HTrave, STrave, LBarra - LTrave) + local TempAccPinz2, TempMinAccPinz2, RidFeed2 = CalcDinamicaPinze( HTrave, STrave, LTrave) + if IdTrave >= 0 then local sPrt = '( *** Part '.. EgtNumToString( IdTrave, 0) ..' ***)' local sOut = '( SN=' .. IdTrave .. ' LBarra=' .. EmtLenToString( LBarra, 3) .. ' L='..EmtLenToString( LTrave, 3) .. @@ -247,7 +240,8 @@ function OnDispositionEnd() -- se carico barra if EMT.LOAD or EMT.RELOAD then sOut = 'M115 P1=' .. EmtLenToString( LBarra, 2) .. ' P2=' .. EmtLenToString( HTrave, 2) .. ' P3=' .. EmtLenToString( STrave, 2) .. - ' P4=' .. EmtLenToString( HOverM, 2) .. ' P5=' .. tostring( nLoad90) .. ' P6=' .. EmtLenToString( LTrave, 2) + ' P4=' .. EmtLenToString( HOverM, 2) .. ' P5=' .. tostring( nLoad90) .. ' P6=' .. EmtLenToString( LTrave, 2) .. + ' P7=' .. EgtNumToString( TempAccPinze, 2) .. ' P8=' .. EgtNumToString( TempAccPinz2, 2) .. ' P9=' .. EgtNumToString( TempAccPinz1, 2) if EMT.LOAD then ParkLine( sOut) SetStartValue( 1, LBarra) @@ -261,7 +255,8 @@ function OnDispositionEnd() -- altrimenti recupero rimanenza else sOut = 'M115 P1=' .. EmtLenToString( LBarra, 2) .. ' P2=' .. EmtLenToString( HTrave, 2) .. ' P3=' .. EmtLenToString( STrave, 2) .. - ' P4=' .. EmtLenToString( HOverM, 2) .. ' P5=' .. tostring( nLoad90) .. ' P6=' .. EmtLenToString( EgtIf( IdTrave >= 0, LTrave, LBarra), 2) + ' P4=' .. EmtLenToString( HOverM, 2) .. ' P5=' .. tostring( nLoad90) .. ' P6=' .. EmtLenToString( EgtIf( IdTrave >= 0, LTrave, LBarra), 2) .. + ' P7=' .. EgtNumToString( TempAccPinze, 2) .. ' P8=' .. EgtNumToString( TempAccPinz2, 2) .. ' P9=' .. EgtNumToString( TempAccPinz1, 2) EmtOutput( sOut) EmtOutput( 'M112'..' P1='..EmtLenToString( LoadT, 3).. ' P5=1 P6='..EmtLenToString( EMT.YPOS, 3)..' P7='..EmtLenToString( ParkV, 3) ..' P9='..GetFmaxClamp()) -- aggiorno dati aggancio carrelli alla trave @@ -643,10 +638,6 @@ function OnRapid() EmitZmax() end end - if not EMT.LOAD then - local sOut = string.gsub( string.gsub( EMT.MCHNAME..'/'..EMT.TOOL, '%(', '['), '%)', ']') - EmtOutput( '( * ' .. sOut .. ' * )') - end -- primo posizionamento local MyZHome = EgtGetAxisHomePos( 'Z') local bZmax = ( #EMT.AUXSTR > 0 or EMT.TOOL ~= EMT.PREVTOOL or EMT.L3 > -1) @@ -657,7 +648,15 @@ function OnRapid() ' P6=' .. EgtNumToString( EMT.PREVTCPOS, 3) .. ' P7=' .. EgtNumToString( EMT.PREVS, 0) .. ' P8=0' .. ' P9=0' .. ' P10=' .. EgtIf( bZmax, '3', '4') EmtOutput( sOutPreMove) + EmtOutput( 'M101 P1=2') + EmtOutput( 'M101 P1=3') end + + if not EMT.LOAD then + local sOut = string.gsub( string.gsub( EMT.MCHNAME..'/'..EMT.TOOL, '%(', '['), '%)', ']') + EmtOutput( '( * ' .. sOut .. ' * )') + end + -- se carico motosega, ruoto in zona sicura prima di approcciare la lavorazione if EMT.HEAD == 'H3' and EMT.ST > BeamHeightForFixRot and EMT.FLAG2 == 1 then local sOutPreMove = 'M101 P1=1' .. ' P2=' .. EmtLenToString( -SafeXRotAxes, 3) .. ' P3=' .. EmtLenToString( MyZHome, 3) .. @@ -665,6 +664,8 @@ function OnRapid() ' P6=' .. AdjustTcPos( false) .. ' P7=' .. EgtNumToString( EMT.S, 0) .. ' P8=0' .. ' P9=0' .. ' P10=' .. EgtIf( bZmax, '3', '4') EmtOutput( sOutPreMove) + EmtOutput( 'M101 P1=2') + EmtOutput( 'M101 P1=3') end -- resetto valori precedenti EmtResetPrev() @@ -975,6 +976,28 @@ function OnArc() EmtUpdatePrev() end +--------------------------------------------------------------------- +function CalcDinamicaPinze( dH, dS, dL) + local MinTempoAcc = 0.3 -- [s] + local MaxTempoAcc = 4.0 -- [s] + local KgMtCubo= 550 -- densità legno [Kg / metro cubo] + local Massa = ( dH * dS * dL * KgMtCubo ) / 1e9 -- massa [Kg] + local FMaxPinze = EMT.FMAXPINZE -- Feed massima pinze [mm/min] + local ForzaAttrito = 350 * 9.8 * 0.2 -- Forza chiusura pinze [Kgf] * g * Coeff_Attrito -> [N] + local TempoAcc = ( ( Massa * FMaxPinze) / ( 60 * ForzaAttrito) / 1000) + if ( TempoAcc < MinTempoAcc) then TempoAcc = MinTempoAcc end + if ( TempoAcc > MaxTempoAcc) then TempoAcc = MaxTempoAcc end + local AccMaxPinze = FMaxPinze / ( 60 * MinTempoAcc) + local AccPinze = FMaxPinze / ( 60 * TempoAcc) + local RidFeed = 100 / Massa * 100 + if RidFeed > 100 then + RidFeed = 100 + elseif RidFeed < 10 then + RidFeed = 10 + end + return TempoAcc * 1000, MinTempoAcc * 1000, RidFeed +end + --------------------------------------------------------------------- function CalcCharStatus( sCmd, bSkipPress) -- aperto diff --git a/Common-FAST.mlpe b/Common-FAST.mlpe index 39e5d2f..344a063 100644 --- a/Common-FAST.mlpe +++ b/Common-FAST.mlpe @@ -671,35 +671,8 @@ end --------------------------------------------------------------------- function OnSimulPathEnd() - -- se attivo VMILL, lavorazione ed è richiesto di eliminare gli sfridi - if EMT.VMILL and #EMT.VMILL > 0 and not EMT.OPEISDISP and EMT.VMRS then - EgtOutLog( 'OnSimulPathEnd', 5) - local vMillId = EMT.VMILL[1] - local nPart = EgtVolZmapPartCount( vMillId) - if nPart > 1 then - -- ricerca del pezzo con massimo volume - local nPartMax = 0 - local dVolMax = 0 - for i = 1, nPart do - local dVol = EgtVolZmapPartVolume( vMillId, i - 1) - if dVol > dVolMax then - dVolMax = dVol - nPartMax = i - end - end - -- eliminazione di tutti i pezzi piccoli - for i = nPart, 1, -1 do - if i ~= nPartMax then - local b3Vmill = EgtVolZmapGetPartBBoxGlob( vMillId, i - 1, GDB_BB.STANDARD) - if b3Vmill:getDimX() < 1200 then - EgtRemoveVolZmapPart( vMillId, i - 1) - end - end - end - -- aggiorno visualizzazione - EgtDraw() - end - end + -- rimozione eventuali sfridi + ExecRemoveScraps() end --------------------------------------------------------------------- @@ -788,8 +761,12 @@ function OnSimulMoveStart() end --------------------------------------------------------------------- ---function OnSimulMoveEnd() ---end +function OnSimulMoveEnd() + if EMT.FLAG == 301 then + -- rimozione eventuali sfridi + ExecRemoveScraps() + end +end --------------------------------------------------------------------- function OnSimulCollision() @@ -893,6 +870,39 @@ function ExecAuxCmd( sCmd) end end +--------------------------------------------------------------------- +function ExecRemoveScraps() + -- se attivo VMILL, lavorazione ed è richiesto di eliminare gli sfridi + if EMT.VMILL and #EMT.VMILL > 0 and not EMT.OPEISDISP and EMT.VMRS then + EgtOutLog( 'OnSimulPathEnd', 5) + local vMillId = EMT.VMILL[1] + local nPart = EgtVolZmapPartCount( vMillId) + if nPart > 1 then + -- ricerca del pezzo con massimo volume + local nPartMax = 0 + local dVolMax = 0 + for i = 1, nPart do + local dVol = EgtVolZmapPartVolume( vMillId, i - 1) + if dVol > dVolMax then + dVolMax = dVol + nPartMax = i + end + end + -- eliminazione di tutti i pezzi piccoli + for i = nPart, 1, -1 do + if i ~= nPartMax then + local b3Vmill = EgtVolZmapGetPartBBoxGlob( vMillId, i - 1, GDB_BB.STANDARD) + if b3Vmill:getDimX() < 1200 then + EgtRemoveVolZmapPart( vMillId, i - 1) + end + end + end + -- aggiorno visualizzazione + EgtDraw() + end + end +end + --------------------------------------------------------------------- function ExecUnloading() if EMT.VMILL and #EMT.VMILL > 0 then diff --git a/Essetre-FAST.mlde b/Essetre-FAST.mlde index 1056906..688b8de 100644 --- a/Essetre-FAST.mlde +++ b/Essetre-FAST.mlde @@ -40,12 +40,12 @@ -- Allineamento con common ver. 2.6c2 -- 2024/02/23 AV ver 2.6c3 Allineamento con common ver. 2.6c3 -- 2024/02/27 AV ver 2.6c4 Allineamento con common ver. 2.6c4. Aggiunto parametro 'SafeXRotAxes' per rotazione motosega con pezzi alti - +-- 2024/02/29 AV ver 2.6c5 Allineamento con common ver. 2.6c5 require( 'EmtGenerator') EgtEnableDebug( false) -PP_VER = '2.6c4' +PP_VER = '2.6c5' MIN_MACH_VER = '2.5k1' diff --git a/UpdateLog.txt b/UpdateLog.txt index c6faa46..05a1e35 100644 --- a/UpdateLog.txt +++ b/UpdateLog.txt @@ -1,5 +1,10 @@ ==== Common_FAST Update Log ==== +Versione 2.6c5 (29/02/2024) +- (GEN) Aggiunto comando di wait fine M101/G101 in caso di movimento in zona sicurezza per motosega +- (GEN) Gestione accelerazioni pinze in M115 ( solo per TPA) +- (SIM) Gestione rimozione VMILL per tagli a cubetti a zig-zag + Versione 2.6c4 (27/02/2024) - (MLDE-SIM-GEN) Con pezzi molto alti '> BeamHeightForFixRot', aggiunto parametro 'SafeXRotAxes' per ruotare motosega in zona sicura lontano dal pezzo - (SIM) Nelle funzioni movimentaizone assi, utilizzate costanti 'MCH_SIM_STEP' diff --git a/Version.lua b/Version.lua index a6cc8c4..2da8ddb 100644 --- a/Version.lua +++ b/Version.lua @@ -3,7 +3,7 @@ local InfoCommon_STD_PP = { NAME = 'Common-FAST', -- nome script PP standard - VERSION = '2.6c4', -- versione script + VERSION = '2.6c5', -- versione script MIN_MACH_VER_PP_COMMON = '2.5k1' -- versione minima kernel }