CN110505596A - A kind of sensing data adaptively acquires real-time report method - Google Patents
A kind of sensing data adaptively acquires real-time report method Download PDFInfo
- Publication number
- CN110505596A CN110505596A CN201910659815.3A CN201910659815A CN110505596A CN 110505596 A CN110505596 A CN 110505596A CN 201910659815 A CN201910659815 A CN 201910659815A CN 110505596 A CN110505596 A CN 110505596A
- Authority
- CN
- China
- Prior art keywords
- sensor
- time
- value
- sampling
- collection
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/66—Arrangements for connecting between networks having differing types of switching systems, e.g. gateways
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/12—Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W4/00—Services specially adapted for wireless communication networks; Facilities therefor
- H04W4/30—Services specially adapted for particular environments, situations or purposes
- H04W4/38—Services specially adapted for particular environments, situations or purposes for collecting sensor information
Abstract
The invention discloses a kind of sensing datas adaptively to acquire real-time report method, comprising: sampling thread initialization judges whether the quantity of the sensor accessed in Internet of things system is less than or equal to preset quantity threshold value;If so, whether the quantity for judging sensor is 0;If not 0, according to the quantity of sensor, initialization sampling sleeping time, sampling sleeping time is per interval time between the value for acquiring sensor twice;Sampling thread obtains collection value to sample sleeping time as the value of time interval searching loop sensor;Periodic report thread pre-processes collection value twice or more when default report cycle arrives, and calculates acquisition average value, to reporting to server after acquisition average value coding.Compared with prior art, the present invention can be used for realizing the data acquisition in different Internet of Things application scenarios, have the characteristics that adaptivity, real-time and stability are high.
Description
Technical field
The present invention relates to internet of things field more particularly to a kind of sensing data adaptively to acquire real-time report method.
Background technique
In the data acquisition of Internet of things system, if gateway is in a report cycle to sensor times of collection one
It is fixed, when times of collection is less, such as acquires one time in a report cycle to sensor, with the increasing of number of probes
It is more, in fact it could happen that the phenomenon that the sensor having in a report cycle is not collected, then the data that server receives cannot
The state of all the sensors accessed in current Internet of things system is enough accurately reflected, therefore guarantees that gateway has been accessed to all
The integrality of sensor device acquisition data is necessary.Further, if gateway in a report cycle only to sensor
Acquisition is primary, since there are accidental errors for sensor, it is not high enough to will cause the data accuracy that server receives, it is therefore desirable to right
Each sensor carries out multi collect to achieve the effect that deburring.Further, if gateway in a report cycle to biography
Sensor times of collection is too many, and the operation that will lead to sensor is excessively frequent, so that sensor is more easy to damage, shortens sensor
Service life, while also reducing the working efficiency of things-internet gateway.
In addition, during the data of Internet of things system report, if things-internet gateway reported data occurs being delayed and report
The factors such as the period is unstable, the data that will lead to server end storage are irregular, influence the data processing and data analysis in later period.
Therefore, under the premise of ensuring to access the integrality and accuracy of sensor device acquisition data, the real-time of reported data is realized
Property is critically important for Internet of things system.
Summary of the invention
The present invention provides a kind of sensing datas adaptively to acquire real-time report method, to solve existing Internet of Things net
Will appear delay and the factors such as report cycle is unstable when closing reported data, the data for causing server end to store are irregular,
Such as the collection value missing of period unstable, certain sensor, situations such as data burr is serious, influence the later period data processing and
Data analysis, leads to this lower problem of the working efficiency of things-internet gateway.
The embodiment of the present invention provides a kind of sensing data and adaptively acquires real-time report method, which comprises
Step 1, sampling thread initialization, judges whether the quantity of the sensor accessed in Internet of things system is less than or equal to
It can access the preset quantity threshold value of the sensor of the Internet of things system;
Step 2, if the quantity of the sensor is less than or equal to preset quantity threshold value, judge that the quantity of the sensor is
No is 0;
Step 3, if the quantity of the sensor is not 0, according to the quantity of the sensor, when initialization sampling is slept
Between, the sampling sleeping time is per interval time between the value for acquiring sensor twice;
Step 4, sampling thread loops traverse the value of the sensor, obtain collection value;
Step 5, periodic report thread is when default report cycle arrives, the acquisition twice or more to each sensor
Value is pre-processed, and the acquisition average value of each sensor is calculated, and is encoded to the acquisition average value, is reported to service
Device.
Further, the step 1 includes:
It can access the preset quantity threshold value of the sensor of the Internet of things system are as follows:
Wherein, Nmax is the preset quantity threshold value that can access the sensor of the Internet of things system, and Tperiod is on default
The period is reported, Cmin is the minimum times of collection in a default report cycle to each sensor, the minimum times of collection
It is the minimum time spent needed for acquiring the value of primary transducer that Cmin, which is greater than or equal to 2, Ttransaction,;
In a default report cycle, minimum times of collection is at least up to the times of collection of the value of each sensor
Cmin, it may be assumed that
Wherein, N is the quantity for accessing the sensor of Internet of things system.
Further, the sampling sleeping time in the step 4 is defined as:
Wherein, Tsleep is sampling sleeping time, and Cmax is the maximum in a default report cycle to each sensor
Times of collection.
Further, when the sampling sleeping time Tsleep is 0, the sampling thread dispatching sched_yield ()
Actively abandon CPU.
Further, the step 4, comprising: sampling thread loops acquire the value of each sensor, by each sensing
The value of device is temporarily stored in data buffer zone.
Further, to the collection value twice or more of the sensor in a default report cycle in the step 5
It is pre-processed, the pretreatment includes deburring.
Further, the step 1 includes:
If the quantity of the sensor accessed in the Internet of things system is greater than the pre- of the sensor that can access Internet of things system
If amount threshold, the sampling thread is alerted and is exited.
Further, the step 2 includes:
If the quantity of the sensor accessed in the Internet of things system is 0, the sampling thread is exited.
From the above technical scheme, the embodiment of the present invention provides a kind of sensing data and adaptively acquires real-time report side
Method.It include: step 1, sampling thread initialization judges whether the quantity of the sensor accessed in Internet of things system is less than or equal to
It can access the preset quantity threshold value of the sensor of the Internet of things system;Step 2, if the quantity of the sensor is less than or equal to
Preset quantity threshold value judges whether the quantity of the sensor is 0;Step 3, if the quantity of the sensor is not 0, according to institute
The quantity of sensor, initialization sampling sleeping time are stated, the sampling sleeping time is per between the value for acquiring sensor twice
Interval time;Step 4, the sampling thread is obtained using sampling sleeping time as the value of time interval circle collection sensor
Collection value;Step 5, periodic report thread is when default report cycle arrives, the acquisition twice or more to each sensor
Value is pre-processed, and the acquisition average value of each sensor is calculated, and is encoded to the acquisition average value, is reported to service
Device.
It will appear delay when existing things-internet gateway reported data and the factors such as report cycle is unstable, cause to service
The data of device end storage are irregular, for example the collection value missing and data burr of period unstable, certain sensor are serious etc.,
The data processing and data analysis for influencing the later period, lead to this lower problem of the working efficiency of things-internet gateway.
And use preceding method, can reach it is following the utility model has the advantages that
(1) present invention is independent by sampling task and periodic report task, and sampling task is acquired according to certain period
Data;Periodic report is reported according to the fixed cycle, it is ensured that the stability in period and the real-time reported, not by sampling task
The uncertain time effects such as delay.
(2) the invention can ensure that all reporting the value of the sensor of all accesses in a report cycle.By wanting
It asks the quantity of access sensor in theoretical range, and ensures at least to acquire the value two of all the sensors in a report cycle
It is secondary, it ensure that the integrality of reported data in a report cycle.
(3) sleeping time between present invention setting double sampling dynamically becomes with the quantity variation of access sensor
Change, the sensor device all accessed can be acquired by not only having met in a report cycle, but also can allow gateway to the greatest extent can
Access sensor more than energy, while also avoiding causing the lossy to sensor due to frequent operation sensor.
(4) collection value for the sensor that sampling obtains is temporarily stored in data buffer zone by the present invention, provides next visit
It asks use, so that subsequent report thread quicker to the use of sensing data, improves the real-time reported.
(5) present invention carries out deburring processing to sampled data before reported data, while guaranteeing that report cycle is stablized,
There is obvious benefit to the big data analysis in later period.
Therefore, a kind of sensing data proposed by the present invention adaptively acquires real-time report method, can not only guarantee object
Networking gateway realizes the effect to sampled data deburring to the integralities of all sensor samples accessed, and can be with
It avoids excessively frequent to sensor operations, has the function that the service life for protecting sensor, while can be realized the reality of data
When report, further, promote the working efficiency of things-internet gateway.
Detailed description of the invention
In order to illustrate more clearly of technical solution of the present invention, letter will be made to attached drawing needed in the embodiment below
Singly introduce, it should be apparent that, for those of ordinary skills, without any creative labor,
It is also possible to obtain other drawings based on these drawings.
Fig. 1 is the system that a kind of sensing data that part of the embodiment of the present invention provides adaptively acquires real-time report method
Structural schematic diagram;
Fig. 2 is that a kind of sensing data that part of the embodiment of the present invention provides adaptively is acquired and sampled in real-time report method
The workflow schematic diagram of thread;
Fig. 3 is that a kind of sensing data that part of the embodiment of the present invention provides adaptively is acquired and reported in real-time report method
The workflow schematic diagram of thread;
Fig. 4 is that a kind of sensing data that part of the embodiment of the present invention provides adaptively is acquired and sampled in real-time report method
The workflow schematic diagram of algorithm.
Specific embodiment
In order to make the foregoing objectives, features and advantages of the present invention clearer and more comprehensible, with reference to the accompanying drawing and specific real
Applying mode, the present invention is described in further detail.
The embodiment of the present invention discloses a kind of sensing data and adaptively acquires real-time report method, and this method is applied to Internet of Things
In net gateway system, as the data transmission method of a kind of sensing network and conventional communication networks, play a part of data transmission,
Wherein sensing network refers to that various the sensor devices such as temperature sensor, pH value of the operative scenarios such as industrial and agricultural production sense
Device, air velocity transducer etc.;And conventional communication networks refer to some application servers in internet.As shown in Figure 1, being this
A kind of sensing data that inventive embodiments part provides adaptively acquires the system structure diagram of real-time report method.
In the present embodiment, it is complete by two threads that things-internet gateway realization adaptively acquires real-time report to sensing data
At being that sampling and reports thread at thread respectively, wherein sampling thread is mainly responsible for the data of circle collection sensor, report thread
Being mainly responsible for timing reports the average value of sensing data to server.
The described method comprises the following steps: step 1, sampling thread initialization judges the sensing accessed in Internet of things system
Whether the quantity of device is less than or equal to the preset quantity threshold value that can access the sensor of the Internet of things system, if so, executing
Step 2, it alerts and exits if it is not, then sampling thread;
Step 2, if the quantity of the sensor is less than or equal to preset quantity threshold value, judge that the quantity of the sensor is
No is 0;
Step 3, if the quantity of the sensor is not 0, according to the quantity of the sensor, when initialization sampling is slept
Between, the sampling sleeping time is per interval time between the value for acquiring sensor twice;
Specifically, in this step, if the quantity of sensorThen enable IfThen enable Tsleep=0.
Wherein, N is the quantity for accessing the sensor of Internet of things system, and Nmax is the sensor that can access Internet of things system
Preset quantity threshold value, Tperiod are default report cycle, and Cmin is the minimum in a default report cycle to each sensor
Times of collection, it is in a default report cycle to each sensor that the minimum times of collection Cmin, which is greater than or equal to 2, Cmax,
Maximum times of collection, Ttransaction be acquire primary transducer value needed for spend shortest time, Tsleep be adopt
Sample sleeping time.
Step 4, the sampling thread is acquired using sampling sleeping time as the value of time interval circle collection sensor
Value.
In this step, if the sampling sleeping time is equal to 0, the value of next sensor is and then acquired;If described adopt
Sample sleeping time is not equal to 0, after the time of the sensor sleep reaches sampling sleeping time, acquires next sensor
Value.Specifically, including multiple sensors in system, the value of a sensor is acquired every time, then acquires next sensor
Value after complete one time to be collected, then carries out second time acquisition.
In the present embodiment, in order to carry out debounce to sampled data, thread is sampled in a default report cycle to sensing
Device carries out multiple repairing weld, and such as Fig. 2 is that a kind of sensing data that part of the embodiment of the present invention provides adaptively acquires real-time report
The workflow schematic diagram that thread is sampled in method, is implemented as follows:
Judge whether the number of probes accessed in system is greater than the preset quantity of the sensor of accessible Internet of things system
Threshold value Nmax;
If the number of sensors accessed in system is greater than preset quantity threshold value Nmax, alarm, sampling thread exits extremely;
If the sensor accessed in system is less than or equal to preset quantity threshold value Nmax, the number of sensor in judgement system
Whether amount is 0;
If the quantity of sensor is 0 in system, fair termination samples thread;
If the quantity of sensor is not 0 in system, initialized according to the quantity N of sensor between sampling twice in succession
Sampling sleeping time Tsleep, it is specific as follows:
Things-internet gateway real-time report of the present invention meets following formula, respective figure 4:
Tperiod=C*N* (Ttransaction+Tsleep) (1.1)
Wherein, Tperiod indicates a default report cycle, as shown in figure 4, a sampling period T1, C expression one is pre-
If the times of collection in report cycle, N indicates the quantity of the sensor of access Internet of things system, when Tsleep indicates sampling sleep
Between.Wherein Ttransaction indicates the minimum time spent needed for the value of acquisition primary transducer, for 485 buses,
Including Tdata and Tmute, as described in following formula:
Ttransaction=Tdata+Tmute
Wherein, Tdata refers to that data the time it takes of acquisition primary transducer, specific logic of segmenting include:
write(…);Select (..., T-timeout);read(…);Tdata is not unfolded in the practical derivation of equation.
Tmute refers to the silence period, and Modbus bus is sharing mode, needs to protect in bus between twi-read operation
One section of silence period Tmute is held to avoid interference, which carries out after and then bus operation.
In the present embodiment, the silence period Tmute is to be grasped according to an empirical fixed value by the suspend mode
Make, can guarantee the normal work of Modbus bus.
For formula (1.1), presetting report cycle Tperiod in actual operation is to be determined by demand, and acquire one
The shortest time Ttransaction spent needed for the value of secondary sensor is determined by hardware performance, wherein variable parameter is just
It is times of collection C in a default report cycle, the quantity N of sensor and sampling sleeping time Tsleep.
When the quantity N of sensor is smaller, guarantee the maximum times of collection in a default report cycle to each sensor
The processing of Cmax.
Why times of collection C in report cycle default for one does not take in acquisition primary transducer data
Report primary way, but take once report before carry out multi collect data way, main purpose be for deburring,
Carrying out multiple repairing weld to sensor before once reporting also is exactly one of demand.But the number of multiple repairing weld is also limited
, the maximum times of collection Cmax in a default report cycle to each sensor is denoted as in the present invention, in conditions permit
In the case of, wish to sample Cmax times in a default report cycle in the present invention.In the case where guaranteeing C=Cmax, sampling
The time of sleeping time Tsleep reduces, such as following formula as the quantity N of equipment increases:
When sampling sleeping time Tsleep is reduced to the limit i.e. 0, the quantity of the sensor of Internet of things system is accessed
N has one to meet in a default report cycle to the limiting value of the maximum times of collection Cmax of each sensor, is denoted as Nmid
=Tperiod/ (Cmax*Ttransaction), so being obtained when the quantity N of the sensor of access Internet of things system is smaller
Following relational expression:
When the quantity N of the sensor of access Internet of things system is larger, times of collection C is with the sensing for accessing Internet of things system
The variation of the quantity N of device and change.
If supporting the quantity N for more accessing the sensor of Internet of things system, fixed sample is slept on formula (1.1)
Sleep time Tsleep=0, when the quantity N of the sensor of access Internet of things system becomes larger, It is not necessary to acquiring every time
Insertion sampling sleeping time Tsleep, simple at this time between the minimum time Ttransaction spent needed for the value of primary transducer
Change formula (1.1) to obtain:
Tperiod=C*N*Ttransaction, available after deformation:
Formula (1.4) shows that the quantity N of the sensor with access Internet of things system continues to become larger, times of collection C gesture
Necessity reduces, and times of collection C can be a decimal during this, and it is default at one to illustrate that the algorithm in the present invention does not require
Sampling period in report cycle Tperiod is an integer, and physical meaning is one default report cycle of permission in the present invention
In the accessed number of each sensor be different.But otherwise times of collection C cannot mean default at one less than 1
There is sensor not to be accessed in report cycle, this does not allow.Currently in order to deburring, regulation is supported in the present invention
Minimum times of collection C is denoted as the maximum times of collection Cmin=2 in a default report cycle to each sensor, corresponding
Nmax is exactly the quantity for the maximum sensor that system can be supported in the present invention:
In known default report cycle Tperiod when actual development, the minimum spent needed for the value of primary transducer is acquired
Time Ttransaction, the interior maximum times of collection Cmax to each sensor of a default report cycle, and at one
In default default report cycle the times of collection of each sensor be at least up to the present invention after minimum times of collection Cmin obtain as
Fruit will support the quantity N for more accessing the sensor of Internet of things system also possible, sample sleeping time Tsleep at this time
Meet following formula:
To sum up, sampling sleeping time Tsleep is as follows:
Wherein, the minimum time spent needed for the value of a default report cycle Tperiod, acquisition primary transducer
The data the time it takes Tdata and silence period Tmute of acquisition primary transducer in Ttransaction, one it is default
To the acquisition time of each sensor in the maximum times of collection Cmax of each sensor, a default report cycle in report cycle
Number is at least up to minimum times of collection Cmin and can configure, and is usually arranged as the empirical value obtained by test.
Occupy CPU always due to when sampling sleeping time Tsleep is 0, will cause sampling thread, to periodic report and
Communication response causes certain delay, therefore when sampling sleeping time Tsleep is 0, and sampling thread can call sched_
Yield () actively abandons CPU, so that other threads have an opportunity to be dispatched in time.
After initialization sampling sleeping time Tsleep, the value of circle collection sensor carries out sequential sampling, and sampling obtains
Value, that is, collection value of each sensor be temporarily stored in data buffer zone, access next time is provided and is used, so that subsequent report
Thread is quicker to the use of sensing data, improves the real-time reported, and the collection value of sensor refers to reading sensing
The data that device obtains, for example read a temperature sensor and obtain 28.3 degree of temperature, then the current collection value of temperature sensor
It is 28.3.After sampling a sensor and terminating, judge to sample whether sleeping time Tsleep is 0, if sampling sleeping time
Tsleep is not 0, and the time of sampling thread sleep Tsleep is allowed to carry out the acquisition of next sensor again.If when sampling sleep
Between Tsleep be 0, sampling thread does not sleep and directly carries out the acquisition of next sensor.
As shown in figure 3, being that a kind of sensing data that part of the embodiment of the present invention provides adaptively acquires real-time report side
The workflow schematic diagram of thread is reported in method.
Step 5, periodic report thread is when default report cycle arrives, the acquisition twice or more to each sensor
Value is pre-processed, and the acquisition average value of each sensor is calculated, and is encoded to the acquisition average value, is reported to service
Device.In this step, the collection value twice or more refers to the collection value twice or more of sensor, and the sensor is one
Sensor in a default report cycle.
A kind of sensing data described in the present embodiment adaptively acquires in real-time report method, and the step 1 includes:
It can access the preset quantity threshold value of the sensor of Internet of things system are as follows:
Wherein, Nmax is the preset quantity threshold value that can access the sensor of Internet of things system, and Tperiod is to preset to report week
Phase, Cmin are the minimum times of collection in a default report cycle to each sensor, and the minimum times of collection Cmin is big
In or be equal to 2, Ttransaction be acquire primary transducer value needed for cost minimum time;
In a default report cycle, minimum times of collection is at least up to the times of collection of the value of each sensor
Cmin, it may be assumed that
Wherein, N is the quantity for accessing the sensor of Internet of things system.It is right in a default report cycle in the present embodiment
The minimum times of collection Cmin value of each sensor is 2.
A kind of sensing data described in the present embodiment adaptively acquires in real-time report method, the sampling in the step 4
Sleeping time is defined as:
Wherein, Tsleep is sampling sleeping time, and Cmax is the maximum in a default report cycle to each sensor
Times of collection.It is 2 to the minimum times of collection Cmin value of each sensor in a default report cycle in the present embodiment,
It is 5 to the maximum times of collection Cmax value of each sensor in one default report cycle.
A kind of sensing data described in the present embodiment adaptively acquires in real-time report method, due to when sampling sleeping time
When Tsleep is 0, it will cause sampling thread and occupy CPU always, certain delay is caused to periodic report and communication response, therefore
When sampling sleeping time Tsleep is 0, sampling thread can call sched_yield () actively to abandon CPU, so as to other lines
Journey has an opportunity to be dispatched in time.
A kind of sensing data described in the present embodiment adaptively acquires in real-time report method, the step 4, comprising: adopt
The collection value of each sensor is temporarily stored in data buffer zone by the value of each sensor of line-transect journey circle collection.This step
In rapid, by the way that the collection value of each sensor to be temporarily stored in data buffer zone, it is capable of providing access next time and uses, so that
It is subsequent to report thread quicker to the use of sensing data, improve the real-time that data report.
A kind of sensing data described in the present embodiment adaptively acquires in real-time report method, to one in the step 5
The collection value twice or more of sensor in default report cycle is pre-processed, and the pretreatment includes deburring.
In this step, the deburring, that is, Exception Filter value, refer to rule of thumb combine current environment, the time,
Season provides the max min within the scope of a normal operation of sensor, if judgement collection value is in scheduled normal range (NR)
Within, then retain this collection value, if collection value not in the range, does not save this collection value.Such as predetermined summer
The water temperature range in Nanjing aquaculture area is (6-45) degree, then reporting to remote server by after data prediction
Data can be retained within normal range (NR) (6-45), hence it is evident that exceptional value has been filtered out.
A kind of sensing data described in the present embodiment adaptively acquires in real-time report method, the step 1, comprising: if
The quantity of the sensor accessed in the Internet of things system is greater than the preset quantity threshold value that can access the sensor of Internet of things system,
The sampling thread is alerted and is exited.
In this step, the sampling thread is alerted and exited to be exited to be abnormal, specifically, can be by printing warning information
To alert.
A kind of sensing data described in the present embodiment adaptively acquires in real-time report method, the step 2, comprising: if
The quantity of the sensor accessed in the Internet of things system is 0, and the sampling thread exits.
In this step, the sampling thread is exited normally to exit.
It will appear delay when existing things-internet gateway reported data and the factors such as report cycle is unstable, cause to service
The data of device end storage are irregular, for example the sampled value of period unstable, certain sensor lacks, data burr is serious etc., shadow
The data processing and data analysis for ringing the later period, lead to this lower problem of the working efficiency of things-internet gateway.
And use preceding method, can reach it is following the utility model has the advantages that
(1) present invention is independent by sampling task and periodic report task, and sampling task is acquired according to certain period
Data;Periodic report is reported according to the fixed cycle, it is ensured that the stability in period and the real-time reported, not by sampling task
The uncertain time effects such as delay
(2) the invention can ensure that all reporting the collection value of the sensor of all accesses in a report cycle.It is logical
It crosses and requires the quantity of access sensor in theoretical range, and ensure at least to acquire all the sensors two in a report cycle
It is secondary, it ensure that the integrality of reported data in a report cycle.
(3) sleeping time between present invention setting double sampling dynamically becomes with the quantity variation of access sensor
Change, access device can be acquired all by not only having met in a report cycle, but also can allow gateway is as much as possible to connect
Enter sensor, while also avoiding causing the lossy to sensor due to frequent operation sensor.
(4) sensor values that sampling obtains is temporarily stored in data buffer zone by the present invention, is provided access next time and is used,
So that subsequent report thread quicker to the use of sensing data, the real-time reported is improved.
(5) present invention carries out deburring processing to sampled data before reported data, while guaranteeing that report cycle is stablized,
There is obvious benefit to the big data analysis in later period.
Therefore, a kind of sensing data proposed by the present invention adaptively acquires real-time report method, can not only guarantee object
Networking gateway realizes the effect to sampled data deburring to the integralities of all sensor samples accessed, and can be with
It avoids excessively frequent to sensor operations, has the function that the service life for protecting sensor, while can be realized the reality of data
When report, further, promote the working efficiency of things-internet gateway.
In the specific implementation, the present invention also provides a kind of computer storage mediums, wherein the computer storage medium can store
There is program, which may include that a kind of sensing data provided by the invention adaptively acquires each of real-time report method when executing
Step some or all of in embodiment.The storage medium can for magnetic disk, CD, read-only memory (English:
Read-only memory, referred to as: ROM) or random access memory (English: random access memory, referred to as:
RAM) etc..
It is required that those skilled in the art can be understood that the technology in the embodiment of the present invention can add by software
The mode of general hardware platform realize.Based on this understanding, the technical solution in the embodiment of the present invention substantially or
Say that the part that contributes to existing technology can be embodied in the form of software products, which can deposit
Storage is in storage medium, such as ROM/RAM, magnetic disk, CD, including some instructions are used so that computer equipment (can be with
It is personal computer, server or the network equipment etc.) execute certain part institutes of each embodiment of the present invention or embodiment
The method stated.
Same and similar part may refer to each other between each embodiment in this specification.Invention described above is real
The mode of applying is not intended to limit the scope of the present invention..
Claims (8)
1. a kind of sensing data adaptively acquires real-time report method characterized by comprising
Step 1, sampling thread initialization, judges whether the quantity of the sensor accessed in Internet of things system is less than or equal to and can connect
Enter the preset quantity threshold value of the sensor of the Internet of things system;
Step 2, if the quantity of the sensor be less than or equal to preset quantity threshold value, judge the sensor quantity whether be
0;
Step 3, if the quantity of the sensor is not 0, according to the quantity of the sensor, initialization sampling sleeping time, institute
Stating sampling sleeping time is per interval time between the value for acquiring sensor twice;
Step 4, the sampling thread obtains collection value to sample sleeping time as the value of time interval circle collection sensor;
Step 5, periodic report thread is when default report cycle arrives, to the collection value twice or more of each sensor into
Row pretreatment, calculates the acquisition average value of each sensor, encodes to the acquisition average value, report to server.
2. a kind of sensing data adaptively acquires real-time report method according to claim 1, which is characterized in that the step
Rapid 1 includes:
It can access the preset quantity threshold value of the sensor of the Internet of things system are as follows:
Wherein, Nmax is the preset quantity threshold value that can access the sensor of the Internet of things system, and Tperiod is to preset to report week
Phase, Cmin are the minimum times of collection in a default report cycle to each sensor, and the minimum times of collection Cmin is big
In or be equal to 2, Ttransaction be acquire primary transducer value needed for cost shortest time;
In a default report cycle, minimum times of collection Cmin is at least up to the times of collection of the value of each sensor,
That is:
Wherein, N is the quantity for accessing the sensor of Internet of things system.
3. a kind of sensing data according to claim 1 or claim 2 adaptively acquires real-time report method, which is characterized in that institute
State the sampling sleeping time in step 4 is defined as:
Wherein, Tsleep is sampling sleeping time, and Cmax is to acquire in a default report cycle to the maximum of each sensor
Number.
4. a kind of sensing data adaptively acquires real-time report method according to claim 3, which is characterized in that when described
When sampling sleeping time Tsleep is 0, the sampling thread dispatching sched_yield () actively abandons CPU.
5. a kind of sensing data adaptively acquires real-time report method according to claim 1, which is characterized in that the step
Rapid 4, comprising: sampling thread loops acquire the value of each sensor, and the collection value of each sensor is temporarily stored in data and is delayed
It rushes in area.
6. a kind of sensing data adaptively acquires real-time report method according to claim 1, which is characterized in that the step
The collection value twice or more of the sensor in a default report cycle is pre-processed in rapid 5, the pretreatment packet
Include deburring.
7. a kind of sensing data according to claim 1 adaptively acquires real-time report method, which is characterized in that described
Step 1 includes:
If the quantity of the sensor accessed in the Internet of things system is greater than the present count that can access the sensor of Internet of things system
Threshold value is measured, the sampling thread is alerted and exited.
8. a kind of sensing data according to claim 1 adaptively acquires real-time report method, which is characterized in that described
Step 2 includes:
If the quantity of the sensor accessed in the Internet of things system is 0, the sampling thread is exited.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910659815.3A CN110505596B (en) | 2019-07-22 | 2019-07-22 | Sensor data self-adaptive acquisition real-time reporting method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910659815.3A CN110505596B (en) | 2019-07-22 | 2019-07-22 | Sensor data self-adaptive acquisition real-time reporting method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110505596A true CN110505596A (en) | 2019-11-26 |
CN110505596B CN110505596B (en) | 2022-03-29 |
Family
ID=68586669
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910659815.3A Active CN110505596B (en) | 2019-07-22 | 2019-07-22 | Sensor data self-adaptive acquisition real-time reporting method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110505596B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113709591A (en) * | 2021-07-15 | 2021-11-26 | 国网安徽省电力有限公司检修分公司 | Substation radio frequency sensor ad hoc network data transmission method and system |
CN113959569A (en) * | 2021-10-25 | 2022-01-21 | 京东方科技集团股份有限公司 | Temperature measurement method and device, temperature measurement equipment and storage medium |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101609168A (en) * | 2009-07-07 | 2009-12-23 | 上海真灼电子技术有限公司 | Vehicle detecting system and method based on wireless earth induction |
US20110205415A1 (en) * | 2007-05-17 | 2011-08-25 | Sony Corporation | Image sensor, electronic apparatus, and driving method of electronic apparatus |
CN103249127A (en) * | 2013-05-22 | 2013-08-14 | 清华大学 | Energy-saving data transmission method for Internet of things |
US20130317659A1 (en) * | 2011-09-06 | 2013-11-28 | Stevens Water Monitoring Systems, Inc. | Distributed low-power wireless monitoring |
CN105101277A (en) * | 2015-09-01 | 2015-11-25 | 中国联合网络通信集团有限公司 | Method, device and system for judging abnormalities of monitoring area and sensing node |
CN106716096A (en) * | 2014-09-17 | 2017-05-24 | Kyb株式会社 | Displacement sensor inspection device and inspection method for same |
CN108419206A (en) * | 2018-02-28 | 2018-08-17 | 北京邮电大学 | A kind of target homing system and method |
CN109919748A (en) * | 2019-03-06 | 2019-06-21 | 中汇信息技术(上海)有限公司 | A kind of data processing method and system based on block chain |
-
2019
- 2019-07-22 CN CN201910659815.3A patent/CN110505596B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20110205415A1 (en) * | 2007-05-17 | 2011-08-25 | Sony Corporation | Image sensor, electronic apparatus, and driving method of electronic apparatus |
CN101609168A (en) * | 2009-07-07 | 2009-12-23 | 上海真灼电子技术有限公司 | Vehicle detecting system and method based on wireless earth induction |
US20130317659A1 (en) * | 2011-09-06 | 2013-11-28 | Stevens Water Monitoring Systems, Inc. | Distributed low-power wireless monitoring |
CN103249127A (en) * | 2013-05-22 | 2013-08-14 | 清华大学 | Energy-saving data transmission method for Internet of things |
CN106716096A (en) * | 2014-09-17 | 2017-05-24 | Kyb株式会社 | Displacement sensor inspection device and inspection method for same |
CN105101277A (en) * | 2015-09-01 | 2015-11-25 | 中国联合网络通信集团有限公司 | Method, device and system for judging abnormalities of monitoring area and sensing node |
CN108419206A (en) * | 2018-02-28 | 2018-08-17 | 北京邮电大学 | A kind of target homing system and method |
CN109919748A (en) * | 2019-03-06 | 2019-06-21 | 中汇信息技术(上海)有限公司 | A kind of data processing method and system based on block chain |
Non-Patent Citations (4)
Title |
---|
JUAN XIAO; FEI YIN: "Energy-efficient data collection in WSN-MCN convergence architecture", 《IEEE》 * |
刘永生等: "农田无线传感器网络数据服务器的设计与实现", 《农业工程学报》 * |
孙新伟: "无线传感器网络节点周期性休眠时间同步研究", 《机电工程》 * |
张杰等: "基于无线传感器网络的信息采集监测系统设计", 《传感技术学报》 * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113709591A (en) * | 2021-07-15 | 2021-11-26 | 国网安徽省电力有限公司检修分公司 | Substation radio frequency sensor ad hoc network data transmission method and system |
CN113709591B (en) * | 2021-07-15 | 2023-09-29 | 国网安徽省电力有限公司超高压分公司 | Ad hoc network data transmission method and system for transformer substation radio frequency sensor |
CN113959569A (en) * | 2021-10-25 | 2022-01-21 | 京东方科技集团股份有限公司 | Temperature measurement method and device, temperature measurement equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN110505596B (en) | 2022-03-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103327072B (en) | A kind of method of cluster load balance and system thereof | |
CN100591052C (en) | Traffic control method and service processing system | |
US20090031314A1 (en) | Fairness in memory systems | |
CN105095109B (en) | cache access method, cache access router and computer system | |
CN110505596A (en) | A kind of sensing data adaptively acquires real-time report method | |
CN103136120B (en) | Row buffering operating strategy defining method and device, bank division methods and device | |
CN102362464A (en) | Memory access monitoring method and device | |
EP3073383A1 (en) | Method, device, and computer storage medium for hierarchical storage | |
US20090228663A1 (en) | Control circuit, control method, and control program for shared memory | |
CN107145388A (en) | Method for scheduling task and system under a kind of multitask environment | |
CN110401697A (en) | A kind of method, system and the equipment of concurrent processing HTTP request | |
CN110222871A (en) | The selection method and device of similar day for load forecast | |
CN109426623A (en) | A kind of method and device reading data | |
CN109344164A (en) | Date storage method and device | |
CN105183398B (en) | A kind of storage device, electronic equipment and data processing method | |
CN112286844A (en) | DDR4 control method and device capable of adapting to service address mapping | |
CN109150819B (en) | A kind of attack recognition method and its identifying system | |
CN110648356A (en) | Multi-target tracking processing optimization method based on visual digital signal processing | |
CN112015326A (en) | Cluster data processing method, device, equipment and storage medium | |
CN110457133A (en) | A kind of processing method and system of operating-system resources exception | |
WO2017162075A1 (en) | Task scheduling method and device | |
CN105072048B (en) | A kind of packet storage dispatching method and device | |
CN115576759A (en) | Pressure testing method and device, electronic equipment and readable storage medium | |
CN109002381A (en) | Process communication monitoring method, electronic device and computer readable storage medium | |
CN105242971B (en) | Memory object management method and system towards Stream Processing system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |