Update conf x gestione ADIGE

This commit is contained in:
Samuele Locatelli
2023-12-19 17:28:52 +01:00
parent 564407fdd1
commit d183d1f336
7 changed files with 311 additions and 106 deletions
+6 -1
View File
@@ -412,6 +412,11 @@ namespace IOB_UT_NEXT
/// </summary>
OpcUaEwon,
/// <summary>
/// Adapter OPC-UA per Ewon x Adige (BLM) / STIL
/// </summary>
OpcUaEwonAdige,
/// <summary>
/// Adapter OPC-UA per Ewon x BLM / Mecart
/// </summary>
@@ -423,7 +428,7 @@ namespace IOB_UT_NEXT
OpcUaEwonMonti,
/// <summary>
/// Adapter OPC-UA per Ewon x Mecolpress / Stil
/// Adapter OPC-UA per Ewon x Mecolpress (BLM) / STIL
/// </summary>
OpcUaEwonMecolpress,
+5
View File
@@ -1752,6 +1752,11 @@ namespace IOB_WIN_NEXT
start.Enabled = true;
break;
case tipoAdapter.OpcUaEwonAdige:
iobObj = new IobOpc.OpcUaEwonAdige(this, IOBConf);
start.Enabled = true;
break;
case tipoAdapter.OpcUaEwonBLM:
iobObj = new IobOpc.OpcUaEwonBLM(this, IOBConf);
start.Enabled = true;
+1 -1
View File
@@ -29,7 +29,6 @@ CLI_INST=SteamWareSim
;STARTLIST=FINASSI_HELPI_01
;STARTLIST=FINASSI_OMP_01
;STARTLIST=BAGLIETTO_CIMOLAI_01
;STARTLIST=SIMUL_01
;STARTLIST=GIACO_SAIM_003
;STARTLIST=PIZ09
;STARTLIST=IMI_RIMOR_SAB_01
@@ -43,6 +42,7 @@ CLI_INST=SteamWareSim
;STARTLIST=IMI_GOMBA
;STARTLIST=PING
;STARTLIST=SIMUL_02
;STARTLIST=SIM_DP_01
;NB: mettere copy always ai file di conf x fare test...
STARTLIST=SIMUL_01
+4 -1
View File
@@ -1,7 +1,7 @@
;Configurazione IOB-WIN
[IOB]
;Centro di lavoro OpcUa
CNCTYPE=OpcUaEwon
CNCTYPE=OpcUaEwonAdige
PING_MS_TIMEOUT=500
[MACHINE]
@@ -63,6 +63,9 @@ ENABLE_DYN_DATA=FALSE
FORCE_DYN_DATA=TRUE
ENABLE_DATA_FILTER=TRUE
ENABLE_CLI_RESTART=TRUE
MAX_TRY_PING=3
NO_PING=TRUE
DISABLE_SEND_WDST=TRUE
; conf parametri memoria READ/WRITE
OPC_PARAM_CONF=STEL_210.json
+191 -103
View File
@@ -2,54 +2,86 @@
"BrowseFullVal": "ns=4;i=5001",
"BrowseNSIndex": 4,
"BrowseValue": 5001,
"keyPartCount": "tomes_17_partial_prod",
"keyPartReq": "tomach_6_quantity",
"keyPartCount": "PartDone(0)",
"keyPartReq": "PartToDo(0)",
"keyPartId": "",
"keyProgName": "",
"keyProgName": "PartName(0)",
"keyRunMode": "",
"pingAsPowerOn": false,
"pingAsPowerOn": true,
"Identity": {
"UserName": "opcread",
"Passwd": "opcread"
},
"condWork": [
{
"keyName": "tomes_5_autom",
"targetValue": "True"
"keyName": "MachineStatus(0)",
"targetValue": "4"
}
],
"condPowerOn": {
"condWorkOpc": {
"checkMode": "AND",
"checkList": [
{
"keyName": "tomes_2_mach_on",
"targetValue": "True"
"keyName": "MachineStatus(0)",
"targetValue": "4"
}
]
},
"condPowerOn": {
"checkMode": "OR",
"negateValue": true,
"checkList": [
{
"keyName": "MachineStatus(0)",
"targetValue": "0"
},
{
"keyName": "MachineStatus(0)",
"targetValue": "1"
},
{
"keyName": "MachineStatus(0)",
"targetValue": "2"
}
]
},
"condReady": {
"checkMode": "AND",
"checkList": []
"checkMode": "OR",
"checkList": [
{
"keyName": "MachineStatus(0)",
"targetValue": "3"
},
{
"keyName": "MachineStatus(0)",
"targetValue": "5"
}
]
},
"condManual": {
"checkMode": "AND",
"checkList": [
{
"keyName": "tomes_6_manual",
"targetValue": "True"
"keyName": "MachineStatus(0)",
"targetValue": "8"
}
]
},
"condEStop": {
"checkMode": "AND",
"checkList": []
"checkList": [
{
"keyName": "EmergencyState",
"targetValue": "0"
}
]
},
"condError": {
"checkMode": "AND",
"checkList": [
{
"keyName": "tomes_7_alarm",
"targetValue": "True"
"keyName": "MachineStatus(0)",
"targetValue": "6"
}
]
},
@@ -59,15 +91,20 @@
},
"condWarmUpCoolDown": {
"checkMode": "OR",
"checkList": [],
"negateValue": true
"negateValue": true,
"checkList": [
{
"keyName": "MachineStatus(0)",
"targetValue": "7"
}
]
},
"condWarning": {
"checkMode": "AND",
"checkList": [
{
"keyName": "tomes_8_warning",
"targetValue": "True"
"keyName": "MachineStatus(0)",
"targetValue": "9"
}
]
},
@@ -75,98 +112,149 @@
"checkMode": "AND",
"checkList": [
{
"keyName": "tomes_3_setup",
"targetValue": "True"
"keyName": "MachineStatus(0)",
"targetValue": "7"
}
]
},
"fluxLogVeto": [
"tomes_1_Watchdog"
],
"fluxLogVeto": [],
"itemTranslation": {
"avail": "Machine Available",
"rstat": "Execution Mode",
"mode": "Controller Mode",
"ncprog": "Program Name",
"tomes_13_good_prod": "Pezzi Prodotta",
"tomach_6_quantity": "Qta Richiesta",
"PartName(0)": "Program Name",
"PartDone(0)": "Pezzi Prodotti",
"PartToDo(0)": "Qta Richiesta",
"MachineStatus(0)": "Stato Macchina principale",
"MachineStatus(1)": "Stato Macchina secondario",
"EmergencyState": "Emergenza",
"fdovrd": "PATH FEED OVERRIDE",
"rovrd": "PATH RAPID OVERRIDE"
},
"paramsEndThresh": {
"InvDDone": 50
},
"mMapWrite": {
"setPzComm": {
"name": "setPzComm",
"description": "Qty",
"tipoMem": "Int",
"memAddr": "ns=4;s=tomach_6_quantity",
"index": 0,
"size": 4
},
"setComm": {
"name": "setComm",
"description": "Commessa",
"tipoMem": "String",
"memAddr": "ns=4;s=tomach_4_prod_order",
"index": 0,
"size": 24
},
"setArt": {
"name": "setArt",
"description": "Articolo",
"tipoMem": "String",
"memAddr": "ns=4;s=tomach_3_code_die",
"index": 0,
"size": 24
}
},
"subscribedItems": [
"ns=4;s=tomes_1_Watchdog",
"ns=4;s=tomes_2_mach_on",
"ns=4;s=tomes_3_setup",
"ns=4;s=tomes_4_impulse",
"ns=4;s=tomes_5_autom",
"ns=4;s=tomes_6_manual",
"ns=4;s=tomes_7_alarm",
"ns=4;s=tomes_8_warning",
"ns=4;s=tomes_10_cycle_life",
"ns=4;s=tomes_11_ack_new_order",
"ns=4;s=tomes_13_good_prod",
"ns=4;s=tomes_14_bad_prod_calipso",
"ns=4;s=tomes_15_bad_prod_startup",
"ns=4;s=tomes_16_bad_prod_stop",
"ns=4;s=tomes_17_partial_prod",
"ns=4;s=tomes_18_total_prod",
"ns=4;s=tomes_20_code_die",
"ns=4;s=tomes_21_order",
"ns=4;s=tomach_1_watchdog",
"ns=4;s=tomach_2_new_prod",
"ns=4;s=tomach_3_code_die",
"ns=4;s=tomach_4_prod_order",
"ns=4;s=tomach_6_quantity"
],
"WatchDog": {
"IsEnabled": true,
"MemConfRead": "ns=4;s=tomes_1_Watchdog",
"MemConfWrite": "ns=4;s=tomach_1_watchdog",
"MaxVal": 9999
},
"SetupConf": {
"SetupMode": "MECOLPRESS",
"EnableAdvSetup": false,
"checkParList": {
"tomach_3_code_die": "tomes_20_code_die",
"tomach_4_prod_order": "tomes_21_order"
},
"writeParAction": [
{
"TargetParam": "ns=4;s=tomach_2_new_prod",
"TargetValEqual": 0,
"TargetValNotEqual": 1,
"DisablePzCountNotEqual": true
}
]
}
"ns=4;s=MachineCode",
"ns=4;s=MachineType",
"ns=4;s=MachineStatus(0)",
"ns=4;s=MachineStatus(1)",
"ns=4;s=NumOfAlarms",
"ns=4;s=NumOfMessages",
"ns=4;s=AlarmCode(0)",
"ns=4;s=AlarmCode(1)",
"ns=4;s=AlarmCode(2)",
"ns=4;s=AlarmCode(3)",
"ns=4;s=AlarmCode(4)",
"ns=4;s=AlarmCode(5)",
"ns=4;s=AlarmCode(6)",
"ns=4;s=AlarmCode(7)",
"ns=4;s=AlarmCode(8)",
"ns=4;s=AlarmCode(9)",
"ns=4;s=AlarmText(0)",
"ns=4;s=AlarmText(1)",
"ns=4;s=AlarmText(2)",
"ns=4;s=AlarmText(3)",
"ns=4;s=AlarmText(4)",
"ns=4;s=AlarmText(5)",
"ns=4;s=AlarmText(6)",
"ns=4;s=AlarmText(7)",
"ns=4;s=AlarmText(8)",
"ns=4;s=AlarmText(9)",
"ns=4;s=MessageCode(0)",
"ns=4;s=MessageCode(1)",
"ns=4;s=MessageCode(2)",
"ns=4;s=MessageCode(3)",
"ns=4;s=MessageCode(4)",
"ns=4;s=MessageCode(5)",
"ns=4;s=MessageCode(6)",
"ns=4;s=MessageCode(7)",
"ns=4;s=MessageCode(8)",
"ns=4;s=MessageCode(9)",
"ns=4;s=MessageText(0)",
"ns=4;s=MessageText(1)",
"ns=4;s=MessageText(2)",
"ns=4;s=MessageText(3)",
"ns=4;s=MessageText(4)",
"ns=4;s=MessageText(5)",
"ns=4;s=MessageText(6)",
"ns=4;s=MessageText(7)",
"ns=4;s=MessageText(8)",
"ns=4;s=MessageText(9)",
"ns=4;s=SwitchOnDuration",
"ns=4;s=BladeName",
"ns=4;s=BladeCutSpeed",
"ns=4;s=BladeRotSpeed",
"ns=4;s=BladeRotTorquePercent",
"ns=4;s=BladeType",
"ns=4;s=BladeDiameter",
"ns=4;s=BladeThickness",
"ns=4;s=BladeTeethNum",
"ns=4;s=BladePartCut",
"ns=4;s=BladeAreaCut",
"ns=4;s=BladeRotSpeedSuggested",
"ns=4;s=BladeCutSpeedSuggested",
"ns=4;s=JobName(0)",
"ns=4;s=JobCode",
"ns=4;s=JobStatus(0)",
"ns=4;s=BarNum",
"ns=4;s=BarFinalScrapLength",
"ns=4;s=BarSectionType",
"ns=4;s=BarSectionDimMax",
"ns=4;s=BarSectionDimMin",
"ns=4;s=BarSectionThickness",
"ns=4;s=BarMaterialType",
"ns=4;s=PartName(0)",
"ns=4;s=PartName(1)",
"ns=4;s=PartName(2)",
"ns=4;s=PartName(3)",
"ns=4;s=PartName(4)",
"ns=4;s=PartOrderERP(0)",
"ns=4;s=PartOrderERP(1)",
"ns=4;s=PartOrderERP(2)",
"ns=4;s=PartOrderERP(3)",
"ns=4;s=PartOrderERP(4)",
"ns=4;s=PartWorkOrderERP(0)",
"ns=4;s=PartWorkOrderERP(1)",
"ns=4;s=PartWorkOrderERP(2)",
"ns=4;s=PartWorkOrderERP(3)",
"ns=4;s=PartWorkOrderERP(4)",
"ns=4;s=PartLength(0)",
"ns=4;s=PartLength(1)",
"ns=4;s=PartLength(2)",
"ns=4;s=PartLength(3)",
"ns=4;s=PartLength(4)",
"ns=4;s=PartToDo(0)",
"ns=4;s=PartToDo(1)",
"ns=4;s=PartToDo(2)",
"ns=4;s=PartToDo(3)",
"ns=4;s=PartToDo(4)",
"ns=4;s=PartDone(0)",
"ns=4;s=PartDone(1)",
"ns=4;s=PartDone(2)",
"ns=4;s=PartDone(3)",
"ns=4;s=PartDone(4)",
"ns=4;s=PartLastDuration(0)",
"ns=4;s=PartLastDuration(1)",
"ns=4;s=PartLastDuration(2)",
"ns=4;s=PartLastDuration(3)",
"ns=4;s=PartLastDuration(4)"
//"ns=4;s=EmergencyState",
//"ns=4;s=FeedRateOverride",
//"ns=4;s=OperativeModeCN",
//"ns=4;s=SoftwareVersions(0)",
//"ns=4;s=SoftwareVersions(1)",
//"ns=4;s=SoftwareVersions(2)",
//"ns=4;s=SoftwareVersions(3)",
//"ns=4;s=UserLevel",
//"ns=4;s=MachineModel",
//"ns=4;s=UseHourCount",
//"ns=4;s=DriveEnabledHourCount",
//"ns=4;s=JobTimeToFinish(0)",
//"ns=4;s=TotalPiecesCounter",
//"ns=4;s=PartIndex",
//"ns=4;s=CurrentDeviceSelected",
//"ns=4;s=PartDiscarded(0)",
//"ns=4;s=WireAvailableLength",
//"ns=4;s=eWonOn",
//"ns=4;s=ShutdownDeltaTime",
//"ns=4;s=CurrentCycle"
]
}
+1
View File
@@ -399,6 +399,7 @@
<Link>VersGen.cs</Link>
</Compile>
<Compile Include="IobFile\IobFileSoitaab.cs" />
<Compile Include="IobOpc\OpcUaEwonAdige.cs" />
<Compile Include="IobOpc\OpcUaKpwRama.cs" />
<Compile Include="IobOpc\OpcUaKpw.cs" />
<Compile Include="Iob\BaseObj.cs" />
+103
View File
@@ -0,0 +1,103 @@
using MapoSDK;
using Opc.Ua;
using System.Collections.Generic;
using System.Linq;
namespace IOB_WIN_NEXT.IobOpc
{
public class OpcUaEwonAdige : OpcUaEwon
{
#region Public Constructors
/// <summary>
/// Estende l'init della classe base, impiegando il pacchetto Nuget OPC-UA foundation con la
/// gestione specifica per EWON (es Adige/BLM, Stel)
/// https://github.com/OPCFoundation/UA-.NETStandard
/// </summary>
/// <param name="caller"></param>
/// <param name="IOBConf"></param>
public OpcUaEwonAdige(AdapterForm caller, IobConfiguration IOBConf) : base(caller, IOBConf)
{
lgInfo("Init Ewon versione Adige/BLM");
// inizializzo classe base...
if (!string.IsNullOrEmpty(getOptPar("CHANGE_ODL_MODE")))
{
CHANGE_ODL_MODE = getOptPar("CHANGE_ODL_MODE");
}
sendKeyRichiesta = true;
}
#endregion Public Constructors
#region Protected Methods
/// <summary>
/// Effettua vera scrittura parametri
/// </summary>
/// <param name="updatedPar"></param>
protected override void plcWriteParams(ref List<objItem> updatedPar)
{
base.plcWriteParams(ref updatedPar);
// se DEVO gestire setup Mecolpress...
if (opcUaParams.SetupConf.SetupMode == IOB_UT_NEXT.MachineSetupMode.MECOLPRESS)
{
List<WriteValue> nodes2Write = new List<WriteValue>();
// faccio un check tra i valori in memoria che devono corrispondere e se NON
// corrispondono --> metto valore in scrittura...
int numDiff = 0;
foreach (var item in opcUaParams.SetupConf.checkParList)
{
// cerco la memoria corrispondente...
var memorieMes = dataItemMem.Where(x => x.Key.Contains(item.Key)).ToList();
var memorieMac = dataItemMem.Where(x => x.Key.Contains(item.Value)).ToList();
// se ho trovato qualcosa verifico se corrispondono...
if (memorieMes.Count > 0 && memorieMes.Count > 0)
{
// controllo primo record con primo record
if (memorieMes.FirstOrDefault().Value.value != memorieMac.FirstOrDefault().Value.value)
{
numDiff++;
}
}
}
// ciclo le condizioni di uscita
foreach (var item in opcUaParams.SetupConf.writeParAction)
{
WriteValue commWriteVal = new WriteValue();
commWriteVal.NodeId = new NodeId(item.TargetParam);
commWriteVal.AttributeId = Attributes.Value;
commWriteVal.Value = new DataValue();
// se ho differenze --> scrivo richiesta attrezzaggio...
if (numDiff > 0)
{
commWriteVal.Value.Value = item.TargetValNotEqual;
}
else
{
commWriteVal.Value.Value = item.TargetValEqual;
}
// accodo x scrittura
nodes2Write.Add(commWriteVal);
lgInfo($"richiesta scrittura valore | nodeId: {commWriteVal.NodeId} | targetPar: {item.TargetParam} | val {commWriteVal.Value.Value}");
}
// x ora NON eseguo
if (opcUaParams.SetupConf.EnableAdvSetup)
{
// ora scrivo!
if (nodes2Write.Count > 0)
{
UA_ref.WriteNodes(nodes2Write);
}
}
}
}
#endregion Protected Methods
}
}