電子發(fā)燒友App

硬聲App

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學(xué)習(xí)在線課程
  • 觀看技術(shù)視頻
  • 寫文章/發(fā)帖/加入社區(qū)
會員中心
創(chuàng)作中心

完善資料讓更多小伙伴認(rèn)識你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示
創(chuàng)作
電子發(fā)燒友網(wǎng)>電子資料下載>電子資料>使用Azure IoT Hub對熱交換器進(jìn)行熱分析

使用Azure IoT Hub對熱交換器進(jìn)行熱分析

2023-06-16 | zip | 0.00 MB | 次下載 | 免費(fèi)

資料介紹

描述

熱交換器被認(rèn)為是工業(yè)過程中廣泛使用的最常見類型的交換器之一。該交換器由一個(gè)不同尺寸的容器組成,其中包含許多管子。傳遞熱量的速率取決于幾個(gè)因素,例如進(jìn)料溫度和濕度、外殼直徑、管的數(shù)量、管的幾何形狀、擋板間距和切割間距。因此,溫度分析對于保持管內(nèi)正確的溫度并診斷其中的故障變得非常重要。采取正確的措施可以增加設(shè)備的容錯(cuò)能力。

無線傳感器網(wǎng)絡(luò)已安裝在許多工業(yè)應(yīng)用中,例如民用基礎(chǔ)設(shè)施的結(jié)構(gòu)監(jiān)測、水輪機(jī)的振動(dòng)分析等,并且在消除許多工業(yè)并發(fā)癥方面做得非常好。

在本教程中,我們將介紹無線溫度和濕度傳感器及其在熱交換器熱分析中的優(yōu)勢。所以在這里我們將演示以下內(nèi)容:

  • 無線溫度和濕度傳感器。
  • 使用這些傳感器進(jìn)行溫度分析。
  • 使用無線網(wǎng)關(guān)設(shè)備收集和分析數(shù)據(jù)。
  • 使用 Azure 發(fā)布和訂閱傳感器數(shù)據(jù)。

硬件和軟件規(guī)格

軟件規(guī)范

硬件規(guī)格

物聯(lián)網(wǎng)遠(yuǎn)程無線溫濕度傳感器

這些是工業(yè)級長距離溫度和濕度傳感器,傳感器分辨率為 ±1.7%RH ±0.6° C。僅由 2 節(jié) AA 電池(隨附)供電,使用壽命為 500,000 次無線傳輸,您可以期望實(shí)現(xiàn)高達(dá)長達(dá) 10 年的電池壽命取決于環(huán)境條件和傳輸間隔可以由您選擇。可選地,該傳感器可以由外部供電。這些傳感器的范圍為 2 英里,帶有板載天線。使用網(wǎng)狀網(wǎng)絡(luò)架構(gòu),該范圍可達(dá)到 28 英里。

獲取溫度和濕度值

我們從無線溫度和濕度傳感器獲得以下值:

  • 攝氏溫度
  • 華氏溫度
  • 相對濕度
  • 電池使用情況

然后在 Azure IoT 中心對這些數(shù)據(jù)進(jìn)行可視化和分析。若要開始設(shè)置 Azure IoT 中心,請閱讀本教程。為了發(fā)送值 Azure IoT 中心,應(yīng)遵循以下過程。

Azure IoT 中心遵循 MQTT 協(xié)議以發(fā)布和訂閱數(shù)據(jù)。

  • Azure 函數(shù)是 azure 門戶提供的另一個(gè)重要功能。使用 Azure 函數(shù),我們可以在云中編寫一段代碼或函數(shù)。在這個(gè)項(xiàng)目中,我們正在解析包含原始傳感器數(shù)據(jù)的 JSON,并使用 Azure 函數(shù)從中獲取真實(shí)的溫度和濕度值。要設(shè)置 Azure 功能,請遵循本教程。
  • 我們將使用解析后的 JSON 原始數(shù)據(jù)獲取真實(shí)的溫度和濕度數(shù)據(jù)
public static async Task Run(HttpRequestMessage req, TraceWriter log)
{  
double humidity;  
int rawTemp;  
double Ctemp;  
double Ftemp;  
double voltage;  
string utcEnque;  
string devFormat;  
string utcProcess;  
log.Info("C# HTTP trigger function processed a request: " + content);  
JArray array = JArray.Parse($"{await req.Content.ReadAsStringAsync()}");//parsing the JSON array   
foreach(dynamic message in array){      
utcProcess = message.EventProcessedUtcTime;      
utcEnque = message.EventEnqueuedUtcTime;      
humidity = ((message.Humid1)*256 + (message.Humid2))/100;      
rawTemp = ((message.Temp1)*256 + (message.Temp2));      
Ctemp = rawTemp /100.0;         
Ftemp = Ctemp *1.8 + 32;       
int bat = ((message.Bat1)*256 + (message.Bat2));      
voltage = 0.00322 * bat;      
string utcTime = utcProcess.ToString();      
DateTime localDateTime = DateTime.Parse(utcTime);       
DateTime utcDateTime = localDateTime.ToUniversalTime();      
string usTimeZone = "US Eastern Standard Time";      
TimeZoneInfo ust = TimeZoneInfo.FindSystemTimeZoneById(usTimeZone);      
DateTime dateTime = TimeZoneInfo.ConvertTime(utcDateTime, ust);      
log.Info(dateTime.ToString("dd/MM/yyyy HH:mm:ss"));    }return req.CreateResponse(HttpStatusCode.OK, "Executed");  } public class Message{    
[JsonProperty("temp1")]    
public int temp1 { get; set; }    
[JsonProperty("temp2")]    
public int temp2 { get; set; }    
[JsonProperty("humid1")]    
public int humid1 { get; set; }    
[JsonProperty("humid2")]    
public int humid2 { get; set; }    
[JsonProperty("bat1")]    
public int bat1 { get; set; }    
[JsonProperty("bat2")]    
public int bat2 { get; set; }  }

在 PowerBi 中分析數(shù)據(jù)

我們正在使用 Power BI 來可視化數(shù)據(jù)。它提供了分析數(shù)據(jù)的交互式方法。此數(shù)據(jù)可以以折線圖、條形圖、餅圖等形式進(jìn)行解釋。首先在 Power Bi 中創(chuàng)建一個(gè)帳戶并登錄到您的帳戶。在上一篇文章中,我們設(shè)置了 Power Bi 并使用流分析作業(yè)將數(shù)據(jù)發(fā)送到 Power Bi。在這篇文章中,我們使用 Azure 功能將傳感器數(shù)據(jù)發(fā)送給 Bi。要設(shè)置 Power Bi,請閱讀此博客。

有四種方法可以將數(shù)據(jù)發(fā)送到 Power Bi:

  • 將數(shù)據(jù)從 IoT 中心直接流式傳輸?shù)?Power Bi。
  • 使用 API 向 Power Bi 發(fā)送數(shù)據(jù)。
  • 使用網(wǎng)絡(luò)鉤子函數(shù)
  • 使用 PubNub。

在我們的例子中,我們使用 Power BI API 并從 azure 函數(shù)向 Power BI 發(fā)送 HTTP 響應(yīng)。可視化面板中列出了不同的圖形、折線圖、Pi 圖等。我們可以通過從可視化面板中選擇任何圖表來創(chuàng)建圖表。

我們還可以將數(shù)據(jù)導(dǎo)出為 Excel 表格或 CSV 格式。在后期可用于數(shù)據(jù)分析。

PowerBI 的 Azure 函數(shù)代碼

從 JSON 中解析所有 JSON 對象,并獲取溫度、濕度等的真實(shí)值。這里的產(chǎn)品是一個(gè)產(chǎn)品類對象,我們在其中存儲解析的值。

Product product = new Product();foreach(dynamic message in array){humidity = ((message.humid1)*256 + (message.humid2))/100;      
rawTemp = ((message.temp1)*256 + (message.temp2));      
Ctemp = rawTemp /100.0;         
Ftemp = Ctemp *1.8 + 32;       
int bat = ((message.bat1)*256 + (message.bat2));      
voltage = 0.00322 * bat;      
utcProcess = message.EventProcessedUtcTime;      
utcEnque = message.EventEnqueuedUtcTime;      
product.Ctemperature = Ctemp;      
product.Ftemperature = Ftemp;      
product.humid = humidity;      
product.battery = voltage;     
//product.dateTime = ;         
product.EventProcessedUtcTime=utcProcess;       
product.EventEnqueuedUtcTime=utcEnque;     }public class Product{  
public double Ctemperature{get; set;}  
public double humid{get; set;}  
public double battery{get; set;}  
//public double dateTime{get; set;}  
public string EventProcessedUtcTime { get; set; }  
public string EventEnqueuedUtcTime { get; set; }  
public double Ftemperature{get; set;}}
  • 現(xiàn)在創(chuàng)建一個(gè)變量來存儲 Power Bi 的連接字符串
  • 創(chuàng)建 HTTP 客戶端實(shí)例
string connString = "https://api.powerbi.com/beta/***************";  HttpClient client = new HttpClient();
  • 我們需要發(fā)送 JSON 給 Bi 供電。因此,使用模型類對象序列化 Json。
  • 將轉(zhuǎn)換后的 JSON 作為 HTTP 請求發(fā)送到 power bi。
string output = JsonConvert.SerializeObject(product);     HttpContent httpContent = new StringContent("[" + output + "]");       
HttpResponseMessage response = await client.PostAsync(connString, httpContent);     response.EnsureSuccessStatusCode();

Power BI 中的數(shù)據(jù)可視化

在這里,我們在不同的日期和時(shí)間可視化我們的傳感器數(shù)據(jù)。我們可以分別看到不同日子內(nèi)濕度、溫度和電池使用量的百分比變化。

?
?
?
?
pYYBAGNy24aAILhFAAFfIJrv354990.png
?
1 / 4
?

使用 SendGrid 的無線溫度傳感器 Azure 電子郵件托管

軟件即服務(wù)(Saas 應(yīng)用程序)提供了另一個(gè)令人驚嘆的功能,稱為 SendGrid。在 Microsoft Azure 中,SendGrid 支持迅速將電子郵件通知傳遞給不同的用戶。

此博客中描述了發(fā)送網(wǎng)格的設(shè)置。

在這里,我們將描述使用 Azure 功能發(fā)送電子郵件通知的代碼。

  • 添加這些依賴項(xiàng),“Send Grid”用于訪問 SendGrid 郵件服務(wù)。
?
?
?
?
poYBAGNy24iAAz37AAAsD-9DNh0305.png
?
1 / 3
?
#r "SendGrid"using Newtonsoft.Json;using Newtonsoft.Json.Linq;
using System.Net;using System.Net.Mail;
using SendGrid.Helpers.Mail;using Microsoft.Extensions.Logging;
  • 從郵件、smtp 端口、用戶名、密碼、smtp 主機(jī)、郵件主題和郵件正文創(chuàng)建用于存儲到郵件的變量。
string fromMail="enter from mail";string toMail="enter to mail";int smtpPort = 587;
string smtpUserName="Enter your smtp send grid username";  
string smtpPassword = "enter sendgrid password";  
string smtpHost = "smtp.sendgrid.net";  
string subject = "Temperature Alert!!!";  
string mailMessage = "Temperature has reached beyond 30";
  • 創(chuàng)建 MailMessage 和 SmtpClient 的實(shí)例
MailMessage mail = new MailMessage(fromMail,toMail);SmtpClient smtpClient = new SmtpClient();
  • 設(shè)置端口、傳遞方法、smtp 主機(jī)、用戶憑據(jù)郵件正文和主題到 Smtp 客戶端和郵件消息對象。
smtpClient.Port = smtpPort;smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
smtpClient.UseDefaultCredentials = false;
smtpClient.Host = smtpHost;
smtpClient.Credentials = new System.Net.NetworkCredential(smtpUserName,smtpPassword);
mail.Subject = subject;mail.Body = mailMessage;
  • 設(shè)置端口、傳遞方法、smtp 主機(jī)、用戶憑據(jù)郵件正文和主題到 Smtp 客戶端和郵件消息對象。
smtpClient.Port = smtpPort;smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
smtpClient.UseDefaultCredentials = false;
smtpClient.Host = smtpHost;
smtpClient.Credentials = new System.Net.NetworkCredential(smtpUserName,smtpPassword);
mail.Subject = subject;mail.Body = mailMessage;
  • 每當(dāng)溫度超過 30 度閾值時(shí)。用戶將收到一封郵件到所描述的電子郵件 ID。
if(product.Ctemperature > 30.00){              smtpClient.Send(mail);     }

通知結(jié)果

  • 每次溫度超過 30 度標(biāo)記時(shí),都會向用戶發(fā)送自動(dòng)電子郵件通知。
  • 發(fā)送網(wǎng)格每次都將電子郵件通知傳遞給同一主題。我們不必在收件箱中向下滾動(dòng)來搜索最后發(fā)送的消息。只需搜索溫度警報(bào)!你會得到消息列表。

整體代碼

此設(shè)置的固件可在此GitHub 存儲庫中找到。


下載該資料的人也在下載 下載該資料的人還在閱讀
更多 >

評論

查看更多

下載排行

本周

  1. 1山景DSP芯片AP8248A2數(shù)據(jù)手冊
  2. 1.06 MB  |  532次下載  |  免費(fèi)
  3. 2RK3399完整板原理圖(支持平板,盒子VR)
  4. 3.28 MB  |  339次下載  |  免費(fèi)
  5. 3TC358743XBG評估板參考手冊
  6. 1.36 MB  |  330次下載  |  免費(fèi)
  7. 4DFM軟件使用教程
  8. 0.84 MB  |  295次下載  |  免費(fèi)
  9. 5元宇宙深度解析—未來的未來-風(fēng)口還是泡沫
  10. 6.40 MB  |  227次下載  |  免費(fèi)
  11. 6迪文DGUS開發(fā)指南
  12. 31.67 MB  |  194次下載  |  免費(fèi)
  13. 7元宇宙底層硬件系列報(bào)告
  14. 13.42 MB  |  182次下載  |  免費(fèi)
  15. 8FP5207XR-G1中文應(yīng)用手冊
  16. 1.09 MB  |  178次下載  |  免費(fèi)

本月

  1. 1OrCAD10.5下載OrCAD10.5中文版軟件
  2. 0.00 MB  |  234315次下載  |  免費(fèi)
  3. 2555集成電路應(yīng)用800例(新編版)
  4. 0.00 MB  |  33566次下載  |  免費(fèi)
  5. 3接口電路圖大全
  6. 未知  |  30323次下載  |  免費(fèi)
  7. 4開關(guān)電源設(shè)計(jì)實(shí)例指南
  8. 未知  |  21549次下載  |  免費(fèi)
  9. 5電氣工程師手冊免費(fèi)下載(新編第二版pdf電子書)
  10. 0.00 MB  |  15349次下載  |  免費(fèi)
  11. 6數(shù)字電路基礎(chǔ)pdf(下載)
  12. 未知  |  13750次下載  |  免費(fèi)
  13. 7電子制作實(shí)例集錦 下載
  14. 未知  |  8113次下載  |  免費(fèi)
  15. 8《LED驅(qū)動(dòng)電路設(shè)計(jì)》 溫德爾著
  16. 0.00 MB  |  6656次下載  |  免費(fèi)

總榜

  1. 1matlab軟件下載入口
  2. 未知  |  935054次下載  |  免費(fèi)
  3. 2protel99se軟件下載(可英文版轉(zhuǎn)中文版)
  4. 78.1 MB  |  537798次下載  |  免費(fèi)
  5. 3MATLAB 7.1 下載 (含軟件介紹)
  6. 未知  |  420027次下載  |  免費(fèi)
  7. 4OrCAD10.5下載OrCAD10.5中文版軟件
  8. 0.00 MB  |  234315次下載  |  免費(fèi)
  9. 5Altium DXP2002下載入口
  10. 未知  |  233046次下載  |  免費(fèi)
  11. 6電路仿真軟件multisim 10.0免費(fèi)下載
  12. 340992  |  191187次下載  |  免費(fèi)
  13. 7十天學(xué)會AVR單片機(jī)與C語言視頻教程 下載
  14. 158M  |  183279次下載  |  免費(fèi)
  15. 8proe5.0野火版下載(中文版免費(fèi)下載)
  16. 未知  |  138040次下載  |  免費(fèi)