From 7806f539b55e6cacf7363fe39165f95a5f44c3c3 Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Wed, 10 Sep 2025 13:09:55 +0200 Subject: [PATCH 1/2] Stima tempi considerando accelerazioni --- Common_FAST.NUM_PLUS.mlpe | 24 +------- Common_FAST.TPA.mlpe | 24 +------- Common_FAST.mlpe | 121 +++++++++++++++++++++++++++++++++----- UpdateLog.txt | 3 + Version.lua | 2 +- 5 files changed, 116 insertions(+), 58 deletions(-) diff --git a/Common_FAST.NUM_PLUS.mlpe b/Common_FAST.NUM_PLUS.mlpe index a245c20..eb6600a 100644 --- a/Common_FAST.NUM_PLUS.mlpe +++ b/Common_FAST.NUM_PLUS.mlpe @@ -207,9 +207,9 @@ function OnDispositionEnd() local BtlInfoId = EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or EgtGetCurrMachGroup() or GDB_ID.NULL local nLoad90 = EgtGetInfo( BtlInfoId, 'LOAD90', 'i') or 0 -- calcolo dati pinze - local AccPinze, AccMaxPinze, RidFeed, TempoAcc = CalcDinamicaPinze( HTrave, STrave, LBarra) - local AccPinz1, AccMaxPinz1, RidFeed1, TempoAcc1 = CalcDinamicaPinze( HTrave, STrave, LBarra - LTrave) - local AccPinz2, AccMaxPinz2, RidFeed2, TempoAcc2 = CalcDinamicaPinze( HTrave, STrave, LTrave) + local AccPinze, AccMaxPinze, RidFeed, TempoAcc = CalcDinamicaPinze_NUM( HTrave, STrave, LBarra) + local AccPinz1, AccMaxPinz1, RidFeed1, TempoAcc1 = CalcDinamicaPinze_NUM( HTrave, STrave, LBarra - LTrave) + local AccPinz2, AccMaxPinz2, RidFeed2, TempoAcc2 = CalcDinamicaPinze_NUM( HTrave, STrave, LTrave) if IdTrave >= 0 then local sOut = '( SN='..IdTrave..' LBarra='..EmtLenToString( LBarra, 3)..' L='..EmtLenToString( LTrave, 3).. ' H='..EmtLenToString( HTrave, 3)..' S='..EmtLenToString( STrave, 3)..' Acc='..EgtNumToString( TempoAcc, 1).. @@ -1113,24 +1113,6 @@ function FindNextTool() return sTool, sHead, sTcPos end ---------------------------------------------------------------------- -function CalcDinamicaPinze( dH, dS, dL) - local KgMtCubo= WoodDensity or 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) - local AccMaxPinze = EMT.MAXACC - local AccPinze = EgtClamp( FMaxPinze / ( 60 * TempoAcc), EMT.MINACC, EMT.MAXACC) - local RidFeed = 100 / Massa * 100 - if RidFeed > 100 then - RidFeed = 100 - elseif RidFeed < 10 then - RidFeed = 10 - end - return AccPinze, AccMaxPinze, RidFeed, TempoAcc -end - --------------------------------------------------------------------- function CalcCharStatus( sCmd, bSkipPress) -- aperto diff --git a/Common_FAST.TPA.mlpe b/Common_FAST.TPA.mlpe index c6aafe7..00a4a35 100644 --- a/Common_FAST.TPA.mlpe +++ b/Common_FAST.TPA.mlpe @@ -225,9 +225,9 @@ function OnDispositionEnd() local HOverM = EMT.HOVM -- calcolo dati pinze - 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) + local TempAccPinze, TempMinAccPinze, RidFeed = CalcDinamicaPinze_TPA( HTrave, STrave, LBarra) + local TempAccPinz1, TempMinAccPinz1, RidFeed1 = CalcDinamicaPinze_TPA( HTrave, STrave, LBarra - LTrave) + local TempAccPinz2, TempMinAccPinz2, RidFeed2 = CalcDinamicaPinze_TPA( HTrave, STrave, LTrave) if IdTrave >= 0 then local sPrt = '( *** Part '.. EgtNumToString( IdTrave, 0) ..' ***)' @@ -1076,24 +1076,6 @@ function FindNextTool() return sTool, sHead, sTcPos end ---------------------------------------------------------------------- -function CalcDinamicaPinze( dH, dS, dL) - local MinTempoAcc = EMT.MINACC -- [ms] ~300 - local MaxTempoAcc = EMT.MAXACC -- [ms] ~4000 - local KgMtCubo= WoodDensity or 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 = EgtClamp( ( Massa * FMaxPinze) / ( 60 * ForzaAttrito), MinTempoAcc, MaxTempoAcc) - local RidFeed = 100 / Massa * 100 - if RidFeed > 100 then - RidFeed = 100 - elseif RidFeed < 10 then - RidFeed = 10 - end - return TempoAcc, MinTempoAcc, RidFeed -end - --------------------------------------------------------------------- function CalcCharStatus( sCmd, bSkipPress) -- aperto diff --git a/Common_FAST.mlpe b/Common_FAST.mlpe index bb9357c..e8bace1 100644 --- a/Common_FAST.mlpe +++ b/Common_FAST.mlpe @@ -168,13 +168,13 @@ function OnSimulDispositionStart() -- Determino dimensioni del grezzo local nSolId = EgtGetFirstNameInGroup( EgtGetFirstRawPart() or GDB_ID.NULL, 'RawSolid') or GDB_ID.NULL local b3Sol = EgtGetBBoxGlob( nSolId, GDB_BB.STANDARD) - EMT.LB = 0 - EMT.SB = 0 - EMT.HB = 0 + EMT.LT = 0 + EMT.ST = 0 + EMT.HT = 0 if b3Sol then - EMT.LB = b3Sol:getDimX() - EMT.SB = b3Sol:getDimY() - EMT.HB = b3Sol:getDimZ() + EMT.LT = b3Sol:getDimX() + EMT.ST = b3Sol:getDimY() + EMT.HT = b3Sol:getDimZ() end -- Carico primo utensile sulla testa 1 local sTool, nTlen = FindFirstToolOnHead( 'H1') @@ -558,7 +558,7 @@ function OnSimulToolDeselect() -- movimento scarico sega a catena if EMT.HEAD == 'H3' then -- se avevo motosega, torno in zona sicura senza ruotare assi rotanti - if EMT.HB > BeamHeightForFixRot then + if EMT.HT > BeamHeightForFixRot then SimulMoveAxis( 'X', SafeXRotAxes, MCH_SIM_STEP.RAPID) end local dPosA = EgtGetAxisPos( 'A') @@ -796,7 +796,7 @@ function OnSimulMoveStart() EMT.MCHFIRST = false local bZmax = ( EMT.TOOL ~= EMT.PREVTOOL or EMT.L3 > -1) -- con pezzi alti aggiorno gli assi rotanti prima di muovermi sopra il pezzo - if not EMT.LOAD and EMT.MOVE == 0 and ( EMT.HB > BeamHeightForFixRot or ( EMT.HEAD == 'H1' and EMT.TOTLEN > 350) or bGoToHome) and EMT.FLAG2 == 1 then + if not EMT.LOAD and EMT.MOVE == 0 and ( EMT.HT > BeamHeightForFixRot or ( EMT.HEAD == 'H1' and EMT.TOTLEN > 350) or bGoToHome) and EMT.FLAG2 == 1 then -- se motosega mi muovo a X di sicurezza per ruotare, prima si raddrizza B e poi C in posizione if EMT.HEAD == 'H3' and bGoToHome then SimulMoveAxis( 'X', SafeXRotAxes, MCH_SIM_STEP.RAPID) @@ -928,14 +928,14 @@ function ExecAuxCmd( sCmd) elseif Cmd[1] == '11' then local dPY = MaxOpen if Cmd[2] ~= '0' then - dPY = EgtIf( EMT.ROT == -1, EMT.HB, EMT.SB) + dPY = EgtIf( EMT.ROT == -1, EMT.HT, EMT.ST) end SimulMoveAxis( 'PY', dPY, MCH_SIM_STEP.RAPID) SetPYLight( Cmd[2] ~= '0') elseif Cmd[1] == '12' then local dPV = MaxOpen if Cmd[2] ~= '0' then - dPV = EgtIf( EMT.ROT == -1, EMT.HB, EMT.SB) + dPV = EgtIf( EMT.ROT == -1, EMT.HT, EMT.ST) end SimulMoveAxis( 'PV', dPV, MCH_SIM_STEP.RAPID) SetPVLight( Cmd[2] ~= '0') @@ -1002,7 +1002,7 @@ function ExecUnloading() -- li sposto per lasciare spazio al nuovo pezzo local nId = EgtGetFirstInGroup( nVmGrpId) while nId do - EgtMove( nId, Vector3d( 0, EgtIf( BD.RIGHT_LOAD, ( EMT.SB + 50.0), -( EMT.SB + 50.0)), 0), GDB_RT.GLOB) + EgtMove( nId, Vector3d( 0, EgtIf( BD.RIGHT_LOAD, ( EMT.ST + 50.0), -( EMT.ST + 50.0)), 0), GDB_RT.GLOB) nId = EgtGetNext( nId) end -- creo un nuovo layer e vi inserisco il nuovo pezzo @@ -1220,6 +1220,18 @@ local FALL_T = 2 * ESTIMATION_RAPID_COEFF -- s --------------------------------------------------------------------- function OnEstimStart() EMT.INCHES = not EgtUiUnitsAreMM() -- unità di misura mm/inches + + -- TPA + if NumericalControl == 'TPA' then + EMT.FMAXPINZE = EgtClamp( MaxFeedPinze or 154000, 20000, 160000) -- feed massima pinze + EMT.MAXACC = MaxAcc or 4000 -- accelerazione massima pinze. In realtà è il tempo in millisecondi, quindi MAXACC corrisponde al tempo massimo per raggiungere la velocità desiderata + EMT.MINACC = MinAcc or 300 -- accelerazione minima pinze. In realtà è il tempo in millisecondi, quindi MINACC corrisponde al tempo massimo per raggiungere la velocità desiderata + -- NUM_PLUS e NUM + else + EMT.FMAXPINZE = EgtClamp( MaxFeedPinze or 154000, 20000, 160000) -- feed massima pinze + EMT.MAXACC = MaxAcc or ( EMT.FMAXPINZE / ( 60 * 0.3)) -- accelerazione massima pinze + EMT.MINACC = MinAcc or ( EMT.FMAXPINZE / ( 60 * 4)) -- accelerazione minima pinze + end end --------------------------------------------------------------------- @@ -1305,6 +1317,15 @@ function OnEstimDispositionEnd() EMT.OPEISDISP = false end +--------------------------------------------------------------------- +function OnEstimRawMoveData() + -- se start del pezzo + if IsStartOrRestPhase( EMT.PHASE) then + EMT.SPLIT = false + end + OnRawMoveData() +end + --------------------------------------------------------------------- function OnEstimToolSelect() -- reset indice utensile in tabella lunghezze @@ -1361,6 +1382,12 @@ function OnEstimMachiningEnd() EMT.TLE_NAME = nil EMT.TLE_TIME = nil end + + EMT.MCHUSERNOTES = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' + EMT.MCHSPLIT = ( EMT.MCHUSERNOTES:find( 'Split;', 1, true) ~= nil) + if EMT.MCHSPLIT then + EMT.SPLIT = true + end end --------------------------------------------------------------------- @@ -1491,11 +1518,11 @@ function OnEstimRapid() EMT.MCHEXTLEN = EMT.MCHEXTLEN + dLen -- calcolo tempo local dTime = RAPID_MIN_T - local dT1 = abs( dL1) / RAPID_X_FEED * 60 + local dT1 = CalcMoveTime( abs( dL1), RAPID_X_FEED, EMT.SPLIT) if dT1 > dTime then dTime = dT1 end - local dT2 = abs( dL2) / RAPID_Y_FEED * 60 + local dT2 = CalcMoveTime( abs( dL2), EMT.FMAXPINZE, EMT.SPLIT) if dT2 > dTime then dTime = dT2 end - local dT3 = abs( dL3) / RAPID_Z_FEED * 60 + local dT3 = CalcMoveTime( abs( dL3), RAPID_Z_FEED, EMT.SPLIT) if dT3 > dTime then dTime = dT3 end local dT4 = abs( dR1) / RAPID_C_FEED * 60 if dT4 > dTime then dTime = dT4 end @@ -1517,7 +1544,7 @@ function OnEstimLinear() local dLen = sqrt( dL1 * dL1 + dL2 * dL2 + dL3 * dL3) EMT.MCHCUTLEN = EMT.MCHCUTLEN + dLen -- calcolo tempo - local dTime = dLen / EMT.F * 60 + local dTime = CalcMoveTime( dLen, EMT.F, EMT.SPLIT) EMT.MCHCUTTIME = EMT.MCHCUTTIME + dTime EgtOutLog( string.format( ' G1 Len=%.0f Time=%.2f', dLen, dTime), 5) -- aggiorno valori come precedenti @@ -1664,6 +1691,70 @@ function GetParkT() end end +--------------------------------------------------------------------- +function CalcDinamicaPinze_TPA( dH, dS, dL) + local MinTempoAcc = EMT.MINACC -- [ms] ~300 + local MaxTempoAcc = EMT.MAXACC -- [ms] ~4000 + local KgMtCubo= WoodDensity or 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 = EgtClamp( ( Massa * FMaxPinze) / ( 60 * ForzaAttrito), MinTempoAcc, MaxTempoAcc) + local RidFeed = 100 / Massa * 100 + if RidFeed > 100 then + RidFeed = 100 + elseif RidFeed < 10 then + RidFeed = 10 + end + return TempoAcc, MinTempoAcc, RidFeed +end + +--------------------------------------------------------------------- +function CalcDinamicaPinze_NUM( dH, dS, dL) + local KgMtCubo= WoodDensity or 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) + local AccMaxPinze = EMT.MAXACC + local AccPinze = EgtClamp( FMaxPinze / ( 60 * TempoAcc), EMT.MINACC, EMT.MAXACC) + local RidFeed = 100 / Massa * 100 + if RidFeed > 100 then + RidFeed = 100 + elseif RidFeed < 10 then + RidFeed = 10 + end + return AccPinze, AccMaxPinze, RidFeed, TempoAcc +end + +--------------------------------------------------------------------- +function CalcMoveTime( dPathLen, dFeed, bIsSplitted) + local dTime + local dFeedInSec = dFeed / 60 + + if NumericalControl == 'TPA' then + local dTempoAcc, _, _ = CalcDinamicaPinze_TPA( EMT.HT, EMT.ST, EgtIf( bIsSplitted, EMT.LT, EMT.LB)) + dTempoAcc = dTempoAcc / 1000 + -- se si raggiunge la velocità massima + if dPathLen >= dFeedInSec * dTempoAcc then + dTime = dTempoAcc * 2 + ( ( dPathLen - dFeedInSec * dTempoAcc) / dFeedInSec) + else + dTime = 2 * sqrt( (dPathLen * dTempoAcc) / dFeedInSec) + end + else + local dAcc, _, _, _ = CalcDinamicaPinze_NUM( EMT.HT, EMT.ST, EgtIf( bIsSplitted, EMT.LT, EMT.LB)) + -- Caso 1: dFeed raggiunta + if dPathLen >= ( dFeedInSec ^ 2) / dAcc then + dTime = ( dFeedInSec / dAcc) + ( dPathLen / dFeedInSec) + -- Caso 2: dFeed non raggiunta + else + dTime = 2 * sqrt( dPathLen / dAcc) + end + end + + return dTime +end + --------------------------------------------------------------------- -- *** END GENERAL *** --------------------------------------------------------------------- diff --git a/UpdateLog.txt b/UpdateLog.txt index ad9dabe..918cf09 100644 --- a/UpdateLog.txt +++ b/UpdateLog.txt @@ -1,5 +1,8 @@ ==== Common_FAST Update Log ==== +Versione 2.7-- (--/--/2025) +- (EST) Stima tempi considerando accelerazioni + Versione 2.7i1 (08/09/2025) - (SIM-GEN) Se lavorazione precedente e successiva con motosega e si cambiano assi rotanti, vado in parcheggio per ruotare. Ticket#1844 - (SIM-GEN) Per NEWCLAMPING, corretto un caso di riposizionemento allo scarico dove la pinza V poteva andare in posizione direttamente, ma cercava di fare passo pellegrino. Ticket#2572 diff --git a/Version.lua b/Version.lua index 3841ba9..e0a36b2 100644 --- a/Version.lua +++ b/Version.lua @@ -3,7 +3,7 @@ local InfoCommon_STD_PP = { NAME = 'Common_FAST', -- nome script PP standard - VERSION = '2.7i1', -- versione script + VERSION = '2.7--', -- versione script MIN_MACH_VER_PP_COMMON = '2.5k1' -- versione minima kernel } From a8a708697df2cfe3d43e38270a631bb0550fac90 Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Wed, 17 Sep 2025 08:56:07 +0200 Subject: [PATCH 2/2] Prelievo e deposito motosega con gli angoli comunicati da Essetre --- Common_FAST.mlpe | 15 ++++++++++++--- UpdateLog.txt | 3 ++- Version.lua | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Common_FAST.mlpe b/Common_FAST.mlpe index e8bace1..400fb60 100644 --- a/Common_FAST.mlpe +++ b/Common_FAST.mlpe @@ -563,9 +563,9 @@ function OnSimulToolDeselect() end local dPosA = EgtGetAxisPos( 'A') if abs( dPosA) < 0.1 then - SimulMoveAxes( 'B', 0, MCH_SIM_STEP.COLLROT, 'C', EgtIf( BD.RIGHT_LOAD, 180, 0), MCH_SIM_STEP.COLLROT) + SimulMoveAxes( 'B', 0, MCH_SIM_STEP.COLLROT, 'C', EgtIf( BD.RIGHT_LOAD, -180, 0), MCH_SIM_STEP.COLLROT) else - SimulMoveAxes( 'B', 0, MCH_SIM_STEP.COLLROT, 'C', EgtIf( BD.RIGHT_LOAD, 90, -90), MCH_SIM_STEP.COLLROT) + SimulMoveAxes( 'B', 0, MCH_SIM_STEP.COLLROT, 'C', EgtIf( BD.RIGHT_LOAD, 90, 270), MCH_SIM_STEP.COLLROT) end SimulMoveAxis( 'X', 0, MCH_SIM_STEP.RAPID) -- movimento scarico rinvio @@ -608,7 +608,16 @@ function OnSimulToolDeselect() if EMT.NEXTHEAD ~= 'H3' and EMT.NEXTHEAD ~= 'H5' and EMT.NEXTHEAD ~= 'H6' then SimulMoveAxes( 'B', EgtIf( GetTCSet( EMT.TCPOS) == 1, 90, -90), MCH_SIM_STEP.RAPROT, 'C', EgtIf( BD.RIGHT_LOAD, 90, -90), MCH_SIM_STEP.RAPROT) else - SimulMoveAxes( 'B', 0, MCH_SIM_STEP.RAPROT, 'C', EgtIf( BD.RIGHT_LOAD, 90, -90), MCH_SIM_STEP.RAPROT) + if EMT.NEXTHEAD == 'H3' then + local dPosA = EgtGetAxisPos( 'A') + if abs( dPosA) < 0.1 then + SimulMoveAxes( 'B', 0, MCH_SIM_STEP.RAPROT, 'C', EgtIf( BD.RIGHT_LOAD, 90, 270), MCH_SIM_STEP.RAPROT) + else + SimulMoveAxes( 'B', 0, MCH_SIM_STEP.COLLROT, 'C', EgtIf( BD.RIGHT_LOAD, -180, 0), MCH_SIM_STEP.COLLROT) + end + else + SimulMoveAxes( 'B', 0, MCH_SIM_STEP.RAPROT, 'C', EgtIf( BD.RIGHT_LOAD, 90, -90), MCH_SIM_STEP.RAPROT) + end end -- se segue lama, carico utensile di default if EMT.NEXTHEAD == 'H2' then diff --git a/UpdateLog.txt b/UpdateLog.txt index 918cf09..a065644 100644 --- a/UpdateLog.txt +++ b/UpdateLog.txt @@ -1,7 +1,8 @@ ==== Common_FAST Update Log ==== -Versione 2.7-- (--/--/2025) +Versione 2.7i2 (17/09/2025) - (EST) Stima tempi considerando accelerazioni +- (SIM) Prelievo e deposito motosega con gli angoli comunicati da Essetre Versione 2.7i1 (08/09/2025) - (SIM-GEN) Se lavorazione precedente e successiva con motosega e si cambiano assi rotanti, vado in parcheggio per ruotare. Ticket#1844 diff --git a/Version.lua b/Version.lua index e0a36b2..4c395f5 100644 --- a/Version.lua +++ b/Version.lua @@ -3,7 +3,7 @@ local InfoCommon_STD_PP = { NAME = 'Common_FAST', -- nome script PP standard - VERSION = '2.7--', -- versione script + VERSION = '2.7i2', -- versione script MIN_MACH_VER_PP_COMMON = '2.5k1' -- versione minima kernel }