A status indication device for industrial configuration based on Internet of Things
By realizing two-way communication between JAVA and HTML/Javascript scripts and the canvas technology of Fabricjs in the configuration primitives, dynamic configuration and analysis of status indication devices solve the problems of fixed configuration parameters and monotonous graphic display of traditional configuration primitives, and achieve Efficient and diverse configuration display effects.
Patent Information
- Application Number
- CN202210831473.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-15
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2042-07-15
AI Technical Summary
The configuration parameters of traditional configuration primitives are fixed, the dynamic attribute support range is limited, the graphic display is monotonous, and cannot adapt to the needs of diverse equipment parameters. The professional graphics library is insufficient, resulting in unintuitive configuration effects and inconvenient operations.
By establishing two-way communication between the JAVA main program of the monitoring system and the Javascript script in the HTML page, the dynamic configuration and analysis of the status indication device is realized. It supports third-party data in Json format and graphic component libraries in Internet resources, and uses the canvas component library of Fabricjs. Build a web configuration page that supports user-defined pictures and dynamic attribute variables, and combines Angular to build a graphic element library and drag and drop events to achieve rich interface interaction effects.
It realizes the dynamic configuration of graphic element attributes, adapts to the frequent update requirements of large-screen systems, provides beautiful interface interaction effects and rich functions, supports flexible dynamic attributes, and improves the diversity and intuitiveness of configuration display.
Smart Images

Figure CN115202540B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of web interface design, and in particular to a state indicating device for industrial configuration based on the Internet of Things. Background Art
[0002] Configuration is to use software tools to configure various resources such as computer hardware and software, and then the computer or software automatically performs specific actions according to the pre-set settings to meet the user's requirements. Traditional configuration primitives are generally divided into three simple objects: lines, graphics, and text. These objects have their own appearance attributes, and the basic attributes include: line color, graphic color, height, width, direction, coordinates, etc. Attributes can be static or dynamic. Static attributes remain unchanged during configuration operation, and dynamic attributes change in real time with changes in system variables (device parameters). Finally, in the operating environment, according to the primitive category and its configuration attributes, it is manifested as different graphic elements.
[0003] There are many problems with traditional configuration elements:
[0004] 1) Fixed configuration parameters, limited support range for dynamic attributes, and monotonous graphic display due to the system image library;
[0005] 2) It does not support attribute configuration and cannot adapt to device parameters with diverse display effect requirements;
[0006] 3) There are few available professional graphic libraries, which causes inconvenience to operators and the configuration effect is not intuitive.
[0007] In view of the above-mentioned deficiencies of configuration design, the present invention proposes a status indication device for industrial configuration based on the Internet of Things. Summary of the invention
[0008] In order to make up for the defects of the prior art, the present invention provides a simple and efficient status indication device for industrial configuration based on the Internet of Things.
[0009] The present invention is achieved through the following technical solutions:
[0010] A status indicator device based on the Internet of Things for industrial configuration, characterized in that: a two-way communication between the JAVA main program of the monitoring system and the Javascript script in the HTML page is established to realize the operation of the status indicator device, and the parameters and variable information of the status indicator device are transmitted in real time, so that the status indicator device can be dynamically configured and parsed, thereby adapting to the large-screen system where the front-end display information needs to be frequently updated;
[0011] At the same time, it supports any third-party data in Json format, various graphic component libraries in Internet resources and pictures uploaded by users, and the dynamic attribute variable data is flexible;
[0012] Finally, the web configuration page is built based on Javascript and fabricjs's canvas component library, giving the web page beautiful interface interaction effects and rich functions.
[0013] The present invention provides a method for implementing a status indication device of an industrial configuration based on the Internet of Things, comprising the following steps:
[0014] Step S1, using Angular to build a graphic library, loading the graphic library when the configuration page is initialized, adding a drag event for the status indicator control in the graphic library, and establishing a call to the graphic object by the user operation;
[0015] Step S2: Build a canvas through fabricjs to realize the embedded interaction of graphics elements, set the canvas attribute selectable to true, support mouse events, and support the operation of graphics elements in the following steps;
[0016] Step S3, adding a click event to the configuration element to monitor the user's editing operation on the configuration element;
[0017] Step S4: Based on the event monitoring in step S3, when the user adds or clicks the status indicator control in the configuration, a property panel pops up;
[0018] Step S5: Based on the property panel of step S4, preview different status indication effects according to the status indication primitive type selected by the user;
[0019] Step S6: Based on the status indication preview of step S5, the system supports setting the corresponding relationship between the variable value and the status code, and adding animation to the graphic element to enhance the display effect;
[0020] Step S7: Bind system parameters in the order of gateway-device-parameters, and store the gateway, device and parameters into primitive attributes;
[0021] Step S8, based on the parameter binding of step S7, set the status indication parameter; select the variable value, the corresponding status code and the preview effect, first encrypt the variable value-status code-preview effect string through base64 and store it in the primitive, and then store the primitive in the configuration;
[0022] Step S9: After the configuration is put into operation, the Javascript script creates an mqtt client, subscribes to device data from the cloud server, and parses the data according to the predetermined format after monitoring it;
[0023] Step S10, parsing the gateway-device-parameters bound to the status indication primitive, and calculating the actual variable value of the status indication primitive according to the device data parsed in step S7;
[0024] Step S11, using the mapping table of variable value-status code-animation stored in step S8, determining the picture that the current graphic element should display as a status indication;
[0025] Step S12: Use the setSrc method of fabricjs to replace the image path of the status indication element to achieve the effect of updating the configuration screen.
[0026] In the step S1, the status indicator control supports display with different types of graphics, including but not limited to circular indicator lights, bar indicator lights and icon indicator lights, and the user selects the simulation graphics according to the actual scene.
[0027] In step S2, in order to ensure that the user only has browsing authority on the current page, the selectable attribute is set to false in the running interface.
[0028] In step S4, the control logic of the property panel is adaptive according to the configuration control, and the setting items in the property panel support registered controls; when the activated control is in the registration list of the setting item, the user has the operation authority of the setting item.
[0029] In step S5, the system displays the pictures of the status prompt graphic elements of the same category, and uses the picture category plus the status code to form the picture name. When switching the status code preview, the Javascript script maps the status code to the picture path to achieve the graphic element preview effect.
[0030] In step S6, when the captured data reaches the threshold condition, the animate function of fabricjs is used to control the regular light and dark switching of the configuration primitive to achieve a flickering effect.
[0031] In the step S5, while setting the primitives for the Boolean variables, it also supports setting the int and string type data; a threshold setting method is provided for judgment, and the status of variables of different data types is indicated.
[0032] In order to more clearly express the status of the configuration device, a default state is set for each indicator control; when the configuration is initialized and loaded, during the waiting process from data connection to screen rendering, the status indicator control does not display according to the logic of true or false, but displays the default state.
[0033] The beneficial effects of the present invention are as follows: the status indication device of the industrial configuration based on the Internet of Things not only facilitates the division of labor and system integration of developers, but also can build hybrid applications, so that the status indication device is seamlessly embedded in the web configuration, and an efficient and easy-to-use web configuration interface is drawn. At the same time, the attributes of the graphic elements can be dynamically configured, and it can adapt to the large-screen system that needs to frequently update the configuration screen. The dynamic attribute support is flexible and diverse, and is suitable for promotion and application. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0035] Attached Figure 1 This is a schematic diagram of a setting page of a property panel of a status indication device of the present invention.
[0036] Attached Figure 2 This is a schematic diagram of the value-status code setting page of the present invention. DETAILED DESCRIPTION
[0037] In order to enable those skilled in the art to better understand the technical solutions in the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0038] The industrial configuration status indicator based on the Internet of Things establishes two-way communication between the JAVA main program of the monitoring system and the Javascript script in the HTML page to realize the operation of the status indicator and transmit the status indicator parameters and variable information in real time, so that the status indicator can be dynamically configured and parsed, thereby adapting to the large-screen system where the front-end display information needs to be frequently updated;
[0039] At the same time, it supports any third-party data in Json format, various graphic component libraries in Internet resources and pictures uploaded by users, and the dynamic attribute variable data is flexible;
[0040] Finally, the web configuration page is built based on Javascript and fabricjs's canvas component library, giving the web page beautiful interface interaction effects and rich functions.
[0041] The implementation method of the state indication device of the industrial configuration based on the Internet of Things comprises the following steps:
[0042] Step S1, using Angular to build a graphic library, loading the graphic library when the configuration page is initialized, adding a drag event for the status indicator control in the graphic library, and establishing a call to the graphic object by the user operation;
[0043] In the step S1, the status indicator control supports display with different types of graphics, including but not limited to circular indicator lights, bar indicator lights and icon indicator lights, and the user selects the simulation graphics according to the actual scene.
[0044] Step S2: Build a canvas through fabricjs to realize the embedded interaction of graphics elements, set the canvas attribute selectable to true, support mouse events, and support the operation of graphics elements in the following steps;
[0045] In step S2, in order to ensure that the user only has browsing authority on the current page, the selectable attribute is set to false in the running interface.
[0046] Step S3, adding a click event to the configuration element to monitor the user's editing operation on the configuration element;
[0047] Step S4: Based on the event monitoring in step S3, when the user adds or clicks the status indicator control in the configuration, a property panel pops up;
[0048] In step S4, the control logic of the property panel is adaptive according to the configuration control, and the setting items in the property panel support registered controls; when the activated control is in the registration list of the setting item, the user has the operation authority of the setting item.
[0049] Step S5: Based on the property panel of step S4, preview different status indication effects according to the status indication primitive type selected by the user;
[0050] If the graphic element is a light bulb type, it corresponds to red and green states, and the status codes are 1 and 2 respectively; if the graphic element is a button type, it corresponds to 1-7 states, and the status codes are 1-7 digits respectively.
[0051] In step S5, the system uses the image category plus the status code to form the image name for the images of the same category of status prompt graphic elements, such as the above light bulb images are light1.png and light2.png; buttons are button1.png and button2.png, etc. When switching the status code preview, the Javascript script maps the status code to the image path to achieve the graphic element preview effect.
[0052] Step S6: Based on the status indication preview of step S5, the system supports setting the corresponding relationship between the variable value and the status code, and adding animation to the graphic element to enhance the display effect;
[0053] For example, if some scenes require the status indicator light to use a flashing effect, you can set the flashing option to "On".
[0054] In step S6, when the captured data reaches the threshold condition, the animate function of fabricjs is used to control the regular light and dark switching of the configuration primitive to achieve a flickering effect;
[0055] Step S7: Taking the light bulb graphic element as an example, bind the system parameters in the order of gateway-device-parameters, and store the gateway, device and parameters into the graphic element attributes;
[0056] Step S8, based on the parameter binding of step S7, set the status indication parameters; select the variable value (machine operation parameter value) as 1, the corresponding status code as 1, the preview effect (also the actual operation effect) as green, first encrypt the variable value-status code-preview effect string through base64 and store it in the primitive, and then store the primitive in the configuration;
[0057] Step S9: After the configuration is put into operation, the Javascript script creates an mqtt client, subscribes to device data from the cloud server, and parses the data according to the predetermined format after monitoring it;
[0058] Step S10, parsing the gateway-device-parameters bound to the status indication primitive, and calculating the actual variable value of the status indication primitive according to the device data parsed in step S7;
[0059] Step S11, using the mapping table of variable value-status code-animation stored in step S8, determining the picture that the current graphic element should display as a status indication;
[0060] Step S12: Use the setSrc method of fabricjs to replace the image path of the status indication element to achieve the effect of updating the configuration screen.
[0061] In step S5, while setting the primitives for variables of Boolean values, it also supports setting the int and string type data; a threshold setting method is provided for judgment, for example, the range 1-10 corresponds to status code 1, 11-20 corresponds to status code 2, etc. Similarly, the status indication is performed for variables of different data types.
[0062] In order to more clearly express the status of the configuration device, a default state is set for each indicator control; when the configuration is initialized and loaded, during the waiting process from data connection to screen rendering, the status indicator control does not display according to the logic of true or false, but displays the default state.
[0063] For example, a light bulb is displayed in green when it is on and in red when it is off. If the data is not connected, that is, the status of the light bulb is unknown, it should be displayed in gray. The same is true for other status indicator controls.
[0064] Compared with the prior art, the industrial configuration status indication device based on the Internet of Things has the following characteristics:
[0065] 1) Based on Javascript and HTML Canvas technology, it has beautiful interface interaction effects and powerful functions, and can draw efficient and easy-to-use web configuration interfaces.
[0066] 2) Based on Fabricjs' instant printing technology, two-way communication between JAVA and HTML / Javascript scripts is realized, and at the same time, the decoupling of JAVA and HTML / Javascript scripts is realized, which is convenient for developers to divide labor and integrate systems. JAVA is combined with HTML, Javascript scripts and CSS to build a hybrid application, so that the status indication device can be seamlessly embedded in the web configuration.
[0067] 3) A method for implementing embedded Web configuration graphics elements is proposed, so that the attributes of the graphics elements can be dynamically configured, which can adapt to large-screen systems where the configuration screen needs to be frequently updated; the dynamic attributes support is flexible and diverse, supporting any third-party data in Json format; and supporting the use of various graphic component libraries in Internet resources.
[0068] The embodiment described above is only one specific implementation of the present invention. Common changes and substitutions made by those skilled in the art within the scope of the technical solution of the present invention should be included in the protection scope of the present invention.
Claims
1. A status indication device for industrial configuration based on the Internet of Things, characterized in that: Establish two-way communication between the monitoring system JAVA main program and the Javascript script in the HTML page to realize the operation of the status indicator device and transmit the status indicator device parameters and variable information in real time, so that the status indicator device can be dynamically configured and parsed, and then adapt to the large-screen system where the front-end display information needs to be frequently updated; At the same time, it supports any third-party data in Json format, various graphic component libraries in Internet resources and pictures uploaded by users, and the dynamic attribute variable data is flexible; Finally, the web configuration page is built based on Javascript and fabricjs canvas component library to make the web page have interface interaction effects; The specific steps include: Step S1, using Angular to build a graphic library, loading the graphic library when the configuration page is initialized, adding a drag event for the status indication control in the graphic library, and establishing a call to the graphic object by the user operation; Step S2: Build a canvas through fabricjs to realize the embedded interaction of graphics elements, set the canvas attribute selectable to true, support mouse events, and support the operation of graphics elements in the following steps; Step S3, adding a click event to the configuration element to monitor the user's editing operation on the configuration element; Step S4: Based on the event monitoring in step S3, when the user adds or clicks the status indicator control in the configuration, a property panel pops up; Step S5: Based on the property panel of step S4, preview different status indication effects according to the status indication primitive type selected by the user; Step S6: Based on the status indication preview of step S5, the system supports setting the corresponding relationship between the variable value and the status code, and adding animation to the graphic element to enhance the display effect; Step S7: Bind system parameters in the order of gateway-device-parameters, and store the gateway, device and parameters into primitive attributes; Step S8, based on the parameter binding of step S7, set the status indication parameter; select the variable value, the corresponding status code and the preview effect, first encrypt the variable value-status code-preview effect string through base64 and store it in the primitive, and then store the primitive in the configuration; Step S9: After the configuration is put into operation, the Javascript script creates an mqtt client, subscribes to device data from the cloud server, and parses the data according to the predetermined format after monitoring it; Step S10, parsing the gateway-device-parameters bound to the status indication primitive, and calculating the actual variable value of the status indication primitive according to the device data parsed in step S7; Step S11, using the mapping table of variable value-status code-animation stored in step S8, determining the picture that the current graphic element should display as a status indication; Step S12: Use the setSrc method of fabricjs to replace the image path of the status indication element to achieve the effect of updating the configuration screen.
2. The method for implementing the state indication device of the industrial configuration based on the Internet of Things according to claim 1 is characterized in that: In the step S1, the status indicator control supports display with different types of graphics, including but not limited to circular indicator lights, bar indicator lights and icon indicator lights, and the user selects the simulation graphics according to the actual scene.
3. The method for implementing the state indication device of the industrial configuration based on the Internet of Things according to claim 1 is characterized in that: In step S2, in order to ensure that the user only has browsing authority on the current page, the selectable attribute is set to false in the running interface.
4. The method for implementing the state indication device of the industrial configuration based on the Internet of Things according to claim 1 is characterized in that: In step S4, the control logic of the property panel is adaptive according to the configuration control, and the setting items in the property panel support registered controls; when the activated control is in the registration list of the setting item, the user has the operation authority of the setting item.
5. The method for implementing the state indication device of industrial configuration based on the Internet of Things according to claim 1 is characterized in that: In step S5, the system displays the pictures of the status prompt graphic elements of the same category, and uses the picture category plus the status code to form the picture name. When switching the status code preview, the Javascript script maps the status code to the picture path to achieve the graphic element preview effect.
6. The method for implementing the state indication device of industrial configuration based on the Internet of Things according to claim 1 is characterized in that: In step S6, when the captured data reaches the threshold condition, the animate function of fabricjs is used to control the regular light and dark switching of the configuration primitive to achieve a flickering effect.
7. The method for implementing the state indication device of industrial configuration based on the Internet of Things according to claim 1 is characterized in that: In the step S5, while setting the primitives for the Boolean variables, it also supports setting the int and string type data; a threshold setting method is provided for judgment, and the status of variables of different data types is indicated.
8. The method for implementing the state indication device of industrial configuration based on the Internet of Things according to claim 1, characterized in that: In order to more clearly express the status of the configuration device, a default state is set for each indicator control; when the configuration is initialized and loaded, during the waiting process from data connection to screen rendering, the status indicator control does not display according to the logic of true or false, but displays the default state.
Citation Information
Patent Citations
Implementation method of embedded Web configuration primitive
CN112231608A
