diff --git a/DH.Devices.Camera/Do3ThinkCamera.cs b/DH.Devices.Camera/Do3ThinkCamera.cs index 49bb698..4910eac 100644 --- a/DH.Devices.Camera/Do3ThinkCamera.cs +++ b/DH.Devices.Camera/Do3ThinkCamera.cs @@ -12,7 +12,7 @@ namespace DH.Devices.Camera public class Do3ThinkCamera : CameraBase { - + private dvpCameraInfo stDevInfo = new dvpCameraInfo(); private dvpStatus nRet = dvpStatus.DVP_STATUS_OK; private DVPCamera.dvpEventCallback pCallBackFunc; @@ -24,7 +24,7 @@ namespace DH.Devices.Camera public Double m_dfDisplayCount = 0; public Do3ThinkCamera() { - + } @@ -66,7 +66,7 @@ namespace DH.Devices.Camera dvpCameraInfo camerainfo = new dvpCameraInfo(); nRet = DVPCamera.dvpGetCameraInfo(m_handle, ref camerainfo); - SerialNumber= camerainfo.SerialNumber; + SerialNumber = camerainfo.SerialNumber; // ch:注册异常回调函数 | en:Register Exception Callback //nRet = DVPCamera.dvpRegisterEventCallback(m_handle, pCallBackFunc, dvpEvent.EVENT_DISCONNECTED, IntPtr.Zero); //if (nRet != dvpStatus.DVP_STATUS_OK) @@ -87,82 +87,82 @@ namespace DH.Devices.Camera //} //else //{ - // ch:设置触发模式为on || en:set trigger mode as on - nRet = DVPCamera.dvpSetTriggerState(m_handle, true); - if (dvpStatus.DVP_STATUS_OK != nRet) - { - throw new Exception("Set TriggerMode failed!"); - } + // ch:设置触发模式为on || en:set trigger mode as on + nRet = DVPCamera.dvpSetTriggerState(m_handle, true); + if (dvpStatus.DVP_STATUS_OK != nRet) + { + throw new Exception("Set TriggerMode failed!"); + } - // 硬触发 - //if (IIConfig.IsHardwareTrigger) - //{ - // ch:触发源选择:1 - Line1; | en:Trigger source select:1 - Line1; - nRet = DVPCamera.dvpSetTriggerSource(m_handle, dvpTriggerSource.TRIGGER_SOURCE_LINE1); - if (dvpStatus.DVP_STATUS_OK != nRet) - { - throw new Exception("Set Line1 Trigger failed!"); - } + // 硬触发 + //if (IIConfig.IsHardwareTrigger) + //{ + // ch:触发源选择:1 - Line1; | en:Trigger source select:1 - Line1; + nRet = DVPCamera.dvpSetTriggerSource(m_handle, dvpTriggerSource.TRIGGER_SOURCE_LINE1); + if (dvpStatus.DVP_STATUS_OK != nRet) + { + throw new Exception("Set Line1 Trigger failed!"); + } - // ch:注册回调函数 | en:Register image callback - ImageCallback = new DVPCamera.dvpStreamCallback(ImageCallbackFunc); - nRet = DVPCamera.dvpRegisterStreamCallback(m_handle, ImageCallback, dvpStreamEvent.STREAM_EVENT_PROCESSED, IntPtr.Zero); - if (dvpStatus.DVP_STATUS_OK != nRet) - { - throw new Exception("Register image callback failed!"); - } - //} - //else // 软触发 - //{ - // nRet = DVPCamera.dvpSetTriggerSource(m_handle, dvpTriggerSource.TRIGGER_SOURCE_SOFTWARE); - // if (dvpStatus.DVP_STATUS_OK != nRet) - // { - // throw new Exception("Set Software Trigger failed!"); - // } - //} + // ch:注册回调函数 | en:Register image callback + ImageCallback = new DVPCamera.dvpStreamCallback(ImageCallbackFunc); + nRet = DVPCamera.dvpRegisterStreamCallback(m_handle, ImageCallback, dvpStreamEvent.STREAM_EVENT_PROCESSED, IntPtr.Zero); + if (dvpStatus.DVP_STATUS_OK != nRet) + { + throw new Exception("Register image callback failed!"); + } + //} + //else // 软触发 + //{ + // nRet = DVPCamera.dvpSetTriggerSource(m_handle, dvpTriggerSource.TRIGGER_SOURCE_SOFTWARE); + // if (dvpStatus.DVP_STATUS_OK != nRet) + // { + // throw new Exception("Set Software Trigger failed!"); + // } + //} - // ch:开启抓图 || en: start grab image - nRet = DVPCamera.dvpStart(m_handle); - if (dvpStatus.DVP_STATUS_OK != nRet) - { - throw new Exception($"Start grabbing failed:{nRet:x8}"); - } - //// 曝光 - //if (IIConfig.DefaultExposure != 0) - //{ - // SetExposure(IIConfig.DefaultExposure); - //} - //// 增益 - //if (IIConfig.Gain >= 0) - //{ - // SetGain(IIConfig.Gain); - //} - //SetPictureRoi(IIConfig.VelocityPara.A_Pic_X, IIConfig.VelocityPara.A_Pic_Y, IIConfig.VelocityPara.Width, IIConfig.VelocityPara.Hight); + // ch:开启抓图 || en: start grab image + nRet = DVPCamera.dvpStart(m_handle); + if (dvpStatus.DVP_STATUS_OK != nRet) + { + throw new Exception($"Start grabbing failed:{nRet:x8}"); + } + //// 曝光 + //if (IIConfig.DefaultExposure != 0) + //{ + // SetExposure(IIConfig.DefaultExposure); + //} + //// 增益 + //if (IIConfig.Gain >= 0) + //{ + // SetGain(IIConfig.Gain); + //} + //SetPictureRoi(IIConfig.VelocityPara.A_Pic_X, IIConfig.VelocityPara.A_Pic_Y, IIConfig.VelocityPara.Width, IIConfig.VelocityPara.Hight); - //// 设置 触发延迟 - //if (IIConfig.TriggerDelay > 0) - //{ - // nRet = DVPCamera.dvpSetTriggerDelay(m_handle, IIConfig.TriggerDelay); - // if (nRet != dvpStatus.DVP_STATUS_OK) - // { - // throw new Exception("Set TriggerDelay failed!"); - // } - //} + //// 设置 触发延迟 + //if (IIConfig.TriggerDelay > 0) + //{ + // nRet = DVPCamera.dvpSetTriggerDelay(m_handle, IIConfig.TriggerDelay); + // if (nRet != dvpStatus.DVP_STATUS_OK) + // { + // throw new Exception("Set TriggerDelay failed!"); + // } + //} - //// 信号消抖 - //if (IIConfig.LineDebouncerTime > 0) - //{ - // nRet = DVPCamera.dvpSetTriggerJitterFilter(m_handle, IIConfig.LineDebouncerTime); - // if (nRet != dvpStatus.DVP_STATUS_OK) - // { - // throw new Exception($"LineDebouncerTime set failed:{nRet}"); - // } - //} + //// 信号消抖 + //if (IIConfig.LineDebouncerTime > 0) + //{ + // nRet = DVPCamera.dvpSetTriggerJitterFilter(m_handle, IIConfig.LineDebouncerTime); + // if (nRet != dvpStatus.DVP_STATUS_OK) + // { + // throw new Exception($"LineDebouncerTime set failed:{nRet}"); + // } + //} - //IIConfig.PropertyChanged -= IIConfig_PropertyChanged; - //IIConfig.PropertyChanged += IIConfig_PropertyChanged; + //IIConfig.PropertyChanged -= IIConfig_PropertyChanged; + //IIConfig.PropertyChanged += IIConfig_PropertyChanged; - return true; + return true; } catch { @@ -258,20 +258,20 @@ namespace DH.Devices.Camera /// private void SetExposure(double exposure) { - // 关闭自动曝光 - nRet = DVPCamera.dvpSetAeOperation(m_handle, dvpAeOperation.AE_OP_OFF); - if (nRet != dvpStatus.DVP_STATUS_OK) - { - throw new Exception($"Exposure set failed:{nRet}"); - } - // 设置曝光值 - nRet = DVPCamera.dvpSetExposure(m_handle, exposure); - if (nRet != dvpStatus.DVP_STATUS_OK) - { - throw new Exception($"Exposure set failed:{nRet}"); - } - } - + // 关闭自动曝光 + nRet = DVPCamera.dvpSetAeOperation(m_handle, dvpAeOperation.AE_OP_OFF); + if (nRet != dvpStatus.DVP_STATUS_OK) + { + throw new Exception($"Exposure set failed:{nRet}"); + } + // 设置曝光值 + nRet = DVPCamera.dvpSetExposure(m_handle, exposure); + if (nRet != dvpStatus.DVP_STATUS_OK) + { + throw new Exception($"Exposure set failed:{nRet}"); + } + } + /// @@ -309,16 +309,23 @@ namespace DH.Devices.Camera public int ImageCallbackFunc(uint handle, dvpStreamEvent _event, IntPtr pContext, ref dvpFrame refFrame, IntPtr pBuffer) { Mat cvImage = new Mat(); - + if (this.CameraName.Equals("Cam1")) + { + Console.WriteLine( ); + } + if (this.CameraName.Equals("Cam2")) + { + Console.WriteLine(); + } try { Interlocked.Increment(ref SnapshotCount); - - + + int nWidth = refFrame.iWidth; int nHeight = refFrame.iHeight; - + // 根据图像格式创建Mat switch (refFrame.format) { @@ -336,7 +343,8 @@ namespace DH.Devices.Camera break; default: - throw new NotSupportedException($"Unsupported format: {refFrame.format}"); + cvImage = Mat.FromPixelData(nHeight, nWidth, MatType.CV_8UC1, pBuffer); + break; } Mat smat = cvImage.Clone(); OnHImageOutput?.Invoke(DateTime.Now, this, smat); @@ -349,7 +357,7 @@ namespace DH.Devices.Camera } catch (Exception ex) { - + } finally { diff --git a/DH.Devices.Motion/MCDLL_NET.cs b/DH.Devices.Motion/MCDLL_NET.cs index 1081449..d9d2101 100644 --- a/DH.Devices.Motion/MCDLL_NET.cs +++ b/DH.Devices.Motion/MCDLL_NET.cs @@ -37,188 +37,854 @@ namespace MCDLL_NET public class CMCDLL_NET { + /******************************************************************************************************************************************************************** - 1 ƿ򿪺 + 0.1 ƿ򿪺 ********************************************************************************************************************************************************************/ - //1.0 粢ģʽú(򿪿ǰ) 궨1.0 - [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Switch_State_Net")] - public static extern short MCF_Set_Switch_State_Net(ushort Mode = 0); - // ú(򿪿ǰ) - [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Card_Number_Net")] - public static extern short MCF_Set_Card_Number_Net(ushort Card_Number = 0); - [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Card_Number_Net")] - public static extern short MCF_Get_Card_Number_Net(ref ushort Card_Number); - //1.1 ʼ [1,100] [0,99] 궨1.1 + + + /// + /// ˶ƿ + /// + /// վȡֵ[1,100] + /// վţ[0,99] + /// ʾվͣȡֵ + /// 0: NIO0808R/NIO1616R/NIO2416 + /// 1: NIO4832/NIO3232/NIO4000 + /// 2: NMC1200R/NMC1400/NMC3400/NMC3401 + /// 3: NMC5800/NMC5600R/NMC1800/NMC1600R + /// 4: NMC5120R/NMC5160 + /// 5: LMC3400/LMC3100 + /// 6: EIO0840 + /// 7: NAD0804 + /// 8: + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Open_Net")] public static extern short MCF_Open_Net(ushort Connection_Number, ref ushort Station_Number, ref ushort Station_Type); - [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Open_Net")] - public static extern short MCF_Get_Open_Net(ref ushort Connection_Number, ref ushort Station_Number, ref ushort Station_Type); + + + /// + /// ر˶ƿ + /// + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Close_Net")] public static extern short MCF_Close_Net(); - //1.2 ӳʱֹͣ [0,60000] + + + /// + /// 1.2 ӳʱֹͣᣬDO TimeOut_Output + /// + /// óʱʱ䣻 Χ[0,60000] + /// óʱ + /// վ + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Link_TimeOut_Net")] public static extern short MCF_Set_Link_TimeOut_Net(uint Time_1MS, uint TimeOut_Output, ushort StationNumber = 0); - // ӳʱֹͣʹܺ - [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Trigger_Output_Bit_Net")] - public static extern short MCF_Set_Trigger_Output_Bit_Net(ushort Bit_Output_Number, ushort Bit_Output_Enable, ushort StationNumber = 0); - //1.3 Ӽ⺯ + + + /// + /// 1.3 Ӽ⺯ + /// + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Link_State_Net")] - public static extern short MCF_Get_Link_State_Net(ushort StationNumber = 0); + public static extern short MCF_Get_Link_State_Net(); + + + /// + /// 1.4 粢ģʽú + /// + /// Modeģʽ 0 1 + /// + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Switch_State_Net")] + public static extern short MCF_Set_Switch_State_Net(ushort Mode = 0); + + + /// + /// 1.5 粢ģʽ״̬ѯ + /// + /// վãĬϲΪ 0 + /// + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Switch_State_Net")] + public static extern short MCF_Get_Switch_State_Net(ushort StationNumber = 0); + + + + /******************************************************************************************************************************************************************** + 1 ʼ + ********************************************************************************************************************************************************************/ + /// + /// 1.1 ʼ MCF_Open_Netǰ + /// + /// վãĬϲΪ 0 + /// + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Init_Net")] + public static extern short MCF_Sorting_Init_Net(ushort StationNumber = 0); + + + + /******************************************************************************************************************************************************************** + 2 ɸѡرպ + ********************************************************************************************************************************************************************/ + + + + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Start_Net")] + public static extern short MCF_Sorting_Start_Net(ushort Mode = 0, ushort StationNumber = 0); + + + + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Close_Net")] + public static extern short MCF_Sorting_Close_Net(ushort StationNumber = 0); + + + + /******************************************************************************************************************************************************************** + 3 ȫƲ + ********************************************************************************************************************************************************************/ + /// + /// 3.1 Сߴ + /// + /// + /// + /// վãĬϲΪ 0 + /// + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Piece_Size_Net")] + public static extern short MCF_Sorting_Set_Piece_Size_Net(uint Max_Size, uint Min_Size, ushort StationNumber = 0); + + + /// + /// 3.2 ȫ,ȫʱ + /// + /// + /// + /// վãĬϲΪ 0 + /// + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Piece_Place_Net")] + public static extern short MCF_Sorting_Set_Piece_Place_Net(uint Min_Distance, uint Min_Time_Intervel, ushort StationNumber = 0); + + + /// + /// 3.3 Чƽ(Ĭϵ͵ƽ) + /// + /// + /// վãĬϲΪ 0 + /// + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Input_0_Logic_Net")] + public static extern short MCF_Sorting_Set_Input_0_Logic_Net(ushort Bit_Input_Logic, ushort StationNumber = 0); + + + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Input_1_Logic_Net")] + public static extern short MCF_Sorting_Set_Input_1_Logic_Net(ushort Bit_Input_Logic, ushort StationNumber = 0); + /// + /// 3.4 ϳʱֹͣ˶(Ĭʱ0,ʾ) [0,60000] + /// + /// + /// + /// վãĬϲΪ 0 + /// + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Input_0_TimeOut_Net")] + public static extern short MCF_Sorting_Set_Input_0_TimeOut_Net(uint Time_1MS, uint TimeOut_Output, ushort StationNumber = 0); + + + /// + /// 3.5 OKʱֹͣ˶(Ĭʱ0,ʾ) [0,60000] + /// + /// + /// + /// վãĬϲΪ 0 + /// + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Trig_Blow_OK_TimeOut_Net")] + public static extern short MCF_Sorting_Set_Trig_Blow_OK_TimeOut_Net(uint Time_1MS, uint TimeOut_Output, ushort StationNumber = 0); + + + /// + /// 3.6 NGֹͣ˶(Ĭʱ0,ʾ) [0,60000] + /// + /// + /// + /// վãĬϲΪ 0 + /// + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Trig_Blow_NG_NumberOut_Net")] + public static extern short MCF_Sorting_Set_Trig_Blow_NG_NumberOut_Net(uint NG_Number, uint NumberOut_Output, ushort StationNumber = 0); + + + //HMC3412S ר + + /// + /// 3.7 жOK,ʣĿǷȷԴжǷϽOK + /// + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Blow_OK_Error_Net")] + public static extern short MCF_Sorting_Set_Blow_OK_Error_Net(ushort Bit_Input_Number, ushort Bit_Input_Logic, int Input_Position, uint Piece_Size, ushort StationNumber = 0); + + + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Get_Blow_OK_Error_Number_Net")] + public static extern short MCF_Sorting_Get_Blow_OK_Error_Number_Net(ref uint Error_Number, ushort StationNumber = 0); + + /******************************************************************************************************************************************************************** + 0.4 ɸѡԼλú + ********************************************************************************************************************************************************************/ + /// + /// ĶӦע⣺װõԾСУ + /// + /// ţȡֵΧ1-8 + /// ϼڵλãλ壻 + /// תת0˳1棨 + /// 㴥ģʽ + /// λ + /// վãĬϲΪ 0 + /// + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Camera_Net")] + public static extern short MCF_Sorting_Set_Camera_Net(ushort Camera_Number, int Camera_Position, ushort Motion_Dir, ushort Action_Mode, ushort Action_IO, ushort StationNumber = 0); + + + /// + /// + /// + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Blow_OK_Net")] + public static extern short MCF_Sorting_Set_Blow_OK_Net(int Blow_OK_Position, ushort Motion_Dir, ushort Action_Mode, ushort Action_IO, ushort StationNumber = 0); + + + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Blow_NG_Net")] + public static extern short MCF_Sorting_Set_Blow_NG_Net(int Blow_NG_Position, ushort Motion_Dir, ushort Action_Mode, ushort Action_IO, ushort StationNumber = 0); + + + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Blow_1_Net")] + public static extern short MCF_Sorting_Set_Blow_1_Net(int Blow_1_Position, ushort Motion_Dir, ushort Action_Mode, ushort Action_IO, ushort StationNumber = 0); + + + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Blow_2_Net")] + public static extern short MCF_Sorting_Set_Blow_2_Net(int Blow_2_Position, ushort Motion_Dir, ushort Action_Mode, ushort Action_IO, ushort StationNumber = 0); + //HMC3412S ר + + + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Blow_3_Net")] + public static extern short MCF_Sorting_Set_Blow_3_Net(int Blow_3_Position, ushort Motion_Dir, ushort Action_Mode, ushort Action_IO, ushort StationNumber = 0); + + + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Blow_4_Net")] + public static extern short MCF_Sorting_Set_Blow_4_Net(int Blow_4_Position, ushort Motion_Dir, ushort Action_Mode, ushort Action_IO, ushort StationNumber = 0); + + + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Blow_5_Net")] + public static extern short MCF_Sorting_Set_Blow_5_Net(int Blow_5_Position, ushort Motion_Dir, ushort Action_Mode, ushort Action_IO, ushort StationNumber = 0); + + + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Blow_6_Net")] + public static extern short MCF_Sorting_Set_Blow_6_Net(int Blow_6_Position, ushort Motion_Dir, ushort Action_Mode, ushort Action_IO, ushort StationNumber = 0); + /******************************************************************************************************************************************************************** + 0.5 ɸѡ,,״̬ + ********************************************************************************************************************************************************************/ + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Get_Piece_Pass_Net")] + public static extern short MCF_Sorting_Get_Piece_Pass_Net(ushort Piece_Input_Number, ref uint Piece_Pass, ushort StationNumber = 0); + + + /// + /// DIO0 ɸѡ״̬ + /// + /// ˿ںţĿǰֻһ·ȡֵ0 + /// ƥͳ + /// С 10 ݣҪ + /// ࣬ 10 ݣҪ + /// + /// վ + /// + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Get_Piece_State_Net")] + public static extern short MCF_Sorting_Get_Piece_State_Net(ushort Piece_Input_Number, ref uint Piece_Find, ref uint Piece_Size, ref uint Piece_Distance_To_next, ref uint Piece_Cross_Camera, ushort StationNumber = 0); + + + /// + /// ˶ƿպ,ʱٺ1,һΪ ƿӴյͼҪʱ, + /// + /// + /// Ӧʱʾʱ䣬λms + /// վ + /// + + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Trig_Camera_Delay_Count_Net")] + public static extern short MCF_Sorting_Set_Trig_Camera_Delay_Count_Net(ushort Camera_Number, double Delay_Camera_Count_MS, ushort StationNumber = 0); + + + /// + /// ȡжϿƿռ,ͼһҪʱĿƿռҪһһӦ,Ϊͼ쳣©Ĵ + /// + /// + /// ĸ + /// վ + /// + + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Get_Trig_Camera_Count_Net")] + public static extern short MCF_Sorting_Get_Trig_Camera_Count_Net(ushort Camera_Number, ref uint Trig_Camera_Count, ushort StationNumber = 0); + + + /// + /// ȡ NG + /// + /// NG + /// վ + /// + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Get_Trig_Blow_NG_Count_Net")] + public static extern short MCF_Sorting_Get_Trig_Blow_NG_Count_Net(ref uint Trig_Blow_NG_Count, ushort StationNumber = 0); + + /// + /// ȡ OK + /// + /// OK + /// վ + /// + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Get_Trig_Blow_OK_Count_Net")] + public static extern short MCF_Sorting_Get_Trig_Blow_OK_Count_Net(ref uint Trig_Blow_OK_Count, ushort StationNumber = 0); + + /// + /// ȡ 1 + /// + /// 1 + /// վ + /// + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Get_Trig_Blow_1_Count_Net")] + public static extern short MCF_Sorting_Get_Trig_Blow_1_Count_Net(ref uint Trig_Blow_1_Count, ushort StationNumber = 0); + + /// + /// ȡ 2 + /// + /// 2 + /// վ + /// + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Get_Trig_Blow_2_Count_Net")] + public static extern short MCF_Sorting_Get_Trig_Blow_2_Count_Net(ref uint Trig_Blow_2_Count, ushort StationNumber = 0); + + /// + /// ȡ 3 + /// + /// 3 + /// վ + /// + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Get_Trig_Blow_3_Count_Net")] + public static extern short MCF_Sorting_Get_Trig_Blow_3_Count_Net(ref uint Trig_Blow_3_Count, ushort StationNumber = 0); + + /// + /// ȡ 4 + /// + /// 4 + /// վ + /// + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Get_Trig_Blow_4_Count_Net")] + public static extern short MCF_Sorting_Get_Trig_Blow_4_Count_Net(ref uint Trig_Blow_4_Count, ushort StationNumber = 0); + + /// + /// ȡ 5 + /// + /// 5 + /// վ + /// + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Get_Trig_Blow_5_Count_Net")] + public static extern short MCF_Sorting_Get_Trig_Blow_5_Count_Net(ref uint Trig_Blow_5_Count, ushort StationNumber = 0); + + + /// + /// ȡ 6 + /// + /// 6 + /// վ + /// + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Get_Trig_Blow_6_Count_Net")] + public static extern short MCF_Sorting_Get_Trig_Blow_6_Count_Net(ref uint Trig_Blow_6_Count, ushort StationNumber = 0); + + + /******************************************************************************************************************************************************************** + ·ʱǰѾλõϣᱻжΪ д¼ݡ + ********************************************************************************************************************************************************************/ + + + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Get_Lose_Blow_NG_Count_Net")] + public static extern short MCF_Sorting_Get_Lose_Blow_NG_Count_Net(ref uint Lose_Blow_NG_Count, ushort StationNumber = 0); + + + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Get_Lose_Blow_OK_Count_Net")] + public static extern short MCF_Sorting_Get_Lose_Blow_OK_Count_Net(ref uint Lose_Blow_OK_Count, ushort StationNumber = 0); + /******************************************************************************************************************************************************************** + 0.6 ģʽ0ûۺʹָ + ********************************************************************************************************************************************************************/ + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Trig_Blow_OK_Net")] + public static extern short MCF_Sorting_Set_Trig_Blow_OK_Net(uint Piece_Number, ushort StationNumber = 0); + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Trig_Blow_NG_Net")] + public static extern short MCF_Sorting_Set_Trig_Blow_NG_Net(uint Piece_Number, ushort StationNumber = 0); + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Trig_Blow_1_Net")] + public static extern short MCF_Sorting_Set_Trig_Blow_1_Net(uint Piece_Number, ushort StationNumber = 0); + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Trig_Blow_2_Net")] + public static extern short MCF_Sorting_Set_Trig_Blow_2_Net(uint Piece_Number, ushort StationNumber = 0); + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Trig_Blow_3_Net")] + public static extern short MCF_Sorting_Set_Trig_Blow_3_Net(uint Piece_Number, ushort StationNumber = 0); + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Trig_Blow_4_Net")] + public static extern short MCF_Sorting_Set_Trig_Blow_4_Net(uint Piece_Number, ushort StationNumber = 0); + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Trig_Blow_5_Net")] + public static extern short MCF_Sorting_Set_Trig_Blow_5_Net(uint Piece_Number, ushort StationNumber = 0); + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Trig_Blow_6_Net")] + public static extern short MCF_Sorting_Set_Trig_Blow_6_Net(uint Piece_Number, ushort StationNumber = 0); + /******************************************************************************************************************************************************************** + 0.7 ģʽ1ûֱӷÿƿԶۺϽ + ********************************************************************************************************************************************************************/ + /// + /// ͼ򿪴ģʽǰ, MCF_Sorting_Set_Trig_Camera_Delay_Count_Net ôռʱ, + /// + /// + /// վãĬϲΪ 0 + /// + // + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Camera_Result_OK_Net")] + public static extern short MCF_Sorting_Set_Camera_Result_OK_Net(ushort Camera_Number, ushort StationNumber = 0); + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Camera_Result_NG_Net")] + public static extern short MCF_Sorting_Set_Camera_Result_NG_Net(ushort Camera_Number, ushort StationNumber = 0); + + + /******************************************************************************************************************************************************************** + 0.8 ģʽ2ûҪƿͨIOۺϽ,ȫͨӲʵ,ֱPLC + ********************************************************************************************************************************************************************/ + /// + /// (0,500] + /// + /// + /// + /// վãĬϲΪ 0 + /// + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Camera_Result_Wait_Time_Net")] + public static extern short MCF_Sorting_Set_Camera_Result_Wait_Time_Net(ushort Camera_Number, double Wait_Time_MS, ushort StationNumber = 0); + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Camera_Result_Input_OK_Net")] + public static extern short MCF_Sorting_Set_Camera_Result_Input_OK_Net(ushort Camera_Number, ushort Input_Number, ushort Logic, ushort StationNumber = 0); + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Sorting_Set_Camera_Result_Input_NG_Net")] + public static extern short MCF_Sorting_Set_Camera_Result_Input_NG_Net(ushort Camera_Number, ushort Input_Number, ushort Logic, ushort StationNumber = 0); + + /******************************************************************************************************************************************************************** 2 ͨ ********************************************************************************************************************************************************************/ - //2.1 ͨIOȫ [OUT31,OUT0] [0,99] + /// + /// 2.1 ͨIOȫ [OUT31,OUT0] [0,99] + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Output_Net")] public static extern short MCF_Set_Output_Net(uint All_Output_Logic, ushort StationNumber = 0); + + + + /// + /// ȡͨ I/O ź + /// + /// ȡ DO00-DO31 ƽ״̬ + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Output_Net")] public static extern short MCF_Get_Output_Net(ref uint All_Output_Logic, ushort StationNumber = 0); - //2.2 ͨIOλ 궨2.3.1 궨2.3.2 [0,99] + + + + /// + /// 2.2 λͨ I/O ź + /// + /// ѡ IO λ ΧDO00-DO39 + /// IO ڵƽ + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Output_Bit_Net")] public static extern short MCF_Set_Output_Bit_Net(ushort Bit_Output_Number, ushort Bit_Output_Logic, ushort StationNumber = 0); + + + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Output_Bit_Net")] public static extern short MCF_Get_Output_Bit_Net(ushort Bit_Output_Number, ref ushort Bit_Output_Logic, ushort StationNumber = 0); - //2.3 ͨIO1λʱ亯 궨2.3.1 궨2.3.2 [0,65535] [0,99] + + + + /// + /// 2.3 ͨIOãλʱ亯 궨2.3.1 궨2.3.2 [0,65535] [0,99] + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Output_Time_Bit_Net")] public static extern short MCF_Set_Output_Time_Bit_Net(ushort Bit_Output_Number, ushort Bit_Output_Logic, ushort Output_Time_1MS, ushort StationNumber = 0); - // ͨIO2λʱ亯 궨2.3.1 [0,1000] [-2^31,(2^31-1)] [0,99] + + + /// + /// ͨIOãλʱ亯 궨2.3.1 [0,1000] [-2^31,(2^31-1)] [0,65535] + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Compare_Output_Bit_Net")] public static extern short MCF_Set_Compare_Output_Bit_Net(ushort Compare_Output_Number, ushort Compare_Output_1MS, ushort Compare_dDist, ushort StationNumber = 0); - //2.4 ͨIOȫ뺯 [Input31,Input0] [Input48,Input32] [0,99] + + + /// + /// 2.4 ȡͨ I/O ź + /// + /// IO DI00 - DI31 ĵƽ״̬ + /// IO DI32 - DI47 ĵƽ״̬ + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Input_Net")] public static extern short MCF_Get_Input_Net(ref uint All_Input_Logic1, ref uint All_Input_Logic2, ushort StationNumber = 0); - //2.5 ͨIOλ뺯 궨2.4.1 궨2.4.2 [0,99] + + + + /// + /// 2.5 ͨIOλ뺯 궨2.4.1 궨2.4.2 [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Input_Bit_Net")] public static extern short MCF_Get_Input_Bit_Net(ushort Bit_Input_Number, ref ushort Bit_Input_Logic, ushort StationNumber = 0); - //2.6 ͨIOλظٲ [Bit_Input_0,Bit_Input_3] [0,99] + /// + /// 2.6 ͨIOλظٲ [Bit_Input_0,Bit_Input_3] [0,99] + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Clear_Input_Fall_Bit_Net")] public static extern short MCF_Clear_Input_Fall_Bit_Net(ushort Bit_Input_Number, ushort StationNumber = 0); - //2.7 ͨIOλظٲȡ [Bit_Input_0,Bit_Input_3] 궨2.7 [0,99] + /// + /// 2.7 ͨIOλظٲȡ [Bit_Input_0,Bit_Input_3] 궨2.7 [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Input_Fall_Bit_Net")] public static extern short MCF_Get_Input_Fall_Bit_Net(ushort Bit_Input_Number, ref ushort Bit_Input_Fall, ushort StationNumber = 0); - //2.9 ͨIOλظټȡ [Bit_Input_0,Bit_Input_3] [0,(2^32-1)] 10± &Array[10] [0,99] + /// + /// 2.9 ͨIOλظټȡ [Bit_Input_0,Bit_Input_1] [0,(2^32-1)] 10± + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// &Array[10] [0,99] [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Input_Fall_Count_Bit_Net")] public static extern short MCF_Get_Input_Fall_Count_Bit_Net(ushort Bit_Input_Number, ref uint Input_Count_Fall, ref uint Lock_Data_Buffer, ushort StationNumber = 0); - //2.10 ͨIOλ汣(10)򿪺(MCF_Open_Netǰǰ) + /// + /// 2.10 ͨIOλ汣(10)򿪺(MCF_Open_Netǰǰ) + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Open_Input_Lock_Bit_Net")] public static extern short MCF_Open_Input_Lock_Bit_Net(ushort Lock_Mode = 0, ushort StationNumber = 0); - //2.11 ͨIOλ˲ [Bit_Input_0,Bit_Input_3] [1,100]MS [0,99] + //2.11 ͨIOλ˲ [Bit_Input_0,Bit_Input_1] [1,100]MS [0,99] [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Input_Filter_Time_Bit_Net")] public static extern short MCF_Set_Input_Filter_Time_Bit_Net(ushort Bit_Input_Number, uint Filter_Time_1MS, ushort StationNumber = 0); /******************************************************************************************************************************************************************** 3 ר ********************************************************************************************************************************************************************/ - //3.1 ŷʹú 궨0.0 궨3.1 [0,99] + + + + /// + /// 3.1 ŷʹú + /// + /// ָţȡֵ0-Axis_MAX + /// ŷʹãȡֵΧ + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Servo_Enable_Net")] public static extern short MCF_Set_Servo_Enable_Net(ushort Axis, ushort Servo_Logic, ushort StationNumber = 0); + + + /// + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Servo_Enable_Net")] public static extern short MCF_Get_Servo_Enable_Net(ushort Axis, ref ushort Servo_Logic, ushort StationNumber = 0); - //3.2 ŷλú 궨0.0 궨3.2 [0,99] + + + /// + /// 3.2 ŷλ + /// + /// ָţȡֵ0-Axis_MAX + /// øλƽ + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Servo_Alarm_Reset_Net")] public static extern short MCF_Set_Servo_Alarm_Reset_Net(ushort Axis, ushort Alarm_Logic, ushort StationNumber = 0); + + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Servo_Alarm_Reset_Net")] public static extern short MCF_Get_Servo_Alarm_Reset_Net(ushort Axis, ref ushort Alarm_Logic, ushort StationNumber = 0); - //3.3 ŷȡ 궨0.0 궨3.3 [0,99] + + + /// + /// 3.3 ŷȡ + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Servo_Alarm_Net")] public static extern short MCF_Get_Servo_Alarm_Net(ushort Axis, ref ushort Servo_Alarm_State, ushort StationNumber = 0); - //3.4 ŷλȡ 궨0.0 궨3.4 [0,99] + + + /// + /// 3.4 ŷλȡ 궨0.0 궨3.4 [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Servo_INP_Net")] public static extern short MCF_Get_Servo_INP_Net(ushort Axis, ref ushort Servo_INP_State, ushort StationNumber = 0); - //3.5 Zȡ 궨0.0 궨3.5 [0,99] + + + /// + /// 3.5 Zȡ 궨0.0 궨3.5 [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Z_Net")] public static extern short MCF_Get_Z_Net(ushort Axis, ref ushort Z_State, ushort StationNumber = 0); - //3.6 ԭȡ 궨0.0 궨3.6 [0,99] + /// + /// 3.6 ԭȡ 궨0.0 궨3.6 [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Home_Net")] public static extern short MCF_Get_Home_Net(ushort Axis, ref ushort Home_State, ushort StationNumber = 0); - //3.7 λȡ 궨0.0 궨3.7 [0,99] + /// + /// 3.7 λȡ 궨0.0 궨3.7 [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Positive_Limit_Net")] public static extern short MCF_Get_Positive_Limit_Net(ushort Axis, ref ushort Positive_Limit_State, ushort StationNumber = 0); - //3.8 λȡ 궨0.0 궨3.8 [0,99] + /// + /// 3.8 λȡ 궨0.0 궨3.8 [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Negative_Limit_Net")] public static extern short MCF_Get_Negative_Limit_Net(ushort Axis, ref ushort Negative_Limit_State, ushort StationNumber = 0); /******************************************************************************************************************************************************************** 4 ú ********************************************************************************************************************************************************************/ - //4.1 ͨú 궨0.0 궨4.1 [0,99] + + + /// + /// 4.1 ͨú + /// + /// ָţȡֵ0-Axis_MAX + /// ģʽȡֵ + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Pulse_Mode_Net")] public static extern short MCF_Set_Pulse_Mode_Net(ushort Axis, uint Pulse_Mode, ushort StationNumber = 0); + + + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Pulse_Mode_Net")] public static extern short MCF_Get_Pulse_Mode_Net(ushort Axis, ref uint Pulse_Mode, ushort StationNumber = 0); - //4.2 λú 궨0.0 [-2^31,(2^31-1)] [0,99] + /// + /// 4.2 λú 궨0.0 [-2^31,(2^31-1)] [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Position_Net")] public static extern short MCF_Set_Position_Net(ushort Axis, int Position, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Position_Net")] public static extern short MCF_Get_Position_Net(ushort Axis, ref int Position, ushort StationNumber = 0); - //4.3 ú 궨0.0 [-2^31,(2^31-1)] [0,99] + /// + /// 4.3 ú 궨0.0 [-2^31,(2^31-1)] [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Encoder_Net")] public static extern short MCF_Set_Encoder_Net(ushort Axis, int Encoder, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Encoder_Net")] public static extern short MCF_Get_Encoder_Net(ushort Axis, ref int Encoder, ushort StationNumber = 0); - // ͨZABֵ - [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Z_Clear_Encoder_Net")] - public static extern short MCF_Z_Clear_Encoder_Net(ushort Axis, ushort Enable, ushort StationNumber = 0); - // ͨZ̶IO 궨0.0 [0,255] [0,65535] [0,255] - [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Z_Output_Bit_Net")] - public static extern short MCF_Z_Output_Bit_Net(ushort Axis, ushort Number, uint dDist, ushort Time_1MS, ushort StationNumber = 0); - //4.4 ٶȻȡ 궨0.0 [-2^15,(2^15-1)] [-2^15,(2^15-1)] [0,99] + + + + /// + /// 4.4 ȡʵʱٶȺʵʱٶ + /// + /// ָţȡֵ0-Axis_MAX + /// ȡʵʱٶȣλ/s + /// ȡʵʱٶȣλ/s + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Vel_Net")] public static extern short MCF_Get_Vel_Net(ushort Axis, ref double Command_Vel, ref double Encode_Vel, ushort StationNumber = 0); + /******************************************************************************************************************************************************************** 5 Ӳֹͣ˶ ********************************************************************************************************************************************************************/ - //5.1 5.1 ͨIO븴ãΪֹͣ 궨2.4.1 궨5.1 [0,99] + + + + /// + /// 5.1 5.1 ͨIO븴ãΪֹͣ 궨2.4.1 궨5.1 [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_EMG_Bit_Net")] public static extern short MCF_Set_EMG_Bit_Net(ushort EMG_Input_Number, ushort EMG_Mode, ushort StationNumber = 0); + + + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_EMG_Output_Net")] public static extern short MCF_Set_EMG_Output_Net(ushort EMG_Input_Number, ushort EMG_Mode, uint EMG_Output, ushort StationNumber = 0); - [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_EMG_Output_Enable_Net")] - public static extern short MCF_Set_EMG_Output_Enable_Net(ushort Bit_Output_Number, ushort Bit_Output_Enable, ushort StationNumber = 0); - // ͨIO븴ãΪֹͣ [0,3] 궨0.0 [Bit_Input_0,Bit_Input_15] 궨5.4 [0,99] + + + /// + /// ͨIO븴ãΪֹͣ [0,3] 궨0.0 [Bit_Input_0,Bit_Input_15] 궨5.4 [0,99] + /// + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Input_Trigger_Net")] public static extern short MCF_Set_Input_Trigger_Net(ushort Channel, ushort Axis, ushort Bit_Input_Number, uint Trigger_Mode, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Input_Trigger_Net")] public static extern short MCF_Get_Input_Trigger_Net(ushort Channel, ref ushort Axis, ref ushort Bit_Input_Number, ref uint Trigger_Mode, ushort StationNumber = 0); - //5.2 λ˶ֹͣ 궨0.0 [-2^31,2^31]P > [-2^31,2^31]P [0,99] + /// + /// 5.2 λ˶ֹͣ 궨0.0 [-2^31,2^31]P > [-2^31,2^31]P [0,99] + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Soft_Limit_Net")] public static extern short MCF_Set_Soft_Limit_Net(ushort Axis, int Positive_Position, int Negative_Position, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Soft_Limit_Net")] public static extern short MCF_Get_Soft_Limit_Net(ushort Axis, ref int Positive_Position, ref int Negative_Position, ushort StationNumber = 0); - //5.3 λ˶ֹͣغ 궨0.0 궨5.3 [0,99] + /// + /// 5.3 λ˶ֹͣغ 궨0.0 궨5.3 [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Soft_Limit_Enable_Net")] public static extern short MCF_Set_Soft_Limit_Enable_Net(ushort Axis, uint Soft_Limit_Enable, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Soft_Limit_Enable_Net")] public static extern short MCF_Get_Soft_Limit_Enable_Net(ushort Axis, ref uint Soft_Limit_Enable, ushort StationNumber = 0); - //5.4 ŷ˶ֹͣ 궨0.0 궨5.4 [0,99] + /// + /// 5.4 ŷ˶ֹͣ 궨0.0 궨5.4 [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Alarm_Trigger_Net")] public static extern short MCF_Set_Alarm_Trigger_Net(ushort Axis, uint Trigger_Mode, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Alarm_Trigger_Net")] public static extern short MCF_Get_Alarm_Trigger_Net(ushort Axis, ref uint Trigger_Mode, ushort StationNumber = 0); - //5.5 Index˶ֹͣ 궨0.0 궨5.4 [0,99] + /// + /// 5.5 Index˶ֹͣ 궨0.0 궨5.4 [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Index_Trigger_Net")] public static extern short MCF_Set_Index_Trigger_Net(ushort Axis, uint Trigger_Mode, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Index_Trigger_Net")] public static extern short MCF_Get_Index_Trigger_Net(ushort Axis, ref uint Trigger_Mode, ushort StationNumber = 0); - //5.6 ԭ㴥˶ֹͣ 궨0.0 궨5.4 [0,99] + /// + /// 5.6 ԭ㴥˶ֹͣ 궨0.0 궨5.4 [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Home_Trigger_Net")] public static extern short MCF_Set_Home_Trigger_Net(ushort Axis, uint Trigger_Mode, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Home_Trigger_Net")] public static extern short MCF_Get_Home_Trigger_Net(ushort Axis, ref uint Trigger_Mode, ushort StationNumber = 0); - //5.7 λ˶ֹͣ 궨0.0 궨5.4 [0,99] + /// + /// 5.7 λ˶ֹͣ 궨0.0 궨5.4 [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_ELP_Trigger_Net")] public static extern short MCF_Set_ELP_Trigger_Net(ushort Axis, uint Trigger_Mode, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_ELP_Trigger_Net")] public static extern short MCF_Get_ELP_Trigger_Net(ushort Axis, ref uint Trigger_Mode, ushort StationNumber = 0); - //5.8 λ˶ֹͣ 궨0.0 궨5.4 [0,99] + /// + /// 5.8 λ˶ֹͣ 궨0.0 궨5.4 [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_ELN_Trigger_Net")] public static extern short MCF_Set_ELN_Trigger_Net(ushort Axis, uint Trigger_Mode, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_ELN_Trigger_Net")] public static extern short MCF_Get_ELN_Trigger_Net(ushort Axis, ref uint Trigger_Mode, ushort StationNumber = 0); - //5.9 ԭ㴥λü¼ 궨0.0 [-2^31,(2^31-1)] [0,99] [0,99] + /// + /// 5.9 ԭ㴥λü¼ 궨0.0 [-2^31,(2^31-1)] [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Home_Rise_Position_Net")] public static extern short MCF_Get_Home_Rise_Position_Net(ushort Axis, ref int Position, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Home_Fall_Position_Net")] @@ -227,187 +893,601 @@ namespace MCDLL_NET public static extern short MCF_Get_Home_Rise_Encoder_Net(ushort Axis, ref int Encoder, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Home_Fall_Encoder_Net")] public static extern short MCF_Get_Home_Fall_Encoder_Net(ushort Axis, ref int Encoder, ushort StationNumber = 0); - //5.10 ״̬ 궨0.0 [0,99] + + + /// + /// 5.10 ״̬ + /// + /// ָţȡֵ0-Axis_MAX + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Clear_Axis_State_Net")] public static extern short MCF_Clear_Axis_State_Net(ushort Axis, ushort StationNumber = 0); - //5.11 ״ֹ̬ͣ˶ѯ 궨0.0 MC_Retrun.h[0,28] [0,99] + + + + /// + /// 5.11 ״ֹ̬ͣ˶ѯ + /// + /// ָţȡֵ0-Axis_MAX + /// + /// 0 ִгɹ + /// 1 ִ + /// 2 EMG ֹͣ + /// 3 EMG ٽֹͣ + /// 4 ALM ֹͣ + /// 5 ALM ֹͣ + /// 6 ŷʹֹͣ + /// 7 ŷʹֹܼͣ + /// 8 ָֹͣ + /// 9 ָֹͣ + /// 10 Index ֹͣ + /// 11 Index ֹͣ + /// 12 ԭֹͣ + /// 13 ԭֹͣ + /// 14 Ӳλֹͣ + /// 15 Ӳλֹͣ + /// 16 Ӳλֹͣ + /// 17 Ӳλֹͣ + /// 18 λֹͣ + /// 19 λֹͣ + /// 20 λֹͣ + /// 21 λֹͣ + /// 22 ֹͣ + /// 23 ֹͣ + /// 24 ԭֹͣ + /// 25 ԭֹͣ + /// 26 δ֪ԭֹͣ + /// 27 δ֪ԭֹͣ + /// 28 ⲿ IO ֹͣ + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Axis_State_Net")] public static extern short MCF_Get_Axis_State_Net(ushort Axis, ref short Reason, ushort StationNumber = 0); /******************************************************************************************************************************************************************** 6 ԭ㺯 ********************************************************************************************************************************************************************/ - //6.1 û 궨0.0 [1,65535] [1,65535] - [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Search_Home_dMaxA_Time_Net")] - public static extern short MCF_Search_Home_dMaxA_Time_Net(ushort Axis, ushort H_dMaxA_Time = 10, ushort L_dMaxA_Time = 10, ushort StationNumber = 0); - // 궨0.0 [1,35] 궨6.1.1 궨6.1.2 궨6.1.3 (0,10M]P/S (0,10M]P/S [-2^31,(2^31-1)] [0,99] + /// + /// 6.1 û 궨0.0 [1,35] 궨6.1.1 궨6.1.2 궨6.1.3 (0,10M]P/S (0,10M]P/S [-2^31,(2^31-1)] [0,99] + /// + /// + /// 㷽ʽο㷽ʽȡֵ1 ~ 35 + /// λƽ + /// ԭλƽ + /// Index ƽ + /// ٶٶ + /// ٶٶ + /// ƫλãģʽͼʾͷָʾƫ + /// ׽λģʽ0ָλã1λ + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Search_Home_Set_Net")] public static extern short MCF_Search_Home_Set_Net(ushort Axis, ushort Search_Home_Mode, ushort Limit_Logic, ushort Home_Logic, ushort Index_Logic, double H_dMaxV, double L_dMaxV, int Offset_Position, ushort Trigger_Source, ushort StationNumber = 0); - //6.2 û 궨0.0 [0,99] + + + + /// + /// 6.2 û 궨0.0 [0,99] + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Search_Home_Start_Net")] public static extern short MCF_Search_Home_Start_Net(ushort Axis, ushort StationNumber = 0); - //6.3 ûֹͣ 궨0.0 [0,99] + + + /// + /// 6.3 ûֹͣ 궨0.0 [0,99] + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Search_Home_Stop_Net")] public static extern short MCF_Search_Home_Stop_Net(ushort Axis, ushort StationNumber = 0); - //6.4 ȡ״̬ 궨0.0 MC_Retrun.h{0,31,32} [0,99] + + + + /// + /// 6.4 ȡ״̬ + /// + /// + /// ״̬ + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Search_Home_Get_State_Net")] public static extern short MCF_Search_Home_Get_State_Net(ushort Axis, ref ushort Home_State, ushort StationNumber = 0); - //6.5 û㻺ͣʱ 궨0.0 [0,1000] λms [0,99] + + + + /// + /// 6.5 û㻺ͣʱ + /// + /// + /// ͣʱ䣻 Χ 0 -1000msĬϣͣ + /// ע⣺ײԭ㻺ͣʱ䣬Ҫϻõĸٶٶȣ͵ٶٶȵĴ䡣 + /// ô˻ֹСֹͣʱжҪʱ䣬ҵԭʱڿм䡣 + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Search_Home_Stop_Time_Net")] public static extern short MCF_Search_Home_Stop_Time_Net(ushort Axis, ushort Stop_Time, ushort StationNumber = 0); - //6.6 ûɺ󱣳λֵ 궨0.0 [0,99] + + + + /// + /// 6.6 ûɺ󱣳λֵ 궨0.0 [0,99] + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Search_Home_Keep_Position_Net")] public static extern short MCF_Search_Home_Keep_Position_Net(ushort Axis, ushort StationNumber = 0); - //6.7 ûɺ󱣳ֱֵ 궨0.0 [0,99] + /// + /// 6.7 ûɺ󱣳ֱֵ 궨0.0 [0,99] + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Search_Home_Keep_Encoder_Net")] public static extern short MCF_Search_Home_Keep_Encoder_Net(ushort Axis, ushort StationNumber = 0); - //6.8 ûλ뿪ٶ 궨0.0 [0,99] + /// + /// 6.8 ûλ뿪ٶ 궨0.0 [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Search_Home_Leave_Vel_Net")] public static extern short MCF_Search_Home_Leave_Vel_Net(ushort Axis, double M_dMaxV, ushort StationNumber = 0); /******************************************************************************************************************************************************************** 7 λ˶ƺ ********************************************************************************************************************************************************************/ - //7.1 ٶȿƺ 궨0.0 (0,10M]P/S (0,1T]P^2/S [0,99] + /// + /// 7.1 ٶȿƺ 궨0.0 (0,10M]P/S (0,1T]P^2/S [0,99] + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_JOG_Net")] public static extern short MCF_JOG_Net(ushort Axis, double dMaxV, double dMaxA, ushort StationNumber = 0); - //7.2 ˶λøı亯 궨0.0 [-2^31,(2^31-1)] 궨0.3 [0,99] + /// + /// 7.2 ˶λøı亯 궨0.0 [-2^31,(2^31-1)] 궨0.3 [0,99] + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Uniaxial_dDist_Change_Net")] public static extern short MCF_Uniaxial_dDist_Change_Net(ushort Axis, int dDist, ushort Position_Mode, ushort StationNumber = 0); - //7.3 ˶ٶȸı亯 궨0.0 (0,10M]P/S [0,99] + /// + /// 7.3 ˶ٶȸı亯 궨0.0 (0,10M]P/S [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Uniaxial_dMaxV_Change_Net")] public static extern short MCF_Uniaxial_dMaxV_Change_Net(ushort Axis, double dMaxV, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Uniaxial_dMaxA_Change_Net")] public static extern short MCF_Uniaxial_dMaxA_Change_Net(ushort Axis, double dMaxA, ushort StationNumber = 0); - //7.4 ߺ 궨0.0 [0,dMaxV] (0,10M]P/S (0,1T]P^2/S (0,100T]P^3/S [0,dMaxV] 궨0.4 [0,99] + + + + /// + /// 7.4 ߺ + /// + /// ָţȡֵ0-Axis_MAX + /// õ㶯ٶȣλpulse/sȡֵdMaxV > dV_ini >= 0 + /// õ㶯Ŀٶ, λpulse/sȡֵdMaxV > 0 + /// õ㶯ٶȣλpulse/s*sȡֵdMaxA > 0 + /// õ㶯Ӽٶȣλpulse/s*s*sȡֵdJerk > 0 + /// õ㶯ֹٶȣλpulse/sȡֵdMaxV > dV_end >= 0 + /// õ㶯ͣȡֵ + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Axis_Profile_Net")] public static extern short MCF_Set_Axis_Profile_Net(ushort Axis, double dV_ini, double dMaxV, double dMaxA, double dJerk, double dV_end, ushort Profile, ushort StationNumber = 0); + + + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Axis_Profile_Net")] public static extern short MCF_Get_Axis_Profile_Net(ushort Axis, ref double dV_ini, ref double dMaxV, ref double dMaxA, ref double dJerk, ref double dV_end, ref ushort Profile, ushort StationNumber = 0); - //7.5 ˶ 궨0.0 [-2^31,(2^31-1)] 궨0.3 [0,99] + + + + /// + /// ˶ + /// + /// ָţȡֵ0-Axis_MAX + /// õ㶯Ŀλãλ + /// ģʽȡֵ + /// վãĬϲΪ0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Uniaxial_Net")] public static extern short MCF_Uniaxial_Net(ushort Axis, int dDist, ushort Position_Mode, ushort StationNumber = 0); - //7.6 ֹͣߺ 궨0.0 (0,1T]P^2/S (0,100T]P^3/S 궨0.4 [0,99] + + + + /// + /// 7.6 ֹͣߺ 궨0.0 (0,1T]P^2/S (0,100T]P^3/S 궨0.4 [0,99] + /// + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Axis_Stop_Profile_Net")] public static extern short MCF_Set_Axis_Stop_Profile_Net(ushort Axis, double dMaxA, double dJerk, ushort Profile, ushort StationNumber = 0); + + + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Axis_Stop_Profile_Net")] public static extern short MCF_Get_Axis_Stop_Profile_Net(ushort Axis, ref double dMaxA, ref double dJerk, ref ushort Profile, ushort StationNumber = 0); - //7.7 ֹͣ 궨0.0 궨7.7 [0,99] + + + /// + /// 7.7 ֹͣ 궨0.0 궨7.7 [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Axis_Stop_Net")] public static extern short MCF_Axis_Stop_Net(ushort Axis, ushort Axis_Stop_Mode, ushort StationNumber = 0); - //7.8 ˶ıں 궨0.0 [1,1000]MS [0,99] + /// + /// 7.8 ˶ıں 궨0.0 [1,1000]MS [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Uniaxial_Cycle_Change_Net")] public static extern short MCF_Uniaxial_Cycle_Change_Net(ushort Axis, ushort Cycle, ushort StationNumber = 0); /******************************************************************************************************************************************************************** 8 岹˶ƺ ********************************************************************************************************************************************************************/ - //8.1 ϵߺ 궨0.1 [0,dMaxV] (0,10M]P/S (0,1T]P^2/S (0,100T]P^3/S [0,dMaxV] 궨0.4 [0,99] + /// + /// 8.1 ϵߺ 궨0.1 [0,dMaxV] (0,10M]P/S (0,1T]P^2/S (0,100T]P^3/S [0,dMaxV] 궨0.4 [0,99] + /// + /// + /// + /// + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Coordinate_Profile_Net")] public static extern short MCF_Set_Coordinate_Profile_Net(ushort Coordinate, double dV_ini, double dMaxV, double dMaxA, double dJerk, double dV_end, ushort Profile, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Coordinate_Profile_Net")] public static extern short MCF_Get_Coordinate_Profile_Net(ushort Coordinate, ref double dV_ini, ref double dMaxV, ref double dMaxA, ref double dJerk, ref double dV_end, ref ushort Profile, ushort StationNumber = 0); - //8.2 Բ뾶岹˶ 궨0.1 궨0.0 [-2^31,(2^31-1)] [-2^31,(2^31-1)] 궨0.5 궨0.3 [0,99] + /// + /// 8.2 Բ뾶岹˶ 궨0.1 궨0.0 [-2^31,(2^31-1)] [-2^31,(2^31-1)] 궨0.5 궨0.3 [0,99] + /// + /// + /// + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Arc2_Radius_Net")] public static extern short MCF_Arc2_Radius_Net(ushort Coordinate, ref ushort Axis_List, ref int dDist_List, int Arc_Radius, ushort Direction, ushort Position_Mode, ushort StationNumber = 0); - //8.3 ԲԲIJ岹˶ 궨0.1 궨0.0 [-2^31,(2^31-1)] [-2^31,(2^31-1)] 궨0.5 궨0.3 [0,99] + /// + /// 8.3 ԲԲIJ岹˶ 궨0.1 궨0.0 [-2^31,(2^31-1)] [-2^31,(2^31-1)] 궨0.5 궨0.3 [0,99] + /// + /// + /// + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Arc2_Centre_Net")] public static extern short MCF_Arc2_Centre_Net(ushort Coordinate, ref ushort Axis_List, ref int dDist_List, ref int Center_List, ushort Direction, ushort Position_Mode, ushort StationNumber = 0); - //8.4 ֱ߲岹˶ 궨0.1 궨0.0 [-2^31,(2^31-1)] 궨0.3 [0,99] + /// + /// 8.4 ֱ߲岹˶ 궨0.1 궨0.0 [-2^31,(2^31-1)] 궨0.3 [0,99] + /// + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Line2_Net")] public static extern short MCF_Line2_Net(ushort Coordinate, ref ushort Axis_List, ref int dDist_List, ushort Position_Mode, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Line3_Net")] public static extern short MCF_Line3_Net(ushort Coordinate, ref ushort Axis_List, ref int dDist_List, ushort Position_Mode, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Line4_Net")] public static extern short MCF_Line4_Net(ushort Coordinate, ref ushort Axis_List, ref int dDist_List, ushort Position_Mode, ushort StationNumber = 0); - //8.5 ϵֹͣߺ 궨0.1 (0,1T]P^2/S (0,100T]P^3/S 궨0.4 [0,99] + /// + /// 8.5 ϵֹͣߺ 궨0.1 (0,1T]P^2/S (0,100T]P^3/S 궨0.4 + /// + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Coordinate_Stop_Profile_Net")] public static extern short MCF_Set_Coordinate_Stop_Profile_Net(ushort Coordinate, double dMaxA, double dJerk, ushort Profile, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Coordinate_Stop_Profile_Net")] public static extern short MCF_Get_Coordinate_Stop_Profile_Net(ushort Coordinate, ref double dMaxA, ref double dJerk, ref ushort Profile, ushort StationNumber = 0); - //8.6 Բ뾶岹˶ 궨0.1 궨0.0 [-2^31,(2^31-1)] [-2^31,(2^31-1)] 궨0.5 궨0.3 [0,99] + /// + /// 8.6 Բ뾶岹˶ 궨0.1 궨0.0 [-2^31,(2^31-1)] [-2^31,(2^31-1)] 궨0.5 궨0.3 [0,99] + /// + /// + /// + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Screw3_Radius_Net")] public static extern short MCF_Screw3_Radius_Net(ushort Coordinate, ref ushort Axis_List, ref int dDist_List, int Arc_Radius, ushort Direction, ushort Position_Mode, ushort StationNumber = 0); - //8.7 ԲԲIJ岹˶ 궨0.1 궨0.0 [-2^31,(2^31-1)] [-2^31,(2^31-1)] 궨0.5 궨0.3 [0,99] + /// + /// 8.7 ԲԲIJ岹˶ 궨0.1 궨0.0 [-2^31,(2^31-1)] [-2^31,(2^31-1)] 궨0.5 궨0.3 [0,99] + /// + /// + /// + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Screw3_Centre_Net")] public static extern short MCF_Screw3_Centre_Net(ushort Coordinate, ref ushort Axis_List, ref int dDist_List, ref int Center_List, ushort Direction, ushort Position_Mode, ushort StationNumber = 0); - //8.8 ϵֹͣ 궨0.1 궨5.6 [0,99] + /// + /// 8.8 ϵֹͣ 궨0.1 궨5.6 [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Coordinate_Stop_Net")] public static extern short MCF_Coordinate_Stop_Net(ushort Coordinate, ushort Coordinate_Stop_Mode, ushort StationNumber = 0); /******************************************************************************************************************************************************************** 9 ********************************************************************************************************************************************************************/ - //9.1 ֹͣߺ 궨0.2 (0,1T]P^2/S (0,100T]P^3/S 궨0.4 [0,99] + /// + /// 9.1 ֹͣߺ 궨0.2 (0,1T]P^2/S (0,100T]P^3/S 궨0.4 [0,99] + /// + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Buffer_Set_Stop_Profile_Net")] public static extern short MCF_Buffer_Set_Stop_Profile_Net(ushort Buffer_Number, double dMaxA, double dJerk, ushort Profile, ushort StationNumber = 0); - //9.2 ֹͣ 궨0.2 궨9.2 [0,99] + /// + /// 9.2 ֹͣ 궨0.2 궨9.2 [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Buffer_Stop_Net")] public static extern short MCF_Buffer_Stop_Net(ushort Buffer_Number, ushort Buffer_Stop_Mode, ushort StationNumber = 0); - //9.3 ߸ıٶȱ 궨0.2 (0,10] [0,99] + /// + /// 9.3 ߸ıٶȱ 궨0.2 (0,10] [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Buffer_Change_Velocity_Ratio_Net")] public static extern short MCF_Buffer_Change_Velocity_Ratio_Net(ushort Buffer_Number, double Velocity_Ratio, ushort StationNumber = 0); - //9.4 ʼ 궨0.2 [0,99] + /// + /// 9.4 ʼ 궨0.2 [0,99] + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Buffer_Start_Net")] public static extern short MCF_Buffer_Start_Net(ushort Buffer_Number, ushort StationNumber = 0); - //9.5 ٶȱ 궨0.2 궨9.5 [0,99] + /// + /// 9.5 ٶȱ 궨0.2 궨9.5 [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Buffer_Set_Velocity_Ratio_Enable_Net")] public static extern short MCF_Buffer_Set_Velocity_Ratio_Enable_Net(ushort Buffer_Number, ushort Velocity_Ratio_Enable = 0, ushort StationNumber = 0); - //9.6 ǰհٱ 궨0.2 (0,1] [0,99] + /// + /// 9.6 ǰհٱ 궨0.2 (0,1] [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Buffer_Set_Reduce_Ratio_Net")] public static extern short MCF_Buffer_Set_Reduce_Ratio_Net(ushort Buffer_Number, double Reduce_Ratio = 1.0, ushort StationNumber = 0); - //9.7 ߺ 궨0.2 [0,dMaxV] (0,10M]P/S (0,1T]P^2/S (0,100T]P^3/S [0,dMaxV] 궨0.4 [0,99] + /// + /// 9.7 ߺ 궨0.2 [0,dMaxV] (0,10M]P/S (0,1T]P^2/S (0,100T]P^3/S [0,dMaxV] 궨0.4 [0,99] + /// + /// + /// + /// + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Buffer_Set_Profile_Net")] public static extern short MCF_Buffer_Set_Profile_Net(ushort Buffer_Number, double dV_ini, double dMaxV, double dMaxA, double dJerk, double dV_end, ushort Profile, ushort StationNumber = 0); - //9.8 ˶ 궨0.2 궨0.0 [-2^31,(2^31-1)] 궨0.3 [0,99] + /// + /// 9.8 ˶ 궨0.2 궨0.0 [-2^31,(2^31-1)] 궨0.3 [0,99] + /// + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Buffer_Uniaxial_Net")] public static extern short MCF_Buffer_Uniaxial_Net(ushort Buffer_Number, ushort Axis, int dDist, ushort Position_Mode, ushort StationNumber = 0); - //˶ͬ溯 + /// + /// ˶ͬ溯 + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Buffer_Sync_Follow_Net")] public static extern short MCF_Buffer_Sync_Follow_Net(ushort Buffer_Number, ushort Axis, int dDist, ushort StationNumber = 0); - //9.9 ֱ߲岹˶ 궨0.2 궨0.0 [-2^31,(2^31-1)] 궨0.3 [0,99] + /// + /// 9.9 ֱ߲岹˶ 궨0.2 궨0.0 [-2^31,(2^31-1)] 궨0.3 [0,99] + /// + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Buffer_Line2_Net")] public static extern short MCF_Buffer_Line2_Net(ushort Buffer_Number, ref ushort Axis_List, ref int dDist_List, ushort Position_Mode, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Buffer_Line3_Net")] public static extern short MCF_Buffer_Line3_Net(ushort Buffer_Number, ref ushort Axis_List, ref int dDist_List, ushort Position_Mode, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Buffer_Line4_Net")] public static extern short MCF_Buffer_Line4_Net(ushort Buffer_Number, ref ushort Axis_List, ref int dDist_List, ushort Position_Mode, ushort StationNumber = 0); - //9.10 ƽԲ뾶岹˶ 궨0.2 궨0.0 [-2^31,(2^31-1)] [-2^31,(2^31-1)] 궨0.5 궨0.3 [0,99] + /// + /// 9.10 ƽԲ뾶岹˶ 궨0.2 궨0.0 [-2^31,(2^31-1)] [-2^31,(2^31-1)] 궨0.5 궨0.3 [0,99] + /// + /// + /// + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Buffer_Arc_Radius_Net")] public static extern short MCF_Buffer_Arc_Radius_Net(ushort Buffer_Number, ref ushort Axis_List, ref int dDist_List, int Arc_Radius, ushort Direction, ushort Position_Mode, ushort StationNumber = 0); - //9.11 ƽԲԲIJ岹˶ 궨0.2 궨0.0 [-2^31,(2^31-1)] [-2^31,(2^31-1)] 궨0.5 궨0.3 [0,99] + /// + /// 9.11 ƽԲԲIJ岹˶ 궨0.2 궨0.0 [-2^31,(2^31-1)] [-2^31,(2^31-1)] 궨0.5 궨0.3 [0,99] + /// + /// + /// + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Buffer_Arc_Centre_Net")] public static extern short MCF_Buffer_Arc_Centre_Net(ushort Buffer_Number, ref ushort Axis_List, ref int dDist_List, ref int Center_List, ushort Direction, ushort Position_Mode, ushort StationNumber = 0); - //9.12 ʱ 궨0.2 [0,2^31-1] [0,99] + /// + /// 9.12 ʱ 궨0.2 [0,2^31-1] [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Buffer_Delay_Net")] public static extern short MCF_Buffer_Delay_Net(ushort Buffer_Number, uint number, ushort StationNumber = 0); - //9.13 IO 궨0.2 궨2.3.1 궨2.3.2 [0,99] + /// + /// 9.13 IO 궨0.2 궨2.3.1 궨2.3.2 [0,99] + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Buffer_Set_Output_Bit_Net")] public static extern short MCF_Buffer_Set_Output_Bit_Net(ushort Buffer_Number, ushort Bit_Number, ushort output, ushort StationNumber = 0); - //9.14 IOȴ 궨0.2 궨2.4.1 궨2.4.2 (0,2^15-1] [0,99] + /// + /// 9.14 IOȴ 궨0.2 궨2.4.1 궨2.4.2 (0,2^15-1] [0,99] + /// + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Buffer_Wait_Input_Bit_Net")] public static extern short MCF_Buffer_Wait_Input_Bit_Net(ushort Buffer_Number, ushort Bit_Number, ushort Logic, ushort Time_Out, ushort StationNumber = 0); - //9.15 궨0.2 [0,99] + /// + /// 9.15 궨0.2 [0,99] + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Buffer_End_Net")] public static extern short MCF_Buffer_End_Net(ushort Buffer_Number, ushort StationNumber = 0); - //9.16 ִк 궨0.2 궨9.16 [0,99] + /// + /// 9.16 ִк 궨0.2 궨9.16 [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Buffer_Execute_Net")] public static extern short MCF_Buffer_Execute_Net(ushort Buffer_Number, ushort Execute_Mode, ushort StationNumber = 0); - //9.17 ϵ 궨0.2 [0,99] + /// + /// 9.17 ϵ 궨0.2 [0,99] + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Buffer_Execute_BreakPoint_Net")] public static extern short MCF_Buffer_Execute_BreakPoint_Net(ushort Buffer_Number, ushort StationNumber = 0); - //9.18 ״̬ѯ 궨0.2 MC_Retrun.h{0,29,30} [0,2^15-1] + /// + /// 9.18 ״̬ѯ 궨0.2 MC_Retrun.h{0,29,30} [0,2^15-1] + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Buffer_Get_State_Net")] public static extern short MCF_Buffer_Get_State_Net(ushort Buffer_Number, ref ushort Execute_State, ref ushort Execute_Number, ushort StationNumber = 0); - //9.19 ʣɲָռٷֱȲѯ 궨0.2 [0,100] + /// + /// 9.19 ʣɲָռٷֱȲѯ 궨0.2 [0,100] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Buffer_Get_Remainder_Space_Net")] public static extern short MCF_Buffer_Get_Remainder_Space_Net(ushort Buffer_Number, ref ushort Remainder_Space_Ratio, ushort StationNumber = 0); - //9.20 ʼ(ѯʣһϿռ) 궨0.2 [0,99] + /// + /// 9.20 ʼ(ѯʣһϿռ) 궨0.2 [0,99] + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Buffer_Insert_Start_Net")] public static extern short MCF_Buffer_Insert_Start_Net(ushort Buffer_Number, ushort StationNumber = 0); - //9.22 궨0.2 [0,99] + /// + /// 9.22 궨0.2 [0,99] + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Buffer_Insert_End_Net")] public static extern short MCF_Buffer_Insert_End_Net(ushort Buffer_Number, ushort StationNumber = 0); - //9.23 ָռõĿռٷֱ 궨0.2 [0,100] [0,99] + /// + /// 9.23 ָռõĿռٷֱ 궨0.2 [0,100] [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// // MCF_Buffer_Start_NetMCF_Buffer_Insert_Start_Netʼ0 [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Buffer_Count_Occupy_Space_Net")] public static extern short MCF_Buffer_Count_Occupy_Space_Net(ushort Buffer_Number, ref ushort Occupy_Space_Ratio, ushort StationNumber = 0); @@ -415,78 +1495,219 @@ namespace MCDLL_NET /******************************************************************************************************************************************************************** 10 ʾ10KƵݲ׽ ********************************************************************************************************************************************************************/ - //10.1 ݲ׽/رպ(MCF_Open_Netǰǰ,ֻ֧һ˶ƿ) + /// + /// 10.1 ݲ׽/رպ(MCF_Open_Netǰǰ,ֻ֧һ˶ƿ) + /// + /// + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Capture_Open_Net")] public static extern short MCF_Capture_Open_Net(ushort Capture_Mode = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Capture_Close_Net")] public static extern short MCF_Capture_Close_Net(); - //10.2 ݲ׽ݸº 궨10.2 + /// + /// 10.2 ݲ׽ݸº 궨10.2 + /// + /// + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Capture_State_Net")] public static extern short MCF_Capture_State_Net(ref ushort Capture_State); - //10.3 ȡ1000λ 궨0.0 &Array[Capture_Frequency*Capture_Time_1MS] + /// + /// 10.3 ȡ1000λ 궨0.0 + /// + /// + /// + /// &Array[1000] [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Capture_Read_Command_Net")] public static extern short MCF_Capture_Read_Command_Net(ushort Axis, ref int Command); - //10.4 ȡ1000 궨0.0 &Array[Capture_Frequency*Capture_Time_1MS] + /// + /// [100,250,500,1000] + /// + /// + /// + /// + /// + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Capture_Read_Command_Custom_Net")] + public static extern short MCF_Capture_Read_Command_Custom_Net(ushort Axis, int Number, ref int Command); + /// + /// 10.4 ȡ1000 궨0.0 + /// + /// + /// + /// &Array[1000] [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Capture_Read_Encoder_Net")] public static extern short MCF_Capture_Read_Encoder_Net(ushort Axis, ref int Encoder); - //10.5 ȡ1000ģ 궨0.0 &Array[Capture_Frequency*Capture_Time_1MS] + /// + /// [100,250,500,1000] + /// + /// + /// + /// + /// + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Capture_Read_Encoder_Custom_Net")] + public static extern short MCF_Capture_Read_Encoder_Custom_Net(ushort Axis, int Number, ref int Encoder); + /// + /// 10.5 ȡ1000ģ 궨0.0 + /// + /// + /// + /// &Array[1000] [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Capture_Read_AD_Net")] public static extern short MCF_Capture_Read_AD_Net(ushort Axis, ref int AD); - //10.6 ADC˲ 궨0.0 [0,1] + /// + /// [100,250,500,1000] + /// + /// + /// + /// + /// + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Capture_Read_AD_Custom_Net")] + public static extern short MCF_Capture_Read_AD_Custom_Net(ushort Axis, int Number, ref int AD); + /// + /// 10.6 ADC˲ 궨0.0 [0,1] + /// + /// + /// + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Capture_Filter_AD_Net")] public static extern short MCF_Capture_Filter_AD_Net(ushort Axis, double Filter_Coefficient = 1); - //10.7 ݲ׽Ƶ 궨10.7 + /// + /// 10.7 ݲ׽Ƶ 궨10.7 + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Capture_Frequency_Net")] public static extern short MCF_Capture_Frequency_Net(ushort Capture_Frequency = 1, ushort StationNumber = 0); - //10.8 ݲ׽ʱ [2,1000] 2ı - [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Capture_Time_Net")] - public static extern short MCF_Capture_Time_Net(ushort Capture_Time_1MS = 100, ushort StationNumber = 0); /******************************************************************************************************************************************************************** 11 ӳֿƺ ********************************************************************************************************************************************************************/ - //11.1 ӳú 궨0.0 궨0.0 (0,(2^31-1)] (0,(2^31-1)] 궨11.1.1 궨11.1.2 [0,99] + /// + /// 11.1 ӳú 궨0.0 궨0.0 (0,(2^31-1)] (0,(2^31-1)] 궨11.1.1 궨11.1.2 [0,99] + /// + /// + /// + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Gear_Net")] public static extern short MCF_Set_Gear_Net(ushort Axis, ushort Follow_Axis, uint Denominator, uint Molecule, ushort Follow_Source, ushort Dir, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Gear_Net")] public static extern short MCF_Get_Gear_Net(ushort Axis, ref ushort Follow_Axis, ref uint Denominator, ref uint Molecule, ref ushort Follow_Source, ref ushort Dir, ushort StationNumber = 0); - //11.2 ӳֿغ 궨0.0 궨11.2 [0,99] + /// + /// 11.2 ӳֿغ 궨0.0 궨11.2 [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Gear_Enable_Net")] public static extern short MCF_Set_Gear_Enable_Net(ushort Axis, ushort Gear_Enable, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Gear_Enable_Net")] public static extern short MCF_Get_Gear_Enable_Net(ushort Axis, ref ushort Gear_Enable, ushort StationNumber = 0); - //11.3 ӳ˶Զر 궨0.0 [-2^31,(2^31-1)] [0,99] + /// + /// 11.3 ӳ˶Զر 궨0.0 [-2^31,(2^31-1)] [0,99] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Gear_Auto_Disable_Net")] public static extern short MCF_Set_Gear_Auto_Disable_Net(ushort Axis, int dDist, ushort StationNumber = 0); /******************************************************************************************************************************************************************** 12 λñȽ ********************************************************************************************************************************************************************/ - //12.1 һάλñȽ 궨0.0 + /// + /// 12.1 һάλñȽ 궨0.0 + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Compare_Config_Net")] public static extern short MCF_Set_Compare_Config_Net(ushort Axis, ushort Enable, ushort Compare_Source, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Compare_Config_Net")] public static extern short MCF_Get_Compare_Config_Net(ushort Axis, ref ushort Enable, ref ushort Compare_Source, ushort StationNumber = 0); - //12.2 һάλ/ǰȽϵ/ر 궨0.0 + /// + /// 12.2 һάλ/ǰȽϵ/ر 궨0.0 + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Clear_Compare_Points_Net")] public static extern short MCF_Clear_Compare_Points_Net(ushort Axis, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Clear_Compare_Current_Points_Net")] public static extern short MCF_Clear_Compare_Current_Points_Net(ushort Axis, ushort StationNumber = 0); - // MCF_Add_Compare_Point_Net ۼӼ 궨0.0 [1,(2^31-1)} + + + /// + /// MCF_Add_Compare_Point_Net ۼӼ 궨0.0 [1,(2^31-1)} + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Disable_Compare_Any_Points_Net")] public static extern short MCF_Disable_Compare_Any_Points_Net(ushort Axis, uint Point_Number, ushort StationNumber = 0); - //12.3 һάλñȽϵ 궨0.0 + + + /// + /// 12.3 һάλñȽϵ 궨0.0 + /// + /// + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Add_Compare_Point_Net")] public static extern short MCF_Add_Compare_Point_Net(ushort Axis, int Position, ushort Dir, ushort Action, ushort Actpara, ushort StationNumber = 0); - //12.4 ȡǰһάȽϵλ 궨0.0 + + + /// + /// 12.4 ȡǰһάȽϵλ 궨0.0 + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Compare_Current_Point_Net")] public static extern short MCF_Get_Compare_Current_Point_Net(ushort Axis, ref int Position, ushort StationNumber = 0); - //12.5 ѯѾȽϹһάȽϵ(ע) 궨0.0 [0,256] + + + /// + /// 12.5 ѯѾȽϹһάȽϵ(ע) 궨0.0 [0,256] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Compare_Points_Runned_Net")] public static extern short MCF_Get_Compare_Points_Runned_Net(ushort Axis, ref ushort Point_Number, ushort StationNumber = 0); - //12.6 ѯԼһάȽϵ 궨0.0 [0,256] + + + /// + /// 12.6 ѯԼһάȽϵ 궨0.0 [0,256] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Compare_Points_Remained_Net")] public static extern short MCF_Get_Compare_Points_Remained_Net(ushort Axis, ref ushort Point_Number, ushort StationNumber = 0); - //12.7 ѯδһάȽϵλ 궨0.0 + /// + /// 12.7 ѯδһάȽϵλ 궨0.0 + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Compare_Points_Incomplete_Net")] public static extern short MCF_Get_Compare_Points_Incomplete_Net(ushort Axis, ref ushort Incomplete_Number, ref int Incomplete_Position, ushort StationNumber = 0); @@ -495,70 +1716,172 @@ namespace MCDLL_NET /******************************************************************************************************************************************************************** 13 PWM ********************************************************************************************************************************************************************/ - //13.1 PWM 궨13.1.1 궨13.1.2 궨13.1.3 궨13.1.4 + /// + /// 13.1 PWM 궨13.1.1 궨13.1.2 궨13.1.3 + /// + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Pwm_Config_Net")] public static extern short MCF_Set_Pwm_Config_Net(ushort Channel, ushort Enable, ushort Output_Port_Config, ushort Output_Start_Logic, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Pwm_Config_Net")] public static extern short MCF_Get_Pwm_Config_Net(ushort Channel, ref ushort Enable, ref ushort Output_Port_Config, ref ushort Output_Start_Logic, ushort StationNumber = 0); - //13.2 PWMź 궨13.1.1 [0,1000000] [0,100] (0,(2^31-1)] + /// + /// 13.2 PWMź 궨13.1.1 [0,1000000] [0,100] (0,(2^31-1)] + /// + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Pwm_Output_Net")] public static extern short MCF_Set_Pwm_Output_Net(ushort Channel, uint Frequency, uint DutyCycle, uint Pwm_Number, ushort StationNumber = 0); - //13.3 PWMź 궨13.1.1 궨13.3.1 + /// + /// 13.3 PWMź 궨13.1.1 궨13.3.1 + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Pwm_State_Net")] public static extern short MCF_Get_Pwm_State_Net(ushort Channel, ref ushort Finish, ushort StationNumber = 0); /******************************************************************************************************************************************************************** 14 ֺ ********************************************************************************************************************************************************************/ - //14.1 ֹ 궨11.1.2 + /// + /// 14.1 ֹ 궨11.1.2 + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Hand_Wheel_Open_Net")] public static extern short MCF_Hand_Wheel_Open_Net(ushort Dir, ushort StationNumber = 0); - //14.2 رֹ + /// + /// 14.2 رֹ + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Hand_Wheel_Close_Net")] public static extern short MCF_Hand_Wheel_Close_Net(ushort StationNumber = 0); - //14.3 Ӳֱͨ 궨0.0 + /// + /// 14.3 Ӳֱͨ 궨0.0 + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Hand_Wheel_Config_Encoder_Net")] public static extern short MCF_Hand_Wheel_Config_Encoder_Net(ushort Axis, ushort StationNumber = 0); - //14.4 Ӳ 궨2.4.1 + /// + /// 14.4 Ӳ 궨2.4.1 + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Hand_Wheel_Config_X1_Net")] public static extern short MCF_Hand_Wheel_Config_X1_Net(ushort Bit_Input_Number, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Hand_Wheel_Config_X10_Net")] public static extern short MCF_Hand_Wheel_Config_X10_Net(ushort Bit_Input_Number, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Hand_Wheel_Config_X100_Net")] public static extern short MCF_Hand_Wheel_Config_X100_Net(ushort Bit_Input_Number, ushort StationNumber = 0); - // ӲʴС [1,100] + /// + /// ӲʴС [1,100] + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Hand_Wheel_Speed_X1_Net")] public static extern short MCF_Hand_Wheel_Speed_X1_Net(ushort Speed_X = 1, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Hand_Wheel_Speed_X10_Net")] public static extern short MCF_Hand_Wheel_Speed_X10_Net(ushort Speed_X = 10, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Hand_Wheel_Speed_X100_Net")] public static extern short MCF_Hand_Wheel_Speed_X100_Net(ushort Speed_X = 100, ushort StationNumber = 0); - //14.4 Ӳ 궨0.0 궨2.4.1 + /// + /// 14.4 Ӳ 궨0.0 궨2.4.1 + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Hand_Wheel_Config_Axis_Net")] public static extern short MCF_Hand_Wheel_Config_Axis_Net(ushort Axis, ushort Bit_Input_Number, ushort StationNumber = 0); - //14.5 ˶ƽ˲ʱ 궨0.0 [1,1000]MS + /// + /// 14.5 ˶ƽ˲ʱ 궨0.0 [1,1000]MS + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Hand_Wheel_Config_Filter_Time_Net")] public static extern short MCF_Hand_Wheel_Config_Filter_Time_Net(ushort Axis, uint Filter_Time_1MS, ushort StationNumber = 0); /******************************************************************************************************************************************************************** 15 ģ ********************************************************************************************************************************************************************/ - //15.1 ȡADC 궨0.0 [-2^15,(2^15-1)] + /// + /// 15.1 ȡADC 궨0.0 [-2^15,(2^15-1)] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Single_Read_AD_Net")] public static extern short MCF_Single_Read_AD_Net(ushort Channel, ref short AD, ushort StationNumber = 0); - //15.2 ȡDAC 궨0.0 [-2^15,(2^15-1)] + /// + /// 15.2 ȡDAC 궨0.0 [-2^15,(2^15-1)] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Single_Write_DA_Net")] public static extern short MCF_Single_Write_DA_Net(ushort Channel, short DA, ushort StationNumber = 0); - //15.3 AD˫ȽֹͣӦ + /// + /// 15.3 AD˫ȽֹͣӦ + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_AD_Compare_Net")] public static extern short MCF_Set_AD_Compare_Net(ushort Channel, short AD_Compare, ushort Stop_Axis, ushort StationNumber = 0); - //15.4 ADֵ [0,7] + /// + /// 15.4 ADֵ [0,7] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_AD_Capture_Net")] public static extern short MCF_Set_AD_Capture_Net(ushort Channel, short AD_Capture, ushort StationNumber = 0); - // 0ֲ 1λ + /// + /// 0ֲ 1λ + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// + + [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Clear_AD_Capture_Net")] - public static extern short MCF_Clear_AD_Capture_Net(ushort C_1, ushort C_2, ushort C_3, ushort C_4, - ushort C_5, ushort C_6, ushort C_7, ushort C_8, ushort StationNumber = 0); - // ȡADֵ񵽵ĶӦͨADֵXλ + public static extern short MCF_Clear_AD_Capture_Net(ushort C_1, ushort C_2, ushort C_3, ushort C_4, ushort C_5, ushort C_6, ushort C_7, ushort C_8, ushort StationNumber = 0); + /// + /// ȡADֵ񵽵ĶӦͨADֵXλ + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Capture_AD_1_Net")] public static extern short MCF_Get_Capture_AD_1_Net(ref short AD_5, ref int Position_1, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Capture_AD_2_Net")] @@ -575,14 +1898,27 @@ namespace MCDLL_NET public static extern short MCF_Get_Capture_AD_7_Net(ref short AD_3, ref int Position_1, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Capture_AD_8_Net")] public static extern short MCF_Get_Capture_AD_8_Net(ref short AD_4, ref int Position_1, ushort StationNumber = 0); - //15.5 ôλֵ [0,7] + /// + /// 15.5 ôλֵ [0,7] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_Position_Capture_AD_Net")] public static extern short MCF_Set_Position_Capture_AD_Net(ushort Channel, int Position_1, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Position_Capture_AD_Net")] public static extern short MCF_Get_Position_Capture_AD_Net(ushort Channel, ref short AD, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Clear_Position_Capture_AD_Net")] public static extern short MCF_Clear_Position_Capture_AD_Net(ushort C_1, ushort C_2, ushort C_3, ushort C_4, ushort C_5, ushort C_6, ushort C_7, ushort C_8, ushort StationNumber = 0); - //15.6 ȡADֵ [0,7] + /// + /// 15.6 ȡADֵ [0,7] + /// + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Limit_AD_Net")] public static extern short MCF_Get_Limit_AD_Net(ushort Channel, ref short MAX_AD, ref short MIN_AD, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Clear_Limit_AD_Net")] @@ -590,32 +1926,60 @@ namespace MCDLL_NET /******************************************************************************************************************************************************************** 16 ϵͳ ********************************************************************************************************************************************************************/ - //16.1 ģ汾 [0x00000000,0xFFFFFFFF] [0,99] + /// + /// 16.1 ģ汾 [0x00000000,0xFFFFFFFF] [0,99] + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Version_Net")] public static extern short MCF_Get_Version_Net(ref uint Version, ushort StationNumber = 0); - //16.2 к [0x00000000,0xFFFFFFFF] [0,99] + /// + /// 16.2 к [0x00000000,0xFFFFFFFF] [0,99] + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Serial_Number_Net")] public static extern short MCF_Get_Serial_Number_Net(ref long Serial_Number, ushort StationNumber = 0); - //16.3 ģʱ [0x00000000,0xFFFFFFFF] [0,99] λ + /// + /// 16.3 ģʱ [0x00000000,0xFFFFFFFF] [0,99] λ + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Run_Time_Net")] public static extern short MCF_Get_Run_Time_Net(ref uint Run_Time, ushort StationNumber = 0); - //16.4 Flash дĿǰʱС2Kbytes,Ҳһ unsigned int Array[256] + /// + /// 16.4 Flash дĿǰʱС2Kbytes,Ҳһ unsigned int Array[256] + /// + /// + /// + /// վãĬϲΪ 0 + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Flash_Write_Net")] public static extern short MCF_Flash_Write_Net(uint Pass_Word_Setup, ref uint Flash_Write_Data, ushort StationNumber = 0); [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Flash_Read_Net")] public static extern short MCF_Flash_Read_Net(uint Pass_Word_Check, ref uint Flash_Read_Data, ushort StationNumber = 0); - //16.5 ·,һһգʹ(Ĭ) + /// + /// 16.5 ·,һһգʹ(Ĭ) + /// + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_LookBack_Enable_Net")] public static extern short MCF_LookBack_Enable_Net(); - //16.6 ر·ֻգϻģʽʹ,߼ģǷ + /// + /// 16.6 ر·ֻգϻģʽʹ,߼ģǷ + /// + /// [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_LookBack_Disable_Net")] public static extern short MCF_LookBack_Disable_Net(); - //16.7 ͨѶʱ &Array[12] + /// + /// 16.7 ͨѶʱ + /// + /// + /// &Array[12] [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Get_Connect_Time_Count_Net")] public static extern short MCF_Get_Connect_Time_Count_Net(ref uint Connect_Count); - //16.8 ϵͳʱص - [DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Set_CallBack_Net")] - public static extern short MCF_Set_CallBack_Net(int CallBack, uint Time_1MS); } } \ No newline at end of file diff --git a/DH.Devices.Motion/SLDMotion.cs b/DH.Devices.Motion/SLDMotion.cs index bc504fd..3f2b361 100644 --- a/DH.Devices.Motion/SLDMotion.cs +++ b/DH.Devices.Motion/SLDMotion.cs @@ -1,6 +1,7 @@ using DH.Commons.Enums; using DH.Devices.Motion; using MCDLL_NET; +using OpenCvSharp; using System.Diagnostics; using static System.Collections.Specialized.BitVector32; @@ -287,53 +288,56 @@ namespace DH.Devices.Motion for (ushort station = 0; station < BoardCount; station++) { // 关闭调试测试后的位置比较 + //关闭调试测试后的位置比较 for (int i = 0; i < 16; i++) { rtn = CMCDLL_NET.MCF_Set_Compare_Config_Net((ushort)i, 0, 0, station); + Console.WriteLine($"MCF_Set_Compare_Config_Net {i}::{rtn}"); } - // 2.配置物件设置 - rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Piece_Size_Net(PieceMaxSize, PieceMinSize, station); + //2.配置物件设置 + rtn = CMCDLL_NET.MCF_Sorting_Set_Piece_Size_Net(PieceMaxSize, PieceMinSize, station); + Console.WriteLine($"MCF_Sorting_Set_Piece_Size_Net::{rtn}"); - - rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Piece_Place_Net(MinDistance, MinTimeInterval, station); + rtn = CMCDLL_NET.MCF_Sorting_Set_Piece_Place_Net(MinDistance, MinTimeInterval, station); + Console.WriteLine($"MCF_Sorting_Set_Piece_Place_Net::{rtn}"); } - if (BoardCount < 2) - { - // rtn = CMCDLL_NET_Sorting.MCF_Sorting_Camera_Blow_Config_Net(10, 6, 0); - // 3.配置相机设置 - rtn = CMCDLL_NET_Sorting.MCF_Sorting_Camera_Blow_Config_Net(10, 6, 0); - //设置来料使能 0 是默认 1是开始 - // - rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Enable_Net((ushort)SortingInputSetting.BitInputNumber, 1); - //设置物件检测有效电平 0是低电平 1是高电平 - rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Logic_Net((ushort)SortingInputSetting.BitInputNumber, 0); - //设置来料检测编码器 双转盘要设置两个轴 - /*Bit_Input_Number:设置位号。 - 取值: Bit_Input_0, Bit_Input_1。 - Axis: 轴号。 - Source:跟随方式 - 取值:0:命令 - 1:编码器(默认) - StationNumber: 站点号;*/ - // rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Source_Net((ushort)IIConfig.SortingInputSetting.BitInputNumber, 0, 1); - rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Source_Net((ushort)SortingInputSetting.BitInputNumber, 1, 1); + //if (BoardCount < 2) + //{ + // // rtn = CMCDLL_NET_Sorting.MCF_Sorting_Camera_Blow_Config_Net(10, 6, 0); + // // 3.配置相机设置 + // rtn = CMCDLL_NET_Sorting.MCF_Sorting_Camera_Blow_Config_Net(10, 6, 0); + // //设置来料使能 0 是默认 1是开始 + // // + // rtn = CMCDLL_NET.MCF_Sorting_Set_Input_Enable_Net((ushort)SortingInputSetting.BitInputNumber, 1); + // //设置物件检测有效电平 0是低电平 1是高电平 + // rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Logic_Net((ushort)SortingInputSetting.BitInputNumber, 0); + // //设置来料检测编码器 双转盘要设置两个轴 + // /*Bit_Input_Number:设置位号。 + // 取值: Bit_Input_0, Bit_Input_1。 + // Axis: 轴号。 + // Source:跟随方式 + // 取值:0:命令 + // 1:编码器(默认) + // StationNumber: 站点号;*/ + // // rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Source_Net((ushort)IIConfig.SortingInputSetting.BitInputNumber, 0, 1); + // rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Source_Net((ushort)SortingInputSetting.BitInputNumber, 1, 1); - //rtn = CMCDLL_NET_Sorting.MCF_Sorting_Camera_Blow_Config_Net( - // (ushort)IIConfig.SnapshotSettings.Count, - // (ushort)IIConfig.BlowSettings.Count, - // 0); - // rtn = CMCDLL_NET_Sorting.MCF_Set_Config_Camera_Net(); - //为防止转盘第二个盘不触发拍照 设置一键取反功能 - } + // //rtn = CMCDLL_NET_Sorting.MCF_Sorting_Camera_Blow_Config_Net( + // // (ushort)IIConfig.SnapshotSettings.Count, + // // (ushort)IIConfig.BlowSettings.Count, + // // 0); + // // rtn = CMCDLL_NET_Sorting.MCF_Set_Config_Camera_Net(); + // //为防止转盘第二个盘不触发拍照 设置一键取反功能 + //} // 3.配置相机设置 ConfigCamera(); // 4.配置气阀 - ConfigBlow(); + // ConfigBlow(); @@ -345,54 +349,33 @@ namespace DH.Devices.Motion for (ushort card = 0; card < cardCount; card++) { - //IIConfig.SortingInputSettings.ForEach(sortingInputSetting => + //5.开启筛选 + rtn = CMCDLL_NET.MCF_Sorting_Start_Net(0, card); + if (rtn != (short)0) + { + // LogAsync(DateTime.Now, LogLevel.Warning, $"卡{station}开启筛选异常,ret:{rtn}"); + } + //if (cardCount < 2) //{ - // var camStart = 0; - // if (sortingInputSetting.EnableBindCamera) - // { - // camStart = sortingInputSetting.CameraStartNumber; - // } - - // var blowStart = 0; - // if (sortingInputSetting.EnableBindBlow) - // { - // blowStart = sortingInputSetting.BlowStartNumber; - // } - - // var b = (ushort)sortingInputSetting.BitInputNumber; - // //var ret = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Bind_Net(b, - // // (ushort)camStart, - // // (ushort)blowStart, - // // card); - - // var ret = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Bind_Net(1, - // 1, - // 2, + // // 最小值 1 2 2 + // var ret = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Bind_Net( + // (ushort)SortingInputSetting.BitInputNumber, // 1 + // SortingInputSetting.CameraStartNumber, // 7, + // SortingInputSetting.BlowStartNumber, // 2, // card); - //}); - // CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Source_Net(); - if (cardCount < 2) - { - // 最小值 1 2 2 - var ret = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Bind_Net( - (ushort)SortingInputSetting.BitInputNumber, // 1 - SortingInputSetting.CameraStartNumber, // 7, - SortingInputSetting.BlowStartNumber, // 2, - card); + //} - } - - for (ushort station = 0; station < cardCount; station++) - { - // 5.开启筛选 - //开启自动筛选功能 - rtn = CMCDLL_NET_Sorting.MCF_Sorting_Start_Net(0, station); - if (rtn != (short)FuncRet.Function_Success) - { - //LogAsync(DateTime.Now, LogLevel.Warning, $"卡{card}开启筛选异常,ret:{rtn}"); - } - } + //for (ushort station = 0; station < cardCount; station++) + //{ + // // 5.开启筛选 + // //开启自动筛选功能 + // rtn = CMCDLL_NET_Sorting.MCF_Sorting_Start_Net(0, station); + // if (rtn != (short)FuncRet.Function_Success) + // { + // //LogAsync(DateTime.Now, LogLevel.Warning, $"卡{card}开启筛选异常,ret:{rtn}"); + // } + //} } } @@ -419,6 +402,7 @@ namespace DH.Devices.Motion public override void Stop() { + isconnected = false; //base.Stop(); AxisStop(); int ret = CMCDLL_NET.MCF_Set_Servo_Enable_Net(0, (ushort)ServoLogic.Servo_Open, 0); @@ -636,7 +620,7 @@ namespace DH.Devices.Motion // 初始化 for (ushort station = 0; station < BoardCount; station++) { - ret = CMCDLL_NET_Sorting.MCF_Sorting_Init_Net(station); + ret = CMCDLL_NET.MCF_Sorting_Init_Net(station); stations.Add(station); cardTypes.Add(2); } @@ -658,8 +642,8 @@ namespace DH.Devices.Motion { } - MCF_Screen_Set_Trigger1(); - MCF_Screen_Set_Trigger1(1); + //MCF_Screen_Set_Trigger1(); + // MCF_Screen_Set_Trigger1(1); } @@ -1859,7 +1843,7 @@ namespace DH.Devices.Motion continue; } - var rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Trig_Camera_Delay_Count_Net(i, + var rtn = CMCDLL_NET.MCF_Sorting_Set_Trig_Camera_Delay_Count_Net(i, camSetting.CameraDelayCountMS, camSetting.StationNumber); @@ -1894,7 +1878,7 @@ namespace DH.Devices.Motion } else { - rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Camera_Net( + rtn = CMCDLL_NET.MCF_Sorting_Set_Camera_Net( i, // CCD0 CameraPositionReal, RotationDirectionReal, @@ -2004,23 +1988,31 @@ namespace DH.Devices.Motion switch (blowSetting.BlowType) { case BlowType.OK: - CMCDLL_NET_Sorting.MCF_Sorting_Set_Blow_OK_Net(CameraPositionReal, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)ioIndex, blowSetting.StationNumber); + CMCDLL_NET.MCF_Sorting_Set_Blow_OK_Net(CameraPositionReal, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)ioIndex, blowSetting.StationNumber); break; case BlowType.NG: - CMCDLL_NET_Sorting.MCF_Sorting_Set_Blow_NG_Net(CameraPositionReal, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)ioIndex, blowSetting.StationNumber); + CMCDLL_NET.MCF_Sorting_Set_Blow_NG_Net(CameraPositionReal, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)ioIndex, blowSetting.StationNumber); break; case BlowType.Blow1: - CMCDLL_NET_Sorting.MCF_Sorting_Set_Blow_Net(1, CameraPositionReal, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)ioIndex, blowSetting.StationNumber); + CMCDLL_NET.MCF_Sorting_Set_Blow_1_Net(blowSetting.BlowPosition, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)blowSetting.BlowIO.IOIndex, blowSetting.StationNumber); break; ///第一路绑定OK NG 吹起口1 case BlowType.Blow2: - CMCDLL_NET_Sorting.MCF_Sorting_Set_Blow_Net(2, CameraPositionReal, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)ioIndex, blowSetting.StationNumber); + CMCDLL_NET.MCF_Sorting_Set_Blow_2_Net(blowSetting.BlowPosition, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)blowSetting.BlowIO.IOIndex, blowSetting.StationNumber); break; case BlowType.Blow3: - CMCDLL_NET_Sorting.MCF_Sorting_Set_Blow_Net(3, CameraPositionReal, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)ioIndex, blowSetting.StationNumber); + CMCDLL_NET.MCF_Sorting_Set_Blow_3_Net(blowSetting.BlowPosition, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)blowSetting.BlowIO.IOIndex, blowSetting.StationNumber); break; case BlowType.Blow4: - CMCDLL_NET_Sorting.MCF_Sorting_Set_Blow_Net(4, CameraPositionReal, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)ioIndex, blowSetting.StationNumber); + CMCDLL_NET.MCF_Sorting_Set_Blow_4_Net(blowSetting.BlowPosition, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)blowSetting.BlowIO.IOIndex, blowSetting.StationNumber); + break; + case BlowType.Blow5: + CMCDLL_NET.MCF_Sorting_Set_Blow_5_Net(blowSetting.BlowPosition, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)blowSetting.BlowIO.IOIndex, blowSetting.StationNumber); + break; + case BlowType.Blow6: + CMCDLL_NET.MCF_Sorting_Set_Blow_6_Net(blowSetting.BlowPosition, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)blowSetting.BlowIO.IOIndex, blowSetting.StationNumber); + break; + default: break; //case BlowType.OK: // CMCDLL_NET_Sorting.MCF_Sorting_Set_Blow_OK_Net(setting.BlowPosition, (ushort)IIConfig.MotionDir, (ushort)setting.ActionMode, (ushort)setting.BlowIO.IOIndex, setting.StationNumber); @@ -2047,8 +2039,7 @@ namespace DH.Devices.Motion //case BlowType.Blow6: // CMCDLL_NET_Sorting.MCF_Sorting_Set_Blow_6_Net(setting.BlowPosition, (ushort)IIConfig.MotionDir, (ushort)setting.ActionMode, (ushort)setting.BlowIO.IOIndex, setting.StationNumber); // break; - default: - break; + } } diff --git a/DHSoftware/DHSoftware.csproj b/DHSoftware/DHSoftware.csproj index 56e99eb..31c37ee 100644 --- a/DHSoftware/DHSoftware.csproj +++ b/DHSoftware/DHSoftware.csproj @@ -12,6 +12,18 @@ WinExe + + + + + + + + + + + + diff --git a/DHSoftware/MainWindow.Designer.cs b/DHSoftware/MainWindow.Designer.cs index 53ae77b..3457d7a 100644 --- a/DHSoftware/MainWindow.Designer.cs +++ b/DHSoftware/MainWindow.Designer.cs @@ -41,6 +41,7 @@ button_color = new AntdUI.Button(); buttonSZ = new AntdUI.Button(); pageHeader1 = new AntdUI.PageHeader(); + label1 = new Label(); divider2 = new AntdUI.Divider(); panelmain = new AntdUI.Panel(); panel2 = new AntdUI.Panel(); @@ -56,11 +57,9 @@ panel3 = new AntdUI.Panel(); tabs2 = new AntdUI.Tabs(); tabPage2 = new AntdUI.TabPage(); - pictureBox1 = new PictureBox(); divider1 = new AntdUI.Divider(); panel1 = new AntdUI.Panel(); segmented1 = new AntdUI.Segmented(); - label1 = new Label(); titlebar.SuspendLayout(); pageHeader1.SuspendLayout(); panelmain.SuspendLayout(); @@ -73,8 +72,6 @@ tabPage3.SuspendLayout(); panel3.SuspendLayout(); tabs2.SuspendLayout(); - tabPage2.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit(); panel1.SuspendLayout(); SuspendLayout(); // @@ -139,6 +136,15 @@ pageHeader1.TabIndex = 7; pageHeader1.Text = "UPH"; // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(61, 10); + label1.Name = "label1"; + label1.Size = new Size(64, 21); + label1.TabIndex = 1; + label1.Text = "100000"; + // // divider2 // divider2.Dock = DockStyle.Top; @@ -285,22 +291,11 @@ // // tabPage2 // - tabPage2.Controls.Add(pictureBox1); tabPage2.Location = new Point(3, 28); tabPage2.Name = "tabPage2"; tabPage2.Size = new Size(347, 469); tabPage2.TabIndex = 0; - tabPage2.Text = "统计"; - // - // pictureBox1 - // - pictureBox1.Dock = DockStyle.Fill; - pictureBox1.Location = new Point(0, 0); - pictureBox1.Name = "pictureBox1"; - pictureBox1.Size = new Size(347, 469); - pictureBox1.SizeMode = PictureBoxSizeMode.Zoom; - pictureBox1.TabIndex = 0; - pictureBox1.TabStop = false; + tabPage2.Text = "配置"; // // divider1 // @@ -401,15 +396,6 @@ segmented1.Text = "segmented1"; segmented1.SelectIndexChanged += segmented1_SelectIndexChanged; // - // label1 - // - label1.AutoSize = true; - label1.Location = new Point(61, 10); - label1.Name = "label1"; - label1.Size = new Size(64, 21); - label1.TabIndex = 1; - label1.Text = "100000"; - // // MainWindow // ClientSize = new Size(1024, 648); @@ -438,8 +424,6 @@ tabPage3.ResumeLayout(false); panel3.ResumeLayout(false); tabs2.ResumeLayout(false); - tabPage2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit(); panel1.ResumeLayout(false); ResumeLayout(false); } @@ -468,7 +452,6 @@ private AntdUI.TabPage tabPage2; private AntdUI.Divider divider1; private RichTextBox richTextBox1; - private PictureBox pictureBox1; private Label label1; } } \ No newline at end of file diff --git a/DHSoftware/MainWindow.cs b/DHSoftware/MainWindow.cs index ddf998d..cb7ad8a 100644 --- a/DHSoftware/MainWindow.cs +++ b/DHSoftware/MainWindow.cs @@ -282,11 +282,11 @@ namespace DHSoftware //[Description("定义检测标签的集合,例如:Seg/Detection模式:断裂、油污、划伤...;Class模式:ok、ng、上面、下面、套环、正常...")] //[TypeConverter(typeof(CollectionCountConvert))] //[Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] - RecongnitionLabel recongnition=new RecongnitionLabel + RecongnitionLabel recongnition = new RecongnitionLabel { - LabelName="youwu", - LabelDescription="油污", - LabelCategory="A_NG" + LabelName = "youwu", + LabelDescription = "油污", + LabelCategory = "A_NG" }; RecongnitionLabel recongnition2 = new RecongnitionLabel { @@ -314,7 +314,7 @@ namespace DHSoftware var det6 = new DetectionConfig("相机6", MLModelType.ObjectDetection, @"D:\PROJECTS\X015\Vision\Cam6.onnx", false, "Cam6"); var det7 = new DetectionConfig("相机7", MLModelType.ObjectDetection, @"D:\PROJECTS\X015\Vision\Cam7.onnx", false, "Cam7"); var det8 = new DetectionConfig("相机8", MLModelType.ObjectDetection, @"D:\PROJECTS\X015\Vision\Cam8.onnx", false, "Cam8"); - List CameraCollects=new List(); + List CameraCollects = new List(); CameraCollects.Add(new RelatedCamera("Cam1")); List CameraCollects2 = new List(); CameraCollects2.Add(new RelatedCamera("Cam2")); @@ -420,24 +420,32 @@ namespace DHSoftware } #else - Do3ThinkCamera do3ThinkCamera1 = new Do3ThinkCamera(); + //Do3ThinkCamera do3ThinkCamera1 = new Do3ThinkCamera(); - do3ThinkCamera1.dvpStreamFormat = dvpStreamFormat.S_RAW8; - do3ThinkCamera1.CameraName = "Cam1"; - do3ThinkCamera1.CameraConnect(); - do3ThinkCamera1.OnHImageOutput += OnCameraHImageOutput; - Cameras.Add(do3ThinkCamera1); - for (int i=2;i<=8;i++) + //do3ThinkCamera1.dvpStreamFormat = dvpStreamFormat.S_RAW8; + //do3ThinkCamera1.CameraName = "Cam1"; + //do3ThinkCamera1.CameraConnect(); + //do3ThinkCamera1.OnHImageOutput += OnCameraHImageOutput; + // Cameras.Add(do3ThinkCamera1); + for (int i = 1; i <= 8; i++) { - Do3ThinkCamera do3ThinkCamera2 = new Do3ThinkCamera(); - do3ThinkCamera2.dvpStreamFormat = dvpStreamFormat.S_RGB24; - do3ThinkCamera2.CameraName = $"Cam{i}"; - Cameras.Add(do3ThinkCamera2); - do3ThinkCamera2.CameraConnect(); - do3ThinkCamera2.OnHImageOutput += OnCameraHImageOutput; + Do3ThinkCamera cam = new Do3ThinkCamera(); + if (i == 1) + { + cam.dvpStreamFormat = dvpStreamFormat.S_RAW8; + } + else + { + cam.dvpStreamFormat = dvpStreamFormat.S_RGB24; + } + + cam.CameraName = $"Cam{i}"; + Cameras.Add(cam); + cam.CameraConnect(); + cam.OnHImageOutput += OnCameraHImageOutput; } - + #endif @@ -445,24 +453,24 @@ namespace DHSoftware DetectionConfigs.ForEach(detection => { - detection.CameraCollects.ForEach(cam => - { - List Dets = new List - { + detection.CameraCollects.ForEach(cam => + { + List Dets = new List + { detection.Id - }; - if (!_cameraRelatedDetectionDict.ContainsKey(cam.CameraSourceId)) - { - _cameraRelatedDetectionDict.Add(cam.CameraSourceId, Dets); - } - else - { - _cameraRelatedDetectionDict[cam.CameraSourceId].Add(detection.Id); - } + }; + if (!_cameraRelatedDetectionDict.ContainsKey(cam.CameraSourceId)) + { + _cameraRelatedDetectionDict.Add(cam.CameraSourceId, Dets); + } + else + { + _cameraRelatedDetectionDict[cam.CameraSourceId].Add(detection.Id); + } - } - ); + } + ); }); string inferenceDevice = "CPU"; @@ -474,31 +482,39 @@ namespace DHSoftware //初始化Halcon工具 InitialHalconTools(); - + //深度学习模型加载 - bool resultOK =InitialSimboMLEnginesAsync(); + bool resultOK = InitialSimboMLEnginesAsync(); if (resultOK) { //初始化失败 - // return; + // return; } //位置比较卡 - + sLDMotion.AxisSettings = new List(); - AxisSetting axis1=new AxisSetting(); + AxisSetting axis1 = new AxisSetting(); axis1.AxisIndex = 0; axis1.AxisName = "转盘1"; axis1.IsAxisEnabled = true; //axis1.AlarmLogic = AxisDirection.Positive; - sLDMotion.IODefinitionCollection=new List(); + sLDMotion.IODefinitionCollection = new List(); Motion(sLDMotion.IODefinitionCollection); sLDMotion.SnapshotSettings = new List(); - int[] cameraPositions = { 7613, 24161, 33608, 39702, 45701 }; + int[] cameraPositions = { 24161, 33608, 39702, 45701 }; - for (int i = 0; i < 5; i++) + + sLDMotion.SnapshotSettings.Add(new SnapshotSetting + { + IsEnabled = true, + CameraIO = sLDMotion.IODefinitionCollection.FirstOrDefault(t => t.IOType == IOType.OUTPUT && t.IOIndex == 13), + CameraPosition = 7613, + StationNumber = 0 + }); + for (int i = 0; i < 4; i++) { sLDMotion.SnapshotSettings.Add(new SnapshotSetting { @@ -513,17 +529,20 @@ namespace DHSoftware sLDMotion.BlowSettings = new List(); int[] BlowPositions = { 61353, 68566 }; - - for (int i = 0; i < 2; i++) + sLDMotion.BlowSettings.Add(new BlowSetting { - sLDMotion.BlowSettings.Add(new BlowSetting - { - IsEnabled = true, - BlowIO = sLDMotion.IODefinitionCollection.FirstOrDefault(t => t.IOType == IOType.OUTPUT && t.IOIndex == i), - BlowPosition = BlowPositions[i], - StationNumber = 0 - }); - } + IsEnabled = true, + BlowIO = sLDMotion.IODefinitionCollection.FirstOrDefault(t => t.IOType == IOType.OUTPUT && t.IOIndex == 5), + BlowPosition = BlowPositions[0], + StationNumber = 0 + }); + sLDMotion.BlowSettings.Add(new BlowSetting + { + IsEnabled = true, + BlowIO = sLDMotion.IODefinitionCollection.FirstOrDefault(t => t.IOType == IOType.OUTPUT && t.IOIndex == 6), + BlowPosition = BlowPositions[1], + StationNumber = 0 + }); //SnapshotSetting sna1 = new SnapshotSetting(); //sna1.IsEnabled = true; @@ -536,23 +555,26 @@ namespace DHSoftware // sLDMotion.SnapshotSettings.Add(sna1); sLDMotion.AxisSettings.Add(axis1); sLDMotion.Init(); - // sLDMotion.Start(); - + sLDMotion.OnNewPieces -= MainMotion_NewPieces; + sLDMotion.OnNewPieces += MainMotion_NewPieces; + // sLDMotion.Start(); + //PLC.IP = "192.168.6.6"; //PLC.Port = 502; //PLC.PLCConnect(); //PLC.OnNewPieces -= MainMotion_NewPieces; //PLC.OnNewPieces += MainMotion_NewPieces; - ProductBaseCount = 2; + ProductBaseCount = 8; for (int i = 0; i < ProductBaseCount * ProductListMulti; i++) { ConcurrentDictionary products = new ConcurrentDictionary(); _productLists.Add(products); } - sLDMotion.AxisStop(); - bool e=sLDMotion.CArdReset(); - sLDMotion.JOGRun(10000, 100000); - startTime =DateTime.Now; + sLDMotion.AxisStop(); + bool e = sLDMotion.CArdReset(); + //转盘速度 + sLDMotion.JOGRun(14000, 100000); + startTime = DateTime.Now; } public void Motion(List iODefinitions) { @@ -583,7 +605,7 @@ namespace DHSoftware private int PieceNumberToIndex(uint pn) { // 物料编号,取余 集合数量 - + int ret = (int)(pn % (ProductBaseCount * ProductListMulti)); return ret; } @@ -598,7 +620,7 @@ namespace DHSoftware PieceCount++; - + int index = PieceNumberToIndex(pieceNumber); // productDatas.Add(pData); //转盘2 的物料是不是重新覆盖之前的pDta @@ -607,8 +629,9 @@ namespace DHSoftware ProductData pData = new ProductData("", pieceNumber, ProductBaseCount); _productLists[index][pieceNumber] = pData; } - string logStr = $"时间:{DateTime.Now} 轴{axisIndex}新产品{pieceNumber}加入队列{index}----入料计数{PieceCount}\n"; - Task.Run(() => { + string logStr = $"时间:{DateTime.Now} 轴{axisIndex}新产品{pieceNumber}加入队列{index}----入料计数{PieceCount}\n"; + Task.Run(() => + { this.BeginInvoke(new MethodInvoker(delegate () { richTextBox1.AppendText(logStr); })); }); @@ -622,7 +645,7 @@ namespace DHSoftware { await Task.Run(() => { - //OnUpdateCT?.Invoke(objData, ctTime); + //OnUpdateCT?.Invoke(objData, ctTime); }); } /// @@ -632,7 +655,7 @@ namespace DHSoftware { //深度学习 模型加载 var resultOK = MLLoadModel(); - return resultOK; + return resultOK; } /// /// 深度学习 模型加载 @@ -645,56 +668,56 @@ namespace DHSoftware { SimboStationMLEngineList = new List(); // _cameraRelatedDetectionDict = IConfig.DetectionConfigs.Select(t => t.ModelPath).Distinct().ToList(); - DetectionConfigs.ForEach(dc => + DetectionConfigs.ForEach(dc => //_cameraRelatedDetectionDict.ForEach(dc => - { - - if (dc.IsEnabled && !string.IsNullOrWhiteSpace(dc.ModelPath)) - { - if (dc.IsEnableGPU) - { - //if (IIConfig.IsLockGPU) - //{ - //foreach (var validGPU in ValidGPUList2) - //{ - // if (validGPU.DetectionIds.Contains(dc.Id)) - // { - var engine = SingleMLLoadModel(dc, true, 0); - SimboStationMLEngineList.Add(engine); - // } - //} - //} - //else - //{ - // foreach (var validGPU in ValidGPUList) - // { - // //var validGPU = ValidGPUList.FirstOrDefault(u => u.DetectionIds.Contains(dc.Id)); - // if (validGPU.DetectionId == dc.Id) - // { - // var engine = SingleMLLoadModel(dc, true, validGPU.GPUNo); - // SimboStationMLEngineList.Add(engine); - // } - // } - //} + { - } - else - { - //for (int i = 0; i < IConfig.CPUNums; i++) - for (int i = 0; i <1; i++) - { - //var engine = SingleMLLoadModel(dc, false, i); - var engine = SingleMLLoadModel(dc, false, i); - SimboStationMLEngineList.Add(engine); - } - } - } - }); + if (dc.IsEnabled && !string.IsNullOrWhiteSpace(dc.ModelPath)) + { + if (dc.IsEnableGPU) + { + //if (IIConfig.IsLockGPU) + //{ + //foreach (var validGPU in ValidGPUList2) + //{ + // if (validGPU.DetectionIds.Contains(dc.Id)) + // { + var engine = SingleMLLoadModel(dc, true, 0); + SimboStationMLEngineList.Add(engine); + // } + //} + //} + //else + //{ + // foreach (var validGPU in ValidGPUList) + // { + // //var validGPU = ValidGPUList.FirstOrDefault(u => u.DetectionIds.Contains(dc.Id)); + // if (validGPU.DetectionId == dc.Id) + // { + // var engine = SingleMLLoadModel(dc, true, validGPU.GPUNo); + // SimboStationMLEngineList.Add(engine); + // } + // } + //} + + } + else + { + //for (int i = 0; i < IConfig.CPUNums; i++) + for (int i = 0; i < 1; i++) + { + //var engine = SingleMLLoadModel(dc, false, i); + var engine = SingleMLLoadModel(dc, false, i); + SimboStationMLEngineList.Add(engine); + } + } + } + }); resultOK = true; } catch (Exception ex) { - // LogAsync(DateTime.Now, LogLevel.Exception, $"异常:模型并发加载异常:{ex.GetExceptionMessage()}"); + // LogAsync(DateTime.Now, LogLevel.Exception, $"异常:模型并发加载异常:{ex.GetExceptionMessage()}"); resultOK = false; } @@ -761,7 +784,7 @@ namespace DHSoftware bool isSuccess = mLEngineSet.StationMLEngine.Load(mLInit); if (!isSuccess) { - // throw new ProcessException("异常:模型加载异常", null); + // throw new ProcessException("异常:模型加载异常", null); } //LogAsync(DateTime.Now, LogLevel.Information, $"模型加载成功;是否GPU:{isGPU} CoreInx:{coreInx} - {dc.Name}" + $" {dc.ModelType.GetEnumDescription()}:{dc.ModelPath}"); } @@ -785,9 +808,9 @@ namespace DHSoftware if (!c.IsEnabled) return; - if(c.HalconAlgorithemPath_Pre!=null) + if (c.HalconAlgorithemPath_Pre != null) LoadHalconTool(c.HalconAlgorithemPath_Pre); - + }); } @@ -795,7 +818,7 @@ namespace DHSoftware { if (!HalconToolDict.ContainsKey(path)) { - + string algorithemPath = path; @@ -817,7 +840,7 @@ namespace DHSoftware /// /// /// - public void PreTreated(DetectionConfig detectConfig, DetectStationResult detectResult,Mat MhImage) + public void PreTreated(DetectionConfig detectConfig, DetectStationResult detectResult, Mat MhImage) { try { @@ -828,10 +851,10 @@ namespace DHSoftware { HObject obj = OpenCVHelper.MatToHImage(MhImage); HImage hImage = HalconHelper.ConvertHObjectToHImage(obj); - string toolKey = detectConfig.HalconAlgorithemPath_Pre; + string toolKey = detectConfig.HalconAlgorithemPath_Pre; if (!HalconToolDict.ContainsKey(toolKey)) { - // LogAsync(DateTime.Now, LogLevel.Exception, $"{detectConfig.Name}未获取预处理算法"); + // LogAsync(DateTime.Now, LogLevel.Exception, $"{detectConfig.Name}未获取预处理算法"); return; } //Mean_Thre Deviation_Thre Mean_standard Deviation_standard @@ -851,11 +874,11 @@ namespace DHSoftware if (!tool.RunProcedure(out string errorMsg, out _)) { - // detectResult.PreTreatedFlag = false; - + // detectResult.PreTreatedFlag = false; + detectResult.IsPreTreatDone = false; - + return; } @@ -883,37 +906,37 @@ namespace DHSoftware detectResult.ResultState = ResultState.DetectNG; detectResult.IsPreTreatNG = true; - + // if (detectResult.VisionImageSet.PreTreatedFlag) { //detectResult.VisionImageSet.MLImage = tool.GetResultObject("OUTPUT_PreTreatedImage"); //DetectionResultImage - // detectResult.VisionImageSet.DetectionResultImage = detectResult.VisionImageSet.MLImage.ConvertHImageToBitmap(); + // detectResult.VisionImageSet.DetectionResultImage = detectResult.VisionImageSet.MLImage.ConvertHImageToBitmap(); } } else { - // detectResult.VisionImageSet.DetectionResultImage = detectResult.VisionImageSet.MLImage.ConvertHImageToBitmap(); + // detectResult.VisionImageSet.DetectionResultImage = detectResult.VisionImageSet.MLImage.ConvertHImageToBitmap(); } } } catch (Exception ex) { - + } finally { //detectResult.VisionImageSet.HImage?.Dispose(); //detectResult.VisionImageSet.HImage = null; - // MhImage?.Dispose(); + // MhImage?.Dispose(); //MhImage = null; } - + } /// /// 相机回调 @@ -923,6 +946,16 @@ namespace DHSoftware /// private void OnCameraHImageOutput(DateTime dt, CameraBase camera, Mat imageSet) { + + //if (camera.CameraName.Equals("cam1", StringComparison.OrdinalIgnoreCase)) + //{ + // Console.WriteLine(); + //} + //if (camera.CameraName.Equals("cam2", StringComparison.OrdinalIgnoreCase)) + //{ + // Console.WriteLine(); + //} + // 获取该相机的拍照计数 uint productNumber = (uint)camera.SnapshotCount; @@ -930,7 +963,7 @@ namespace DHSoftware { using (Mat localImageSet = imageSet.Clone()) // 复制 Mat 避免并发问题 { - // imageSet?.Dispose(); + // imageSet?.Dispose(); // 拍照计数与物件编号一致,查找对应的产品 ProductData product = null; //内外壁模组多个相机的处理方法 @@ -939,52 +972,87 @@ namespace DHSoftware // 找到产品存放在哪个队列里 ConcurrentDictionary tmpDic = _productLists[index]; - try - { - int retryTimes = 100; - while (product == null && retryTimes > 0) + try { - if (tmpDic.ContainsKey(productNumber)) + int retryTimes = 100; + while (product == null && retryTimes > 0) { - product = tmpDic[productNumber]; + if (tmpDic.ContainsKey(productNumber)) + { + product = tmpDic[productNumber]; + } + else + { + // Thread.Sleep(20); + await Task.Delay(20); + } + retryTimes--; } - else + // 如果产品为空,则销毁图片,提示错误 + if (null == product) { - Thread.Sleep(20); - } - retryTimes--; - } - // 如果产品为空,则销毁图片,提示错误 - if (null == product) - { - List pnList = tmpDic.Keys.ToList(); + List pnList = tmpDic.Keys.ToList(); - string pnStr = ""; - if (pnList != null && pnList.Count > 0) - { - pnStr = string.Join(",", pnList); + string pnStr = ""; + if (pnList != null && pnList.Count > 0) + { + pnStr = string.Join(",", pnList); + } + + //LogAsync(DateTime.Now, LogLevel.Error, $"{camera.Name} 未找到产品,编号:{productNumber},队列{index}数量:{tmpDic.Count},列表:{pnStr}"); + localImageSet.Dispose(); + this.BeginInvoke(new MethodInvoker(delegate () + { + + int currentScrollPosition = richTextBox1.GetPositionFromCharIndex(richTextBox1.TextLength).Y; + + richTextBox1.AppendText(productNumber + "提前推出" + camera.CameraName); + + // 设置回原来的滚动位置 + richTextBox1.SelectionStart = richTextBox1.TextLength; + richTextBox1.ScrollToCaret(); + })); + //重新生成实例 销毁之前的实例 + + using (StreamWriter sw = new StreamWriter("D://123log.txt", true, Encoding.UTF8)) + { + sw.WriteLine(productNumber + "提前推出" + camera.CameraName); + } + return; } - //LogAsync(DateTime.Now, LogLevel.Error, $"{camera.Name} 未找到产品,编号:{productNumber},队列{index}数量:{tmpDic.Count},列表:{pnStr}"); - localImageSet.Dispose(); - return; - } + // LogAsync(DateTime.Now, LogLevel.Information, $"{camera.Name} 找到产品{productNumber},队列{index}数量:{tmpDic.Count}"); - // LogAsync(DateTime.Now, LogLevel.Information, $"{camera.Name} 找到产品{productNumber},队列{index}数量:{tmpDic.Count}"); + if (!_cameraRelatedDetectionDict.ContainsKey(camera.CameraName)) + { - if (!_cameraRelatedDetectionDict.ContainsKey(camera.CameraName)) - { + localImageSet.Dispose(); + this.BeginInvoke(new MethodInvoker(delegate () + { - localImageSet.Dispose(); - // LogAsync(DateTime.Now, LogLevel.Warning, $"{camera.Name} 找到产品{productNumber},但是没有推理1"); + int currentScrollPosition = richTextBox1.GetPositionFromCharIndex(richTextBox1.TextLength).Y; - return; - } + richTextBox1.AppendText(productNumber+"提前推出" + camera.CameraName); + + // 设置回原来的滚动位置 + richTextBox1.SelectionStart = richTextBox1.TextLength; + richTextBox1.ScrollToCaret(); + })); + //重新生成实例 销毁之前的实例 + + using (StreamWriter sw = new StreamWriter("D://123log.txt", true, Encoding.UTF8)) + { + sw.WriteLine(productNumber+"提前推出" + camera.CameraName); + } + // LogAsync(DateTime.Now, LogLevel.Warning, $"{camera.Name} 找到产品{productNumber},但是没有推理1"); + + return; + } - double totalTime = 0.0; - List resultStates = new List(); - List? detectionDict = _cameraRelatedDetectionDict[camera.CameraName]; + double totalTime = 0.0; + List resultStates = new List(); + List? detectionDict = _cameraRelatedDetectionDict[camera.CameraName]; for (int i = 0; i < detectionDict.Count; i++) @@ -1062,14 +1130,14 @@ namespace DHSoftware req.ResizeHeight = (int)detectConfig.ModelHeight; // req.LabelNames = detectConfig.GetLabelNames(); // req.Score = IIConfig.Score; - + req.mImage = inferenceImage.Clone(); req.in_lable_path = detectConfig.in_lable_path; req.confThreshold = detectConfig.ModelconfThreshold; req.iouThreshold = 0.3f; req.segmentWidth = 320; - + req.out_node_name = "output0"; switch (detectConfig.ModelType) { case MLModelType.ImageClassification: @@ -1117,14 +1185,14 @@ namespace DHSoftware //var result = Dectection[detectionId].RunInference(req); //sw.Stop(); //LogAsync(DateTime.Now, LogLevel.Information, $"{camera.Name} 推理进度1.1,产品{productNumber},耗时{sw.ElapsedMilliseconds}ms"); - + this.BeginInvoke(new MethodInvoker(delegate () { pictureBox1.Image?.Dispose(); // 释放旧图像 pictureBox1.Image = result.ResultMap; - richTextBox1.AppendText($"推理成功 {productNumber}, {result.IsSuccess} 耗时 {mlWatch.ElapsedMilliseconds}ms\n"); + richTextBox1.AppendText($"推理成功 {productNumber}, {result.IsSuccess}相机名字{camera.CameraName} 耗时 {mlWatch.ElapsedMilliseconds}ms\n"); })); - req.mImage.Dispose(); + req.mImage?.Dispose(); @@ -1247,67 +1315,80 @@ namespace DHSoftware } - product.InferenceOne(() => - { - ; - }, () => - { - ; - }); + product.InferenceOne(); - // LogAsync(DateTime.Now, LogLevel.Information, $"{camera.Name} 推理完成,产品{productNumber}"); + // LogAsync(DateTime.Now, LogLevel.Information, $"{camera.Name} 推理完成,产品{productNumber}"); - if (!product.InferenceFinished()) + if (!product.InferenceFinished()) + { + + return; + } + ProductNum_Total++; + CalculateOEE(); + this.BeginInvoke(new MethodInvoker(delegate () + { + + int currentScrollPosition = richTextBox1.GetPositionFromCharIndex(richTextBox1.TextLength).Y; + + richTextBox1.AppendText($"统计结果成功,{productNumber} 吹气!\n"); + + // 设置回原来的滚动位置 + richTextBox1.SelectionStart = richTextBox1.TextLength; + richTextBox1.ScrollToCaret(); + })); + #region 6. 统计产品结果 + product.ProductResult = product.ResultCollection.Any(u => u.ResultState != ResultState.OK) + ? ResultState.B_NG + : ResultState.OK; + product.ProductLabelCategory = product.ProductResult.GetEnumDescription(); + product.ProductLabel = product.ProductResult.GetEnumDescription(); + #endregion + #region 7.产品吹气 + + #endregion + + + + + + // 出列 + ProductData temp = null; + + int tryTimes = 10; + while (temp == null && tryTimes > 0) + { + if (tmpDic.TryRemove(productNumber, out temp)) { - - return; + break; } - ProductNum_Total++; - CalculateOEE(); + + tryTimes--; + Thread.Sleep(5); + } + if (temp == null) + { + string logStr = $"{DateTime.Now}产品{productNumber}出列失败:true," + + $"当前队列产品数量:{tmpDic.Count}"; this.BeginInvoke(new MethodInvoker(delegate () { int currentScrollPosition = richTextBox1.GetPositionFromCharIndex(richTextBox1.TextLength).Y; - richTextBox1.AppendText($"统计结果成功,{productNumber} 吹气!\n"); + richTextBox1.AppendText(logStr); // 设置回原来的滚动位置 richTextBox1.SelectionStart = richTextBox1.TextLength; richTextBox1.ScrollToCaret(); })); - #region 6. 统计产品结果 - product.ProductResult = product.ResultCollection.Any(u => u.ResultState != ResultState.OK) - ? ResultState.B_NG - : ResultState.OK; - product.ProductLabelCategory = product.ProductResult.GetEnumDescription(); - product.ProductLabel = product.ProductResult.GetEnumDescription(); - #endregion - #region 7.产品吹气 - - #endregion - - - - - - // 出列 - ProductData temp = null; - - int tryTimes = 10; - while (temp == null && tryTimes > 0) + } + else + { + try { - if (tmpDic.TryRemove(productNumber, out temp)) - { - break; - } - - tryTimes--; - Thread.Sleep(5); - } - if (temp == null) - { - string logStr = $"{DateTime.Now}产品{productNumber}出列失败:true," + - $"当前队列产品数量:{tmpDic.Count}"; + string logStr = $"{DateTime.Now}产品{productNumber}出列成功:true," + + $"产品结果:{temp.ProductResult.GetEnumDescription()}," + + $"当前队列产品数量:{tmpDic.Count}"; this.BeginInvoke(new MethodInvoker(delegate () { @@ -1319,61 +1400,42 @@ namespace DHSoftware richTextBox1.SelectionStart = richTextBox1.TextLength; richTextBox1.ScrollToCaret(); })); + //重新生成实例 销毁之前的实例 + var saveData = temp.GetProductData(); + using (StreamWriter sw = new StreamWriter("D://123log.txt", true, Encoding.UTF8)) + { + sw.WriteLine(logStr); + } + } - else + catch (Exception) { } + finally { - try - { - string logStr = $"{DateTime.Now}产品{productNumber}出列成功:true," + - $"产品结果:{temp.ProductResult.GetEnumDescription()}," + - $"当前队列产品数量:{tmpDic.Count}"; - this.BeginInvoke(new MethodInvoker(delegate () - { - - int currentScrollPosition = richTextBox1.GetPositionFromCharIndex(richTextBox1.TextLength).Y; - - richTextBox1.AppendText(logStr); - - // 设置回原来的滚动位置 - richTextBox1.SelectionStart = richTextBox1.TextLength; - richTextBox1.ScrollToCaret(); - })); - //重新生成实例 销毁之前的实例 - var saveData = temp.GetProductData(); - using (StreamWriter sw = new StreamWriter("D://123log.txt", true, Encoding.UTF8)) - { - sw.WriteLine(logStr); - } - - } - catch (Exception) { } - finally - { - // temp.Dispose(); - temp = null; - } + // temp.Dispose(); + temp = null; } - - // UpdateCT((float)(dtNow - _ctTime).TotalSeconds); - //_ctTime = dtNow; - // }); - - - } - catch (Exception ex) - { - //LogAsync(DateTime.Now, LogLevel.Error, $"流程检测未捕获的异常:{ex.GetExceptionMessage()}"); - product?.Dispose(); } + + // UpdateCT((float)(dtNow - _ctTime).TotalSeconds); + //_ctTime = dtNow; + // }); + + } + catch (Exception ex) + { + //LogAsync(DateTime.Now, LogLevel.Error, $"流程检测未捕获的异常:{ex.GetExceptionMessage()}"); + product?.Dispose(); + } + } - }); + }); } public void SetResult() { - - + + //// detectResult.IsPreTreatDone = detectResult.VisionImageSet.PreTreatedFlag @@ -1397,19 +1459,20 @@ namespace DHSoftware Cameras.Clear(); Dectection.Clear(); // Add the code for the "停止" button click here - PLC.TurntableStop(); + // PLC.TurntableStop(); CurrentMachine = true; sLDMotion.Stop(); } - public int UPH=0; + public int UPH = 0; public void CalculateOEE() { TimeSpan timeSpan = DateTime.Now - startTime; - UPH = (int)(ProductNum_Total / timeSpan.TotalHours) + 100; + UPH = (int)(ProductNum_Total / timeSpan.TotalHours) + 100; //UPM = (int)UPH / 60; - this.BeginInvoke(new MethodInvoker(delegate () { - label1.Text = UPH.ToString(); + this.BeginInvoke(new MethodInvoker(delegate () + { + label1.Text = UPH.ToString(); })); diff --git a/DHSoftware/MainWindow.resx b/DHSoftware/MainWindow.resx index 1e30dff..3511979 100644 --- a/DHSoftware/MainWindow.resx +++ b/DHSoftware/MainWindow.resx @@ -1,7 +1,7 @@  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DHSoftware/Views/UserConfigFrm.Designer.cs b/DHSoftware/Views/UserConfigFrm.Designer.cs new file mode 100644 index 0000000..941dd2f --- /dev/null +++ b/DHSoftware/Views/UserConfigFrm.Designer.cs @@ -0,0 +1,44 @@ +namespace DHSoftware.Views +{ + partial class UserConfigFrm + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + SuspendLayout(); + // + // UserConfigFrm + // + AutoScaleDimensions = new SizeF(7F, 17F); + AutoScaleMode = AutoScaleMode.Font; + Name = "UserConfigFrm"; + Size = new Size(749, 536); + ResumeLayout(false); + } + + #endregion + } +} diff --git a/DHSoftware/Views/UserConfigFrm.cs b/DHSoftware/Views/UserConfigFrm.cs new file mode 100644 index 0000000..0d81922 --- /dev/null +++ b/DHSoftware/Views/UserConfigFrm.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace DHSoftware.Views +{ + public partial class UserConfigFrm : UserControl + { + public UserConfigFrm() + { + InitializeComponent(); + } + } +} diff --git a/DHSoftware/Views/UserConfigFrm.resx b/DHSoftware/Views/UserConfigFrm.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/DHSoftware/Views/UserConfigFrm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DHSoftware/productModel.cs b/DHSoftware/productModel.cs index 317ed37..4fc7d20 100644 --- a/DHSoftware/productModel.cs +++ b/DHSoftware/productModel.cs @@ -78,16 +78,16 @@ namespace DHSoftware } - public void InferenceOne(Action preAction = null, Action postAction = null) + public void InferenceOne() { //lock (_inferenceLock) //{ // Interlocked.Decrement(ref InferenceLeft); //} - preAction?.Invoke(); + _countdownEvent.Signal(); - postAction?.Invoke(); + } public bool InferenceFinished()