Based on Programmable Logic Controller and the control method thereof of BACNET agreement
Technical field
The present invention relates to a kind of Programmable Logic Controller, be specifically related to a kind of Programmable Logic Controller based on BACNET agreement and control method thereof.
Background technology
BACnet (BulidingAutomationControlnetwork) is a kind of data communication protocol that the special automation and control network for building is formulated, and is formulated by refrigeration heating air conditioning IEEE of the U.S. (being called for short ASHRAE).Its most basic object is a kind of method providing interoperability to building automatic control system, the control system equipment of distribution can be made to be exchanged by the numeral of relevant information, can cooperate in harmony.
Current BACNETMS/TP protocol controller is mainly as an I/O module, and when upper strata BACNET main frame sends read command, it is responsible for the value of analog quantity, switching value, and sends back to upper strata BACNET main frame; When BACNET main frame sends control write order, it will upgrade the value of oneself output interface, such as analog output, output switch parameter, thus can control the performers such as water valve blower fan.
But above-mentioned BACNETMS/TP protocol controller is just as I/O module, all Read-write Catrol information all will be realized by BACNET main frame, when main frame or bus malfunctions, cannot complete local controlling functions, there will be potential safety hazard, as emergency alarm etc.When the equipment that bus mounts is more, control information fails to be convened for lack of a quorum and enlarges markedly, and increases bus burden, thus easily occurs that communication bit error rates improves, data re-transmission is frequent, causes practical communication speed to decline.As inquiry or when controlling the state of certain lower floor's controller on BACNET main frame, wait may be needed just to complete for more than 2 seconds, there is hysteresis quality.
Summary of the invention
In order to overcome the deficiencies in the prior art, the object of the present invention is to provide a kind of Programmable Logic Controller based on BACNET agreement and control method thereof, programmable control module is realized in controller inside, make control module initialization realize controlling this locality of controlled plant by download configuration data, greatly reduce probability of failure and reduce controlling time delay.
For solving the problem, the technical solution adopted in the present invention is as follows:
Scheme one:
Based on the Programmable Logic Controller of BACNET agreement, comprising: control module, data configuration module, state acquisition module, input interface module, output interface module, BACNET communication interface and data download interface;
Described data configuration module, for obtaining configuration data by data download interface from the main frame preserving configuration data, inputs in control module by the parameters in configuration data, with initialization control module;
Described control module, for receiving the data that corresponding input interface obtains from input interface module according to configuration data, computing is carried out according to the operational formula that it is preset, and controlled plant corresponding to the operation result obtained export to, to control the duty of controlled plant by output interface corresponding in output interface module; Wherein, the data that corresponding input interface obtains are the current status data of the monitoring equipment corresponding with this input interface;
Described state acquisition module, for obtaining the data in input interface module and output interface module, and by BACNET communications interface transmission to BACNET main control system.
Preferably, described configuration data comprises PID configuration data, switching value computing configuration data, operation of analog quantity configuration data and selects to control configuration data, described control module comprises pid control module, switching value operation control module, operation of analog quantity control module and selects control module, described input interface module comprises analog input interface module and switch value input interface module, and described output interface module comprises analog output interface circuit module and output switch parameter interface module;
Described pid control module, for receiving the data that corresponding analog input interface obtains from analog input interface module according to PID configuration data, carry out computing according to the operational formula that it is preset, and controlled plant corresponding to the operation result obtained export to by analog output interface circuit corresponding in analog output interface circuit module; Or according to the data that the switch value input interface that PID configuration data receives correspondence from switch value input interface module obtains, carry out computing according to the operational formula that it is preset, and controlled plant corresponding to the operation result obtained export to by output switch parameter interface corresponding in output switch parameter interface module;
Described switching value operation control module, for receiving the data that corresponding switch value input interface obtains from switch value input interface module according to switching value computing configuration data, carry out computing according to the operational formula that it is preset, and controlled plant corresponding to the operation result obtained export to by output switch parameter interface corresponding in output switch parameter interface module;
Described operation of analog quantity control module, for receiving the data that corresponding analog input interface obtains from analog input interface module according to operation of analog quantity configuration data, carry out computing according to the operational formula that it is preset, and controlled plant corresponding to the operation result obtained export to by analog output interface circuit corresponding in analog output interface circuit module;
Described selection control module, for the data obtained according to the multiple analog input interfaces selecting control configuration data to receive correspondence from analog input interface module, carry out computing according to the operational formula that it is preset, and controlled plant corresponding to the operation result obtained export to by analog output interface circuit corresponding in analog output interface circuit module.
Preferably, the parameter in PID configuration data comprises: scale parameter, integral parameter, differential parameter, setting value parameter, corresponding analog input interface parameters, corresponding analog output interface circuit parameter, the switch value input interface parameter of correspondence and the output switch parameter interface parameters of correspondence; The operational formula preset in pid control module is generated by PID configuration data;
Parameter in switching value computing configuration data comprises: with computing initiation parameter or computing initiation parameter, inverse initiation parameter, with or computing initiation parameter, XOR initiation parameter, corresponding switch value input interface parameter and corresponding output switch parameter interface parameters; The operational formula preset in switching value operation control module is generated by switching value computing configuration data;
Parameter in operation of analog quantity configuration data comprises: additive operation initiation parameter, subtraction initiation parameter, multiplying initiation parameter, division arithmetic initiation parameter, the analog input interface parameters of correspondence and the analog output interface circuit parameter of correspondence; The operational formula preset in operation of analog quantity control module is generated by operation of analog quantity configuration data.
The parameter controlled in configuration data is selected to comprise: corresponding analog input interface parameters and corresponding analog output interface circuit parameter; The operational formula preset selected in control module is generated by selecting to control configuration data.
Preferably, described BACNET communication interface is RS485 interface.
Preferably, described data download interface is RS232 interface.
Scheme two:
Based on the control method of the Programmable Logic Controller of BACNET agreement, the Programmable Logic Controller based on BACNET agreement comprises: control module, data configuration module, state acquisition module, input interface module, output interface module, BACNET communication interface and data download interface; Control method comprises the following steps:
S1: data configuration module obtains configuration data by data download interface from the main frame preserving configuration data, inputs in control module by the parameters in configuration data, with initialization control module;
S2: the data that the input interface that control module receives correspondence according to configuration data from input interface module obtains, computing is carried out according to the operational formula that it is preset, and controlled plant corresponding to the operation result obtained export to, to control the duty of controlled plant by output interface corresponding in output interface module; Wherein, the data that corresponding input interface obtains are the current status data of the monitoring equipment corresponding with this input interface;
S3: state acquisition module obtains the data in input interface module and output interface module, and by BACNET communications interface transmission to BACNET main control system.
Preferably, described configuration data comprises PID configuration data, switching value computing configuration data, operation of analog quantity configuration data and selects to control configuration data, described control module comprises pid control module, switching value operation control module, operation of analog quantity control module and selects control module, described input interface module comprises analog input interface module and switch value input interface module, and described output interface module comprises analog output interface circuit module and output switch parameter interface module;
In step s 2, if control module is pid control module, the data that the analog input interface then receiving correspondence according to PID configuration data from analog input interface module obtains, carry out computing according to the operational formula that it is preset, and controlled plant corresponding to the operation result obtained export to by analog output interface circuit corresponding in analog output interface circuit module; Or according to the data that the switch value input interface that PID configuration data receives correspondence from switch value input interface module obtains, carry out computing according to the operational formula that it is preset, and controlled plant corresponding to the operation result obtained export to by output switch parameter interface corresponding in output switch parameter interface module;
If control module is switching value operation control module, the data that the switch value input interface then receiving correspondence according to switching value computing configuration data from switch value input interface module obtains, carry out computing according to the operational formula that it is preset, and controlled plant corresponding to the operation result obtained export to by output switch parameter interface corresponding in output switch parameter interface module;
If control module is operation of analog quantity control module, the data that the analog input interface then receiving correspondence according to operation of analog quantity configuration data from analog input interface module obtains, carry out computing according to the operational formula that it is preset, and controlled plant corresponding to the operation result obtained export to by analog output interface circuit corresponding in analog output interface circuit module;
If control module is for selecting control module, then according to the data that the multiple analog input interfaces selecting control configuration data to receive correspondence from analog input interface module obtain, carry out computing according to the operational formula that it is preset, and controlled plant corresponding to the operation result obtained export to by analog output interface circuit corresponding in analog output interface circuit module.
Preferably, the parameter in PID configuration data comprises: scale parameter, integral parameter, differential parameter, setting value parameter, corresponding analog input interface parameters, corresponding analog output interface circuit parameter, the switch value input interface parameter of correspondence and the output switch parameter interface parameters of correspondence; The operational formula preset in pid control module is generated by PID configuration data;
Parameter in switching value computing configuration data comprises: with computing initiation parameter or computing initiation parameter, inverse initiation parameter, with or computing initiation parameter, XOR initiation parameter, corresponding switch value input interface parameter and corresponding output switch parameter interface parameters; The operational formula preset in switching value operation control module is generated by switching value computing configuration data;
Parameter in operation of analog quantity configuration data comprises: additive operation initiation parameter, subtraction initiation parameter, multiplying initiation parameter, division arithmetic initiation parameter, the analog input interface parameters of correspondence and the analog output interface circuit parameter of correspondence; The operational formula preset in operation of analog quantity control module is generated by operation of analog quantity configuration data.
The parameter controlled in configuration data is selected to comprise: corresponding analog input interface parameters and corresponding analog output interface circuit parameter; The operational formula preset selected in control module is generated by selecting to control configuration data.
Preferably, described BACNET communication interface is RS485 interface.
Preferably, described data download interface is RS232 interface.
Compared to existing technology, beneficial effect of the present invention is: realize programmable control module in controller inside, makes control module initialization realize controlling this locality of controlled plant, be no longer dependent on the control of BACNET main frame by download configuration data; After controller realizes local control, when bus malfunctions, controlling functions is still effective, and as there is fan trouble, by local delivery outlet output alarm signal, security improves greatly; After controller realizes local control, BACNET main frame primary responsibility state is checked, be no longer responsible for concrete controlling functions, its burden reduces greatly, and in bus, data volume declines to a great extent, and error code retransmits and will greatly reduce.
Accompanying drawing explanation
Fig. 1 is the structural drawing of Programmable Logic Controller in the embodiment of the present invention.
Fig. 2 is the structural drawing based on pid control module in the embodiment of the present invention.
Fig. 3 is the structural drawing based on switching value operation control module in the embodiment of the present invention.
Fig. 4 is the structural drawing based on operation of analog quantity control module in the embodiment of the present invention.
Fig. 5 is based on the structural drawing selecting control module in the embodiment of the present invention.
Embodiment
Below, by reference to the accompanying drawings and embodiment, the present invention is described further:
With reference to figure 1, the invention discloses a kind of Programmable Logic Controller based on BACNET agreement, comprising: control module, data configuration module, state acquisition module, input interface module, output interface module, BACNET communication interface and data download interface.Data configuration module obtains configuration data by data download interface from the main frame preserving configuration data, inputs in control module by the parameters in configuration data, with initialization control module; The data that the input interface that control module receives correspondence according to configuration data from input interface module obtains, computing is carried out according to the operational formula that it is preset, and controlled plant corresponding to the operation result obtained export to, to control the duty of controlled plant by output interface corresponding in output interface module; State acquisition module obtains the data in input interface module and output interface module, and by BACNET communications interface transmission to BACNET main control system.
Wherein, BACNET communication interface is preferably RS485 interface, data download interface is preferably RS232 interface, control module comprises pid control module, switching value operation control module, operation of analog quantity control module and selects control module, input interface module comprises analog input interface module and switch value input interface module, and output interface module comprises analog output interface circuit module and output switch parameter interface module.
With reference to figure 2, for pid control module, first need first to make pid control module initialization by data configuration module, concrete, data configuration module obtains PID configuration data by data download interface from main frame, and in main frame, itself stored the PID configuration data that developer creates, PID configuration data comprises scale parameter, integral parameter, differential parameter, setting value parameter, corresponding analog input interface parameters, corresponding analog output interface circuit parameter, corresponding switch value input interface parameter and corresponding output switch parameter interface parameters etc., it should be noted that, if do not need digital output modul, then do not need to configure corresponding On-off signal, output parameter, the configuration of Analog control in like manner.Above-mentioned PID configuration data is substantially identical with the configuration principle of existing PID configuration data, does not too much repeat.Especially, above-mentioned generated PID configuration data transfers in data configuration module by converting text file type to again, from the text received, parse the parameters in PID configuration data by data configuration module and write in pid control module, making pid control module initialization.
Just can start normal work after pid control module initialization, be in fact be in circulating working mode, is described with the process in one of them circulation.First, the data obtained from each analog input interface are preserved in analog input interface module, pid control module just can get the data that corresponding analog input interface collects from analog input interface module, the data that analog input interface collects are states of corresponding watch-dog, such as, be provided with temperature sensor in certain equipment, then analog input interface can be the state obtaining this temperature sensor, thus obtains the current temperature status of this equipment.And switch value input interface module and analog input interface module similar, difference be switch value input interface module corresponding be switch value input interface, and switch value input interface corresponding be obtain the on off state of watch-dog, such as obtain the on off state of certain equipment blower fan.No matter be receive analog input data or On-off signal data, all carry out computing according to the operational formula of correspondence and obtain corresponding analog quantity result or switching value result, wherein, operational formula generates according to the parameters of input, identical with the operational formula generating principle in traditional pid control module, be pre-configured.Such as, after obtaining the temperature of certain equipment, corresponding output analog quantity output control corresponds to the aperture of the cold valves of this equipment, to control the temperature of this equipment in stable scope; Such as obtain again the fan switch amount of certain equipment, if this blower fan should be the state be in out, acquisition be but closed condition, then export signal opened to an alarm, make this alarm send chimes of doom.
With reference to figure 3, for switching value operation control module, it to be configured and initialization according to the parameter in switching value computing configuration data, and the parameter in switching value computing configuration data specifically comprises: with computing initiation parameter or computing initiation parameter, inverse initiation parameter, with or computing initiation parameter, XOR initiation parameter, corresponding switch value input interface parameter and corresponding output switch parameter interface parameters; The operational formula preset in switching value operation control module is generated by switching value computing configuration data.Such as, a switching value operation control module configured, be applied to sewer draining to control, when exceeding high water stage, then control the draining simultaneously of two water pumps, when between high water stage and low-water level, then control a pumping drainage, when lower than low-water level, then close all water pumps, high water stage and low-water level are respectively a definite value of artificial definition; First in initialisation switch amount operation control module or computing module and and computing module, data are obtained from the switch value input interface of two switch value input interface module, be designated as the first switch value input interface and second switch amount input interface, wherein the first switch value input interface is used for exporting high level when water level value is greater than high water stage value, otherwise output low level, second switch amount input interface is used for when water level value exports high level higher than during low-water level value, otherwise output low level; Or computing module in receive the signal of these two switch value input interface, with the signal also receiving these two switch value input interface in computing module; Then when water level value is greater than high water stage value, two switch value input interface all export high level, or computing module and be all judged as very with computing module, all export high level and control corresponding pump working; When water level value is between high water stage value and low-water level value, first switch value input interface output low level, second switch amount input interface exports high level, or computing module is judged as really exporting high level, be judged as dummy output low level with computing module, thus only have a pump working; When water level value is lower than low-water level value, two equal output low levels of switch value input interface, or computing module and be all judged as vacation with computing module, equal output low level, thus there is no pump working.
With reference to figure 4, for operation of analog quantity control module, it is configured and initialization according to the parameter in operation of analog quantity configuration data, and the parameter in operation of analog quantity configuration data specifically comprises: additive operation initiation parameter, subtraction initiation parameter, multiplying initiation parameter, division arithmetic initiation parameter, the analog input interface parameters of correspondence and the analog output interface circuit parameter of correspondence; The operational formula preset in operation of analog quantity control module is generated by operation of analog quantity configuration data.Such as, an operation of analog quantity control module configured, needs to obtain the pressure reduction at certain water valve two ends and controls the duty of certain equipment according to different pressure reduction; First the subtraction module in initialization operation of analog quantity control module, data are obtained from the analog input interface of two analog input interface module, one of them analog input interface obtains the force value of water valve one end, another analog input interface obtains the force value of the water valve other end, two force value obtained are subtracted each other and are obtained pressure difference and the equipment being exported to correspondence by corresponding analog output interface circuit by operation of analog quantity control module, thus control the different operating state of this equipment according to the difference of pressure difference.
With reference to figure 5, for selection control module, it is configured and initialization according to the parameter in operation of analog quantity configuration data, selects the parameter controlled in configuration data specifically to comprise: corresponding analog input interface parameters and corresponding analog output interface circuit parameter; The operational formula preset selected in control module is generated by selecting to control configuration data.Such as, a selection control module configured, needs data that the data exported from multiple analog input interface, acquired value is maximum and according to certain equipment of this Data Control; Operational formula then in this selection control module is that data compare the formula obtaining maximal value, by comparing multiple data of input, choosing maximal value and exporting in corresponding equipment by corresponding analog output interface circuit, realizing controlling.
By above-mentioned multiple control modules, meet different computing demands, achieve and this locality of controlled plant is controlled, be no longer dependent on the control of BACNET main frame, and BACNET main frame is only as supervisory function bit, certain interval of time obtains a secondary data, therefore can greatly reduce data and transmit bandwidth used.Concrete, obtain the data in analog input interface module, analog output interface circuit module, switch value input interface module and output switch parameter interface module by state acquisition module, and by BACNET communications interface transmission to BACNET main control system.
The advantage of above-mentioned Programmable Logic Controller is: realize programmable control module in controller inside, makes control module initialization realize controlling this locality of controlled plant, be no longer dependent on the control of BACNET main frame by download configuration data; After controller realizes local control, when bus malfunctions, controlling functions is still effective, and as there is fan trouble, by local delivery outlet output alarm signal, security improves greatly; After controller realizes local control, BACNET main frame primary responsibility state is checked, be no longer responsible for concrete controlling functions, its burden reduces greatly, and in bus, data volume declines to a great extent, and error code retransmits and will greatly reduce.
Corresponding to the above-mentioned Programmable Logic Controller based on BACNET agreement, the invention also discloses its control method, comprise the following steps:
S1: data configuration module obtains configuration data by data download interface from the main frame preserving configuration data, inputs in control module by the parameters in configuration data, with initialization control module;
S2: the data that the input interface that control module receives correspondence according to configuration data from input interface module obtains, computing is carried out according to the operational formula that it is preset, and controlled plant corresponding to the operation result obtained export to, to control the duty of controlled plant by output interface corresponding in output interface module; Wherein, the data that corresponding input interface obtains are the current status data of the monitoring equipment corresponding with this input interface;
S3: state acquisition module obtains the data in input interface module and output interface module, and by BACNET communications interface transmission to BACNET main control system.
Preferably, described configuration data comprises PID configuration data, switching value computing configuration data, operation of analog quantity configuration data and selects to control configuration data, described control module comprises pid control module, switching value operation control module, operation of analog quantity control module and selects control module, described input interface module comprises analog input interface module and switch value input interface module, and described output interface module comprises analog output interface circuit module and output switch parameter interface module;
In step s 2, if control module is pid control module, the data that the analog input interface then receiving correspondence according to PID configuration data from analog input interface module obtains, carry out computing according to the operational formula that it is preset, and controlled plant corresponding to the operation result obtained export to by analog output interface circuit corresponding in analog output interface circuit module; Or according to the data that the switch value input interface that PID configuration data receives correspondence from switch value input interface module obtains, carry out computing according to the operational formula that it is preset, and controlled plant corresponding to the operation result obtained export to by output switch parameter interface corresponding in output switch parameter interface module;
If control module is switching value operation control module, the data that the switch value input interface then receiving correspondence according to switching value computing configuration data from switch value input interface module obtains, carry out computing according to the operational formula that it is preset, and controlled plant corresponding to the operation result obtained export to by output switch parameter interface corresponding in output switch parameter interface module;
If control module is operation of analog quantity control module, the data that the analog input interface then receiving correspondence according to operation of analog quantity configuration data from analog input interface module obtains, carry out computing according to the operational formula that it is preset, and controlled plant corresponding to the operation result obtained export to by analog output interface circuit corresponding in analog output interface circuit module;
If control module is for selecting control module, then according to the data that the multiple analog input interfaces selecting control configuration data to receive correspondence from analog input interface module obtain, carry out computing according to the operational formula that it is preset, and controlled plant corresponding to the operation result obtained export to by analog output interface circuit corresponding in analog output interface circuit module.
Preferably, the parameter in PID configuration data comprises: scale parameter, integral parameter, differential parameter, setting value parameter, corresponding analog input interface parameters, corresponding analog output interface circuit parameter, the switch value input interface parameter of correspondence and the output switch parameter interface parameters of correspondence; The operational formula preset in pid control module is generated by PID configuration data;
Parameter in switching value computing configuration data comprises: with computing initiation parameter or computing initiation parameter, inverse initiation parameter, with or computing initiation parameter, XOR initiation parameter, corresponding switch value input interface parameter and corresponding output switch parameter interface parameters; The operational formula preset in switching value operation control module is generated by switching value computing configuration data;
Parameter in operation of analog quantity configuration data comprises: additive operation initiation parameter, subtraction initiation parameter, multiplying initiation parameter, division arithmetic initiation parameter, the analog input interface parameters of correspondence and the analog output interface circuit parameter of correspondence; The operational formula preset in operation of analog quantity control module is generated by operation of analog quantity configuration data.
The parameter controlled in configuration data is selected to comprise: corresponding analog input interface parameters and corresponding analog output interface circuit parameter; The operational formula preset selected in control module is generated by selecting to control configuration data.
To one skilled in the art, according to technical scheme described above and design, other various corresponding change and deformation can be made, and all these change and deformation all should belong within the protection domain of the claims in the present invention.