上一页 1 2 3 4 5 6 7 8 ··· 33 下一页
摘要: 1、安装 pip install fastapi 2、新建main.py from fastapi import FastAPI app = FastAPI() @app.get("/") async def root(): return {"message": "Hello World"} 3、运 阅读全文
posted @ 2025-07-18 17:31 daviyoung 阅读(8) 评论(0) 推荐(0)
摘要: vs code中: 创建虚拟环境 python -m venv .venv 激活: .\.venv\Scripts\activate 激活虚拟环境后即可使用。 删除虚拟环境 # 先退出虚拟环境(如果已激活) deactivate # 删除虚拟环境目录 Remove-Item -Recurse -Fo 阅读全文
posted @ 2025-07-18 17:24 daviyoung 阅读(10) 评论(0) 推荐(0)
摘要: FastAPI 的路由系统是其核心组件之一,负责将客户端请求(如 HTTP GET、POST 等)映射到具体的处理函数(也叫“视图函数”或“端点”)。下面是 FastAPI 路由相关的知识总结,涵盖基本使用、进阶功能、最佳实践等。 🧱 基础知识 1. 路由定义方式 from fastapi imp 阅读全文
posted @ 2025-07-18 17:09 daviyoung 阅读(76) 评论(0) 推荐(0)
摘要: 服务端: 客户端: 参考文章:OPCServer:使用Matrikon OPC Server Simulation_matrikonopcsimulation安装失败-CSDN博客 阅读全文
posted @ 2025-07-11 11:10 daviyoung 阅读(130) 评论(0) 推荐(0)
摘要: 一、Nuget上添加OpcUaHelper库,要使用最新的版本2.2.1,旧版本亲测无法连接,比如版本2.1.3经过测试无法连接 二、代码 class Program { static async Task Main(string[] args) { OpcUaClient opcUaClient 阅读全文
posted @ 2025-07-08 15:47 daviyoung 阅读(449) 评论(0) 推荐(0)
摘要: 一、需要确认opc服务器的节点类型是数字型还是字符串型。 例如:数字型:i=2 字符串型:s=Temperature 假如命名空间索引是2,那么ns=2 采集数字型: node_address = "ns=2;i=2" 采集字符串型: node_address = "ns=2;s=Temperatu 阅读全文
posted @ 2025-07-08 10:24 daviyoung 阅读(206) 评论(0) 推荐(0)
摘要: 一、安装库opcua pip install opcua 二、新建文件opcua_server.py # -*- coding: utf-8 -*- from opcua import Client import time # 配置客户端 server_url = "opc.tcp://localh 阅读全文
posted @ 2025-07-08 10:21 daviyoung 阅读(192) 评论(0) 推荐(0)
摘要: Python 快速搭建一个 OPC UA 服务器 一、安装库opcua pip install opcua 二、新建文件opcua_server.py from opcua import Server # 初始化服务器 server = Server() server.set_endpoint("o 阅读全文
posted @ 2025-07-07 15:32 daviyoung 阅读(225) 评论(0) 推荐(0)
摘要: Modbus是工业领域应用最广泛的通信协议 主从架构 Modbus 采用主从(Master/Slave)架构。一个主设备可以与多个从设备通信,从设备之间不直接通信。主设备发出命令,从设备响应。 传输方式 Modbus 协议支持以下三种主要传输方式 1. Modbus RTU:基于串行通信的 Modb 阅读全文
posted @ 2025-04-01 10:01 daviyoung 阅读(95) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2024-10-26 09:17 daviyoung 阅读(274) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 ··· 33 下一页