Disclosure of Invention
In order to be different from the existing door state detection method, the invention provides a novel method for detecting the door state, a door controller and a server.
The invention provides a method for detecting the state of a door by a door controller, wherein the door controller is electrically connected with an electromagnetic lock, and the method comprises the following steps: s1, detecting the total current of the electromagnetic lock flowing through the door; s2, acquiring a current characterization value for characterizing the magnitude of the total current according to the total current; s3, calculating a difference value between the current characterization value and a first current characterization reference value to obtain a first current difference value, and calculating a difference value between the current characterization value and a second current characterization reference value to obtain a second current difference value; wherein the first current characterizing reference value corresponds to the gate being in a first state and the second current characterizing reference value corresponds to the gate being in a second state; and S4, comparing the magnitude of the first current difference value with the magnitude of the second current difference value, if the first current difference value is smaller than the second current difference value, determining that the gate is in the first state, and if the first current difference value is larger than the second current difference value, determining that the gate is in the second state.
In one embodiment, after step S2, the current characterization value of step S2 is written into the nth location of the fifo memory; the first position to the N-1 position of the first-in first-out memory are used for storing current characterization values obtained from the previous N-1 times to the previous time respectively; calculating an average value of the N current characteristic values in the fifo memory as the current characteristic value of the step S3; wherein N is greater than or equal to 3.
In one embodiment, the method further comprises the steps of: and when the door is in the second state and exceeds the set time length, sending a prompt message that the door is in the second state and exceeds the set time length to a server.
In one embodiment, the method further comprises the steps of: sending a request for downloading the set duration corresponding to the door to the server; and receiving the set time length corresponding to the door returned by the server.
In one embodiment, the method further comprises the steps of: s4, receiving a command sent by the server to acquire a first current characterization reference value or a second current characterization reference value corresponding to the door; s5, detecting the total current flowing through the electromagnetic lock according to the command and acquiring the first current characterization reference value or the second current characterization reference value; and S6, sending the first current characterization reference value or the second current characterization reference value corresponding to the gate to a server.
In one embodiment, step S5 is: and detecting the total current flowing through the electromagnetic lock for multiple times according to the command, acquiring current characterization values, and averaging the current characterization values acquired for multiple times to obtain the first current characterization reference value or the second current characterization reference value.
In one embodiment, step S3 further includes the steps of: calculating a difference value between the current characterization value and a third current characterization reference value to obtain a third current difference value; wherein the third current characterizing reference value corresponds to the gate being in a third state; step S4 is: comparing the magnitude of the first current difference, the magnitude of the second current difference and the magnitude of the third current difference, if the first current difference is minimum, determining that the door is in a first state, if the second current difference is minimum, determining that the door is in a second state, and if the third current difference is minimum, determining that the door is in a third state; the electromagnetic lock is in a power-off state, the electromagnetic lock is in a power-on state, and the door is in a first state, namely the door is in a closed state, the door is in a second state, namely the door is in an open state, and the electromagnetic lock is in a power-on state.
The invention also provides a door controller for detecting the door state, which is electrically connected with an electromagnetic lock through a lead and comprises: a detecting unit for detecting a total current flowing through the electromagnetic lock of the door; the acquisition unit is used for acquiring a current characterization value for characterizing the magnitude of the total current according to the total current; the calculating unit is used for calculating a difference value between the current characterization value and a first current characterization reference value to obtain a first current difference value, and calculating a difference value between the current characterization value and a second current characterization reference value to obtain a second current difference value; wherein the first current characterizing reference value corresponds to the gate being in a first state and the second current characterizing reference value corresponds to the gate being in a second state; and the judging unit is used for comparing the magnitude between the first current difference and the second current difference, judging that the door is in a first state if the first current difference is smaller than the second current difference, and judging that the door is in a second state if the first current difference is larger than the second current difference.
In one embodiment, the gate controller further comprises a write unit for: writing the current characterization value acquired by the acquisition unit into an Nth position of a first-in first-out memory; the first position to the N-1 position of the first-in first-out memory are used for storing current characterization values obtained from the previous N-1 times to the previous time respectively; calculating an average value of N current characteristic values in the first-in first-out memory as the current characteristic value used by the calculating unit; wherein N is greater than or equal to 3.
In one embodiment, the door controller further comprises: and the first sending unit is used for sending a prompt message that the length of time of the door in the first state exceeds the set length of time to the server when the door in the first state exceeds the set length of time.
In one embodiment, the door controller further comprises: a request unit, configured to send a request for downloading the set duration corresponding to the door to the server; and the first receiving unit is used for receiving the set time length corresponding to the door returned by the server.
In one embodiment, the door controller further comprises: the second receiving unit is used for receiving a command which is sent by the server and used for acquiring the first current representation reference value or the second current representation reference value corresponding to the door; the acquisition unit is used for detecting the total current flowing through the electromagnetic lock according to the command and acquiring the first current characterization reference value or the second current characterization reference value; and the second sending unit is used for sending the first current representation reference value or the second current representation reference value corresponding to the door to a server.
In one embodiment, the obtaining unit is configured to detect a total current flowing through the electromagnetic lock multiple times according to the command and obtain a current characterization value, and average the current characterization values obtained multiple times to obtain the first current characterization reference value or the second current characterization reference value.
In one embodiment, the calculating unit is further configured to calculate a difference between the current characterization value and a third current characterization reference value to obtain a third current difference; wherein the third current characterizing reference value corresponds to the gate being in a third state; the judging unit is used for comparing the magnitudes of the first current difference, the second current difference and the third current difference, if the first current difference is minimum, the door is judged to be in a first state, if the second current difference is minimum, the door is judged to be in a second state, and if the third current difference is minimum, the door is judged to be in a third state; the electromagnetic lock is in a power-off state, the electromagnetic lock is in a power-on state, and the door is in a first state, namely the door is in a closed state, the door is in a second state, namely the door is in an open state, and the electromagnetic lock is in a power-on state.
The invention also provides a method for detecting the door state by the server, wherein the server is used for communicating with the door controller, and the method comprises the following steps: s1, receiving a current representation value sent by a door controller corresponding to the AND door; s2, calculating a difference value between the current characterization value and a first current characterization reference value to obtain a first current difference value, and calculating a difference value between the current characterization value and a second current characterization reference value to obtain a second current difference value; wherein the first current characterizing reference value corresponds to the gate being in a first state and the second current characterizing reference value corresponds to the gate being in a second state; and S3, comparing the magnitude of the first current difference value with the magnitude of the second current difference value, if the first current difference value is smaller than the second current difference value, determining that the gate is in the first state, and if the first current difference value is larger than the second current difference value, determining that the gate is in the second state.
In one embodiment, after step S1, the current characterization value of step S1 is written into the nth location of the fifo memory; the first position to the N-1 position of the first-in first-out memory respectively store current characterization values obtained from the previous N-1 times to the previous time; calculating an average value of the N current characteristic values in the fifo memory as the current characteristic value of the step S2; wherein N is greater than or equal to 3.
In one embodiment, the method further comprises the steps of: s4, receiving a notification sent by the mobile client to acquire a first current representation reference value or a second current representation reference value corresponding to the gate; s5, sending a command for detecting the total current flowing through the electromagnetic lock and acquiring the first current characterization reference value or the second current characterization reference value to the door controller according to the notification; and S6, receiving and storing the first current characterization reference value or the second current characterization reference value returned by the gate controller.
In one embodiment, step S2 further includes the steps of: calculating a difference value between the current characterization value and a third current characterization reference value to obtain a third current difference value; wherein the third current characterizing reference value corresponds to the gate being in a third state; step S3 is: comparing the magnitude of the first current difference, the magnitude of the second current difference and the magnitude of the third current difference, if the first current difference is minimum, determining that the door is in a first state, if the second current difference is minimum, determining that the door is in a second state, and if the third current difference is minimum, determining that the door is in a third state; the electromagnetic lock is in a power-off state, the electromagnetic lock is in a power-on state, and the door is in a first state, namely the door is in a closed state, the door is in a second state, namely the door is in an open state, and the electromagnetic lock is in a power-on state.
The present invention also provides a server for detecting a door state, comprising: the first receiving unit is used for receiving the current representation value sent by the door controller corresponding to the AND door; the calculating unit is used for calculating a difference value between the current characterization value and a first current characterization reference value to obtain a first current difference value, and calculating a difference value between the current characterization value and a second current characterization reference value to obtain a second current difference value; wherein the first current characterizing reference value corresponds to the gate being in a first state and the second current characterizing reference value corresponds to the gate being in a second state; and the judging unit is used for comparing the magnitude between the first current difference and the second current difference, judging that the door is in a first state if the first current difference is smaller than the second current difference, and judging that the door is in a second state if the first current difference is larger than the second current difference.
In one embodiment, the server further includes a writing unit, configured to: writing the current characterization value acquired by the first receiving unit into the Nth position of a first-in first-out memory; the first position to the N-1 position of the first-in first-out memory respectively store current characterization values obtained from the previous N-1 times to the previous time; calculating an average value of N current characteristic values in the first-in first-out memory as the current characteristic value of the calculation unit; wherein N is greater than or equal to 3.
In one embodiment, the server further comprises: the second receiving unit is used for receiving a notice sent by the mobile client for acquiring the first current representation reference value or the second current representation reference value corresponding to the door; the sending unit is used for sending a command for detecting the total current flowing through the electromagnetic lock and acquiring the first current characterization reference value or the second current characterization reference value to the door controller according to the notification; and the third receiving unit is used for receiving and storing the first current representation reference value or the second current representation reference value returned by the gate controller.
In one embodiment, the calculating unit is further configured to calculate a difference between the current characterization value and a third current characterization reference value to obtain a third current difference; wherein the third current characterizing reference value corresponds to the gate being in a third state; the determination unit is configured to: comparing the magnitude of the first current difference, the magnitude of the second current difference and the magnitude of the third current difference, if the first current difference is minimum, determining that the door is in a first state, if the second current difference is minimum, determining that the door is in a second state, and if the third current difference is minimum, determining that the door is in a third state; the electromagnetic lock is in a power-off state, the electromagnetic lock is in a power-on state, and the door is in a first state, namely the door is in a closed state, the door is in a second state, namely the door is in an open state, and the electromagnetic lock is in a power-on state.
Has the advantages that:
the scheme is different from the existing door state detection method by detecting the total current flowing through the electromagnetic lock and further judging the state of the door according to the total current.
According to the scheme, the difference value between the current characterization value and the plurality of current characterization reference values is calculated, and then the difference values are compared, so that the state of the door is judged, and the accuracy of door state detection can be further improved.
Detailed Description
The preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
FIG. 1 is a schematic diagram of one embodiment of a system for detecting a condition of a door, the system comprising: the system comprises adoor controller 300, anelectromagnetic lock 500, aserver 400, amobile client 600 and a directcurrent voltage source 700. Thedoor controller 300 and theserver 400 can be connected through wireless communication, thedc voltage source 700 supplies power to the electromagnetic lock through thedoor controller 300, thedoor controller 300 is connected with theelectromagnetic lock 500 through the leads L1 and L2, and thedoor controller 300 is used for controlling whether the dc voltage output by thedc voltage source 700 can be transmitted to theelectromagnetic lock 500, that is, for providing the working voltage + U to theelectromagnetic lock 500, and for detecting the total current flowing through theelectromagnetic lock 500 and obtaining a current characteristic value (for example, a current value or a corresponding voltage value) representing the magnitude of the total current. In a preferred embodiment,door controller 300 is located next to or integrated withDC voltage source 700. In one embodiment, theDC voltage source 700 is used to convert AC voltage to DC voltage for output to thedoor controller 300 and theelectromagnetic lock 500. As shown in fig. 10, thedoor controller 300 may include a switch K2, a switch K2 is provided on the voltage supply line L2 of thedc voltage source 700, and a processor for controlling the on/off of the switch K2, so that it is possible to control whether the voltage outputted from the dc voltage source can be supplied to theelectromagnetic lock 500.
Theelectromagnetic lock 500 is disposed on thedoor 100 or thedoorframe 200, and when theelectromagnetic lock 500 is powered on, thedoor 100 and thedoorframe 200 are attracted by magnetic force under the action of the magnetic field. When thedoor 100 is in the first state (e.g., the closed state), the total current flowing through theelectromagnetic lock 500 is the first current; when thedoor 100 is in the second state (e.g., thedoor 100 is blocked and cannot be closed when theelectromagnetic lock 500 is powered on), the total current flowing through theelectromagnetic lock 500 is the second current; when thedoor 100 is in the third state (e.g., thedoor 100 is in the open state and theelectromagnetic lock 500 is in the power-down state), the total current flowing through theelectromagnetic lock 500 is zero. Since the total current flowing through theelectromagnetic lock 500 is different when thedoor 100 is in different states, thedoor controller 300 can determine the state of thedoor 100 according to the obtained current characterization value. Themobile client 600 is used to send an unlock command to thedoor controller 300 through theserver 400 to open theelectromagnetic lock 500.
A first current characterizing reference value C1 corresponding to the first state, a second current characterizing reference value C2 corresponding to the second state, and a third current characterizing reference value C3 corresponding to the third state are set and stored (e.g., in thedoor controller 300 or the server 400). For example, after installing thedoor controller 300, the engineer places thedoor 100 in the first state, and then thedoor controller 300 obtains the first current characterizing reference value corresponding to the first state to store or transmit to theserver 400. The second current characterizing reference value and the third current characterizing reference value may be set in the same way.
If the condition that the state of thegate 100 is determined as whether the current characterization value is equal to a current characterization reference value is used, the state of thegate 100 is easily determined by mistake or not, which is specifically the following reasons: theelectromagnetic lock 500, the wires L1, L2 between theelectromagnetic lock 500 and thedoor controller 300 are often located outdoors, the wires L1, L2 and the electronic components inside the electromagnetic lock are prone to change (e.g., aging, etc.), and the total current flowing through theelectromagnetic lock 500 changes (e.g., decreases) when thedoor 100 is in a certain state over time, but the magnitude of the change in the total current is the same or very close when thedoor 100 is in different states. For example, the total current flowing through the electromagnetic lock 500 (new) when thedoor 100 is in the first state, the second state, and the third state is 300mA, 600mA, and 0, respectively. Thus, the first, second and third current characterizing reference values may be taken as 300mA, 600mA and 0, respectively. When theelectromagnetic lock 500 is used for one year, the total current flowing through theelectromagnetic lock 500 in the first state, the second state and the third state is 200mA, 500mA and 0, respectively. If the condition that whether the current characterization value is equal to a certain current characterization reference value is used as a condition for judging the state of the gate 100: if the total current obtained by thedoor controller 300 is 200mA (after theelectromagnetic lock 500 is used for one year), it cannot be determined what state thedoor 100 is currently in because 200mA is different from any of the above-mentioned current characterization reference values.
Therefore, in order to determine the state of thedoor 100 more accurately, particularly, the state of thedoor 100 after theelectromagnetic lock 500 is used for a long time, the state of thedoor 100 may be determined as follows:
calculating a difference value between the current characterization value and the first current characterization reference value to obtain a first current difference value, calculating a difference value between the current characterization value and the second current characterization reference value to obtain a second current difference value, and calculating a difference value between the current characterization value and the third current characterization reference value to obtain a third current difference value;
comparing the first current difference, the second current difference and the third current difference, if the first current difference is minimum, determining that thegate 100 is in the first state, if the second current difference is minimum, determining that thegate 100 is in the second state, and if the third current difference is minimum, determining that thegate 100 is in the third state.
The above example is still used as an example to illustrate: when theelectromagnetic lock 500 is used for one year, the total current obtained by thedoor controller 300 is 200mA, and the current difference between 200mA and the first current characterization reference value 300mA, the current difference between the second current characterization reference value 600mA and the current difference between the third current characterization reference value 0 are respectively calculated as follows: 100mA, 400mA and 200mA, and then the smallest current difference value 100mA is selected, and it can be determined that thegate 100 is in the first state corresponding to the first current characterization reference value.
Through the scheme, the influence caused by the total current change caused by the circuit performance change can be effectively eliminated, so that the state of thegate 100 can be more accurately judged.
The first total current flowing through theelectromagnetic lock 500 in the first state, the second total current flowing through theelectromagnetic lock 500 in the second state, and the third total current flowing through theelectromagnetic lock 500 in the third state should have enough current difference, and the current difference should be larger than 2 times of the current deviation caused by the aging of the normal circuit, so as to avoid that the state of thedoor 100 is erroneously determined due to the excessive current deviation. It will be appreciated that, accordingly, there is a sufficient difference between two of the first, second and third current characterising reference values.
FIG. 2 is a schematic diagram of another embodiment of a door condition detection system. Theelectromagnetic lock 500 includes a first circuit and a second circuit connected in parallel, thedoor controller 300 is used for providing an operating voltage + U to theelectromagnetic lock 500 and detecting a current flowing through theelectromagnetic lock 500, the first circuit includes a coil L for generating a magnetic field to attract thedoor 100 and thedoor frame 200, and the second circuit includes a resistor R and a switch K.
When thedoor controller 300 provides the operating voltage + U to the electromagnetic lock 500: if the distance between thedoor 100 and thedoor frame 200 is smaller than the threshold value (e.g., close to the threshold value), the switch K is turned off (thedoor 100 is in the first state), and if the distance between thedoor 100 and thedoor frame 200 is larger than the threshold value, the switch K is turned on (thedoor 100 is in the second state), so that the total current flowing through theelectromagnetic lock 500 in the first state is smaller than the total current flowing through theelectromagnetic lock 500 in the second state. When thedoor controller 300 stops supplying the operating voltage + U to theelectromagnetic lock 500, the total current flowing through theelectromagnetic lock 500 is 0. The distance between thedoor 100 and thedoorframe 200 can be measured using an infrared detection device. For example, an infrared transmitter and an infrared receiver are arranged in the electromagnetic lock, and when the infrared receiver cannot receive infrared light from the infrared transmitter (that is, the distance between thedoor 100 and thedoor frame 200 is greater than a threshold), a level control switch K is output to be turned on; when the infrared receiver can not receive the infrared light of the infrared transmitter (at this moment, the door is tightly attached to thedoor frame 200, the infrared light sent by the infrared transmitter is reflected back to the infrared receiver in the electromagnetic lock after being emitted to the door frame), another level is output to control the switch K to be switched off, and the total current flowing through the electromagnetic lock at this moment is smaller than the total current flowing through the electromagnetic lock when the switch K is switched on. The switch K may be a relay, a semiconductor switch (e.g., MOS transistor, etc.). In one embodiment, the resistance R is between 10 Ω and 200 Ω, preferably between 20 Ω and 150 Ω, and more preferably between 120 Ω and 150 Ω, so that the current flowing through theelectromagnetic lock 500 under different conditions can have a sufficient difference, and the heating of theelectromagnetic lock 500 can be controlled to a low level when the resistance is between 120 Ω and 150 Ω.
Fig. 3 is a flowchart of an embodiment of a method for detecting the state of a door according to the present invention, in this embodiment, a controller determines which state thedoor 100 is in, and the method includes the following steps.
S10, thedoor controller 300 downloads the current characterization reference value and the set time length corresponding to thedoor 100 from theserver 400.
Whendoor controller 300 is turned on,door controller 300 may send a request toserver 400 to download the current characterization reference and set duration corresponding todoor 100, which contains the identification code of door controller 300 (the identification codes ofdifferent door controllers 300 are different). Theserver 400 stores the correspondence among the identification code of thedoor controller 300, the identification code of thedoor 100, the current characterization reference value, and the set time length (where the identification code of thedoor 100 is optional, if thedoor controller 300 controls only one door, the identification code of thedoor 100 may not be required to be set, and if thedoor controller 300 controls a plurality ofdoors 100, the identification code of thedoor 100 is required). In one embodiment, the correspondence is shown in table 1 below:
TABLE 1
After theserver 400 receives the request sent by thedoor controller 300, the current characterization reference values (the first current characterization reference value, the second current characterization reference value, and the third current characterization reference value) and the set time length corresponding to the identification code of thedoor controller 300 are found, and then the parameters are returned to thedoor controller 300. Thedoor 100 is in the first state, which means that thedoor 100 is in the closed state (theelectromagnetic lock 500 is in the power-on state, thedoor 100 and thedoorframe 200 are attracted by the magnetic force generated by the electromagnetic lock 500), thedoor 100 is in the second state, which means that thedoor 100 is in the open state and theelectromagnetic lock 500 is in the power-on state, and thedoor 100 is in the third state, which means that thedoor 100 is in the open state and theelectromagnetic lock 500 is in the power-off state.
S11, thegate controller 300 detects the total current flowing through theelectromagnetic lock 500 of the gate, and obtains a current characterization value characterizing the magnitude of the total current according to the total current, wherein the current characterization value characterizes the magnitude of the total current.
In one embodiment, thedoor controller 300 includes a Hall type current sensor for sensing the total current, an analog to digital converter for characterizing the magnitude of the current. The hall-type current sensor detects the total current flowing through the electromagnetic lock 500 (i.e., on lines L1, L2) and converts the total current to a voltage, and the analog-to-digital converter outputs a current representative value that is representative of the magnitude of the voltage.
S12, thegate controller 300 calculates the average value of the current characterization value and the current characterization values obtained in the previous N-1 times to obtain a current characterization average value.
In one embodiment, thegate controller 300 is provided with a FIFO (First In First Out) memory, as shown In FIG. 4. When the electronic device is started, thegate controller 300 continuously detects the total current of theelectromagnetic lock 500, and sequentially obtains N (e.g., 10) current characterization values, wherein the current characterization value obtained at present is stored in the nth position of the FIFO memory, the current characterization value obtained at the previous 1 time is stored in the N-1 th position of the FIFO memory, and so on, and the current characterization value obtained at the previous N-1 time is stored in the 1 st position of the FIFO memory. In normal operation, before the current characteristic value is written into the FIFO memory, the current characteristic values stored in the FIFO memory are all shifted to the right by one position, the current characteristic value stored firstly in the FIFO memory (namely the current characteristic value at the 1 st position of the current FIFO memory) is shifted out of the FIFO memory, and then the current characteristic value obtained currently is stored in the N position of the FIFO memory. The current characterization mean can then be obtained by averaging all (i.e., N) current characterization values in the FIFO memory. By the method, the probability of current mutation caused by noise interference and further wrong judgment of the state of thegate 100 can be effectively reduced, and meanwhile, the method adopting the FIFO memory is simple to realize and needs fewer codes (namely, the corresponding detection method is simpler).
Thegate controller 300 calculates a difference between the current characterization average and the first current characterization reference value to obtain a first current difference, calculates a difference between the current characterization average and the second current characterization reference value to obtain a second current difference, and calculates a difference between the current characterization average and the third current characterization reference value to obtain a third current difference.
S13, thegate controller 300 compares the first current difference, the second current difference and the third current difference, if the first current difference is the smallest, it determines that thegate 100 is in the first state, if the second current difference is the smallest, it determines that thegate 100 is in the second state, and if the third current difference is the smallest, it determines that thegate 100 is in the third state.
S14, thedoor controller 300 calculates the duration of the current state of the door, and when the duration of the second state of the door exceeds the set duration, thedoor controller 300 sends a prompt message to theserver 400 that the second state of thedoor 100 exceeds the set duration.
For example, thedoor controller 300 detects the total current at intervals of time t (e.g. 200ms) and determines the state of thedoor 100, when thedoor controller 300 determines that thedoor 100 is in the second state m times in succession, the duration of the second state of thedoor 100 may be calculated to be mt, and when thedoor controller 300 determines that mt is greater than the set duration, a prompt message, such as an alarm message, indicating that the second state of thedoor 100 exceeds the set duration is sent to theserver 400.
In one embodiment, the following steps may be taken to store a plurality of current characterization reference values in theserver 400.
S15, the mobile client 600 (e.g. a smart phone, a tablet pc, etc.) scans and obtains the identification code in the form of a barcode or a two-dimensional code on thedoor controller 300.
In this embodiment, thedoor controller 300 is provided with an identification code in the form of a bar code or a two-dimensional code, for example, the identification code is printed or pasted on the surface of thedoor controller 300. When the current representation reference value is set, after an engineer clicks a scanning icon provided by a program interface in themobile client 600, themobile client 600 calls a camera to scan the identification code, so that the identification code is acquired.
S16, the program interface of themobile client 600 jumps to an interface for setting a current characterization reference value, where the interface displays an identification code of the current door controller 300 (and an identification code of thedoor 100, which are optional, the same below), and an icon for acquiring a certain current characterization reference value. As shown in fig. 5, after receiving the click operation of the engineer on a certain icon, themobile client 600 sends a notification to theserver 400 to obtain the corresponding current characterization reference value of thedoor controller 300, where the notification includes the identification code of the door controller 300 (and the identification code of the door 100) and the identification of the current characterization reference value.
For example, in the operation state of thedoor controller 300, the engineer puts thedoor 100 in the first state, then clicks the "acquire icon of C1", and themobile client 600 sends a notification to theserver 400 to acquire the first current characterization reference value of thedoor 100 in the first state, where the notification includes: the ID of the door controller 300 (and the ID of the door 100), the identity of the first current characterizing reference value.
After receiving the notification, theserver 400 sends a command to thecorresponding door controller 300 to obtain the first current characterizing reference value of thedoor 100, where the command includes: the ID of the door controller 300 (and the ID of the door 100), the identity of the first current characterizing reference value.
S17, after receiving the command, thedoor controller 300 detects the total current flowing through theelectromagnetic lock 500 of thedoor 100, obtains a current characterization value characterizing the magnitude of the total current according to the total current, and obtains a current characterization reference value according to the current characterization value.
In one embodiment, thegate controller 300 receives the command, acquires the current characterization value N times, stores the current characterization value into the FIFO memory shown in fig. 4 in sequence, and calculates the average value of the N current characterization values in the FIFO memory as the current characterization reference value.
S18, thedoor controller 300 sends the ID of the door controller 300 (and the ID of the door 100) and the current characterization reference value to theserver 400, and theserver 400 stores the parameters as described in table 1 above and sends the current characterization reference value of the ID of the door controller 300 (and the ID of the door 100) to themobile client 600.
S19, after themobile client 600 receives the current characterization reference value of the ID of the door controller 300 (and the ID of the door 100), the current characterization reference value is displayed beside the icon for obtaining a certain current characterization reference value to prompt theengineer server 400 that the current characterization reference value has been successfully obtained.
FIG. 6 is a schematic diagram of an example interface for successfully setting a current characterization reference, which can be seen displayed next to a corresponding icon.
In one embodiment, the Hall type current sensor can detect in the range of-I0~+I0And correspondingly outputs 0 to U1Wherein the relationship among the detected total current, the voltage outputted by the hall type current sensor, and the current characteristic value outputted by the analog-to-digital converter is shown in the following table 2:
TABLE 2
It will be appreciated that when thegate 100 is in the third state (where the total current flowing through theelectromagnetic lock 500 is 0), the value output by the analog-to-digital converter (current-representative reference value) is a value other than 0, as shown in table 1 and fig. 6, and the third current-representative reference value is 875. It should be noted that the third current-characterizing reference value is a certain value (related to the output value range of the analog-to-digital converter) in theory, and therefore thegate controller 300 does not need to acquire the third current-characterizing reference value. However, due to the circuit characteristics of the door controller 300 (e.g., hall-type current sensor, analog-to-digital converter) and/or theelectromagnetic lock 500, the third current-characterizing reference value obtained by thedoor controller 300 may be more accurate because the actually detected third current-characterizing reference value may be different from the theoretical value. FIG. 7 is a schematic diagram of another embodiment of a door detection system, in which adoor controller 300 controls theelectromagnetic locks 501 and 502 of twodoors 101 and 102 simultaneously, and the doors are in four states: the two doors are closed, one door is opened, the corresponding electromagnetic lock is in a power-on state, the other door is closed, the two doors are opened, the two electromagnetic locks are in a power-on state, the two doors are opened, the electromagnetic lock is in a power-off state, the total currents flowing through the electromagnetic lock in the four states are different, and therefore four current characterization reference values need to be set. The method for detecting the gate state of this embodiment is similar to that of the previous embodiment, and is not described herein again.
Fig. 8 is a flowchart of another embodiment of the method for detecting the state of the door according to the present invention, in this embodiment, theserver 400 determines which state thedoor 100 is in, and the method for detecting includes the following steps.
S21, thegate controller 300 detects the total current flowing through theelectromagnetic lock 500 of thegate 100, and obtains a current characterization value characterizing the magnitude of the total current according to the total current, wherein the current characterization value characterizes the magnitude of the current. This step is the same as step S11 of the above embodiment.
S22, thedoor controller 300 sends the current characterization value to theserver 400. Thedoor controller 300 may send a relationship table as shown in table 3 to theserver 400 for representing the correspondence between the identification code of thedoor controller 300, the identification code of the door, and the current characterizing value.
TABLE 3
Wherein the identification code of thedoor 100 is optional: if thedoor controller 300 controls a plurality ofdoors 100, an identification code of thedoor 100 corresponding to the current characterization reference value is required; if thedoor controller 300 controls onedoor 100, the identification code of thedoor 100 is not required.
S23, theserver 400 receives the current characterization reference value and calculates the average value of the current characterization value and the current characterization values obtained in the previous N-1 times to obtain a current characterization average value. Theserver 400 calculates a difference between the current characterization average and the first current characterization reference value to obtain a first current difference, calculates a difference between the current characterization average and the second current characterization reference value to obtain a second current difference, and calculates a difference between the current characterization average and the third current characterization reference value to obtain a third current difference.
This step S23 may be similar to step S12 of the above embodiment, i.e., a FIFO memory may be used to calculate the current characterization average.
S24, theserver 400 compares the first current difference, the second current difference and the third current difference, if the first current difference is the smallest, it is determined that thegate 100 is in the first state, if the second current difference is the smallest, it is determined that thegate 100 is in the second state, and if the third current difference is the smallest, it is determined that thegate 100 is in the third state.
S25, theserver 400 calculates the duration of the current state of thedoor 100, and generates a prompt message when the duration of the second state of thedoor 100 exceeds a predetermined duration.
The invention also provides a door controller for detecting the door state, which is electrically connected with an electromagnetic lock through a lead and comprises:
a detecting unit for detecting a total current flowing through the electromagnetic lock of the door;
the acquisition unit is used for acquiring a current characterization value for characterizing the magnitude of the total current according to the total current;
the calculating unit is used for calculating a difference value between the current characterization value and a first current characterization reference value to obtain a first current difference value, and calculating a difference value between the current characterization value and a second current characterization reference value to obtain a second current difference value; wherein the first current characterizing reference value corresponds to the gate being in a first state and the second current characterizing reference value corresponds to the gate being in a second state;
and the judging unit is used for comparing the magnitude between the first current difference and the second current difference, judging that the door is in a first state if the first current difference is smaller than the second current difference, and judging that the door is in a second state if the first current difference is larger than the second current difference.
The invention also provides a server for detecting the door state, which is used for being in communication connection with the door controller and comprises:
the first receiving unit is used for receiving the current representation value sent by the door controller corresponding to the AND door;
the calculating unit is used for calculating a difference value between the current characterization value and a first current characterization reference value to obtain a first current difference value, and calculating a difference value between the current characterization value and a second current characterization reference value to obtain a second current difference value; wherein the first current characterizing reference value corresponds to the gate being in a first state and the second current characterizing reference value corresponds to the gate being in a second state;
and the judging unit is used for comparing the magnitude between the first current difference and the second current difference, judging that the door is in a first state if the first current difference is smaller than the second current difference, and judging that the door is in a second state if the first current difference is larger than the second current difference.
It should be understood that the above embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same, and those skilled in the art can modify the technical solutions described in the above embodiments, or make equivalent substitutions for some technical features; and all such modifications and alterations are intended to fall within the scope of the appended claims.