公司采购了一个夹具,项目负责人想要试探这个夹具的性能,于是想要我这边写一个烤机的程序,小编结合官网资料
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…