MongoDB在自动化设备上的应用示例
发现MongoDB特别适合自动化检测数据的存储。。。
例如一个晶圆检测项目,定义其数据结构如下
#pragma once
#include <vector>
#include <QString>
#include <QRectF>
#include <string>
#include <memory>class tpoWafer;
class tpoDie;
class tpoDefect;class tpoWafer
{
public:std::vector<std::shared_ptr<tpoDie>>Layouts; //晶圆的layoutQRectF MaskArea;QString WaferID;QString BatchID;QString ProductID;QString StepID;QString LotID;QString EqpID;QString UnitID;QString OperatorID;QString RecipeName;QString RecipeID;int TotalDie;int OKDie;int NGDie;int TotalDefect;double Mark_x;double Mark_y;QString Judge;QString WarningLevel;int WariningCode;QString StartTime;QString EndTime;int ImageCount;QString ImagePath;
};class tpoDie
{
public:std::vector<std::shared_ptr<tpoDefect>>InspectedDefect; //检测到的缺陷double die_x;double die_y;double die_width;double die_height;double die_type;int die_model;
};class tpoDefect
{
public:int id = -1;double x = 0;double y = 0;double gray = 0;double height = 0;double width = 0;double size = 0;double roundness = 1;int type = -1;int judge = 0;QRectF bounding = QRectF(0, 0, 1, 1);bool visible = true;bool skip = false;int inspect_type = 1;int flag = -1;
};
如果用的是结构型数据库存储数据,就需要在数据库中建立3个表,wafer table,die table defect table,还要用外键进行关联。
而在MongoDB这类非关系型数据库中这些都不需要,只需按照定义的数据结构把数据写成类似json文件的domcument存到数据中就可以了。最最重要的是,当数据结构改变了,增加或者减少存储的数据时完全不需要改数据库表,这个在关系型数据库中就不行了。
bool tpoWafer::write_to_database(bsoncxx::builder::stream::document& doc)
{int idx = 0;doc <<"MaskArea_x" + std::to_string(idx) << MaskArea.x() <<"MaskArea_y" + std::to_string(idx) << MaskArea.y() <<"MaskArea_width" + std::to_string(idx) << MaskArea.width() << "MaskArea_height" + std::to_string(idx) << MaskArea.height() <<"WaferID" + std::to_string(idx) << WaferID.toStdString() <<"BatchID" + std::to_string(idx) << BatchID.toStdString() <<"ProductID" + std::to_string(idx) << ProductID.toStdString() <<"StepID" + std::to_string(idx) << StepID.toStdString() <<"LotID" + std::to_string(idx) << LotID.toStdString() <<"EqpID" + std::to_string(idx) << EqpID.toStdString() <<"UnitID" + std::to_string(idx) << UnitID.toStdString() <<"OperatorID" + std::to_string(idx) << OperatorID.toStdString() <<"RecipeName" + std::to_string(idx) << RecipeName.toStdString() <<"RecipeID" + std::to_string(idx) << RecipeID.toStdString() <<"TotalDie" + std::to_string(idx) << TotalDie <<"OKDie" + std::to_string(idx) << OKDie <<"NGDie" + std::to_string(idx) << NGDie <<"TotalDefect" + std::to_string(idx) << TotalDefect <<"Mark_x" + std::to_string(idx) << Mark_x <<"Mark_y" + std::to_string(idx) << Mark_y <<"Judge" << Judge.toStdString() <<"WarningLevel" + std::to_string(idx) << WarningLevel.toStdString() <<"WariningCode" + std::to_string(idx) << WariningCode <<"StartTime" + std::to_string(idx) << StartTime.toStdString() <<"EndTime" + std::to_string(idx) << EndTime.toStdString() <<"ImageCount" + std::to_string(idx) << ImageCount <<"ImagePath" + std::to_string(idx) << ImagePath.toStdString();for (int i = 0; i < Layouts.size(); i++){Layouts[i]->write_to_database(doc, i);}return true;
}bool tpoDefect::write_to_database(bsoncxx::builder::stream::document& doc, int idx)
{doc << "defect_info"+ std::to_string(idx) << bsoncxx::builder::stream::open_document <<"id"+ std::to_string(idx) << id <<"x" + std::to_string(idx) << x <<"t" + std::to_string(idx) << y <<"gray" + std::to_string(idx) << gray <<"height" + std::to_string(idx) << height <<"width" + std::to_string(idx) << width <<"size" + std::to_string(idx) << size <<"roundness" + std::to_string(idx) << roundness <<"type" + std::to_string(idx) << type <<"judge" + std::to_string(idx) << judge <<"bounding_x" + std::to_string(idx) << bounding.x() <<"bounding_y" + std::to_string(idx) << bounding.y() <<"bounding_width" + std::to_string(idx) << bounding.width() <<"bounding_height" + std::to_string(idx) << bounding.height() <<"visible" + std::to_string(idx) << visible <<"skip" + std::to_string(idx) << skip <<"inspect_type" + std::to_string(idx) << inspect_type <<"flag" << flag;doc << bsoncxx::builder::stream::close_document;return false;
}bool tpoDie::write_to_database(bsoncxx::builder::stream::document& doc, int idx)
{doc << "die_info" + std::to_string(idx) <<bsoncxx::builder::stream::open_document<<"die_x" + std::to_string(idx) << die_x <<"die_y" + std::to_string(idx) << die_y <<"die_width" + std::to_string(idx) << die_width <<"die_height" + std::to_string(idx) << die_height <<"die_type" + std::to_string(idx) << die_type <<"die_model" + std::to_string(idx) << die_model <<"die_id" + std::to_string(idx) << die_id.toStdString();for (int i = 0; i < InspectedDefect.size(); i++){InspectedDefect[i]->write_to_database(doc, i); }doc << bsoncxx::builder::stream::close_document;return true;
}
对每个数据结构写一个write document的方法,最后只需要调用wafer的write_to_database方法就能把wafer的每个die的详细信息记录到表中,包括每个die中的缺陷详细信息。
写到数据库中的数据结构是这样的,结构一目了然,wafer中带着die的信息和自身的一些详细信息,die中又有defect的详细信息。

而且这个数据库查询效率奇高,实测千万级的数据,添加了索引之后能在0.1秒之内查询到结果。
相关文章:
MongoDB在自动化设备上的应用示例
发现MongoDB特别适合自动化检测数据的存储。。。 例如一个晶圆检测项目,定义其数据结构如下 #pragma once #include <vector> #include <QString> #include <QRectF> #include <string> #include <memory>class tpoWafer; class tp…...
draggable插件——实现元素的拖动排序——拖动和不可拖动的两种情况处理
最近在写后台管理系统的时候,遇到一个需求,就是关于拖动排序的功能。 我之前是写过一个关于拖动表格的功能,此功能可以实现表格中的每一行数据上下拖动实现排序的效果。 vue——实现表格的拖拽排序功能——技能提升 但是目前我这边的需求是…...
Redux的使用
到如今redux的已经不是react程序中必须的一部分内容了, 我们应该在本地需要大量更新全局变量时才使用它! redux vs reducer reducer的工作机制: 手动构造action对象传入dispatch函数中 dispatch函数将 action传入reducer当中 reducer结合当前state与a…...
【JAVA】Java高级:多数据源管理与Sharding:数据分片(Sharding)技术的实现与实践
大规模分布式系统,数据存储和管理变得越来越复杂。随着用户数量和数据量的急剧增加,单一数据库往往难以承载如此庞大的负载。这时,数据分片(Sharding)技术应运而生。数据分片是一种将数据水平切分到多个数据库实例的技…...
ASP.NET Core 9.0 静态资产传递优化 (MapStaticAssets )
一、结论 💢先看结论吧, MapStaticAssets 在大多数情况下可以替换 UseStaticFiles,它已针对为应用在生成和发布时了解的资产提供服务进行了优化。 如果应用服务来自其他位置(如磁盘或嵌入资源)的资产,则应…...
LeetCode刷题day18——贪心
LeetCode刷题day18——贪心 135. 分发糖果分析: 406. 根据身高重建队列分析:for (auto& p : people) 昨天写了一道,今天写了一道,都有思路,却不能全整对。昨天和小伙伴聊天,说是因为最近作业多…...
MATLAB Simulink® - 智能分拣系统
系列文章目录 前言 本示例展示了如何在虚幻引擎 环境中对四种不同形状的标准 PVC 管件实施半结构化智能分拣。本示例使用 Universal Robots UR5e cobot 执行垃圾箱拣选任务,从而成功检测并分类物体。cobot 的末端执行器是一个吸力抓手,它使 cobot 能够拾…...
linuxCNC(五)HAL驱动的指令介绍
HAL驱动的构成 指令举例详解 从终端进入到HAL命令行,执行halrun,即可进入halcmd命令行 # halrun指令描述oadrt加载comoonent,loadrt threads name1 period1创建新线程loadusr halmeter加载万用表UI界面loadusr halscope加载示波器UI界面sho…...
STM32 进阶 定时器3 通用定时器 案例2:测量PWM的频率/周期
需求分析 上一个案例我们输出了PWM波,这个案例我们使用输入捕获功能,来测试PWM波的频率/周期。 把测到的结果通过串口发送到电脑,检查测试的结果。 如何测量 1、输入捕获功能主要是:测量输入通道的上升沿和下降沿 2、让第一个…...
第一节、电路连接【51单片机-TB6600驱动器-步进电机教程】
摘要:本节介绍如何搭建一个51单片机TB6600驱动器步进电机控制电路,所用材料均为常见的模块,简单高效的方式搭建起硬件环境 一、硬件清单 ①51单片机最小控制系统 ②USB转TTL模块 ③开关电源 ④TB6600步进电机驱动器 ⑤二相四线步进电机 ⑥电…...
【通俗理解】Koopman算符与非线性动力系统分析
【通俗理解】Koopman算符与非线性动力系统分析 关键词: #Koopman算符 Koopman Operator #非线性动力系统 Nonlinear Dynamical System #无穷维线性算子 Infinite-Dimensional Linear Operator #演化分析 Evolution Analysis #Bernard Koopman Bernard Koopman 第…...
mybatis plus打印sql日志
1、官方文档 使用配置 | MyBatis-Plus 2、日志实现 MyBatis-Plus 提供了多种日志实现(log-impl),用于记录 SQL 语句和相关操作,帮助开发者进行调试和监控数据库操作。以下是一些可用的日志实现及其说明: StdOutImpl…...
ObjectMapper
ObjectMapper 是 Jackson 库中非常重要的一个类,它是 JSON 和 Java 对象之间进行序列化与反序列化的核心工具。ObjectMapper 的底层实现是基于 Jackson 的数据绑定模型,它将 Java 对象与 JSON 数据转换为互通格式。 1. ObjectMapper 的设计与核心功能 O…...
新增白名单赋予应用安装权限
目录 相关问题 具体实现 相关问题 安装app到/data/分区时,如何在安装阶段就赋予权限,无需请求权限 具体实现 frameworks/base/core/res/res/values/config.xml <!-- For whitelis apk --><string-array translatable"false" nam…...
传奇996_51——脱下装备,附加属性设为0
奶奶的lua怎么都修改不了,可以调用txt的 ; LINKPICKUPITEM ; ChangeitemaddvaLue -1 5 0 ; GETITEMADDVALUE 3 5 M10 ; SENDUPGRADEITEM ; SENDMSG 9 你的衣服附加了<$STR(M10)>点防御属性. 或者lua callscriptex(actor,“LINKPICKUPITEM”) callscriptex(…...
【Mac】安装Gradle
1、说明 Gradle 运行依赖 JVM,需要先安装JDK,Gradle 与 JDK的版本对应参见:Java Compatibility IDEA的版本也是有要求Gradle版本的,二者版本对应关系参见:Third-Party Software and Licenses 本次 Gradle 安装版本为…...
MySQL中的redoLog
在数据库系统中,redo log(重做日志)用于记录所有已提交事务的修改操作,它的主要目的是确保在系统崩溃或故障后,能够恢复数据库到崩溃前的状态。Redo log 记录的是事务修改的数据的具体操作,而不是数据本身。…...
Windows 安装 MySQL
1.下载 MySQL 安装包 访问:MySQL :: Download MySQL Installer选择适合的版本。推荐下载 MySQL Installer for Windows,该安装包包含所有必要的组件选择 Windows (x86, 32-bit), MSI Installer 或 Windows (x86, 64-bit), MSI Installer 2.运行安装程序…...
yocto的xxx.bb文件在什么时候会拷贝文件到build目录
在 Yocto 中,.bb 文件用于描述如何构建和安装一个软件包,而文件在构建过程中的拷贝操作通常会在某些特定的步骤中进行。具体来说,文件会在以下几个阶段被拷贝到 build 目录(或者更准确地说,拷贝到目标目录 ${D}&#x…...
Ubuntu Server 22.04.5 LTS重启后IP被重置问题
Ubuntu Server 22.04.5 LTS重启后IP被重置问题 最近在使用Ubuntu Server 22.04做项目开发测试时发现每次重启和关机后,所设置的静态IP地址都会回复到安装系统时所设置的ip Ubuntu Server 22.04 官网下载地址:Ubuntu官方下载地址 对虚拟机下安装Ubuntu感…...
Linux应用开发之网络套接字编程(实例篇)
服务端与客户端单连接 服务端代码 #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <arpa/inet.h> #include <pthread.h> …...
家政维修平台实战20:权限设计
目录 1 获取工人信息2 搭建工人入口3 权限判断总结 目前我们已经搭建好了基础的用户体系,主要是分成几个表,用户表我们是记录用户的基础信息,包括手机、昵称、头像。而工人和员工各有各的表。那么就有一个问题,不同的角色…...
2025盘古石杯决赛【手机取证】
前言 第三届盘古石杯国际电子数据取证大赛决赛 最后一题没有解出来,实在找不到,希望有大佬教一下我。 还有就会议时间,我感觉不是图片时间,因为在电脑看到是其他时间用老会议系统开的会。 手机取证 1、分析鸿蒙手机检材&#x…...
Spring AI 入门:Java 开发者的生成式 AI 实践之路
一、Spring AI 简介 在人工智能技术快速迭代的今天,Spring AI 作为 Spring 生态系统的新生力量,正在成为 Java 开发者拥抱生成式 AI 的最佳选择。该框架通过模块化设计实现了与主流 AI 服务(如 OpenAI、Anthropic)的无缝对接&…...
Spring AI与Spring Modulith核心技术解析
Spring AI核心架构解析 Spring AI(https://spring.io/projects/spring-ai)作为Spring生态中的AI集成框架,其核心设计理念是通过模块化架构降低AI应用的开发复杂度。与Python生态中的LangChain/LlamaIndex等工具类似,但特别为多语…...
深度学习习题2
1.如果增加神经网络的宽度,精确度会增加到一个特定阈值后,便开始降低。造成这一现象的可能原因是什么? A、即使增加卷积核的数量,只有少部分的核会被用作预测 B、当卷积核数量增加时,神经网络的预测能力会降低 C、当卷…...
动态 Web 开发技术入门篇
一、HTTP 协议核心 1.1 HTTP 基础 协议全称 :HyperText Transfer Protocol(超文本传输协议) 默认端口 :HTTP 使用 80 端口,HTTPS 使用 443 端口。 请求方法 : GET :用于获取资源,…...
打手机检测算法AI智能分析网关V4守护公共/工业/医疗等多场景安全应用
一、方案背景 在现代生产与生活场景中,如工厂高危作业区、医院手术室、公共场景等,人员违规打手机的行为潜藏着巨大风险。传统依靠人工巡查的监管方式,存在效率低、覆盖面不足、判断主观性强等问题,难以满足对人员打手机行为精…...
MySQL 部分重点知识篇
一、数据库对象 1. 主键 定义 :主键是用于唯一标识表中每一行记录的字段或字段组合。它具有唯一性和非空性特点。 作用 :确保数据的完整性,便于数据的查询和管理。 示例 :在学生信息表中,学号可以作为主键ÿ…...
算法打卡第18天
从中序与后序遍历序列构造二叉树 (力扣106题) 给定两个整数数组 inorder 和 postorder ,其中 inorder 是二叉树的中序遍历, postorder 是同一棵树的后序遍历,请你构造并返回这颗 二叉树 。 示例 1: 输入:inorder [9,3,15,20,7…...
