Disclosure of Invention
The embodiment of the invention provides a method and a device for analyzing configuration information, which are used for solving the problem of poor flexibility caused by association and fixation of a load and a control module in the prior art, thereby achieving the purpose of flexibly configuring the module and a port.
In one aspect, a method for analyzing configuration information is provided, including:
Receiving configuration information of a load;
acquiring a first message part and a second message part from the configuration information;
Analyzing the port type and the port position from the first message part;
And analyzing the number of the expansion modules from the second message part, and determining the module type of the control module associated with the configuration information.
In one embodiment, obtaining the first message part and the second message part from the configuration information includes:
and taking the lower eight bits of the configuration information as the first message part and the upper eight bits of the configuration information as the second message part.
In one embodiment, parsing the port type and port location from the first message portion includes:
Determining a port type according to the upper three bits of the first message part;
And determining the port position according to the lower five bits of the first message part.
In one embodiment, analyzing the number of the expansion modules from the second message part, and determining the module type of the control module associated with the configuration information includes:
Converting the upper eight bits of the configuration information into numerical values;
under the condition that the value is 0, determining the control module associated with the configuration information as a main module, and under the condition that the value is not 0, determining the control module associated with the configuration information as an extension module;
and converting the highest value of the values converted from the upper eight bits in the configuration messages of the loads as the number of the expansion modules.
In one embodiment, after analyzing the number of the expansion modules from the second message part and determining the module type of the control module associated with the configuration information, the method further includes:
under the condition that the control module associated with the configuration information is determined to be the main module, the port information is directly processed through the main module;
And under the condition that the control module associated with the configuration information is an expansion module, transmitting the port information to the associated expansion module for processing through the determined port position.
In another aspect, there is provided a configuration information parsing apparatus, including:
the receiving module is used for receiving the configuration information of the load;
The acquisition module is used for acquiring a first message part and a second message part from the configuration information;
the first analyzing module is used for analyzing the port type and the port position from the first message part;
And the second analysis module is used for analyzing the number of the expansion modules from the second message part and determining the module type of the control module associated with the configuration information.
In one embodiment, the acquiring module is specifically configured to use the lower eight bits of the configuration information as the first message portion and the upper eight bits of the configuration information as the second message portion.
In one embodiment, the first parsing module includes:
a first determining unit, configured to determine a port type according to the upper three bits of the first message portion;
and the second determining unit is used for determining the port position according to the lower five bits of the first message part.
In still another aspect, there is provided an air conditioning unit including: the configuration information analysis device.
In yet another aspect, a network device is provided, comprising: memory, a processor and a computer program stored on the memory and executable on the processor, which processor implements the steps of the above method when executing the computer program.
In yet another aspect, a non-transitory computer readable storage medium is provided, on which a computer program is stored which, when executed by a processor, implements the steps of the above method.
In the above embodiment, the port type, the port position, the module type of the associated control module and other information are identified through the data of different positions in the configuration information, so that flexible port configuration and control module type setting can be performed according to requirements, and only when analysis is performed, analysis is performed according to a preset analysis rule, so that the problem of poor flexibility caused by the association and fixation of the existing load and the control module is solved, and the technical effect of flexibly configuring the port configuration and the control module type is achieved.
Detailed Description
The present invention will be described in further detail with reference to the following embodiments and the accompanying drawings, in order to make the objects, technical solutions and advantages of the present invention more apparent. The exemplary embodiments of the present invention and the descriptions thereof are used herein to explain the present invention, but are not intended to limit the invention.
In order to realize flexible configuration of the ports and the modules, a set of configuration rules of configuration information can be set, then, one configuration information is configured for each load, and the configuration of the ports and the loads can be completed in one step through analysis of the configuration information.
For example, each load may carry a 16-bit interface configuration information according to the following configuration rules:
1) A 16-bit configuration information is defined, wherein the upper 8 bits consist of module sequence numbers and the lower 8 bits consist of channel locations.
Wherein, the upper 8 bits: the serial number of the main module is 0, the serial number of the expansion module 1 is 1, and the serial numbers are sequentially increased according to the order of the expansion modules. The lower 8 bits: the upper 3 bits are the signal type, 0: NC,1: input, 2: AO,3: DO, the lower 5 bits are the module positions, and are orderly ordered according to the module channel positions.
2) Ordering rules:
AI can be arranged in the X channel and AI channel, AO can be arranged in the AO channel only, DO can be arranged in the DO channel only, and DI can be arranged in the X channel and DI channel.
The first controller input is ordered by X1...X (m 1), DI1..DI (n 1) starting at 1, i.e., X1 is numbered 1 and DI (n 1) is numbered m1+n1; the second controller input is ordered by X1...X (m 2), DI1..DI (n 2), AI1..AI (j 2) starting with 1, i.e., X1 is numbered 1, AI (j 2) is numbered m2+n2+j2.AO, DO are ordered by sequence number per se, the first controller AO1 sequence number 1, AO (i 1) sequence number i1, the second controller AO1 sequence number 1, AO (i 2) sequence number i1. The first controller DO1 is numbered 1, DO (l 1) is numbered l1, the second controller DO1 is numbered 1, DO (l 2) is numbered l2.
Based on this, in this example, a configuration information parsing method is provided, as shown in fig. 1, which may include the following steps:
Step 101: receiving configuration information of a load;
Step 102: acquiring a first message part and a second message part from the configuration information;
Step 103: analyzing the port type and the port position from the first message part;
Step 104: and analyzing the number of the expansion modules from the second message part, and determining the module type of the control module associated with the configuration information.
Specifically, the lower eight bits of the configuration information may be used as the first message portion, and the upper eight bits of the configuration information may be used as the second message portion.
Correspondingly, parsing the port type and the port position from the first message part may include: determining a port type according to the upper three bits of the first message part; and determining the port position according to the lower five bits of the first message part. The analyzing the number of the expansion modules from the second message part and determining the module type of the control module associated with the configuration information may include: converting the upper eight bits of the configuration information into numerical values; under the condition that the value is 0, determining the control module associated with the configuration information as a main module, and under the condition that the value is not 0, determining the control module associated with the configuration information as an extension module; and converting the highest value of the values converted from the upper eight bits in the configuration messages of the loads as the number of the expansion modules.
Namely, in the upper 8 bits, the serial number of the main module is 0, the serial number of the expansion module 1 is 1, and the serial numbers are sequentially increased according to the order of the expansion modules, so that whether the related modules belong to the main module or the expansion modules can be represented through the upper 8 bits, and when the expansion modules need to be newly added, the related modules can be represented through the upper 8 bits.
When the method is realized, the number of the expansion modules is analyzed from the second message part, the module type of the control module related to the configuration information is determined, and then the port information is directly processed through the main module under the condition that the control module related to the configuration information is determined to be the main module; and under the condition that the control module associated with the configuration information is an expansion module, transmitting the port information to the associated expansion module for processing through the determined port position.
The above method is described below in connection with a specific embodiment, however, it should be noted that this specific embodiment is only for better illustrating the present application and is not meant to be a undue limitation on the present application.
In this example, two types of controllers are provided, and unlike the existing manner of fixing a main module and an extension module, the main module of the controller provided by this example can be used as an extension module, the extension module can be used as a main module, as shown in fig. 2, the extension module is used as an extension of an IO port of the main module, and one main module can be provided with a plurality of extension modules.
As shown in fig. 3, there are a plurality of loads (load 1, load 2, load 3 …, load n) in the system, and by analyzing the load information into load configuration, port configuration and load position allocation can be realized.
In the conventional port configuration method, the information of each port of the hardware is configured first, and then the load is distributed to the configured ports according to the requirement, in this example, a mode of combining the steps of configuring the ports and selecting the port positions by the load is provided, that is, each load which may occur carries optional port information, when the load is selected, the configuration of each port of the hardware can be completed by having the load information, and the position selection of the load is completed.
Specifically, in this example, two kinds of configurable controller interface configuration rules are provided, and the two kinds of controllers can be used not only as a main module but also as an extension module respectively.
The first controller is provided with 4 port types, an X terminal, a DI terminal, a DO terminal and an AO terminal, and the controller is provided with m 1X terminals, n1 DI terminals, l1 DO terminals and i1 AO terminals respectively;
The second controller is provided with 5 interface types, X, AI, DI, DO and AO, respectively, assuming that the controller has m 2X, n2 DI, l2 DO, i2 AO, j2 AI terminals, respectively. The X terminal, DI terminal, AI terminal are combined into one type, noted as input, as shown in table 1 below:
TABLE 1
| Terminal type/controller type | X terminal | DI terminal | DO terminal | AO terminal | AI terminal |
| First kind of controller | m1 | n1 | l1 | i1 | / |
| Second controller | m2 | n2 | l2 | i2 | j2 |
The configuration rules are as follows:
1) A 16-bit configuration information is defined, wherein the upper 8 bits consist of module sequence numbers and the lower 8 bits consist of channel locations.
Wherein, the upper 8 bits: the serial number of the main module is 0, the serial number of the expansion module 1 is 1, and the serial numbers are sequentially increased according to the order of the expansion modules. The lower 8 bits: the upper 3 bits are the signal type, 0: NC,1: input, 2: AO,3: DO, the lower 5 bits are the module positions, and are orderly ordered according to the module channel positions.
2) Ordering rules:
AI can be arranged in the X channel and AI channel, AO can be arranged in the AO channel only, DO can be arranged in the DO channel only, and DI can be arranged in the X channel and DI channel.
The first controller input is ordered by X1...X (m 1), DI1..DI (n 1) starting at 1, i.e., X1 is numbered 1 and DI (n 1) is numbered m1+n1; the second controller input is ordered by X1...X (m 2), DI1..DI (n 2), AI1..AI (j 2) starting with 1, i.e., X1 is numbered 1, AI (j 2) is numbered m2+n2+j2.AO, DO are ordered by sequence number per se, the first controller AO1 sequence number 1, AO (i 1) sequence number i1, the second controller AO1 sequence number 1, AO (i 2) sequence number i1. The first controller DO1 is numbered 1, DO (l 1) is numbered l1, the second controller DO1 is numbered 1, DO (l 2) is numbered l2.
3) Each load carries a 16-bit interface configuration information, and besides, the AI/AO type interface also fixedly carries a 16-bit signal type information, a 16-bit engineering quantity lower limit value and other configuration information, and if no configuration exists, the above information is 0.
Based on the configuration rule, the port configuration may be performed according to the flow shown in fig. 4:
s1: the upper computer sends the 16-bit configuration information of the load to the main module for unified reception;
s2: analyzing the information of the low eight bits, and dividing the information into high three bits and low five bits;
s3: analyzing the high three bits, obtaining the port type, and connecting and disconnecting the low five bits to obtain the port position;
s4: analyzing the high eight bits, acquiring the number of the expansion modules, and dividing configuration information into two types of main modules and expansion modules;
s5: and under the condition that the configuration information is the main module, the port information is directly processed, and under the condition that the configuration information is the new extension module, the low five-bit communication is sent to the extension module for processing.
In the above example, two types of controllers are provided, both controllers can be used as a main module or an extension module by means of configuration information, the types and the numbers of ports can be configured more flexibly, and the configuration of the ports and the loads can be completed in one step by setting information represented by different bits of the configuration information, so that the configuration is more flexible, the configuration method is simpler, and the number of hardware ports can be changed compatibly.
Based on the same inventive concept, the embodiment of the invention also provides a configuration information analysis device, which is described in the following embodiment. Because the principle of the configuration information analysis device for solving the problem is similar to that of the configuration information analysis method, the implementation of the configuration information analysis device can refer to the implementation of the configuration information analysis method, and the repetition is omitted. As used below, the term "unit" or "module" may be a combination of software and/or hardware that implements the intended function. While the means described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated. Fig. 5 is a block diagram of a configuration information parsing apparatus according to an embodiment of the present invention, as shown in fig. 5, may include: the structure of the receiving module 501, the acquiring module 502, the first analyzing module 503, and the second analyzing module 504 will be described below.
A receiving module 501, configured to receive configuration information of a load;
An obtaining module 502, configured to obtain a first message part and a second message part from the configuration information;
a first parsing module 503, configured to parse a port type and a port location from the first message portion;
and a second parsing module 504, configured to parse the number of extension modules from the second message portion, and determine a module type of the control module associated with the configuration information.
In one embodiment, the obtaining module 502 may specifically be configured to use the lower eight bits of the configuration information as the first message portion and the upper eight bits of the configuration information as the second message portion.
In one embodiment, the first parsing module 503 may include: a first determining unit, configured to determine a port type according to the upper three bits of the first message portion; and the second determining unit is used for determining the port position according to the lower five bits of the first message part.
In one embodiment, the second parsing module 504 may be specifically configured to convert the upper eight bits of the configuration information into a numerical value; under the condition that the value is 0, determining the control module associated with the configuration information as a main module, and under the condition that the value is not 0, determining the control module associated with the configuration information as an extension module; and converting the highest value of the values converted from the upper eight bits in the configuration messages of the loads as the number of the expansion modules.
In one embodiment, the configuration information analyzing device may be further configured to directly process port information through the main module when determining that the control module associated with the configuration information is the main module after analyzing the number of extension modules from the second message part and determining the module type of the control module associated with the configuration information; and under the condition that the control module associated with the configuration information is an expansion module, transmitting the port information to the associated expansion module for processing through the determined port position.
In another embodiment, there is also provided software for executing the technical solutions described in the foregoing embodiments and preferred embodiments.
In another embodiment, there is also provided a storage medium having the software stored therein, including but not limited to: optical discs, floppy discs, hard discs, erasable memory, etc.
From the above description, it can be seen that the following technical effects are achieved in the embodiments of the present invention: the port type, the port position, the module type of the associated control module and other information are identified through the data of different positions in the configuration information, so that flexible port configuration and control module type setting can be carried out according to requirements, and only the analysis is carried out according to a preset analysis rule when the analysis is carried out, thereby solving the problem of poor flexibility caused by the association and fixation of the existing load and the control module, and achieving the technical effect of flexible configuration of the port configuration and the control module type.
Although various embodiments are described in this disclosure, the present application is not limited to the specific embodiments described in the industry standard or examples, and some industry standard or embodiments modified by the use of custom or embodiment described herein may achieve the same, equivalent or similar results as the embodiments described in the embodiments described above, or as expected after modification. Examples of data acquisition, processing, output, judgment, etc. using these modifications or variations are still within the scope of alternative embodiments of the present application.
Although the application provides method operational steps as described in the examples or flowcharts, more or fewer operational steps may be included based on conventional or non-inventive means. The order of steps recited in the embodiments is merely one way of performing the order of steps and does not represent a unique order of execution. When implemented by an apparatus or client product in practice, the methods illustrated in the embodiments or figures may be performed sequentially or in parallel (e.g., in a parallel processor or multi-threaded processing environment, or even in a distributed data processing environment). The terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, it is not excluded that additional identical or equivalent elements may be present in a process, method, article, or apparatus that comprises a described element.
The apparatus or module, etc. set forth in the above embodiments may be implemented in particular by a computer chip or entity, or by a product having a certain function. For convenience of description, the above devices are described as being functionally divided into various modules, respectively. Of course, when implementing the present application, the functions of each module may be implemented in the same or multiple pieces of software and/or hardware, or a module implementing the same function may be implemented by a combination of multiple sub-modules. The above-described apparatus embodiments are merely illustrative, and the division of the modules is merely a logical function division, and there may be additional divisions when actually implemented, for example, multiple modules or components may be combined or integrated into another system, or some features may be omitted or not performed.
Those skilled in the art will also appreciate that, in addition to implementing the controller in a pure computer readable program code, it is well possible to implement the same functionality by logically programming the method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers, etc. Such a controller can be regarded as a hardware component, and means for implementing various functions included therein can also be regarded as a structure within the hardware component. Or even means for achieving the various functions may be regarded as either software modules implementing the methods or structures within hardware components.
The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, classes, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
From the above description of embodiments, it will be apparent to those skilled in the art that the present application may be implemented in software plus a necessary general hardware platform. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a mobile terminal, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments of the present application.
Various embodiments in this specification are described in a progressive manner, and identical or similar parts are all provided for each embodiment, each embodiment focusing on differences from other embodiments. The application is operational with numerous general purpose or special purpose computer system environments or configurations. For example: personal computers, server computers, hand-held or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like.
Although the present application has been described by way of examples, one of ordinary skill in the art will recognize that there are many variations and modifications of the present application without departing from the spirit of the application, and it is intended that the appended embodiments encompass such variations and modifications without departing from the application.