diff --git a/AgentBin/simulator/CMS_DEMO.xml b/AgentBin/simulator/CMS_DEMO.xml index 0fb9166..65d09b5 100644 --- a/AgentBin/simulator/CMS_DEMO.xml +++ b/AgentBin/simulator/CMS_DEMO.xml @@ -35,11 +35,8 @@ - - @@ -59,11 +56,8 @@ - - @@ -83,11 +77,8 @@ - - @@ -107,11 +98,8 @@ - - @@ -128,16 +116,8 @@ - - + + @@ -154,16 +134,8 @@ - - + + @@ -180,8 +152,6 @@ - diff --git a/MTC_Sim/.vs/MTC_Sim/v14/.suo b/MTC_Sim/.vs/MTC_Sim/v14/.suo index 51c6a14..249a6bc 100644 Binary files a/MTC_Sim/.vs/MTC_Sim/v14/.suo and b/MTC_Sim/.vs/MTC_Sim/v14/.suo differ diff --git a/MTC_Sim/MTC_Sim/AdapterConf.cs b/MTC_Sim/MTC_Sim/AdapterConf.cs index fc7c9d5..8835f54 100644 --- a/MTC_Sim/MTC_Sim/AdapterConf.cs +++ b/MTC_Sim/MTC_Sim/AdapterConf.cs @@ -20,7 +20,7 @@ namespace MTC_Sim { string sNomeAdapt; int nVers; - public tipoAdapter etipoAdapt; + tipoAdapter etipoAdapt; element[] _VacuumPump; element[] _VacuumAct; @@ -38,7 +38,7 @@ namespace MTC_Sim public AdapterConf() { sNomeAdapt = ""; - etipoAdapt = tipoAdapter.Demo; + etipoAdapt = tipoAdapter.DEMO; } public int nVacuumPump { diff --git a/MTC_Sim/MTC_Sim/AdapterConf/CMS_FANUC.xml b/MTC_Sim/MTC_Sim/AdapterConf/CMS_FANUC.xml index 858304c..f633571 100644 --- a/MTC_Sim/MTC_Sim/AdapterConf/CMS_FANUC.xml +++ b/MTC_Sim/MTC_Sim/AdapterConf/CMS_FANUC.xml @@ -1,9 +1,8 @@ - Demo 1 - CMS_ADAPTER_00 - Fanuc + CMS_ADAPTER_FANUC + FANUC VacPump_01 @@ -156,39 +155,83 @@ Path_01_FeedRate - 0#15 + INT#D8888.0 Path_01_FeedOverr - 16#31 + INT#D8888.0 Path_01_RapidOverr - 32#47 + INT#D8888.0 Path_01_PosActX - 48#63 + FLOAT#D7777.0 Path_01_PosActY - 64#79 + FLOAT#D7777.1 Path_01_PosActZ - 80#95 + FLOAT#D7777.2 Path_01_PosActI - 96#111 + FLOAT#D7777.3 Path_01_PosActJ - 112#127 + FLOAT#D7777.4 Path_01_PosActK - 128#143 + FLOAT#D7777.5 + + + Path_01_Type + FLAG#R10528.12 + + + Path_01_PartId + INT#D9999 + + + Path_01_PZ_TOT + INT#D9999 + + + Path_01_Cod_M + STROBE#R10520.0 + + + Path_01_Cod_S + STROBE#R10520.1 + + + Path_01_Cod_T + STROBE#R10520.2 + + + Path_01_RUN_MODE + FLAG#R10528.1:R10528.7 + + + Path_01_EXE_MODE + FLAG#R10528.8:R10528.11 + + + Path_01_CurrProg + STRING#D0000 + + + Path_01_CurrProg_RowNum + INT#D0001.0 + + + Path_01_ActiveAxes + STROBE#R10520.3 diff --git a/MTC_Sim/MTC_Sim/AdapterConf/CMS_FANUC.xml.bak b/MTC_Sim/MTC_Sim/AdapterConf/CMS_FANUC.xml.bak new file mode 100644 index 0000000..9ecbf8a --- /dev/null +++ b/MTC_Sim/MTC_Sim/AdapterConf/CMS_FANUC.xml.bak @@ -0,0 +1,632 @@ + + + 1 + CMS_ADAPTER_00 + FANUC + + + VacPump_01 + Pompa 1 + Random + + + VacPump_01_Status + 0#7 + + + + + VacPump_02 + Pompa 2 + Random + + + VacPump_02_Status + 0#7 + + + + + + + VacAct_01 + Attuatore vuoto 1 + Random + + + VacAct_01_Count + 0#15 + + + + + VacAct_02 + Attuatore vuoto 2 + Random + + + VacAct_02_Count + 0#15 + + + + + + + Lubro_01 + Lubrorefrigerante 1 + Random + + + Lubro_01_Num + 0#15 + + + + + Lubro_02 + Lubrorefrigerante 2 + Random + + + Lubro_02_Num + 0#15 + + + + + + + Cooler_01 + Cooler 1 + Random + + + Cooler_01_Status + 0#3 + + + + + Cooler_02 + Cooler 2 + Random + + + Cooler_02_Status + 0#3 + + + + + + + Press_01 + Pressostato 1 + Random + + + Press_01_Value + 0#7 + + + + + Press_02 + Pressostato 2 + Random + + + Press_02_Value + 0#7 + + + + + + + Temp_01 + Sonda Temperatura 1 + Random + + + Temp_01_Value + 0#7 + + + + + Temp_02 + Sonda Temperatura 2 + Random + + + Temp_02_Value + 0#7 + + + + + + + Path_01 + Path num 1 + Random + + + Path_01_FeedRate + INT#D8888.0 + + + Path_01_FeedOverr + INT#D8888.0 + + + Path_01_RapidOverr + INT#D8888.0 + + + Path_01_PosActX + FLOAT#D7777.0 + + + Path_01_PosActY + FLOAT#D7777.1 + + + Path_01_PosActZ + FLOAT#D7777.2 + + + Path_01_PosActI + FLOAT#D7777.3 + + + Path_01_PosActJ + FLOAT#D7777.4 + + + Path_01_PosActK + FLOAT#D7777.5 + + + Path_01_Type + FLAG#R10528.12 + + + Path_01_PartId + INT#D9999 + + + Path_01_PZ_TOT + INT#D9999 + + + Path_01_Cod_M + STROBE#R10520.0 + + + Path_01_Cod_S + STROBE#R10520.1 + + + Path_01_Cod_T + STROBE#R10520.2 + + + Path_01_RUN_MODE + FLAG#R10528.1:R10528.7 + + + Path_01_EXE_MODE + FLAG#R10528.8:R10528.11 + + + Path_01_CurrProg + STRING#D0000 + + + Path_01_CurrProg_RowNum + INT#D0001.0 + + + Path_01_ActiveAxes + STROBE#R10520.3 + + + + + + + UnOp_01 + Unita Op num 1 + Random + + + UnOp_01_ToolId + 0#7 + + + UnOp_01_NumCU + 8#15 + + + UnOp_01_Status + 16#23 + + + UnOp_01_VitaRes + 24#31 + + + UnOp_01_Speed + 32#39 + + + UnOp_01_Load + 40#47 + + + UnOp_01_AccTime + 48#55 + + + + + + + Axis_01 + Asse num 1 + Random + + + Axis_01_MainProc + 0#7 + + + Axis_01_IsMast + 8#15 + + + Axis_01_MastId + 16#23 + + + Axis_01_Type + 24#31 + + + Axis_01_Dir + 32#39 + + + Axis_01_Load + 40#47 + + + Axis_01_PosAct + 48#55 + + + Axis_01_PosTgt + 56#63 + + + Axis_01_FeedAct + 64#71 + + + Axis_01_FeedOver + 72#79 + + + Axis_01_AccelAct + 80#87 + + + Axis_01_AccTime + 88#95 + + + Axis_01_Battery + 96#103 + + + + + Axis_02 + Asse num 2 + Random + + + Axis_02_MainProc + 0#7 + + + Axis_02_IsMast + 8#15 + + + Axis_02_MastId + 16#23 + + + Axis_02_Type + 24#31 + + + Axis_02_Dir + 32#39 + + + Axis_02_Load + 40#47 + + + Axis_02_PosAct + 48#55 + + + Axis_02_PosTgt + 56#63 + + + Axis_02_FeedAct + 64#71 + + + Axis_02_FeedOver + 72#79 + + + Axis_02_AccelAct + 80#87 + + + Axis_02_AccTime + 88#95 + + + Axis_02_Battery + 96#103 + + + + + Axis_03 + Asse num 3 + Random + + + Axis_03_MainProc + 0#7 + + + Axis_03_IsMast + 8#15 + + + Axis_03_MastId + 16#23 + + + Axis_03_Type + 24#31 + + + Axis_03_Dir + 32#39 + + + Axis_03_Load + 40#47 + + + Axis_03_PosAct + 48#55 + + + Axis_03_PosTgt + 56#63 + + + Axis_03_FeedAct + 64#71 + + + Axis_03_FeedOver + 72#79 + + + Axis_03_AccelAct + 80#87 + + + Axis_03_AccTime + 88#95 + + + Axis_03_Battery + 96#103 + + + + + Axis_04 + Asse num 4 + Random + + + Axis_04_MainProc + 0#7 + + + Axis_04_IsMast + 8#15 + + + Axis_04_MastId + 16#23 + + + Axis_04_Type + 24#31 + + + Axis_04_Dir + 32#39 + + + Axis_04_Load + 40#47 + + + Axis_04_PosAct + 48#55 + + + Axis_04_PosTgt + 56#63 + + + Axis_04_FeedAct + 64#71 + + + Axis_04_FeedOver + 72#79 + + + Axis_04_AccelAct + 80#87 + + + Axis_04_AccTime + 88#95 + + + Axis_04_Battery + 96#103 + + + + + Axis_05 + Asse num 5 + Random + + + Axis_05_MainProc + 0#7 + + + Axis_05_IsMast + 8#15 + + + Axis_05_MastId + 16#23 + + + Axis_05_Type + 24#31 + + + Axis_05_Dir + 32#39 + + + Axis_05_Load + 40#47 + + + Axis_05_PosAct + 48#55 + + + Axis_05_PosTgt + 56#63 + + + Axis_05_FeedAct + 64#71 + + + Axis_05_FeedOver + 72#79 + + + Axis_05_AccelAct + 80#87 + + + Axis_05_AccTime + 88#95 + + + Axis_05_Battery + 96#103 + + + + + Axis_06 + Asse num 6 + Random + + + Axis_06_MainProc + 0#7 + + + Axis_06_IsMast + 8#15 + + + Axis_06_MastId + 16#23 + + + Axis_06_Type + 24#31 + + + Axis_06_Dir + 32#39 + + + Axis_06_Load + 40#47 + + + Axis_06_PosAct + 48#55 + + + Axis_06_PosTgt + 56#63 + + + Axis_06_FeedAct + 64#71 + + + Axis_06_FeedOver + 72#79 + + + Axis_06_AccelAct + 80#87 + + + Axis_06_AccTime + 88#95 + + + Axis_06_Battery + 96#103 + + + + + \ No newline at end of file diff --git a/MTC_Sim/MTC_Sim/AdapterConf/Devices.xml b/MTC_Sim/MTC_Sim/AdapterConf/Devices.xml deleted file mode 100644 index 121b10d..0000000 --- a/MTC_Sim/MTC_Sim/AdapterConf/Devices.xml +++ /dev/null @@ -1,59 +0,0 @@ - - -
- - - MTConnect Lab Machine - Machine - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/MTC_Sim/MTC_Sim/AdapterGeneric.cs b/MTC_Sim/MTC_Sim/AdapterGeneric.cs index b3990df..987312c 100644 --- a/MTC_Sim/MTC_Sim/AdapterGeneric.cs +++ b/MTC_Sim/MTC_Sim/AdapterGeneric.cs @@ -284,6 +284,14 @@ namespace MTC_Sim /// Angolo K /// public Sample mPathPosActK; + /// + /// Allarmi CNC del PATH + /// + public Condition mPathAlarmCNC; + /// + /// Allarmi PCL del PATH + /// + public Condition mPathAlarmPLC; /// /// Classe Path con Idx e descrizione @@ -319,6 +327,8 @@ namespace MTC_Sim mPathCurrProg = new Event(dataRefList[17].Key); mPathCurrProgRowNum = new Event(dataRefList[18].Key); mPathActiveAxes = new Event(dataRefList[19].Key); + mPathAlarmCNC = new Condition(string.Format("{0}_AlarmCNC", ident)); + mPathAlarmPLC = new Condition(string.Format("{0}_AlarmPLC", ident)); } } /// @@ -441,6 +451,14 @@ namespace MTC_Sim /// Carica batteria /// public Sample mAxBattery; + /// + /// Allarmi CNC del PATH + /// + public Condition mAxAlarmCNC; + /// + /// Allarmi PCL del PATH + /// + public Condition mAxAlarmPLC; /// /// Classe Asse con relativo ID UNIVOCO ed alias @@ -469,6 +487,9 @@ namespace MTC_Sim mAxAccelAct = new Sample(dataRefList[10].Key); mAxAccTime = new Sample(dataRefList[11].Key); mAxBattery = new Sample(dataRefList[12].Key); + + mAxAlarmCNC = new Condition(string.Format("{0}_AlarmCNC", ident)); + mAxAlarmPLC = new Condition(string.Format("{0}_AlarmPLC", ident)); } } @@ -787,6 +808,8 @@ namespace MTC_Sim mAdapter.AddDataItem(vettPath[i].mPathCurrProg); mAdapter.AddDataItem(vettPath[i].mPathCurrProgRowNum); mAdapter.AddDataItem(vettPath[i].mPathActiveAxes); + // aggiungo condizioni allarme... + } // UnOp vettUnOp = new UnOp[adpConf.nUnOp]; diff --git a/MTC_Sim/MTC_Sim/App.config b/MTC_Sim/MTC_Sim/App.config index b1f3407..d97102e 100644 --- a/MTC_Sim/MTC_Sim/App.config +++ b/MTC_Sim/MTC_Sim/App.config @@ -15,29 +15,11 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/MTC_Sim/MTC_Sim/Appunti.txt b/MTC_Sim/MTC_Sim/Appunti.txt index adaa953..f1aacc7 100644 --- a/MTC_Sim/MTC_Sim/Appunti.txt +++ b/MTC_Sim/MTC_Sim/Appunti.txt @@ -1,32 +1,7 @@ #fix simulation: - meno frequente modifiche produzione... - posizione attuale/sim meno "ballerina" -# modifica threading -- thread molto veloci -- eseguo SEMPRE lettura degli STROBE - - leggo strobe valori speciali - - leggo strobe stato + allarmi -- quando ho lettura minimal/normal/full leggo altri dati OLTRE a strobe -- gestione 3 contatori - - ho dei contatori a count down x task di HF/MF/LF di ripetizione - - decremento contatori - - se count == 0 --> eseguo + reinizializzo variabile... - - - - STROBE: gestione full PLC --> ADP e ADP --> PLC (32 bit) - STATUS: elenco di variabili semaforiche che indicano variazione status importanti (32 bit?) + status delle CLASSI di allarme (32 bit) - - - -AREE PER STATUS -- D3450 - bit 0: AUTO -- D3450 - bit 1: EDIT -- D3450 - bit 2: MDI -- D3450 - bit 3: DNC - -lettura da D3450 --> D3457 ATTENZIONE: aggiungere pos memoria x status e strobe x path diff --git a/MTC_Sim/MTC_Sim/CMS_MachineSim.cs b/MTC_Sim/MTC_Sim/CMS_MachineSim.cs index 7c71cef..a4a5f92 100644 --- a/MTC_Sim/MTC_Sim/CMS_MachineSim.cs +++ b/MTC_Sim/MTC_Sim/CMS_MachineSim.cs @@ -42,7 +42,7 @@ namespace MTC_Sim /// /// tipo di adapter prescelto... /// - protected tipoAdapter tipoScelto = tipoAdapter.Demo; + protected tipoAdapter tipoScelto = tipoAdapter.DEMO; #region utils ed helpers @@ -90,13 +90,13 @@ namespace MTC_Sim { switch (tipoScelto) { - case tipoAdapter.Demo: + case tipoAdapter.DEMO: agObj = new AdapterDemo(this, adpConf); EnableTab(tabCtrlMain.TabPages[1], true); EnableTab(tabCtrlMain.TabPages[2], true); start.Enabled = true; break; - case tipoAdapter.Fanuc: + case tipoAdapter.FANUC: agObj = new AdapterFanuc(this, adpConf); EnableTab(tabCtrlMain.TabPages[1], true); EnableTab(tabCtrlMain.TabPages[2], false); @@ -140,9 +140,9 @@ namespace MTC_Sim OPERATOR_ID.Text = "M9999"; - STATUS_PLC_ADP.Text = utils.binaryForm(utils.CRI("STATUS_PLC_ADP")); - STATUS_ADP_PLC.Text = utils.binaryForm(utils.CRI("STATUS_ADP_PLC")); - STATUS_FLAGS.Text = utils.binaryForm(utils.CRI("STATUS_FLAGS")); + STATUS_PLC_ADP.Text = utils.binaryForm(0); + STATUS_ADP_PLC.Text = utils.binaryForm(0); + STATUS_FLAGS.Text = utils.binaryForm(0); MainProgrBar.Minimum = 0; MainProgrBar.Maximum = 100; @@ -335,7 +335,7 @@ namespace MTC_Sim /// private void simulateData() { - if (enableDataSim.Checked && tipoScelto == tipoAdapter.Demo) + if (enableDataSim.Checked && tipoScelto == tipoAdapter.DEMO) { DateTime adesso = DateTime.Now; Random rnd = new Random(); diff --git a/MTC_Sim/MTC_Sim/MTC_Sim.csproj b/MTC_Sim/MTC_Sim/MTC_Sim.csproj index 66092d5..cb30d3e 100644 --- a/MTC_Sim/MTC_Sim/MTC_Sim.csproj +++ b/MTC_Sim/MTC_Sim/MTC_Sim.csproj @@ -110,9 +110,12 @@ - - - + + PreserveNewest + + + PreserveNewest + Always diff --git a/MTC_Sim/MTC_Sim/SetupAdapter.Designer.cs b/MTC_Sim/MTC_Sim/SetupAdapter.Designer.cs index f404b02..3c6c2d9 100644 --- a/MTC_Sim/MTC_Sim/SetupAdapter.Designer.cs +++ b/MTC_Sim/MTC_Sim/SetupAdapter.Designer.cs @@ -88,7 +88,7 @@ this.txtFileName.Name = "txtFileName"; this.txtFileName.Size = new System.Drawing.Size(122, 20); this.txtFileName.TabIndex = 2; - this.txtFileName.Text = "Demo.xml"; + this.txtFileName.Text = "CMS_FANUC.xml"; // // btnSave // @@ -164,7 +164,6 @@ this.cbTipoAdapt.Name = "cbTipoAdapt"; this.cbTipoAdapt.Size = new System.Drawing.Size(121, 21); this.cbTipoAdapt.TabIndex = 11; - this.cbTipoAdapt.Text = "DEMO"; // // label6 // diff --git a/MTC_Sim/MTC_Sim/SetupAdapter.cs b/MTC_Sim/MTC_Sim/SetupAdapter.cs index 860c4e3..41c457e 100644 --- a/MTC_Sim/MTC_Sim/SetupAdapter.cs +++ b/MTC_Sim/MTC_Sim/SetupAdapter.cs @@ -198,17 +198,26 @@ namespace MTC_Sim c.NomeAdapt = txtAdapter.Text; c.Version = 1; // tipo da selettore - switch (cbTipoAdapt.SelectedText) + string valTipo = ""; + try + { + valTipo = cbTipoAdapt.SelectedItem.ToString().ToUpper(); + } + catch + { + valTipo = cbTipoAdapt.SelectedText; + } + switch (valTipo) { case "FANUC": - c.TipoAdapt = tipoAdapter.Fanuc; + c.TipoAdapt = tipoAdapter.FANUC; break; case "HMI": c.TipoAdapt = tipoAdapter.HMI; break; case "DEMO": default: - c.TipoAdapt = tipoAdapter.Demo; + c.TipoAdapt = tipoAdapter.DEMO; break; } @@ -337,17 +346,17 @@ namespace MTC_Sim listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_PosActJ", i + 1), "FLOAT#D7777.4")); listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_PosActK", i + 1), "FLOAT#D7777.5")); // aggiunta x revisione 2016.05.05 - listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_Type", i + 1), "LAVORO")); + listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_Type", i + 1), "FLAG#R10528.12")); listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_PartId", i + 1), "INT#D9999")); listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_PZ_TOT", i + 1), "INT#D9999")); - listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_Cod_M", i + 1), "STROBE#D6666.0")); - listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_Cod_S", i + 1), "STROBE#D6666.1")); - listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_Cod_T", i + 1), "STROBE#D6666.2")); - listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_RUN_MODE", i + 1), "FLAG#D3450")); - listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_EXE_MODE", i + 1), "FLAG#D3460")); + listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_Cod_M", i + 1), "STROBE#R10520.0")); + listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_Cod_S", i + 1), "STROBE#R10520.1")); + listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_Cod_T", i + 1), "STROBE#R10520.2")); + listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_RUN_MODE", i + 1), "FLAG#R10528.1:R10528.7")); + listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_EXE_MODE", i + 1), "FLAG#R10528.8:R10528.11")); listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_CurrProg", i + 1), "STRING#D0000")); listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_CurrProg_RowNum", i + 1), "INT#D0001.0")); - listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_ActiveAxes", i + 1), "FLAG#D9999")); + listaDR.Add(new DataRefItem(string.Format("Path_{0:00}_ActiveAxes", i + 1), "STROBE#R10520.3")); Path[i] = new element(string.Format("Path_{0:00}", i + 1), string.Format("Path num {0}", i + 1), fonteDati.Random, listaDR); } @@ -419,6 +428,8 @@ namespace MTC_Sim AdapterConf c2 = AdapterConf.Deserialize(filePath); txtAdapter.Text = c2.NomeAdapt; + cbTipoAdapt.SelectedText = c2.TipoAdapt.ToString(); + //cbTipoAdapt.SelectedItem = c2.TipoAdapt; numVacPump = c2.nVacuumPump; numVacAct = c2.nVacuumAct; numLubro = c2.nLubro; diff --git a/MTC_Sim/MTC_Sim/utils.cs b/MTC_Sim/MTC_Sim/utils.cs index e002f32..b1d412d 100644 --- a/MTC_Sim/MTC_Sim/utils.cs +++ b/MTC_Sim/MTC_Sim/utils.cs @@ -147,11 +147,11 @@ namespace MTC_Sim /// /// Adapter generico/demo /// - Demo, + DEMO, /// /// adapter FANUC-CMS /// - Fanuc, + FANUC, /// /// Adapter HMI-SCM /// @@ -167,7 +167,7 @@ namespace MTC_Sim public enum fonteDati { /// - /// dati recuperati da metodi/calssi con HMI + /// dati recuperati da metodi/classi con HMI /// HMI, ///