仿艾莫迅MODBUS調試工具寫一個上位機

公司采購了一個夾具,項目負責人想要試探這個夾具的性能,于是想要我這邊寫一個烤機的程序,小編結合官網資料
https://wiki.amsamotion.com/?title=196&doc=222
在這里插入圖片描述
查看其pdf說明文檔和調試工具并按照其工具寫一個烤機上位機
在這里插入圖片描述
根據項目負責人的要求開發了一個小程序
在這里插入圖片描述
在這里插入圖片描述

using JY_MODBUS_IO8R_IS_Soft.BLL;
using JY_MODBUS_IO8R_IS_Soft.Business;
using JY_MODBUS_IO8R_IS_Soft.JY_MODBUS_IO8R_Controller;
using JY_MODBUS_IO8R_IS_Soft.Model;
using JY_MODBUS_IO8R_IS_Soft.userControl;
using LogManager;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;namespace JY_MODBUS_IO8R_IS_Soft
{public partial class frmMain : Form{ModbusController controller = new ModbusController();static readonly Modbus_helper Modbus_helper = new Modbus_helper(DeviceBll.Single.SerialPort);public frmMain(){InitializeComponent();//獲取電腦上可用的串口號string[] ports = System.IO.Ports.SerialPort.GetPortNames();if (ports.Length != 0){cbb_Com.Items.AddRange(ports);}Modbus_helper.DelResult = DelWriteLog;Modbus_helper.DelTime = DelWriteLog;}private void btnConnect_Click(object sender, EventArgs e){try{LogNetManagment.LogNet.WriteDebug("連接串口");string errMsg = string.Empty;if (!Modbus_helper.Connect(cbb_Com.Text.Trim(), Convert.ToInt32(cbb_ComRate.Text.Trim()), Convert.ToInt32(txtWriteReadTime.Text.Trim()), ref errMsg)){MessageBox.Show(errMsg);}else{UpdateConnectStatus(true);}}catch (Exception ex){LogNetManagment.LogNet.WriteException("連接通信", ex);MessageBox.Show(ex.ToString());}}/// <summary>/// 改變連接狀態/// </summary>/// <param name="status"></param>public void UpdateConnectStatus(bool status){if (status){btnConnect.Enabled = false;btnBreak.Enabled = true;}else{btnConnect.Enabled = true;btnBreak.Enabled = false;}}private void btnBreak_Click(object sender, EventArgs e){try{LogNetManagment.LogNet.WriteDebug("斷開串口");string errMsg = string.Empty;if (!Modbus_helper.Close(ref errMsg)){MessageBox.Show(errMsg);}else{UpdateConnectStatus(false);}}catch (Exception ex){LogNetManagment.LogNet.WriteException("斷開通訊", ex);MessageBox.Show(ex.ToString());}}private void btnTest_Click(object sender, EventArgs e){try{LogNetManagment.LogNet.WriteDebug("開始循環測試,循環次數為"+txtTestTime.ToString());this.btnTest.Enabled = false;int channel = cmbChannel.SelectedIndex;Task.Factory.StartNew(() =>{string errMsg = string.Empty;Modbus_helper.IsTestStatus = true;if (!Modbus_helper.ContinueTest(channel, Convert.ToInt32(txtTestTime.Text),ref errMsg)){this.Invoke(new Action(() =>{MessageBox.Show(errMsg);}));}}).ContinueWith((task) => {this.Invoke(new Action(() => {this.btnTest.Enabled = true;}));});}catch (Exception ex){LogNetManagment.LogNet.WriteException("開始循環測試", ex);MessageBox.Show(ex.ToString());}}private void DelWriteLog(int runtime){this.BeginInvoke(new Action(() =>{DateTime date = DateTime.Now;txtLog.AppendText($"{date.ToString("yyyy-MM-dd HH:mm:ss.fff")} 當前正在執行{runtime}次"+ Environment.NewLine);}));}private void DelWriteLog(ResultModel result){this.BeginInvoke(new Action(() =>{DateTime date = DateTime.Now;if (result.TestResult == (uint)Common.CommonEnum.TestResultType.Success){txtLog.AppendText(date.ToString("yyyy-MM-dd HH:mm:ss.fff") + " " + result.LabelTip + Environment.NewLine);}else if (result.TestResult == (uint)Common.CommonEnum.TestResultType.Fail){txtLog.AppendText(date.ToString("yyyy-MM-dd HH:mm:ss.fff") + " " + result.LabelTip + Environment.NewLine);}else{txtLog.AppendText(date.ToString("yyyy-MM-dd HH:mm:ss.fff") + " " + result.LabelTip + Environment.NewLine);}}));}private void switchButtons1_Btn_Click(object sender, EventArgs e){Button userCtl = sender as Button;string errMsg = string.Empty;if (switchButtons1.Controls.Find($"btn{userCtl.Tag}", true)[0].BackColor == SystemColors.Control){if (!Modbus_helper.TestByChannel(Convert.ToInt32(userCtl.Tag), Common.CommonEnum.OrderType.Control, ref errMsg)){switchButtons1.Controls.Find($"btn{userCtl.Tag}", true)[0].BackColor = SystemColors.Control;}else{switchButtons1.Controls.Find($"btn{userCtl.Tag}", true)[0].BackColor = Color.Red;}}else if (switchButtons1.Controls.Find($"btn{userCtl.Tag}", true)[0].BackColor == Color.Red){if (!Modbus_helper.TestByChannel(Convert.ToInt32(userCtl.Tag), Common.CommonEnum.OrderType.Clearance, ref errMsg)){switchButtons1.Controls.Find($"btn{userCtl.Tag}", true)[0].BackColor = Color.Red;}else{switchButtons1.Controls.Find($"btn{userCtl.Tag}", true)[0].BackColor = SystemColors.Control;}}}private void btnStop_Click(object sender, EventArgs e){LogNetManagment.LogNet.WriteDebug("點擊停止");Modbus_helper.IsTestStatus = false;DateTime date = DateTime.Now;txtLog.AppendText(date.ToString("yyyy-MM-dd HH:mm:ss.fff") + " 點擊停止"  + Environment.NewLine);}}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace JY_MODBUS_IO8R_IS_Soft.Common
{public class CommonEnum{/// <summary>/// 指令類型/// </summary>public enum OrderType : uint{/// <summary>/// 控制/// </summary>Control = 0,/// <summary>/// 解控/// </summary>Clearance = 1}/// <summary>/// 測試結束各種原因/// </summary>public enum TestResultType : uint{/// <summary>/// 正常成功結束/// </summary>Success = 0,/// <summary>/// 異常結束/// </summary>Fail = 1,/// <summary>/// 倒計時結束/// </summary>FixedSuccess = 2}}
}
using Common;
using JY_MODBUS_IO8R_IS_Soft.Config;
using LogManager;
using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace JY_MODBUS_IO8R_IS_Soft.Business
{public class DeviceBll{private static DeviceBll bDeviceSingle = null;public static DeviceBll Single{get{if (bDeviceSingle == null) bDeviceSingle = new DeviceBll();return bDeviceSingle;}}//不允許外部New操作private DeviceBll() { }/// <summary>/// 硬件配置文件路徑/// </summary>public string ChoosesetPath = AppDomain.CurrentDomain.BaseDirectory + "\\Chooseset.ini";/// <summary>/// 保存數據的路徑/// </summary>public string SaveDataPath = string.Empty;/// <summary>/// 是否保存數據/// </summary>public bool IsSaveData = true;/// <summary>/// 保存數據最大的行數 到達之后重新創建文件/// </summary>public int ExportDataLines = 0;/// <summary>/// 通道數/// </summary>public int ChannelNum = 12;/// <summary>/// 設備通訊連接狀態 true已連接 false未連接/// </summary>public bool IsLink = false;/// <summary>/// 鎖對象/// </summary>public readonly object LockFileObj = new object();/// <summary>/// 配置文件/// </summary>public mainSet MainConfigSet = new mainSet();///// <summary>///// 設備接口對象///// </summary>//public I_MUX _ifun;public delegate void DelUpdateConfig();/// <summary>/// 用戶切換響應事件/// </summary>public static event DelUpdateConfig EventUpdateConfig;/// <summary>/// 串口對象/// </summary>public SerialPort SerialPort;/// <summary>/// 用戶切換/// </summary>public static void UpdateConfig(){if (EventUpdateConfig != null){EventUpdateConfig();}}public delegate void DelUpdateBtnStartAll();public static event DelUpdateBtnStartAll EventUpdateBtnStartAll;public static void UpdateBtnStartAll(){if (EventUpdateBtnStartAll != null){EventUpdateBtnStartAll();}}/// <summary>///系統硬件初始化/// </summary>public void Init(){try{DeviceInit();int delayTime = Convert.ToInt32(IniFileHelper.IniReadValue(DeviceBll.Single.ChoosesetPath, "DelayTime", "DelayTime_ms", ""));ChannelNum = Convert.ToInt32(IniFileHelper.IniReadValue(DeviceBll.Single.ChoosesetPath, "Channel", "ChannelNum", ""));LogManager.LogNetManagment.LogNet.WriteInfo("獲取參數保護文件參數");}catch (Exception ex){LogNetManagment.LogNet.WriteException("Init", ex);}}/// <summary>/// 設備初始化加載/// </summary>public void DeviceInit(){SerialPort = new SerialPort();//串口對象}}
}
using JY_MODBUS_IO8R_IS_Soft.Model;
using LogManager;
using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;namespace JY_MODBUS_IO8R_IS_Soft.BLL
{public class Modbus_helper{/// <summary>/// 串口對象/// </summary>public SerialPort SerialPort { get; set; }/// <summary>/// 發送結果數據/// </summary>public Action<ResultModel> DelResult { get; set; }/// <summary>/// 發送執行的次數/// </summary>public Action<int> DelTime { get; set; }/// <summary>/// 獲取結果類/// </summary>public ResultModel Result { get; set; }/// <summary>/// 測試狀態/// </summary>public bool IsTestStatus { get; set; }public int WriteReadTime { get; set; }/// <summary>/// 鎖對象/// </summary>private readonly object _lockWr = new object();public Modbus_helper(SerialPort serialPort){this.SerialPort = serialPort;this.Result = new ResultModel();IsTestStatus = false;}/// <summary>/// 連接串口/// </summary>/// <param name="comName">串口號</param>/// <param name="comRate">串口速率</param>/// <param name="errMsg">錯誤信息</param>/// <returns></returns>public bool Connect(string comName, int comRate, int time, ref string errMsg){try{SerialPort.BaudRate = comRate;SerialPort.StopBits = StopBits.One;SerialPort.PortName = comName;SerialPort.NewLine = "\r\n";SerialPort.ReadTimeout = 10000;SerialPort.WriteTimeout = 1000;SerialPort.Open();if (SerialPort.IsOpen.Equals(false)){//串口連接失敗!errMsg = "連接串口失敗";return false;}else{WriteReadTime = time;return true;}}catch (Exception ex){LogNetManagment.LogNet.WriteException(nameof(Modbus_helper) + "_" + nameof(Connect), ex);errMsg = ex.ToString();return false;}}public bool Close(ref string errMsg){try{if (SerialPort.IsOpen){SerialPort.Close();}if (!SerialPort.IsOpen){return true;}return true;}catch (Exception ex){LogNetManagment.LogNet.WriteException(nameof(Modbus_helper) + "_" + nameof(Close), ex);errMsg = ex.ToString();return false;}}public bool ContinueTest(int channel, int time, ref string errMsg){try{for (int i=0;i<time;i++){if (!IsTestStatus){return true;}int testtime = i + 1;DelTime(testtime);byte[] controlBytes = GetControlBytes(channel, Common.CommonEnum.OrderType.Control);//控制if (!WriteRead(controlBytes, ref errMsg)){Result.TestResult = 1;Result.LabelTip = "當前正在執行" + testtime + "次吸合失敗";DelResult(Result);return false;}byte[] clearanceBytes = GetControlBytes(channel, Common.CommonEnum.OrderType.Clearance);//解控if (!WriteRead(clearanceBytes, ref errMsg)){Result.TestResult = 1;Result.LabelTip = "當前正在執行" + testtime + "次斷開失敗";DelResult(Result);return false;}Result.TestResult = 0;Result.LabelTip = "執行成功";DelResult(Result);}Result.LabelTip = "執行完畢";Result.TestResult = 2;DelResult(Result);return true;}catch (Exception ex){LogNetManagment.LogNet.WriteException(nameof(Modbus_helper) + "_" + nameof(ContinueTest), ex);errMsg = ex.ToString();return false;}}public bool TestByChannel(int channel, Common.CommonEnum.OrderType orderType, ref string errMsg){try{if (orderType == Common.CommonEnum.OrderType.Control){byte[] controlBytes = GetControlBytes(channel, Common.CommonEnum.OrderType.Control);//控制if (!WriteRead(controlBytes, ref errMsg)){Result.TestResult = 1;Result.LabelTip = $"當前正在執行channel{channel}吸合失敗";DelResult(Result);return false;}else{Result.TestResult = 0;Result.LabelTip = $"當前正在執行channel{channel}吸合成功";DelResult(Result);return true;}}else if (orderType == Common.CommonEnum.OrderType.Clearance){byte[] clearanceBytes = GetControlBytes(channel, Common.CommonEnum.OrderType.Clearance);//解控if (!WriteRead(clearanceBytes, ref errMsg)){Result.TestResult = 1;Result.LabelTip = $"當前正在執行channel{channel}斷開失敗";DelResult(Result);return false;}else{Result.TestResult = 0;Result.LabelTip = $"當前正在執行channel{channel}斷開成功";DelResult(Result);return true;}}return true;}catch (Exception ex){LogNetManagment.LogNet.WriteException(nameof(Modbus_helper) + "_" + nameof(TestByChannel), ex);errMsg = ex.ToString();return false;}}public bool WriteRead(byte[] strWrite, ref string errMsg){try{SerialPort.DiscardInBuffer();//丟棄緩沖區數據SerialPort.DiscardOutBuffer();//丟棄緩沖區數據SerialPort.DiscardInBuffer();//丟棄緩沖區數據SerialPort.DiscardOutBuffer();//丟棄緩沖區數據SerialPort.Write(strWrite, 0, 8);Thread.Sleep(WriteReadTime);SerialPort.ReadExisting();return true;}catch (Exception ex){LogNetManagment.LogNet.WriteException(nameof(Modbus_helper) + "_" + nameof(WriteRead), ex);errMsg = ex.ToString();return false;}}public byte[] GetControlBytes(int channel, Common.CommonEnum.OrderType OrderType){byte[] bytes = new byte[8];//01 05 00 00 FF 00 8C 3A   控制if (OrderType == Common.CommonEnum.OrderType.Control){//bytes[0] = 01;//bytes[1] = 05;//bytes[2] = 00;//bytes[3] = 00;//bytes[4] = 0xFF;//bytes[5] = 00;//bytes[6] = 0x8C;//bytes[7] = 0x3A;//return bytes;byte address = Convert.ToByte(channel);byte[] cmd = GenerateCommand(0x01, address, true);return cmd;}else if (OrderType == Common.CommonEnum.OrderType.Clearance){//01 05 00 00 00 00 CD CA//bytes[0] = 01;//bytes[1] = 05;//bytes[2] = 00;//bytes[3] = 00;//bytes[4] = 00;//bytes[5] = 00;//bytes[6] = 0xCD;//bytes[7] = 0xCA;//return bytes;byte address = Convert.ToByte(channel);byte[] cmd = GenerateOffCommand(0x01, address);return cmd;}return bytes;}// CRC16校驗計算核心方法public static ushort CalculateCrc(byte[] data){ushort crc = 0xFFFF;foreach (byte b in data){crc ^= b;for (int i = 0; i < 8; i++){bool lsb = (crc & 1) == 1;crc >>= 1;if (lsb) crc ^= 0xA001;}}return crc;}// 生成完整Modbus指令(包含CRC)public static byte[] GenerateCommand(byte deviceId, ushort address, bool state){byte[] cmd = new byte[6];cmd[0] = deviceId;cmd[1] = 0x05; // 功能碼cmd[2] = (byte)(address >> 8); // 地址高字節cmd[3] = (byte)(address & 0xFF); // 地址低字節cmd[4] = state ? (byte)0xFF : (byte)0x00; // 狀態值cmd[5] = 0x00; // 固定填充ushort crc = CalculateCrc(cmd);byte[] fullCmd = new byte[8];Array.Copy(cmd, fullCmd, 6);fullCmd[6] = (byte)(crc & 0xFF); // CRC低字節在前fullCmd[7] = (byte)(crc >> 8);return fullCmd;}// 生成斷開繼電器指令public static byte[] GenerateOffCommand(byte deviceId, ushort address){byte[] cmd = new byte[6];cmd[0] = deviceId;cmd[1] = 0x05; // 功能碼cmd[2] = (byte)(address >> 8); // 地址高字節cmd[3] = (byte)(address & 0xFF); // 地址低字節cmd[4] = 0x00; // 斷開繼電器cmd[5] = 0x00; // 固定填充ushort crc = CalculateCrc(cmd);byte[] fullCmd = new byte[8];Array.Copy(cmd, fullCmd, 6);fullCmd[6] = (byte)(crc & 0xFF); // CRC 低字節在前fullCmd[7] = (byte)(crc >> 8);return fullCmd;}}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace JY_MODBUS_IO8R_IS_Soft.Config
{// 通過此類可以處理設置類的特定事件: //  在更改某個設置的值之前將引發 SettingChanging 事件。//  在更改某個設置的值之后將引發 PropertyChanged 事件。//  在加載設置值之后將引發 SettingsLoaded 事件。//  在保存設置值之前將引發 SettingsSaving 事件。public sealed partial class mainSet{public mainSet(){// // 若要為保存和更改設置添加事件處理程序,請取消注釋下列行: //// this.SettingChanging += this.SettingChangingEventHandler;//// this.SettingsSaving += this.SettingsSavingEventHandler;//}private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e){// 在此處添加用于處理 SettingChangingEvent 事件的代碼。}private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e){// 在此處添加用于處理 SettingsSaving 事件的代碼。}}
}
//------------------------------------------------------------------------------
// <auto-generated>
//     此代碼由工具生成。
//     運行時版本:4.0.30319.42000
//
//     對此文件的更改可能會導致不正確的行為,并且如果
//     重新生成代碼,這些更改將會丟失。
// </auto-generated>
//------------------------------------------------------------------------------namespace JY_MODBUS_IO8R_IS_Soft.Config {[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()][global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]public sealed partial class mainSet : global::System.Configuration.ApplicationSettingsBase {private static mainSet defaultInstance = ((mainSet)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new mainSet())));public static mainSet Default {get {return defaultInstance;}}[global::System.Configuration.UserScopedSettingAttribute()][global::System.Diagnostics.DebuggerNonUserCodeAttribute()][global::System.Configuration.DefaultSettingValueAttribute("COM1")]public string ComName {get {return ((string)(this["ComName"]));}set {this["ComName"] = value;}}[global::System.Configuration.UserScopedSettingAttribute()][global::System.Diagnostics.DebuggerNonUserCodeAttribute()][global::System.Configuration.DefaultSettingValueAttribute("115200")]public string ComRate {get {return ((string)(this["ComRate"]));}set {this["ComRate"] = value;}}[global::System.Configuration.UserScopedSettingAttribute()][global::System.Diagnostics.DebuggerNonUserCodeAttribute()][global::System.Configuration.DefaultSettingValueAttribute("Q.0")]public string Channel {get {return ((string)(this["Channel"]));}set {this["Channel"] = value;}}[global::System.Configuration.UserScopedSettingAttribute()][global::System.Diagnostics.DebuggerNonUserCodeAttribute()][global::System.Configuration.DefaultSettingValueAttribute("10")]public int TestTime {get {return ((int)(this["TestTime"]));}set {this["TestTime"] = value;}}}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;namespace JY_MODBUS_IO8R_IS_Soft.userControl
{public partial class SwitchButtons : UserControl{public SwitchButtons(){InitializeComponent();InitializeTableLayout();}private void InitializeTableLayout(){// 設置TableLayoutPanel的行和列tableLayoutPanel1.RowCount = 2; // 例如,3行tableLayoutPanel1.ColumnCount = 9; // 1列,可以根據需要調整tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 30F)); // 標題行占20%高度tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 30F)); // 按鈕行占60%高度}private void SwitchButtons_Load(object sender, EventArgs e){Label labelcol = new Label();labelcol.Text = $"Do0"; // 按鈕的文本從"按鈕2"開始計數labelcol.AutoSize = false;labelcol.TextAlign = ContentAlignment.MiddleCenter;labelcol.Dock = DockStyle.Fill; // 使按鈕填充整個單元格tableLayoutPanel1.Controls.Add(labelcol, 0, 1); // 添加到相應的行,第一列for (int i = 1; i < 9; i++) // 假設你想添加4個按鈕,從第二行開始(索引為1){this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 60F));Label label = new Label();label.Text = $"Q.{i-1}"; // 按鈕的文本從"按鈕2"開始計數label.AutoSize = false;label.TextAlign = ContentAlignment.MiddleCenter;label.Dock = DockStyle.Fill; // 使按鈕填充整個單元格Button button = new Button();button.Dock = DockStyle.Fill;button.Tag = (i - 1).ToString();button.Name = $"btn{(i-1)}";button.Click += new EventHandler(this.btn_click);tableLayoutPanel1.Controls.Add(label, i, 0); // 添加到相應的行,第一列tableLayoutPanel1.Controls.Add(button, i, 1); // 添加到相應的行,第一列}}//public void btn_click(Object sender, System.EventArgs e)//{//    string id = ((Button)sender).Tag.ToString();//    MessageBox.Show(id);//}/// <summary>/// 點擊事件/// </summary>[Browsable(true), Category("自定義事件"), Description("點擊事件")]public event EventHandler Btn_Click;private void btn_click(object sender, EventArgs e){if (Btn_Click != null){Btn_Click(sender, e);}}}
}
using JY_MODBUS_IO8R_IS_Soft.Business;
using JY_MODBUS_IO8R_IS_Soft.frms;
using LogManager;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;namespace JY_MODBUS_IO8R_IS_Soft
{static class Program{/// <summary>/// 應用程序的主入口點。/// </summary>[STAThread]static void Main(){Application.EnableVisualStyles();Application.SetCompatibleTextRenderingDefault(false);#region 日志構建//初始化日志string logPath = Application.StartupPath + "\\Log"; //日志路徑LogManager.GenerateMode LogSaveMode = LogManager.GenerateMode.ByEveryDay; //日志存儲方式 按天LogNetManagment.LogNet = new LogManager.LogNetDateTime(logPath, LogSaveMode);LogNetManagment.LogNet.WriteDebug("啟動程序");#endregionDeviceBll.Single.Init();Application.Run(new frmMain());}}
}

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/917152.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/917152.shtml
英文地址,請注明出處:http://en.pswp.cn/news/917152.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

云展廳:開啟數字化展示新時代

在科技飛速發展的今天&#xff0c;數字化浪潮正席卷各個行業&#xff0c;展覽展示領域也不例外。云展廳作為一種全新的展覽形式&#xff0c;正逐漸嶄露頭角&#xff0c;以其獨特的優勢和創新的技術應用&#xff0c;為觀眾帶來前所未有的觀展體驗&#xff0c;也為企業和機構提供…

硬件電路基礎學習

一、基礎元器件學習 1、電阻 1.1 作用 電阻的工作原理是基于歐姆定律&#xff0c;即電阻的阻值取決于其材料、長度和橫截面積。電阻的主要作用是限制電流&#xff0c;調節電壓和電流&#xff0c;以及保護電路。1.2 數值計算 歐姆定律 通過歐姆定律計算所需保護電阻的大小注意…

基于C++和人工智能(DeepSeek)實踐

基于C++和人工智能(如DeepSeek)實踐 以下是基于C++和人工智能(如DeepSeek或其他AI框架)的實際應用示例,涵蓋不同領域和技術方向,供參考: 基于C++和人工智能(如DeepSeek或其他AI框架)的實際應用示例 圖像識別與處理 人臉檢測:使用OpenCV和DNN模塊加載預訓練的Caffe…

書生浦語第五期L0G1000

完成 視頻課程學習&#xff0c;并在 https://chat.intern-ai.org.cn/ 平臺中實踐提示詞技巧&#xff0c;與 InternLM 和 InternVL 各完成 10 次對話記錄在飛書文檔中。 參加 浦語提示詞工程論文分類打榜賽&#xff0c;分數超過 40 分 InternLM InternVL 浦語提示詞工程論文分…

SpringCloud(一)微服務基礎認識

1、介紹微服務架構是一種架構模式&#xff0c;它提倡將原本獨立的單體應用&#xff0c;拆分成多個小型服務。這些小型服務各 自獨立運行&#xff0c;服務與服務間的通信采用輕量級通信機制&#xff08;一般基于HTTP協議的RESTful API&#xff09; &#xff0c;達到互相協調、互…

MaxKB+MinerU:通過API實現PDF文檔解析并存儲至知識庫

MinerU是一款開源的高質量數據提取工具&#xff0c;能夠將PDF文檔轉換為Markdown和JSON格式。2025年6月13日&#xff0c;MinerU發布了v2.0版本&#xff0c;相較于v1.0版本實現了架構和功能的全面重構與升級。在優化代碼結構和交互方式的同時&#xff0c;v2.0版本還集成了小參數…

一文了解 `package.json` 和 `package-lock.json`文件

所有使用 npm 或 yarn&#xff08;部分場景&#xff09;管理依賴的 JavaScript/Node.js 項目都會存在**的核心文件–package.json 和 package-lock.json&#xff0c;無論項目類型是 Vue、React、Angular&#xff0c;還是純 Node.js 后端項目、普通 JavaScript 工具庫等。 所以這…

【AI論文】大語言模型量化的幾何原理:將GPTQ視為Babai最近平面算法

摘要&#xff1a;將大型語言模型&#xff08;LLMs&#xff09;的權重從16位量化到更低位寬&#xff0c;是實際部署大規模Transformer模型到更具性價比的加速器上的通用方法。GPTQ已成為大語言模型規模下一站式訓練后量化的標準方法之一。然而&#xff0c;其內部工作原理被描述為…

數據處理四件套:NumPy/Pandas/Matplotlib/Seaborn速通指南

點擊 “AladdinEdu&#xff0c;同學們用得起的【H卡】算力平臺”&#xff0c;H卡級別算力&#xff0c;按量計費&#xff0c;靈活彈性&#xff0c;頂級配置&#xff0c;學生專屬優惠。 數據清洗 特征可視化 Kaggle數據集實操 讀者收獲&#xff1a;1周內具備數據預處理能力 數…

計算機系統層次結構

計算機系統通過多層抽象&#xff0c;平衡硬件效率與軟件靈活性&#xff0c;各層以獨立語言和功能構成有機整體。一、層次劃分&#xff08;從底層到頂層&#xff09;層級名稱特點實現方式第1級微程序機器層硬件直接執行微指令&#xff08;如微操作控制信號&#xff09;。物理硬件…

04 基于sklearn的機械學習-梯度下降(上)

梯度下降一 、為什么要用到梯度下降&#xff1f;正規方程的缺陷&#xff1a;非凸函數問題&#xff1a;損失函數非凸時&#xff0c;導數為0會得到多個極值點&#xff08;非唯一解&#xff09;計算效率低&#xff1a;逆矩陣運算時間復雜度 O(n3)&#xff0c;特征量翻倍時計算時間…

淘寶 API HTTP/2 多路復用與連接優化實踐:提升商品數據采集吞吐量

一、引言?隨著電商行業的蓬勃發展&#xff0c;對淘寶平臺商品數據的采集需求日益增長。無論是市場調研公司分析市場趨勢、電商平臺整合商品資源&#xff0c;還是商家進行競品分析&#xff0c;都需要高效、穩定地獲取大量淘寶商品數據。然而&#xff0c;傳統的 HTTP 協議在面對…

javascript中call、apply 和 bind 的區別詳解

文章目錄深入淺出&#xff1a;JavaScript 中的 call、apply 和 bind一、三位魔法師的共同使命二、各顯神通的魔法師們1. call - 即時通訊專家2. apply - 批量處理高手3. bind - 預約服務大師三、魔法師們的對比表格四、魔法師們的實際應用1. 借用方法2. 函數柯里化3. 事件處理五…

【PHP】接入百度AI開放平臺人臉識別API,實現人臉對比

目錄 一、需求 二、準備工作 1、申請服務 2、創建應用&#xff0c;獲取開發密鑰 3、官方開發文檔 4、測試人像圖片 三、PHP接入 1、鑒權&#xff0c;獲取access_token 2、人臉對比 四、完整代碼 一、需求 現在人臉識別、人臉對比技術越來越成熟&#xff0c;使用越來越…

【東楓科技】DreamHAT+

DreamHAT 是一款頂部附加硬件 (HAT) 套件&#xff0c;可為 Raspberry Pi 提供 60GHz 毫米波雷達供您使用。 全尺寸 HAT 包含一個英飛凌 BGT60TR13C 芯片&#xff0c;具有單個發射天線和三個接收器&#xff08;TX/RX&#xff09;&#xff0c;通過 GPIO 引腳和 SPI 連接到 Raspbe…

Spring Boot + MongoDB:從零開始手動配置 MongoConfig 實戰

前言 你以為只要寫上 spring.data.mongodb.*,就能一勞永逸,MongoDB 立馬聽話?別天真,這只是入門級操作,像是拿個自動擋鑰匙,開個小車溜達溜達,遠遠算不上高手操作。當項目需求變得復雜,連接字符串需要靈活配置,或者多數據源并行作戰時,自動配置的魔法顯得捉襟見肘。…

建筑節能目標下,樓宇自控系統以高效運行助力節能減碳

隨著全球氣候變化問題日益嚴峻&#xff0c;節能減排已成為各國政府和企業的重要任務。在建筑領域&#xff0c;樓宇自控系統&#xff08;Building Automation System, BAS&#xff09;作為實現建筑節能目標的關鍵技術&#xff0c;正發揮著越來越重要的作用。根據中國政府發布的《…

LOVON——面向足式Open-Vocabulary的VLN導航:LLM做任務分解、YOLO11做目標檢測,最后L2MM將指令和視覺映射為動作,且解決動態模糊

前言 因為項目需要(比如我們在做的兩個展廳講解訂單)&#xff0c;近期我一直在研究VLN相關&#xff0c;有些工作哪怕暫時還沒開源(將來可能會開源)&#xff0c;但也依然會解讀&#xff0c;比如好處之一是構建完整的VLN知識體系&#xff0c;本文便是其中一例 我在解讀過程中&am…

在線免費的AI文本轉語音工具TTSMaker介紹

TTSMaker是一個在線的文本轉語音工具&#xff0c; 支持多語言和中文方言&#xff0c;不同的語言和方言單次轉換的字符上限從200-10000 不同&#xff0c;轉換的效果還不錯&#xff0c;聽不出明顯的AI痕跡。 工具的網址是&#xff1a;https://ttsmaker.cn/。 工具的界面如上&…

【AI問答】PromQL中interval和rate_interval的區別以及Grafana面板的配置建議

問題1&#xff1a;interval和rate_interval的區別 在PromQL中確實有 $__rate_interval 這個特殊的變量&#xff0c;它與 $__interval 有不同的用途和計算方式。 $__interval vs $__rate_interval 1. $__interval 含義&#xff1a;Grafana計算出的基本時間間隔計算方式&#xff…