Lettura posizione asse C da variabile PLC
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
Public Const K_A10ID As String = "A10Id"
|
||||
Public Const K_DELTA_C As String = "DeltaC"
|
||||
Public Const K_ININCHES As String = "InInches"
|
||||
Public Const K_CPOS As String = "CPos"
|
||||
|
||||
Public Const S_NCSIEMENS As String = "NcSiemens"
|
||||
Public Const K_COMM_NAME As String = "CommName"
|
||||
|
||||
@@ -413,6 +413,10 @@ Public Class CNCommunication
|
||||
GetPrivateProfileString(S_NCDATA, K_NAXES, "", sVal, m_MainWindow.GetMachIniFile())
|
||||
m_CN.SetCnDataVar(CN_generico.CnData.nAxes, sVal)
|
||||
|
||||
' Solo per controllo speciale NUM 22/01/2025
|
||||
GetPrivateProfileString(S_NCDATA, K_CPOS, "", sVal, m_MainWindow.GetMachIniFile())
|
||||
m_CN.SetCnDataVar(CN_generico.CnData.CPos, sVal)
|
||||
If Not String.IsNullOrEmpty(sVal) Then m_CN.bCPos = True
|
||||
|
||||
' Inizializzo la comunicazione
|
||||
m_CN.Init()
|
||||
@@ -1600,9 +1604,17 @@ Public Class CNCommunication
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
Private Sub GetSpecialCAxes()
|
||||
If m_CN.bCPos Then
|
||||
m_CN.d_axis_position(m_nA4) = m_CN.dCPos
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Friend Function GetAxesPositions(ByRef dA1 As Double, ByRef dA2 As Double, ByRef dA3 As Double,
|
||||
ByRef dA4 As Double, ByRef dA5 As Double, ByRef dA6 As Double,
|
||||
ByRef dA7 As Double, ByRef dA8 As Double, ByRef dA9 As Double, ByRef dA10 As Double) As Boolean
|
||||
' gestione speciale asse C
|
||||
GetSpecialCAxes()
|
||||
dA1 = If(m_nA1 >= 0, m_CN.d_axis_position(m_nA1), 0)
|
||||
dA2 = If(m_nA2 >= 0, m_CN.d_axis_position(m_nA2), 0)
|
||||
dA3 = If(m_nA3 >= 0, m_CN.d_axis_position(m_nA3), 0)
|
||||
@@ -1619,6 +1631,8 @@ Public Class CNCommunication
|
||||
|
||||
Friend Function GetAxesPositions(ByRef dA1 As Double, ByRef dA2 As Double, ByRef dA3 As Double,
|
||||
ByRef dA4 As Double, ByRef dA5 As Double) As Boolean
|
||||
' gestione speciale asse C
|
||||
GetSpecialCAxes()
|
||||
dA1 = If(m_nA1 >= 0, m_CN.d_axis_position(m_nA1), 0)
|
||||
dA2 = If(m_nA2 >= 0, m_CN.d_axis_position(m_nA2), 0)
|
||||
dA3 = If(m_nA3 >= 0, m_CN.d_axis_position(m_nA3), 0)
|
||||
@@ -1637,6 +1651,8 @@ Public Class CNCommunication
|
||||
End Function
|
||||
|
||||
Friend Function GetRotaryAxesPositions(ByRef dR1 As Double, ByRef dR2 As Double) As Boolean
|
||||
' gestione speciale asse C
|
||||
GetSpecialCAxes()
|
||||
dR1 = If(m_nA4 >= 0, m_CN.d_axis_position(m_nA4), 0)
|
||||
dR2 = If(m_nA5 >= 0, m_CN.d_axis_position(m_nA5), 0)
|
||||
Return m_bAxesOk
|
||||
|
||||
@@ -8,7 +8,7 @@ Public MustInherit Class CN_generico
|
||||
Public Const MAX_VAR As Short = 100
|
||||
Public Const MAX_VALUES As Short = 9 ' Max. index to read the data from the FXServer array
|
||||
Public Const MAX_TOOLS As Short = 100
|
||||
Public Const NUM_DATA = 57 ' Numero di dati del CN (Speed,Feed,...)
|
||||
Public Const NUM_DATA = 58 ' Numero di dati del CN (Speed,Feed,...)
|
||||
|
||||
Public m_NewVariable As Boolean = False ' per scrittura delle vairbaili Apllication del PLC
|
||||
|
||||
@@ -74,6 +74,8 @@ Public MustInherit Class CN_generico
|
||||
nAxes = 55
|
||||
|
||||
ResetStatus = 56
|
||||
|
||||
CPos = 57
|
||||
End Enum
|
||||
|
||||
Public Enum Type As Short
|
||||
@@ -233,6 +235,10 @@ Public MustInherit Class CN_generico
|
||||
Public bRemote As Boolean
|
||||
' Nuovi di bottoni -------------------------------------------
|
||||
|
||||
' gestione speciale asse C
|
||||
Public bCPos As Boolean = False
|
||||
Public dCPos As Double
|
||||
|
||||
' solo per NumOld
|
||||
Public bIsDripFeed As Boolean = False
|
||||
|
||||
|
||||
+11
-8
@@ -53,14 +53,14 @@ Namespace Num
|
||||
Dim WithEvents objDRunTimeSystem As FXServer.DRunTimeSystem
|
||||
Dim WithEvents objDGroupManager As FXServer.DGroupManager
|
||||
Dim WithEvents objDReadELS As FXServer.DReadELS
|
||||
' questa è classe che serve a scrivere i dati nel PLC
|
||||
' questa � classe che serve a scrivere i dati nel PLC
|
||||
Dim WithEvents objDPlcVariables As FXServer.DPlcVariables
|
||||
' questa è la classe che serve a scrivere i dati nelle variabili E
|
||||
' questa � la classe che serve a scrivere i dati nelle variabili E
|
||||
Dim WithEvents objDVariables As FXServer.DVariables
|
||||
Dim WithEvents objDReadTestExectime As FXServer.DReadTestExectime
|
||||
Dim WithEvents objDPosition As FXServer.DPosition
|
||||
Dim WithEvents objDNCKParameter As FXServer.DNCKParameter
|
||||
' questa è la classe che serve a scrivere i comandi MDI (come ad esempio le funzioni M)
|
||||
' questa � la classe che serve a scrivere i comandi MDI (come ad esempio le funzioni M)
|
||||
Dim WithEvents objDMdiCommand As FXServer.DMdiCommand
|
||||
Dim WithEvents objDMainCncData As FXServer.DMainCncData
|
||||
|
||||
@@ -458,7 +458,7 @@ Namespace Num
|
||||
'sz_var_names.Add("Application.IOCONFIG_GLOBALS.Flexium_NCK.WCNC.Spindle[2].Override") ' segnaposto per la speed override
|
||||
'sz_var_names.Add("Application.GVL_HMI_OMAG.HMI_Vel_prog") ' FEED
|
||||
'sz_var_names.Add("Application.GVL_HMI_OMAG.HMI_LabRPM") ' Speed
|
||||
'sz_var_names.Add("Application.GVL_HMI_OMAG.HMI_LabAmper") ' Ampère = *0.01
|
||||
'sz_var_names.Add("Application.GVL_HMI_OMAG.HMI_LabAmper") ' Amp�re = *0.01
|
||||
|
||||
' Creo lista nomi variabili PLC da leggere
|
||||
m_nCnDataVarNum = 0
|
||||
@@ -823,7 +823,7 @@ Namespace Num
|
||||
|
||||
|
||||
' Only for FX Server >= 3.9.0.0
|
||||
' poi in realtà ritorna sempre tipo = -1 per cui è eguale alle altre.....
|
||||
' poi in realt� ritorna sempre tipo = -1 per cui � eguale alle altre.....
|
||||
Private Sub objDReadELS_ValueChanged3(nHandle As Integer, value As Object, DataType As Short, Writable As Short, nerrorCode As Short) Handles objDReadELS.ValueChanged3
|
||||
|
||||
Dim edata_type As eDatatype
|
||||
@@ -996,7 +996,7 @@ Namespace Num
|
||||
d_spindle_eff(0) = CDbl(values(n))
|
||||
Case CnData.SpeedOvr ' (5) Potenziom. speed = ...
|
||||
n_spindle_override(0) = CShort(Math.Round((CDbl(values(n)) * 50 / 255) + 50))
|
||||
Case CnData.Power ' (6) Ampère = * 0.01
|
||||
Case CnData.Power ' (6) Amp�re = * 0.01
|
||||
d_spindle_power = CDbl(CLng(values(n))) * 0.01
|
||||
b_spindle_power_changed = True
|
||||
Case CnData.Spindle ' (7) Stato rotazione mandrino
|
||||
@@ -1095,6 +1095,9 @@ Namespace Num
|
||||
Case CnData.EnablePC ' (54)
|
||||
nEnablePc = CInt(values(n))
|
||||
|
||||
Case CnData.CPos ' (57)
|
||||
dCPos = CDbl(values(n))
|
||||
|
||||
End Select
|
||||
Next
|
||||
|
||||
@@ -1701,11 +1704,11 @@ Namespace Num
|
||||
nTimeOut += 1
|
||||
End While
|
||||
If Not bSetModeDone Then
|
||||
EgtOutLog("Errore cambio modalità in MDI: " & TIMEOUT)
|
||||
EgtOutLog("Errore cambio modalit� in MDI: " & TIMEOUT)
|
||||
Return TIMEOUT 'Errore di timeout
|
||||
End If
|
||||
If nSetModeResult <> 0 Then
|
||||
EgtOutLog("Errore 2 cambio modalità in MDI: " & nSetModeResult)
|
||||
EgtOutLog("Errore 2 cambio modalit� in MDI: " & nSetModeResult)
|
||||
End If
|
||||
Return nSetModeResult
|
||||
|
||||
|
||||
Reference in New Issue
Block a user