A method and device for converting data units
By setting metadata standards and indicator instantiation in CIM, automatic conversion of units in the data processing layer and visualization layer is realized, which solves the problem of inconsistent data units in multiple systems, improves data processing efficiency and accuracy, and adapts to the legal unit system. Require.
Patent Information
- Application Number
- CN202111592591.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-23
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2041-12-23
AI Technical Summary
In the process of data access, aggregation and comparison of multiple systems and enterprises, inconsistent data units lead to increased difficulty in data governance. In addition, the existing technology's data visualization unit conversion logic is complex and inefficient, and cannot adapt to Chinese legal units and international unit systems. requirements, resulting in inappropriate data display and low accuracy.
The data unit conversion method based on CIM is adopted, and by setting metadata standards and indicator instantiation, automatic conversion of units in the data processing layer and visualization layer is realized. Scientific notation and unit prefixes are used for data conversion to ensure data accuracy and logical efficiency.
It achieves unified unit conversion of multi-source heterogeneous data, reduces maintenance costs, improves data processing efficiency, ensures data accuracy and the regularity of the visual interface, and adapts to the requirements of Chinese legal units and the international system of units.
Smart Images

Figure CN114385540B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of data processing, and in particular to a data unit conversion method and device. Background Art
[0002] my country's legal measurement units include the International System of Units and other measurement units selected by the country. The International System of Units (SI) is widely adopted internationally, and a system consisting of 7 basic quantities has been selected. All derived quantities can be derived from these 7 basic quantities. The dimensions of the 7 basic quantities are respectively expressed by length L, mass M, time T, current intensity I, temperature θ, amount of substance n and light intensity J.
[0003] CIM (Common Information Model) is an important component of World Wide Web-based Enterprise Management (WBEM). It is a standard for defining devices and applications so that system administrators and management programs can control devices and applications from different manufacturers and sources in the same way. In order to adapt to a wide range of application scenarios, industry standards, enterprise user habits, and meter types, and to facilitate the use of on-site implementation personnel and designers, when configuring the initial unit of a certain indicator, it is allowed to be freely configured under the same dimension (data unit classification). Therefore, in the process of data access, aggregation, and comparison of multiple systems and multiple enterprises, it is necessary to convert the unit of each data, which invisibly increases the difficulty of multi-source heterogeneous data governance. At the same time, the data and unit combination of indicators are often inappropriate, and the values are too large or too small on the visualization interface. When the value is too large, the data exceeds the convenience, and when the value is too small, it is displayed as 0, and the visualization data is distorted.
[0004] In order to solve the above data maintenance problems, the present disclosure proposes a data unit conversion method based on CIM and international unit prefixes, including two application directions: unit conversion at the data processing layer and unit conversion at data visualization. Summary of the invention
[0005] In view of this, the purpose of the present disclosure is to provide a data unit conversion method, device, electronic device and computer-readable storage medium to solve the problems raised in the above background technology.
[0006] To achieve the above objectives, the present disclosure provides the following technical solutions:
[0007] According to a first aspect of an embodiment of the present disclosure, a data unit conversion method is provided, the method comprising:
[0008] Setting metadata standards in CIM, wherein setting metadata standards includes setting dimensions and units of metadata, and there is only one base unit under one dimension, and the base unit is a unit with an empty unit prefix;
[0009] Instantiate the access data indicators through the CIM standard, and map the instantiated indicators to the encoding of the access data through the CIM indicator metadata, and configure them through data item mapping or calculation expressions.
[0010] Convert the initial units of instantiated indicators to default units;
[0011] Visual unit conversion of instantiated indicators. On the premise of data unit conversion, set the number of visualized integer and decimal places, and then perform scientific notation conversion. According to the unit prefix corresponding to the replacement phrase in the result, assemble the default unit of the indicator to achieve visual automatic conversion of units.
[0012] A second aspect of the embodiments of the present disclosure provides a data unit conversion device, including:
[0013] A standard setting module is configured to set metadata standards in CIM, wherein setting metadata standards includes setting the dimension and unit of metadata, and there is only one base unit under one dimension, and the base unit selects a unit with an empty unit prefix;
[0014] The indicator instantiation module is configured to instantiate the indicators of the access data through the model standard, correspond the instantiated indicators to the encoding of the access data through the indicator metadata, and configure them through data item mapping or calculation expression;
[0015] A default unit conversion module, configured to convert an initial unit of an instantiated indicator into a default unit;
[0016] The unit conversion module is configured to perform visual unit conversion of instantiated indicators. Under the premise of unit conversion of data, the number of visualized integer and decimal places is set, and then scientific notation conversion is performed. According to the unit prefix corresponding to the replacement phrase in the result, the default unit of the indicator is assembled to achieve visual unit conversion.
[0017] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0018] According to a fourth aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0019] Compared with the prior art, the embodiments of the present disclosure have at least the following beneficial effects:
[0020] (1) The present disclosure can realize unified unit conversion of multi-source heterogeneous data based on CIM, reduce the cost of later maintenance and personnel maintenance, and achieve less or even no maintenance in the later stage. The unified conversion of data can be completed upon data access.
[0021] (2) The present disclosure adopts unit conversion of visual data, which is more in line with the provisions of China's legal units and the International System of Units, while improving the efficiency of conversion logic and being able to quickly process massive amounts of data; the number of displayed digits of the target value is controllable, so that the visual interface can ensure regularity while having higher data accuracy.
[0022] (3) In the data processing layer, the present invention automatically converts the initial unit + value of the instantiated indicator of the CIM standard into the default unit + value of the instantiated indicator according to the dimension unit metadata (including conversion coefficient) in the CIM and the default unit set in the indicator metadata in accordance with the set data precision; in the data visualization layer, the value is converted in accordance with the scientific notation method according to the set number of display data digits (integer, decimal), and the default unit is converted into the unit prefix + default unit according to the relationship between the unit prefix and the Nth power of 10, thereby realizing the automatic conversion and carry of the value + unit in the data visualization layer. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, 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 only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0024] Figure 1 A flowchart of a data unit conversion method provided in an embodiment of the present disclosure;
[0025] Figure 2 A schematic diagram of a process for converting an initial unit of an instantiation indicator into a default unit provided in an embodiment of the present disclosure;
[0026] Figure 3 A schematic diagram of a flow chart of a unit conversion model provided in an embodiment of the present disclosure;
[0027] Figure 4 A schematic diagram of a flow chart of a data unit conversion device provided in an embodiment of the present disclosure;
[0028] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0029] In the following description, specific details such as specific system structures and technologies are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present disclosure. However, it should be clear to those skilled in the art that the present disclosure may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obstructing the description of the present disclosure with unnecessary details.
[0030] A data unit conversion method and device according to an embodiment of the present disclosure will be described in detail below with reference to the accompanying drawings.
[0031] In the process of data conversion, the most common data processing is data unit consistency processing and data visualization unit conversion.
[0032] (1) Data unit consistency processing: When the data units of multi-source heterogeneous data are inconsistent, programmers need to develop and set conversion parameters based on the initial design units to process unit conversion. When the set units of the data source change (such as the replacement and upgrade of on-site meters), the conversion parameters need to be modified synchronously, which requires a lot of manual processing work.
[0033] (2) Data visualization unit conversion: Automatically convert data measurement units according to data size, automatically calculate and convert data units by setting data basic information and conversion rules. It is necessary to establish unit conversion rules and set the upper and lower limits of the absolute value of each unit to determine whether the data is too large or too small and needs to be converted.
[0034] From the above two parts, we can know that there are two types of shortcomings in the processing process:
[0035] (1) When the amount of data to be processed is very large, the workload of manual configuration and maintenance is large, the cost is high, the inspection is difficult, and the bit error rate is high. At the same time, because the parameters need to be set manually, the subsequent maintenance cost is high.
[0036] (2) The existing technology of data visualization unit conversion has the problem that the logic is relatively complex and there are many judgment conditions, resulting in low efficiency and unsuitable for processing large amounts of data. In addition, the standards and rules are poorly adapted to the docking of Chinese legal units and the international system of units.
[0037] The disclosed embodiment provides a data unit conversion method based on CIM and unit prefixes. The method, at the data processing layer, automatically converts the initial unit + value of the CIM standard instantiated indicator into the default unit + value of the instantiated indicator according to the default unit set by the dimensional unit metadata (including the conversion coefficient) in the CIM and the indicator metadata according to the set data precision; at the data visualization layer, the value is converted in scientific notation according to the set number of display data digits (integer, decimal), and the default unit is converted into the unit prefix + default unit according to the relationship between the unit prefix and the Nth power of 10, so as to realize the automatic conversion and carry of the value + unit at the data visualization layer.
[0038] Figure 1 A data unit conversion method provided by the present disclosure is shown, and the method is applied to a device that can connect to the Internet in real time, and the device can be a mobile phone, a tablet computer, a computer, and other communication devices, which are not specifically limited here. The method includes the following steps:
[0039] S101, setting metadata standards in CIM, wherein setting metadata standards includes setting dimensions and units of metadata, and there is only one base unit under one dimension, and the base unit is a unit with an empty unit prefix.
[0040] S102, instantiate the access data indicators through the CIM standard, correspond the instantiated indicators to the encoding (code or IO number) of the access data through the indicator metadata of CIM, and configure them through data item mapping or calculation expression.
[0041] S103: Convert the initial unit of the instantiation indicator into a default unit.
[0042] S104, visualized unit conversion of instantiated indicators. On the premise of data unit conversion, the visualized integer and decimal places are set, and then scientific notation is converted. According to the unit prefix corresponding to the replacement phrase in the result, the default unit of the indicator is assembled to realize the visualized automatic conversion of the unit.
[0043] Scientific notation is also called scientific notation. It is a method of counting. A number is expressed as a multiplication of a and 10 to the power of n (1≤|a|<10, a is not a fraction, n is an integer). This method of counting is called scientific notation. For example: 19971400000000=1.99714×10^13. Calculators or computers generally use E or e to express 10 powers, that is, 1.99714E13=19971400000000.
[0044] (1) Setting metadata standards in CIM
[0045] Setting dimension metadata table
[0046] Dimension ID Dimension name Dimensional type Export Representation L length Basic amount M Torque Export volume Nm
[0047] Set unit metadata table
[0048]
[0049] Among them, only one base unit is allowed under one dimension. The base unit must be a unit with an empty unit prefix. The conversion method is divided into no conversion / fixed conversion / floating conversion. When no conversion and floating conversion are used, the multiplication coefficient and addition coefficient are empty.
[0050] Setting indicator metadata table
[0051] Indicator name CIM Coding Numeric Types dimension Default Units Maximum current Imax Double precision Current intensity [A] Phase A current I A Double precision Current intensity [A] Phase B current IB Double precision Current intensity [A]
[0052] Setting unit vocabulary
[0053]
[0054]
[0055] Note: Symbol prefixes and replacement phrases are used as conversion items for visual unit conversion.
[0056] The unit prefixes are compiled with reference to the International Unit Prefixes (SI Prefixes) and the unit prefixes commonly used in my country.
[0057] (2) Relying on CIM standards to instantiate indicators for access data
[0058] Relying on the indicator metadata of CIM, the instantiated indicator (object + indicator) corresponds to the code or IO number of the access data. It can be configured by data item mapping or calculation expression.
[0059] In order to reduce the difficulty of personnel configuration and meet usage requirements, indicators are allowed to be instantiated, and the set initial units are custom configured within the same dimension of the default units of the indicators. Therefore, it is recommended that the initial units of the instantiated indicators be consistent with the data access source.
[0060] refer to Figure 2 , the specific steps to convert the initial unit of the instantiated indicator into the default unit are:
[0061] (1) Obtain the value and initial unit of the instantiated indicator;
[0062] (2) Calling the general unit conversion module to perform unit conversion;
[0063] (3) The instantiated indicator conversion results are stored in a database (historical database or data center).
[0064] Among them, the unit conversion module is a general model that is abstracted and summarized for wide application in multiple software applications. It supports batch data processing capabilities and can process massive indicators at the same time with the support of multiple processes. Figure 3 As shown, the specific design is as follows:
[0065] Model input parameters:
[0066] Data name, value, initial unit, target unit (optional).
[0067] Model output parameters:
[0068] Data name, result value, initial unit, target unit, result identifier, message.
[0069] Model logic diagram:
[0070] Step 1: Determine whether the target unit is empty. If it is empty, go to step 2. If it is not empty, go to step 3.
[0071] Step 2: Get the default unit from the CIM indicator metadata by instantiating the indicator name as the target unit. If the acquisition fails, the conversion fails and the result 005 is returned. If the acquisition succeeds, proceed to step 3.
[0072] Step 3: Obtain all unit lists and conversion parameter information under the same dimension from the unit metadata of CIM through the target unit. If the query fails, the conversion failure returns result 004. If the query succeeds, proceed to step 4;
[0073] Step 4: Check whether the initial unit is in the obtained unit list under the same dimension. If not, the conversion fails and the result 003 is returned. If the check succeeds, go to step 5.
[0074] Step 5: Check the unit conversion method. If there is no conversion method, the conversion fails and the result 007 is returned. If it is a fixed conversion method, go to step 6. If it is a floating conversion method, go to step 7.
[0075] Step 6: Determine whether the original unit is consistent with the target unit. If they are consistent, the conversion is successful and the result 002 is returned; if they are inconsistent, go to step 8;
[0076] Step 7: After obtaining the floating parameter information of the business configuration and completing the conversion coefficient, execute step 8, such as floating parameters such as standard coal conversion coefficient and carbon emission coefficient;
[0077] Step 8: Perform unit conversion according to the unit conversion calculation rules; after the conversion is successful, the result 001 is returned.
[0078] Unit conversion calculation rules:
[0079] P' = ((P * multiplication factor A + addition factor A) - addition factor B) / multiplication factor B
[0080] Among them, P' is the value after conversion, and P is the value before conversion.
[0081] A is the original unit and B is the target unit.
[0082] For example, the maximum current (index) before conversion is 100kA (current), and the default unit of the maximum current is MA. The unit kA coefficient in the dimension current is (10^3, 0), and the unit MA coefficient is (10^6, 0); therefore, the maximum current (index) after conversion = ((100*(10^3)+0)-0) / (10^6) = 0.1MA.
[0083] Return result rules:
[0084]
[0085] (4) Visualization unit conversion of instantiated indicators
[0086] The indicator visualization process, under the premise of data unit conversion, sets the number of visualized integer and decimal places, and then performs scientific notation conversion (format requirement sample 12.34E8). According to the unit prefix corresponding to the replacement phrase in the result, assemble the default unit of the indicator to realize the automatic conversion of the unit visualization.
[0087] Step 1: Get the value + storage unit of the instantiated indicator. It depends on the result in method (3). If there is no special requirement, the storage unit is the default unit of the indicator.
[0088] Step 2: Convert the value of the instantiated indicator into a shorthand format (E+, E-) according to the set integer and decimal places.
[0089] Step 3: In text format, extract the characters after "E" in the scientific notation value, correspond them to the replacement phrases in the unit prefix table, obtain the corresponding unit prefix, and combine it with the default unit to form a display unit. Return the extracted value and the new unit to the visualization interface for display.
[0090] It is noteworthy that in this disclosure:
[0091] (1) The design of CIM metadata standard meets the standards of Chinese legal units and the International System of Units.
[0092] (2) Data processing layer: the model method and processing process of unit conversion can be used independently without CIM standard. At the same time, the model supports batch processing capabilities.
[0093] (3) The data visualization layer is based on text processing of unit prefixes (including "100 million" and so on) and scientific notation. It has wide applicability and can be used independently without the CIM standard.
[0094] In some other preferred embodiments of the present disclosure:
[0095] The CIM standard can be replaced by power information model, equipment information model, city information model, master data information model, etc.
[0096] Data processing methods can be packaged using big data processing methods such as data scheduling tools and AI strategy algorithms.
[0097] Unit prefixes may be replaced by other standard lists of unit prefixes with the same purpose.
[0098] The beneficial effects of the embodiments of the present disclosure include at least:
[0099] (1) The embodiments of the present disclosure can realize unified unit conversion of multi-source heterogeneous data based on CIM, reduce the cost of later maintenance and personnel maintenance, and achieve less or even no maintenance in the later stage. The unified conversion of data can be completed upon data access.
[0100] (2) The disclosed embodiment adopts unit conversion of visual data, which is more in line with the provisions of China's legal units and the International System of Units, while improving the efficiency of conversion logic and being able to quickly process massive amounts of data; the number of displayed digits of the target value is controllable, so that the visual interface can ensure regularity while having higher data accuracy.
[0101] (3) In the data processing layer, the embodiments of the present disclosure automatically convert the initial unit + value of the instantiated indicator of the CIM standard into the default unit + value of the instantiated indicator according to the dimension unit metadata (including conversion coefficient) in the CIM and the default unit set in the indicator metadata according to the set data precision; in the data visualization layer, the value is converted according to the scientific notation method according to the set number of display data digits (integer, decimal), and the default unit is converted into the unit prefix + default unit according to the relationship between the unit prefix and the Nth power of 10, thereby realizing the automatic conversion and carry of the value + unit in the data visualization layer.
[0102] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.
[0103] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present disclosure.
[0104] The following are embodiments of the device disclosed herein, which can be used to execute the method embodiments disclosed herein. For details not disclosed in the device embodiments disclosed herein, please refer to the method embodiments disclosed herein.
[0105] Figure 4 Schematic diagram of a data unit conversion device provided by an embodiment of the present disclosure. Figure 4 As shown, the data unit conversion device includes a standard setting module 401, an indicator instantiation module 402, a default unit conversion module 403 and a unit conversion module 404. Among them, the standard setting module 401 is configured to set metadata standards in CIM, and the setting metadata standards includes setting the dimension and unit of metadata, and there is only one base unit under one dimension, and the base unit selects a unit with an empty unit prefix. The indicator instantiation module 402 is configured to instantiate the access data through the model standard, and correspond the instantiated indicator to the encoding of the access data through the indicator metadata, and configure it through data item mapping or calculation expression. The default unit conversion module 403 is configured to convert the initial unit of the instantiated indicator into the default unit. The unit conversion module 404 is configured to instantiate the visualized unit conversion of the indicator. Under the premise of unit conversion of the data, the visualized integer digits and decimal digits are set, and then the scientific notation conversion is performed. According to the unit prefix corresponding to the replacement phrase in the result, the default unit of the indicator is assembled to realize the visualized unit conversion.
[0106] In some embodiments, the default unit conversion module 403 is specifically configured to: obtain the value and initial unit of the instantiated indicator; call the general unit conversion model to perform unit conversion; and store the instantiated indicator conversion result in the database.
[0107] In some embodiments, the specific design of the universal unit conversion model is as follows:
[0108] Step 1: Determine whether the target unit is empty. If it is empty, go to step 2. If it is not empty, go to step 3.
[0109] Step 2: By instantiating the indicator name, obtain its default unit from the indicator metadata of CIM as the target unit. If the acquisition fails, the conversion fails and the result 005 is returned. If the acquisition is successful, go to step 3.
[0110] Step 3: Obtain all unit lists and conversion parameter information under the same dimension from the unit metadata of CIM through the target unit. If the query fails, the conversion fails and the result 004 is returned. If the query succeeds, go to step 4.
[0111] Step 4: Check whether the initial unit is in the obtained unit list under the same dimension. If not, the conversion fails and the result 003 is returned. If yes, go to step 5.
[0112] Step 5: Check the unit conversion method. If there is no conversion method, the conversion fails and the result 007 is returned. If it is a fixed conversion method, go to step 6. If it is a floating conversion method, go to step 7.
[0113] Step 6: Determine whether the original unit is consistent with the target unit. If they are consistent, the conversion is successful and the result 002 is returned; if they are inconsistent, go to step 8;
[0114] Step 7: After obtaining the floating parameter information of the business configuration and completing the conversion coefficient, proceed to step 8;
[0115] Step 8: Perform unit conversion according to the unit conversion calculation rules. After the conversion is successful, the result 001 is returned.
[0116] In some embodiments, the unit conversion module 404 is specifically configured to: obtain the numerical value and storage unit of the instantiated indicator; convert the numerical value of the instantiated indicator into a shorthand format (E+, E-) according to the set number of integer digits and decimal places; truncate the characters after "E" in the scientific notation value in text format, correspond them to the replacement phrases in the unit prefix table, obtain the corresponding unit prefix, and merge it with the default unit into a display unit, and return the truncated numerical value and new unit to the visualization interface for display.
[0117] Figure 5 Schematic diagram of an electronic device 5 provided in an embodiment of the present disclosure. Figure 5 As shown, the electronic device 5 of this embodiment includes: a processor 501, a memory 502, and a computer program 503 stored in the memory 502 and executable on the processor 501. When the processor 501 executes the computer program 503, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 501 executes the computer program 503, the functions of the modules / units in the above-mentioned device embodiments are implemented.
[0118] Exemplarily, the computer program 503 may be divided into one or more modules / units, which are stored in the memory 502 and executed by the processor 501 to complete the present disclosure. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program 503 in the electronic device 5.
[0119] The electronic device 5 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 5 may include, but is not limited to, a processor 501 and a memory 502. Those skilled in the art will appreciate that Figure 5 It is only an example of the electronic device 5 and does not constitute a limitation of the electronic device 5. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device may also include input and output devices, network access devices, buses, etc.
[0120] The processor 501 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
[0121] The memory 502 may be an internal storage unit of the electronic device 5, for example, a hard disk or memory of the electronic device 5. The memory 502 may also be an external storage device of the electronic device 5, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 5. Further, the memory 502 may also include both an internal storage unit of the electronic device 5 and an external storage device. The memory 502 is used to store computer programs and other programs and data required by the electronic device. The memory 502 may also be used to temporarily store data that has been output or is to be output.
[0122] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0123] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0124] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this disclosure.
[0125] In the embodiments provided in the present disclosure, it should be understood that the disclosed devices / electronic devices and methods can be implemented in other ways. For example, the device / electronic device embodiments described above are merely schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation. Multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection of devices or units, which may be electrical, mechanical or other forms.
[0126] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0127] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0128] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present disclosure implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, and the computer program code may be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electric carrier signals and telecommunication signals.
[0129] The above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should all be included in the protection scope of the present disclosure.
Claims
1. A data unit conversion method, characterized in that: The method comprises: Setting metadata standards in CIM, wherein setting metadata standards includes setting dimensions and units of metadata, and there is only one base unit under one dimension, and the base unit is a unit with an empty unit prefix; Instantiate the access data indicators through the CIM standard, and map the instantiated indicators to the encoding of the access data through the CIM indicator metadata, and configure them through data item mapping or calculation expressions. Convert the initial units of instantiated indicators to default units; Visual unit conversion of instantiated indicators. On the premise of data unit conversion, set the number of visualized integer and decimal places, and then perform scientific notation conversion. According to the unit prefix corresponding to the replacement phrase in the result, assemble the default unit of the indicator to achieve visual automatic conversion of units. The converting the initial unit of the instantiated indicator into the default unit includes: Get the value and initial unit of the instantiated indicator; Call the general unit conversion model to perform unit conversion; The instantiated index conversion results are stored in the database; The specific design of the general unit conversion model is as follows: Step 1: Determine whether the target unit is empty. If it is empty, go to step 2. If it is not empty, go to step 3. Step 2: By instantiating the indicator name, obtain its default unit from the indicator metadata of CIM as the target unit. If the acquisition fails, the conversion fails and the result 005 is returned. If the acquisition is successful, go to step 3. Step 3: Obtain all unit lists and conversion parameter information under the same dimension from the unit metadata of CIM through the target unit. If the query fails, the conversion fails and the result 004 is returned. If the query succeeds, go to step 4. Step 4: Check whether the initial unit is in the obtained unit list under the same dimension. If not, the conversion fails and the result 003 is returned. If yes, go to step 5. Step 5: Check the unit conversion method. If there is no conversion method, the conversion fails and the result 007 is returned. If it is a fixed conversion method, go to step 6. If it is a floating conversion method, go to step 7. Step 6: Determine whether the original unit is consistent with the target unit. If they are consistent, the conversion is successful and the result 002 is returned; if they are inconsistent, go to step 8; Step 7: After obtaining the floating parameter information of the business configuration and completing the conversion coefficient, proceed to step 8; Step 8: Convert units according to the unit conversion calculation rules. After the conversion is successful, the result 001 is returned.
2. The method according to claim 1, characterized in that The unit conversion calculation rules are as follows: P' = ((P * multiplication factor A + addition factor A) - addition factor B) / multiplication factor B Among them, P' is the converted value, P is the value before conversion, A is the original unit, and B is the target unit.
3. The method according to claim 1, characterized in that Unit conversion methods include no conversion, fixed conversion and floating conversion. When no conversion and floating conversion are used, the multiplication coefficient and addition coefficient are empty.
4. The method according to claim 1, characterized in that: The visualization unit conversion of the instantiation indicator includes: Get the value and storage unit of the instantiated indicator; Convert the value of the instantiated indicator into a shorthand format (E+, E-) according to the set integer and decimal places; The characters after "E" in the scientific notation value are intercepted in text format, and matched to the replacement phrases in the unit prefix table to obtain the corresponding unit prefix, and combined with the default unit into a display unit, and the intercepted value and new unit are returned to the visualization interface for display.
5. The method according to claim 4, characterized in that In the process of converting the units of the instantiated indicator visualization, the storage unit is the indicator default unit.
6. A data unit conversion device, characterized in that: include: A standard setting module is configured to set metadata standards in CIM, wherein setting metadata standards includes setting the dimension and unit of metadata, and there is only one base unit under one dimension, and the base unit selects a unit with an empty unit prefix; The indicator instantiation module is configured to instantiate the indicators of the access data through the model standard, correspond the instantiated indicators to the encoding of the access data through the indicator metadata, and configure them through data item mapping or calculation expression; A default unit conversion module, configured to convert an initial unit of an instantiated indicator into a default unit; The unit conversion module is configured to perform visual unit conversion of instantiated indicators. Under the premise of unit conversion of data, the number of visualized integer digits and decimal digits is set, and then scientific notation conversion is performed. According to the unit prefix corresponding to the replacement phrase in the result, the default unit of the indicator is assembled to realize visual unit conversion; The default unit conversion module is specifically configured to: obtain the value and initial unit of the instantiated indicator; call the universal unit conversion model to perform unit conversion; and store the instantiated indicator conversion result in the database. The specific design of the universal unit conversion model is as follows: Step 1: Determine whether the target unit is empty. If it is empty, go to step 2. If it is not empty, go to step 3. Step 2: By instantiating the indicator name, obtain its default unit from the indicator metadata of CIM as the target unit. If the acquisition fails, the conversion fails and the result 005 is returned. If the acquisition is successful, go to step 3. Step 3: Obtain all unit lists and conversion parameter information under the same dimension from the unit metadata of CIM through the target unit. If the query fails, the conversion fails and the result 004 is returned. If the query succeeds, go to step 4. Step 4: Check whether the initial unit is in the obtained unit list under the same dimension. If not, the conversion fails and the result 003 is returned. If yes, go to step 5. Step 5: Check the unit conversion method. If there is no conversion method, the conversion fails and the result 007 is returned. If it is a fixed conversion method, go to step 6. If it is a floating conversion method, go to step 7. Step 6: Determine whether the original unit is consistent with the target unit. If they are consistent, the conversion is successful and the result 002 is returned; if they are inconsistent, go to step 8; Step 7: After obtaining the floating parameter information of the business configuration and completing the conversion coefficient, proceed to step 8; Step 8: Convert units according to the unit conversion calculation rules. After the conversion is successful, the result 001 is returned.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
