最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

【W(wǎng)SN】基于XBea連續(xù)監(jiān)測(cè)無線溫度傳感器網(wǎng)絡(luò)附matlab代碼

2023-10-21 11:15 作者:Matlab工程師  | 我要投稿

?作者簡(jiǎn)介:熱愛科研的Matlab仿真開發(fā)者,修心和技術(shù)同步精進(jìn),matlab項(xiàng)目合作可私信。

??個(gè)人主頁:Matlab科研工作室

??個(gè)人信條:格物致知。

更多Matlab完整代碼及仿真定制內(nèi)容點(diǎn)擊??

智能優(yōu)化算法?? ? ??神經(jīng)網(wǎng)絡(luò)預(yù)測(cè)?? ? ??雷達(dá)通信?? ? ?無線傳感器?? ? ? ?電力系統(tǒng)

信號(hào)處理?? ? ? ? ? ? ?圖像處理?? ? ? ? ? ? ??路徑規(guī)劃?? ? ??元胞自動(dòng)機(jī)?? ? ? ?無人機(jī)

?? 內(nèi)容介紹

摘要:無線傳感器網(wǎng)絡(luò)(WSN)已經(jīng)成為了現(xiàn)代科技領(lǐng)域中的熱門話題。在許多應(yīng)用領(lǐng)域,如環(huán)境監(jiān)測(cè)、農(nóng)業(yè)、醫(yī)療保健和工業(yè)自動(dòng)化中,WSN都被廣泛應(yīng)用。其中,溫度傳感器網(wǎng)絡(luò)在許多實(shí)時(shí)監(jiān)測(cè)和控制應(yīng)用中起著重要作用。本文將介紹一種基于XBea的連續(xù)監(jiān)測(cè)無線溫度傳感器網(wǎng)絡(luò)算法步驟。

引言:隨著科技的不斷發(fā)展,無線傳感器網(wǎng)絡(luò)的應(yīng)用范圍越來越廣泛。無線傳感器網(wǎng)絡(luò)由許多小型傳感器節(jié)點(diǎn)組成,這些節(jié)點(diǎn)可以通過無線通信進(jìn)行數(shù)據(jù)傳輸和交互。溫度傳感器網(wǎng)絡(luò)是無線傳感器網(wǎng)絡(luò)中的一種重要類型,可以用于監(jiān)測(cè)和控制環(huán)境中的溫度變化。

XBea是一種常用的無線通信模塊,可以用于構(gòu)建無線傳感器網(wǎng)絡(luò)。它具有低功耗、低成本和易于使用的特點(diǎn),非常適合于溫度傳感器網(wǎng)絡(luò)的應(yīng)用。本文將基于XBea模塊,介紹一種連續(xù)監(jiān)測(cè)無線溫度傳感器網(wǎng)絡(luò)的算法步驟。

算法步驟:

  1. 部署傳感器節(jié)點(diǎn):首先,需要在監(jiān)測(cè)區(qū)域內(nèi)部署一定數(shù)量的傳感器節(jié)點(diǎn)。這些傳感器節(jié)點(diǎn)應(yīng)該均勻分布在整個(gè)區(qū)域內(nèi),以確保溫度監(jiān)測(cè)的全面性和準(zhǔn)確性。

  2. 建立通信網(wǎng)絡(luò):使用XBea模塊建立傳感器節(jié)點(diǎn)之間的通信網(wǎng)絡(luò)。每個(gè)傳感器節(jié)點(diǎn)都與周圍的節(jié)點(diǎn)建立連接,形成一個(gè)無線傳感器網(wǎng)絡(luò)。通過這個(gè)網(wǎng)絡(luò),節(jié)點(diǎn)可以相互傳輸溫度數(shù)據(jù)和控制命令。

  3. 數(shù)據(jù)采集和傳輸:每個(gè)傳感器節(jié)點(diǎn)定期采集周圍環(huán)境的溫度數(shù)據(jù),并將數(shù)據(jù)通過XBea模塊傳輸給相鄰的節(jié)點(diǎn)。通過這種方式,溫度數(shù)據(jù)可以在整個(gè)網(wǎng)絡(luò)中傳輸和共享。

  4. 數(shù)據(jù)處理和分析:接收到溫度數(shù)據(jù)的節(jié)點(diǎn)將對(duì)數(shù)據(jù)進(jìn)行處理和分析。節(jié)點(diǎn)可以根據(jù)預(yù)先設(shè)定的閾值進(jìn)行溫度異常檢測(cè),并采取相應(yīng)的控制措施。同時(shí),節(jié)點(diǎn)還可以將處理后的數(shù)據(jù)傳輸給基站或上級(jí)節(jié)點(diǎn),以供進(jìn)一步的分析和決策。

  5. 能量管理:為了延長(zhǎng)網(wǎng)絡(luò)的壽命,需要對(duì)能量進(jìn)行有效的管理。節(jié)點(diǎn)可以根據(jù)能量消耗情況進(jìn)行自適應(yīng)的工作調(diào)度,以減少能量消耗并延長(zhǎng)節(jié)點(diǎn)的使用壽命。此外,還可以采用能量回收和能量傳輸?shù)燃夹g(shù),以提供節(jié)點(diǎn)的能量供應(yīng)。

結(jié)論:本文介紹了一種基于XBea的連續(xù)監(jiān)測(cè)無線溫度傳感器網(wǎng)絡(luò)的算法步驟。通過部署傳感器節(jié)點(diǎn)、建立通信網(wǎng)絡(luò)、數(shù)據(jù)采集和傳輸、數(shù)據(jù)處理和分析以及能量管理等步驟,可以實(shí)現(xiàn)對(duì)溫度的連續(xù)監(jiān)測(cè)和控制。這種算法步驟可以為溫度傳感器網(wǎng)絡(luò)的設(shè)計(jì)和應(yīng)用提供一種有效的解決方案,具有重要的實(shí)際意義和應(yīng)用前景。

?? 部分代碼

%% Introduction% In <part1_buildingthenetwork.html part one>, <part2_gatheringdata.html% part two>, and <part3_calibration.html part three> of this series of blog% post I went through the process of reading voltages from a network of% XBee(R) modules, building and testing my wireless network of temperature% sensors, calibrating the sensors, and gathering temperature data from the% network of sensors in my apartment. In this post I will show you some of% the basic analyses I performed on the data. In particular, I have two% goals:%% # determine how long it takes for my apartment to warm up after% the heat has been turned on, and% # find out what rooms in my apartment% take the longest to heat up, so I can make the necessary adjustments to% my radiators so that all the rooms warm up at the same rate.%% Overview of Data% As I mentioned in a previous post, I collected the temperature every two% minutes over the course of 9 days. I placed 14 sensors in my apartment: 9% located inside, 2 located outside, and 3 located in radiators. The data% is stored in the file <../twoweekstemplog.txt |twoweekstemplog.txt|>.[tempF,ts,location,lineSpecs] = XBeeReadLog('twoweekstemplog.txt',60);tempF = calibrateTemperatures(tempF);plotTemps(ts,tempF,location,lineSpecs)legend('off')xlabel('Date')title('All Data Overview')%%% _Figure 1: All temperature data from a 9 day period._%% That graph is a bit too cluttered to be very meaningful. Let me remove% the radiator data and the legend and see if that helps.notradiator = [1 2 3 5 6 7 8 9 10 12 13];plotTemps(ts,tempF(:,notradiator),location(notradiator),lineSpecs(notradiator,:))legend('off')xlabel('Date')title('All Inside and Outside Temperature Data')%%% _Figure 2: Just inside and outside temperature data, with radiator data removed._%% Now I can see some places where one of the outdoor temperature sensors% (blue line) gave erroneous data, so let's remove those data points. This% data was collected in March in Massachusetts, so I can safely assume the% outdoor temperature never reached 80 F. I replaced any values above 80 F% with |NaN| (not-a-number) so they are ignored in further analysis.outside = [3 10];outsideTemps = tempF(:,outside);toohot = outsideTemps>80;outsideTemps(toohot) = NaN;tempF(:,outside) = outsideTemps;plotTemps(ts,tempF(:,notradiator),location(notradiator),lineSpecs(notradiator,:))legend('off')xlabel('Date')title('Cleaned-up Inside and Outside Temperature Data')%%% _Figure 3: Inside and outside temperature data with erroneous data removed._%% I'll also remove all but one inside sensor per room, and give the% remaining sensors shorter names, to keep the graph from getting too% cluttered.show = [1 5 9 12 10 3];location(show) = ... ? ?{'Bedroom','Kitchen','Living Room','Office','Front Porch','Side Yard'}';plotTemps(ts,tempF(:,show),location(show),lineSpecs(show,:))ylim([0 90])legend('Location','SouthEast')xlabel('Date')title('Summary of Temperature Data')%%% _Figure 4: Summary of temperature data with only one inside temperature% sensor per room with outside temperatures._%% That looks much better. This data was collected over the course of 9% days, and the first thing that stands out to me is the periodic outdoor% temperature, which peaks every day at around noon. I also notice a sharp% spike in the side yard (green) temperature on most days. My front porch% (blue) is located on the north side of my apartment, and does not get% much sun. My side yard is on the east side of my apartment, and that% spike probably corresponds to when the sun hits the sensor from between% my apartment and the building next door.%% When do my radiators start to heat up?% The radiator temperature can be used to measure how long it takes for my% boiler and radiators to warm up after the heat has been turned on. Let's% take a look at 1 day of data from the living room radiator:% Grab the Living Room Radiator Temperature (index 11) from the |tempF| matrix.radiatorTemp = tempF(:,11);% Fill in any missing values:validts = ts(~isnan(radiatorTemp));validtemp = radiatorTemp(~isnan(radiatorTemp));nants = ts(isnan(radiatorTemp));radiatorTemp(isnan(radiatorTemp)) = interp1(validts,validtemp,nants);% Plot the dataoneday = [ts(1) ts(1)+1];figureplot(ts,radiatorTemp,'k.-')xlim(oneday)xlabel('Time')ylabel('Radiator Temperature (\circF)')title('Living Room Radiator Temperature')datetick('keeplimits')snapnow%%% _Figure 5: One day of temperature data from the living room radiator._%% As expected, I see a sharp rise in the radiator temperature, followed by% a short leveling off (when the radiator temperature maxes out the% temperature sensor), and finally a gradual cooling of the radiator. Let% me superimpose the rate of change in temperature onto the plot.tempChange = diff([NaN; radiatorTemp]);hold onplot(ts,tempChange,'b.-')legend({'Temperature', 'Temperature Change'},'Location','Best')%%% _Figure 6: One day of data from the living room radiator with temperature change._%% It looks like I can detect those peaks by looking for large jumps in the% temperature. After some trial and error, I settled on three criteria to% identify when the heat comes on:%% # Change in temperature greater than four times the previous change in temperature.% # Change in temperature of more than 1 degree F.% # Keep the first in a sequence of matching points (remove doubles)fourtimes = [tempChange(2:end)>abs(4*tempChange(1:end-1)); false];greaterthanone = [tempChange(2:end)>1; false];heaton = fourtimes & greaterthanone;doubles = [false; heaton(2:end) & heaton(1:end-1)];heaton(doubles) = false;%%% Let's see how well I detected those peaks by superimposing red dots over% the times I detected.figureplot(ts,radiatorTemp,'k.-')hold onplot(ts(heaton),radiatorTemp(heaton),'r.','MarkerSize',20)xlim(oneday);datetick('keeplimits')xlabel('Time')ylabel('Radiator Temperature (\circF)')title('Heat On Event Detection')legend({'Temperature', 'Heat On Event'},'Location','Best')%%% _Figure 7: Radiator temperature with heating events marked with red dots._%% Looks pretty good, which means now I have a list of all the times that% the heat came on in my apartment.heatontimes = ts(heaton);%% How long does it take for my heat to turn on?% I currently have a programmable 5/2 thermostat, which means I can set% one program for weekdays (Monday through Friday) and one program for both% Saturday and Sunday. I know my thermostat is set to go down to 62 at% night, and back up to 68 at 6:15am Monday through Friday and 10:00am on% Saturday and Sunday. I used that knowledge to determine how long after my% thermostat activates that my radiators warm up.%% I started by creating a vector of all the days in the test period. I% removed Monday because I manually turned on the thermostat early that day.mornings = floor(min(ts)):floor(max(ts));mornings(2) = []; % Remove Monday%%% Then I added either 6:15am or 10:00am to each day depending on whether it% was a weekday or a weekend.isweekend = weekday(mornings) == 1 | weekday(mornings) == 7;mornings(isweekend) = mornings(isweekend)+10/24; % 10:00 AMmornings(~isweekend) = mornings(~isweekend)+6.25/24; % 6:15 AM%%% Next I looked for the first time the heat came on after the programmed% time each morning.heatontimes_mat = repmat(heatontimes,1,length(mornings));mornings_mat = repmat(mornings,length(heatontimes),1);timelag = heatontimes_mat - mornings_mat;timelag(timelag<=0) = NaN;[delay, heatind] = min(timelag);delay = round(delay*24*60);%%% Let's take a look at those times to make sure we found the right ones.% In this plot, I'll circle in blue the first time the heat comes on each% morning, and plot blue vertical lines indicating when the thermostat% turns on each morning.heatontemp = radiatorTemp(heaton);onemorning = mornings(3)+[-1/24 5/24];figureplot(ts,radiatorTemp,'k.-')hold onplot(heatontimes,heatontemp,'r.','MarkerSize',20)plot(heatontimes(heatind),heatontemp(heatind),'bo','MarkerSize',10)plot([mornings;mornings],repmat(ylim',1,length(mornings)),'b-');xlim(onemorning);datetick('keeplimits')xlabel('Time')ylabel('Radiator Temperature (\circF)')title('Detection of Scheduled Heat On Events')legend({'Temperature', 'Heat On Event', 'Scheduled Heat On Event',... ? ?'Scheduled Event'},'Location','Best')%%% _Figure 8: Six hours of radiator data, with a blue line indicating when% the thermostat turned on in the morning, and blue circle indicating the% corresponding heat on event of the radiator._%% Let's look at a histogram of those delays:figurehist(delay,min(delay):max(delay))xlabel('Minutes')ylabel('Frequency')title('How long before the radiator starts to warm up?')%%% _Figure 9: Histogram showing delay between thermostat activation and the% radiators starting to warm up._%% It looks like the delay between the thermostat coming on in the morning% and the radiators starting to warming up can range from 7 minutes to as% high as 24 minutes, but on average this delay is around 12-13 minutes.heatondelay = 12;%% How long does it take for the radiators to warm up?% Once the radiators start to warm up, it takes a few minutes for them to% reach full temperature. Let's look at how long this takes. I'll look for% times when the radiator temperature first maxes out the temperature% sensor after having been below the maximum for at least 10 minutes (5% samples).maxtemp = max(radiatorTemp);radiatorhot = radiatorTemp(6:end)==maxtemp & ... ? ?radiatorTemp(1:end-5)<maxtemp &... ? ?radiatorTemp(2:end-4)<maxtemp &... ? ?radiatorTemp(3:end-3)<maxtemp &... ? ?radiatorTemp(4:end-2)<maxtemp &... ? ?radiatorTemp(5:end-1)<maxtemp;radiatorhot = [false(5,1); radiatorhot];radiatorhottimes = ts(radiatorhot);%%% Let's see how well that worked:figureplot(ts,radiatorTemp,'k.-')hold onplot(ts(heaton),radiatorTemp(heaton),'r.','MarkerSize',20)plot(ts(radiatorhot),radiatorTemp(radiatorhot),'b.','MarkerSize',20)xlim(onemorning);datetick('keeplimits')xlabel('Time')ylabel('Radiator Temperature (\circF)')title('Radiator Hot Event Detection')legend({'Temperature', 'Heat On Event', 'Radiator Hot Event'},... ? ?'Location','Best')%%% _Figure 10: Six hours of radiator data, with red dots indicating the heat% coming on and blue dots indicating the radiator is hot._%% Now I'll match the |radiatorhottimes| to the |heatontimes| using the same% technique I used above.radiatorhottimes_mat = repmat(radiatorhottimes',length(heatontimes),1);heatontimes_mat = repmat(heatontimes,1,length(radiatorhottimes));timelag = radiatorhottimes_mat - heatontimes_mat;timelag(timelag<=0) = NaN;[delay, foundmatch] = min(timelag);delay = round(delay*24*60);%%% Let's look at a histogram of those delays:figurehist(delay,min(delay):2:max(delay))xlabel('Minutes');ylabel('Frequency')title('How long does the radiator take to warm up?')%%% _Figure 11: Histogram showing time required for the radiators to warm up._%% It looks like the radiators take between 4 and 8 minutes from when they% start to warm up until they are at full temperature.radiatorheatdelay = 6;%%% Later on in my analysis, I will only want to use times that the heat came% on and the radiators reached full temperature, so I will only keep those% values in the |heaton| vector.heatonind = find(heaton);heatonind = heatonind(foundmatch);heaton = false(size(heaton));heaton(heatonind) = true;%% When do the radiators cool off?% I'll use the same technique as above to detect when the radiators start% to cool off, which must mean the heat has gone off.heatoff = radiatorTemp(1:end-5)==maxtemp & ... ? ?radiatorTemp(2:end-4)<maxtemp &... ? ?radiatorTemp(3:end-3)<maxtemp &... ? ?radiatorTemp(4:end-2)<maxtemp &... ? ?radiatorTemp(5:end-1)<maxtemp &... ? ?radiatorTemp(6:end)<maxtemp;heatoff = [heatoff; false(5,1)];heatofftimes = ts(heatoff);heatoffind = find(heatoff);%%% Let's take a look at the heat on, radiator hot, and heat off times all% together in one graph.figureplot(ts,radiatorTemp,'k.-')hold onplot(ts(heaton),radiatorTemp(heaton),'r.','MarkerSize',20)plot(ts(radiatorhot),radiatorTemp(radiatorhot),'b.','MarkerSize',20)plot(ts(heatoff),radiatorTemp(heatoff),'g.','MarkerSize',20)xlim(onemorning);datetick('keeplimits')xlabel('Time')ylabel('Radiator Temperature (\circF)')title('Radiator Cooling Event Detection')legend({'Temperature', 'Heat On Event', 'Radiator Hot Event',... ? ?'Radiator Cooling Event'},'Location','Best')%%% _Figure 12: Six hours of radiator data, with red dots indicating the heat% coming on, blue dots indicating the radiator is hot, and green dots% indicating the radiator starting to cool._%%% How long does it take my living room to warm up?% Now that I know it takes about 12-13 minutes from the time my thermostat% activates in the morning until the radiators start to warm up, and% another 4-8 minutes for the radiators themselves to warm up, let's look% at how long it actually takes my apartment to warm up after the radiators% heat up. I'll focus on the living room inside temperature for now.%%% Grab the Living Room Inside Temperature (index 9) from the |tempF| matrix.livingroomtemp = tempF(:,9);%%% Let's look at one day's worth of living room inside temperatures to see% how they compare the the living room radiator temperatures.figure[ax,p1,p2] = plotyy(ts,radiatorTemp,ts,livingroomtemp);set(ax,'XLim',oneday)set(ax(1),'YColor','k','YLim',[60 180],'YTick',60:20:180)set(ax(2),'YColor','b','YLim',[60 ?72],'YTick',60:2:72,'XTick',[])set(p1,'Color','k')set(p2,'Color','b')datetick(ax(1),'keeplimits')xlabel(ax(1),'Time')ylabel(ax(1),'Radiator Temperature (\circF)')ylabel(ax(2),'Room Temperature (\circF)')title('Living Room and Radiator Temperatures')legend([p1,p2],{'Radiator Temperature','Room Temperature'},'Location','SouthEast')%%% _Figure 13: Living room and radiator temperatures plotted overlapping but% with different y-axes scaling._%% As you would expect, once the radiator temperatures rise, so do the room% temperatures, but I would like to find out how quickly the room% temperatures rise. To do that, I will first break up the temperature data% into segments delimited by the times the heat came on. I'll keep only the% rising portion of each segment (up to the first occurrence of the maximum% temperature in the segment, or until the heat is off). I'll also keep% track of the minimum and maximum temperature in the segment, and at what% time those temperatures occur. I am initializing a matrix to store the% segments (|segmentTemps|) so that segments that are shorter than the% maximum length are padded with |NaN| values instead of zeros.numSegments = sum(heaton);segmentSizes = heatoffind-heatonind+1;segmentTemps = NaN(numSegments, max(segmentSizes));for c = 1:numSegments ? ?segmentTemps(c,1:segmentSizes(c)) = livingroomtemp(heatonind(c):heatoffind(c)); ? ?[segmentMaxTemp(c,1),segmentTimeToMax(c,1)] = max(segmentTemps(c,:)); ? ?[segmentMinTemp(c,1),segmentTimeToMin(c,1)] = min(segmentTemps(c,1:segmentTimeToMax(c))); ? ?segmentTemps(c,segmentTimeToMax(c)+1:end) = NaN;end% Clip off columns that are all NaN at the end of the matrix.maxSegmentSize = max(segmentTimeToMax);segmentTemps = segmentTemps(:,1:maxSegmentSize);% Shift from 1-based indexes to 0-based minutes.segmentTimeToMin = (segmentTimeToMin - 1)*2;segmentTimeToMax = (segmentTimeToMax - 1)*2;segmentTimes = (0:(maxSegmentSize-1))*2; % Time since heat came on in minutes%%% Let's take a look at one of these segments:figureplot(segmentTimes, segmentTemps(1,:),'b.-')hold onplot(segmentTimeToMin(1),segmentMinTemp(1),'r.','MarkerSize',20)legend({'Temperature','Minimum Temperature'},'Location','NorthWest')xlabel('Minutes since radiator started to warm')ylabel('Temperature (\circF)')title('Room Temperature During One Heating Event')%%% _Figure 14: Room temperature during one heating event, time zero is when% the radiator started to warm up._%% In the plot you can see that the temperature continues to decrease for a% few minutes, then seems to rise almost linearly. Based on this% information, let's shift the plot so that the base of the linear increase% in temperature is at the origin.figureplot(segmentTimes-segmentTimeToMin(1), segmentTemps(1,:)-segmentMinTemp(1),'b.-')legend({'Temperature Increase'},'Location','NorthWest')xlabel('Minutes since minimum temperature')ylabel('Temperature Increase (\circF)')title('Shifted Room Temperature During One Heating Event')%%% _Figure 15: Change in room temperature during one heating event, time% zero is when the room temperature reached its minimum value._%% That was just one segment, let's look at all of them, with the data% shifted so that the lowest temperature in each segment occurs at the% origin.%%% First I shift all the times based on the |segmentTimeToMin|segmentTimes_mat = repmat(segmentTimes,length(segmentTimeToMin),1);segmentTimeToMin_mat = repmat(segmentTimeToMin,1,length(segmentTimes));segmentTimesShifted = segmentTimes_mat - segmentTimeToMin_mat;%%% Then shift all the temperatures based on the |segmentMinTemp|segmentMinTemp_mat = repmat(segmentMinTemp,1,size(segmentTemps,2));segmentTempsShifted = segmentTemps - segmentMinTemp_mat;%%% And find the total temperature change and time for each segment.segmentRiseTime = segmentTimeToMax-segmentTimeToMin;segmentTempRise = segmentMaxTemp-segmentMinTemp;%%% Now I can plot the shifted datafigureh1 = plot(segmentTimesShifted',segmentTempsShifted','b-');legend(h1(1),{'Temperature Increase'},'Location','NorthWest')xlim([-10 max(segmentTimesShifted(:))])xlabel('Minutes since minimum temperature')ylabel('Temperature Increase (\circF)')title('Shifted Room Temperature During All Heating Events')%%% _Figure 16: Change in room temperature during all heating events, time% zero is when the room temperature reached its minimum value._%% Although it isn't perfect, it looks close to a linear relationship. Since% I am interested in the time it takes to reach the desired temperature% (what could be considered the "specific heat capacity" of the room), let% me replot the data with time on the y-axis and temperature on the x-axis% (swapping the axes from the previous figure). I'll also plot the data as% individual points instead of lines, because that is how the data is going% to be fed into |polyfit| later.% Remove temperatures occuring before the minimum temperature.segmentTempsShifted(segmentTimesShifted<0) = NaN;figureh1 = plot(segmentTempsShifted',segmentTimesShifted','k.');xlabel('Temperature Increase (\circF)')ylabel('Minutes since minimum temperature')title('Time to Heat Living Room')snapnow%%% _Figure 17: The time it takes to heat the living room (axes flipped from% Figure 16)._%% Now let me fit a line to the data so I can get an equation for the time% it takes to heat the living room.%%% First I collect all the time and temperature data into a single column% vector and remove |NaN| values.allTimes = segmentTimesShifted(:);allTemps = segmentTempsShifted(:);allTimes(isnan(allTemps)) = [];allTemps(isnan(allTemps)) = [];%%% Then I can fit a line to the data.linfit = polyfit(allTemps,allTimes,1);%%% Let's see how well we fit the data.hold onh2 = plot(xlim,polyval(linfit,xlim),'r-');linfitstr = sprintf('Linear Fit (y = %.1f*x + %.1f)',linfit(1),linfit(2));legend([ h1(1), h2(1) ],{'Data',linfitstr},'Location','NorthWest')%%% _Figure 18: The time it takes to heat the living room along with a linear fit to the data._%% Not a bad fit. Looking closer at the coefficients from the linear fit, it% looks like it takes about 3 minutes after the radiators start to heat up% for the room to start to warm up. After that, it takes about 5 minutes% for each degree of temperature increase.%% What room takes the longest to warm up?% I can apply the techniques above to each room to find out how long each% room takes to warm up. I took the code above and put it into a separate% function called <../temperatureAnalysis.m |temperatureAnalysis|>, and% applied that to each inside temperature sensor.inside = [1 5 9 12];figurexl = [0 14];for s = 1:size(inside,2) ? ?linfits(s,1:2) = temperatureAnalysis(tempF(:,inside(s)), heaton, heatoff); ? ?y = polyval(linfits(s,1:2),xl) + heatondelay; ? ?plot(xl, y, lineSpecs{inside(s),1}, 'Color',lineSpecs{inside(s),2},... ? ? ? ?'DisplayName',location{inside(s)}) ? ?hold onendlegend('Location','NorthWest')xlabel('Desired temperature increase (\circF)')ylabel('Estimated minutes to heat')title('Estimated Time to Heat Each Room')%%% _Figure 19: The estimated time it takes to heat each room in my apartment._%%%% In <part1_buildingthenetwork.html part one> of this series of blog posts,% I mentioned that "I often find that even though the thermostat shows a% nice and toasty 73, I'm sitting in my bedroom or the office freezing."% Given that my thermostat is located in the living room, the data backs up% my anecdotal observation: the office and bedroom take almost twice as% long to warm up as the living room, while the kitchen warms up a little% faster than the living room.%% Conclusions% I started this series of blog posts with the intention of using a% wireless network of temperature sensors (built using XBee(R) modules) to% get a better understanding of how long my heating system takes to warm up% my apartment, and to use that knowledge to help tune my heating system to% provide more uniform heating.%% The analysis above is just the start of the analysis that can be done on% this data, but it is enough to help me to tune my heating system. I'll% start by opening the valves on the bedroom and office radiators more, and% maybe even close the valves on the living room and kitchen radiators a% little. Then I'll collect data for another week and see whether that% helps.%% I now also know that my heating system takes around 15-20 minutes from% when the heat comes on until the temperature starts to rise, and at best% it takes about 3-5 minutes for each degree of temperature increase. My% thermostat is set to allow the temperature to drop to 62 degrees at% night, and warm up to 68 in the morning. Looking up 6 degrees on that% last plot, I should adjust my thermostat to come on at least 30-40% minutes before I get up in the morning so it has enough time to warm up.% No wonder my heating bill is so high.

?? 運(yùn)行結(jié)果

?? 參考文獻(xiàn)

[1] 肖三強(qiáng),羅文廣.基于無線傳感器網(wǎng)絡(luò)的智能溫度測(cè)量系統(tǒng)的設(shè)計(jì)[J].裝備制造技術(shù), 2014(7):3.DOI:10.3969/j.issn.1672-545X.2014.07.039.

[2] 王翥,郝曉強(qiáng),魏德寶.基于WSN和GPRS網(wǎng)絡(luò)的遠(yuǎn)程水質(zhì)監(jiān)測(cè)系統(tǒng)[J].儀表技術(shù)與傳感器, 2010(1).DOI:10.3969/j.issn.1002-1841.2010.01.017.

[3] 張文洋.基于WSN的鐵軌監(jiān)測(cè)設(shè)計(jì)與仿真[D].大連理工大學(xué),2011.DOI:CNKI:CDMD:2.1012.276150.

?? 部分理論引用網(wǎng)絡(luò)文獻(xiàn),若有侵權(quán)聯(lián)系博主刪除

?? ?關(guān)注我領(lǐng)取海量matlab電子書和數(shù)學(xué)建模資料

?? ?私信完整代碼、論文復(fù)現(xiàn)、期刊合作、論文輔導(dǎo)及科研仿真定制事宜

1 各類智能優(yōu)化算法改進(jìn)及應(yīng)用

生產(chǎn)調(diào)度、經(jīng)濟(jì)調(diào)度、裝配線調(diào)度、充電優(yōu)化、車間調(diào)度、發(fā)車優(yōu)化、水庫調(diào)度、三維裝箱、物流選址、貨位優(yōu)化、公交排班優(yōu)化、充電樁布局優(yōu)化、車間布局優(yōu)化、集裝箱船配載優(yōu)化、水泵組合優(yōu)化、解醫(yī)療資源分配優(yōu)化、設(shè)施布局優(yōu)化、可視域基站和無人機(jī)選址優(yōu)化

2 機(jī)器學(xué)習(xí)和深度學(xué)習(xí)方面

卷積神經(jīng)網(wǎng)絡(luò)(CNN)、LSTM、支持向量機(jī)(SVM)、最小二乘支持向量機(jī)(LSSVM)、極限學(xué)習(xí)機(jī)(ELM)、核極限學(xué)習(xí)機(jī)(KELM)、BP、RBF、寬度學(xué)習(xí)、DBN、RF、RBF、DELM、XGBOOST、TCN實(shí)現(xiàn)風(fēng)電預(yù)測(cè)、光伏預(yù)測(cè)、電池壽命預(yù)測(cè)、輻射源識(shí)別、交通流預(yù)測(cè)、負(fù)荷預(yù)測(cè)、股價(jià)預(yù)測(cè)、PM2.5濃度預(yù)測(cè)、電池健康狀態(tài)預(yù)測(cè)、水體光學(xué)參數(shù)反演、NLOS信號(hào)識(shí)別、地鐵停車精準(zhǔn)預(yù)測(cè)、變壓器故障診斷

2.圖像處理方面

圖像識(shí)別、圖像分割、圖像檢測(cè)、圖像隱藏、圖像配準(zhǔn)、圖像拼接、圖像融合、圖像增強(qiáng)、圖像壓縮感知

3 路徑規(guī)劃方面

旅行商問題(TSP)、車輛路徑問題(VRP、MVRP、CVRP、VRPTW等)、無人機(jī)三維路徑規(guī)劃、無人機(jī)協(xié)同、無人機(jī)編隊(duì)、機(jī)器人路徑規(guī)劃、柵格地圖路徑規(guī)劃、多式聯(lián)運(yùn)運(yùn)輸問題、車輛協(xié)同無人機(jī)路徑規(guī)劃、天線線性陣列分布優(yōu)化、車間布局優(yōu)化

4 無人機(jī)應(yīng)用方面

無人機(jī)路徑規(guī)劃、無人機(jī)控制、無人機(jī)編隊(duì)、無人機(jī)協(xié)同、無人機(jī)任務(wù)分配、無人機(jī)安全通信軌跡在線優(yōu)化

5 無線傳感器定位及布局方面

傳感器部署優(yōu)化、通信協(xié)議優(yōu)化、路由優(yōu)化、目標(biāo)定位優(yōu)化、Dv-Hop定位優(yōu)化、Leach協(xié)議優(yōu)化、WSN覆蓋優(yōu)化、組播優(yōu)化、RSSI定位優(yōu)化

6 信號(hào)處理方面

信號(hào)識(shí)別、信號(hào)加密、信號(hào)去噪、信號(hào)增強(qiáng)、雷達(dá)信號(hào)處理、信號(hào)水印嵌入提取、肌電信號(hào)、腦電信號(hào)、信號(hào)配時(shí)優(yōu)化

7 電力系統(tǒng)方面

微電網(wǎng)優(yōu)化、無功優(yōu)化、配電網(wǎng)重構(gòu)、儲(chǔ)能配置

8 元胞自動(dòng)機(jī)方面

交通流 人群疏散 病毒擴(kuò)散 晶體生長(zhǎng)

9 雷達(dá)方面

卡爾曼濾波跟蹤、航跡關(guān)聯(lián)、航跡融合




【W(wǎng)SN】基于XBea連續(xù)監(jiān)測(cè)無線溫度傳感器網(wǎng)絡(luò)附matlab代碼的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
上蔡县| 揭西县| 靖江市| 池州市| 布尔津县| 旌德县| 特克斯县| 黎川县| 临潭县| 苏州市| 丹棱县| 区。| 孝感市| 汉寿县| 平遥县| 栾城县| 新密市| 玉林市| 怀化市| 弥渡县| 平果县| 武夷山市| 阜新| 湖南省| 神农架林区| 南和县| 呼伦贝尔市| 蒙城县| 平潭县| 贡觉县| 迁安市| 确山县| 竹溪县| 康定县| 分宜县| 江陵县| 徐州市| 紫云| 安乡县| 兴安盟| 贵定县|