CN113687863B - Device state adjustment method, system and storage medium - Google Patents

Device state adjustment method, system and storage medium Download PDF

Info

Publication number
CN113687863B
CN113687863B CN202110970669.3A CN202110970669A CN113687863B CN 113687863 B CN113687863 B CN 113687863B CN 202110970669 A CN202110970669 A CN 202110970669A CN 113687863 B CN113687863 B CN 113687863B
Authority
CN
China
Prior art keywords
switching
state
value
equipment
working state
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110970669.3A
Other languages
Chinese (zh)
Other versions
CN113687863A (en
Inventor
王兴华
包卿
薛立俊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mingdu Zhiyun Zhejiang Technology Co Ltd
Original Assignee
Mingdu Zhiyun Zhejiang Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Mingdu Zhiyun Zhejiang Technology Co Ltd filed Critical Mingdu Zhiyun Zhejiang Technology Co Ltd
Priority to CN202110970669.3A priority Critical patent/CN113687863B/en
Publication of CN113687863A publication Critical patent/CN113687863A/en
Application granted granted Critical
Publication of CN113687863B publication Critical patent/CN113687863B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30094Condition code generation, e.g. Carry, Zero flag
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30003Arrangements for executing specific machine instructions

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • General Factory Administration (AREA)

Abstract

本发明公开了一种设备状态调整方法、系统和存储介质,包括获取计时器超时组态中的超限切换信息,如果当前的第一工作状态符合第三切换起始值,遍历存储有预设切换步骤信息的JSON数组,如果存在起始状态为第三切换起始值、结束状态为第三切换结束值,且切换事件为第四动作编码的切换流程数据则获取当前的设备状态实时值,如处于切换状态值预设区间内则获取计时器超时组态中的第一工作状态对应的已使用到期时间和系统当前时间戳,如果已使用到期时间大于系统当前时间戳则放弃切换,否则将设备切换至第三工作状态。实现根据不同操作或不同当前状态等各种原因进行设备不同状态的切换,避免出现切换状态错误从而导致设备生产可靠性低的问题。

The present invention discloses a device state adjustment method, system and storage medium, including obtaining over-limit switching information in a timer timeout configuration, if the current first working state meets the third switching start value, traversing a JSON array storing preset switching step information, if there is a switching process data with a start state of the third switching start value, an end state of the third switching end value, and a switching event of the fourth action code, then obtaining the current device state real-time value, if it is within the preset interval of the switching state value, then obtaining the used expiration time and the system current timestamp corresponding to the first working state in the timer timeout configuration, if the used expiration time is greater than the system current timestamp, then giving up switching, otherwise switching the device to the third working state. Switching of different states of the device is achieved according to various reasons such as different operations or different current states, avoiding the problem of low equipment production reliability caused by switching state errors.

Description

Device state adjusting method, system and storage medium
Technical Field
The present invention relates to the field of industrial automation, and in particular, to a method, a system, and a storage medium for adjusting a device state.
Background
With the development of computer technology, more and more business systems have been applied to our industrial process, and we can process various businesses through the business systems. During the production process of industrial equipment, various states exist, such as a cleaning state, a checking state or a using state of the equipment, and the like, and transition is caused between the various states of the equipment for various reasons. In the actual process of industrial production, various industrial equipment can be used, and the equipment can be switched in different states according to various reasons such as different operations or different current states, however, as the factors involved in the switching of the equipment states are more, the switching state errors often occur, so that the production reliability of the equipment is low.
Disclosure of Invention
The invention provides a device state adjusting method aiming at the defects in the prior art, which comprises the following steps:
S1, acquiring state configuration of verified equipment at fixed time, traversing each state transition of the equipment, and acquiring out-of-limit switching information in the out-of-limit configuration of a timer if the out-of-limit configuration of the timer exists, wherein the out-of-limit switching information comprises a third switching start value, a third switching end value and a fourth action code;
S2, acquiring the current working state of the equipment according to the equipment identity information, and entering the next step if the current first working state accords with a third switching starting value;
S3, traversing the JSON array stored with the preset switching step information, and entering the next step if switching flow data with a starting state of a third switching start value, an ending state of the third switching end value and a switching event of a fourth action code exists;
s4, acquiring a current equipment state real-time value, judging whether the equipment state real-time value is in a switching state value preset interval of a first working state, and entering the next step if the equipment state real-time value is in the switching state value preset interval;
S5, acquiring the used expiration time and the current time stamp of the system corresponding to the first working state in the timeout configuration of the timer, if the used expiration time is greater than the current time stamp of the system, giving up switching, otherwise, switching the equipment to the third working state.
Preferably, the step S5 specifically includes:
S51, acquiring the used period time and the current time stamp of the system corresponding to the first working state in the overtime configuration of the timer, and if the used period time is smaller than or equal to the current time stamp of the system, acquiring the total switching times in the overrun configuration of the counter and the switching times of the first working state at present;
S52, if the total switching times are greater than the switched times, switching the equipment to a third working state;
And S53, if the total switching times is equal to or less than the switched times, acquiring a second switching start value and a second switching end value in the overrun configuration of the counter, judging whether the second switching start value is the same as a third switching start value or a third switching end value, if so, switching the equipment to a third working state, otherwise, determining the working state to which the equipment is to be switched according to overrun switching information and counting overrun switching information in the overrun configuration of the counter.
Preferably, the step S53 specifically includes:
S531, if the second switching start value is the same as the third switching end value, switching the equipment to a second working state corresponding to the second switching end value;
S532, if the second switching start value is the same as the third switching start value, selecting according to the preset switching end value sequence, and switching the equipment to the working state corresponding to the switching end value with the prior sequence.
Preferably, the device state adjustment method further includes the steps of:
Acquiring a reset instruction for switching equipment from a third working state to a first working state, wherein the reset instruction comprises equipment identity information to be switched and a state parameter ID of the third working state;
Acquiring a right code list corresponding to the reset instruction sending account, searching whether a reset working state right code exists in the right code list, and entering the next step if the reset working state right code exists;
Acquiring a third action code of a reset instruction, traversing the JSON array stored with preset switching step information, and entering the next step if switching flow data of which the starting value corresponds to the third working state, the ending value corresponds to the first working state and the switching event is the third action code exists;
Acquiring a current equipment state real-time value of the equipment, judging whether the equipment state real-time value is in a switching state value preset interval of a third working state, resetting the equipment back to the first working state if the equipment state real-time value is in the switching state value preset interval, and otherwise, abandoning the resetting.
The invention also discloses a device state adjustment system, which comprises a timeout configuration query module, a starting state verification module, an array traversal verification module, a device state verification module, a timer state verification module and a timer state verification module, wherein the timeout configuration query module is used for acquiring the state configuration of verified devices at regular time, traversing each state transition of the devices, acquiring overrun switching information in the timeout configuration of the timers if the timeout configuration of the timers exists, the timeout switching information comprises a third switching starting value, a third switching ending value and a fourth action code, the starting state verification module is used for acquiring the current working state of the devices according to the device identity information, judging whether the current first working state accords with the third switching starting value, and traversing the JSON array stored with preset switching step information, judging whether the starting state is the third switching starting value, the ending state is the third switching ending value and the switching event is the switching flow data of the fourth action code, the timer state verification module is used for acquiring the real-time value of the current device state, judging whether the real-time value of the device state is in the preset section of the switching state value of the first working state, the timer verification module is used for acquiring the used time corresponding to the first working state of the timeout configuration of the devices until the current working state of the devices is in the preset section of the first working state, and the current time stamp is abandoned when the current working state of the system is in the third working state, and the system is in the time stamp is in the state, if the current working state is in the state is larger than the state.
Preferably, the timing verification module specifically comprises a switching frequency acquisition module, a first switching module and a second switching module, wherein the switching frequency acquisition module is used for acquiring the used expiration time and the current timestamp of the system corresponding to the first working state in the overtime configuration of the timer, acquiring the total switching frequency in the overtime configuration of the counter and the switching frequency of the first working state when the used expiration time is smaller than or equal to the current timestamp of the system, the first switching module is used for switching the equipment to the third working state when the total switching frequency is larger than the switching frequency, the second switching module is used for acquiring the second switching starting value and the second switching ending value in the overtime configuration of the counter when the total switching frequency is equal to or smaller than the switching frequency, judging whether the second switching starting value is the same as the third switching starting value or the third switching ending value, switching the equipment to the third working state when the used expiration time is smaller than or equal to the current timestamp of the system, and determining the working state to be switched to by the equipment according to the overtime switching information and the counting overtime switching information in the overtime configuration of the counter.
Preferably, the second switching module specifically includes a first judging module configured to switch the device to a second working state corresponding to a second switching end value when the second switching start value is the same as the third switching end value, and a second judging module configured to select according to a preset switching end value ranking when the second switching start value is the same as the third switching start value, and switch the device to the working state corresponding to the ranked previous switching end value.
Preferably, the second switching module specifically comprises a reset instruction obtaining module, a permission checking module, a switching flow checking module and a state value judging module, wherein the reset instruction obtaining module is used for obtaining a reset instruction for switching equipment from a third working state to a first working state, the reset instruction comprises equipment identity information to be switched and a state parameter ID of the third working state, the permission checking module is used for obtaining a permission code list corresponding to a reset instruction sending account, judging whether a permission code of the reset working state exists in the permission code list, the switching flow checking module is used for obtaining the third working state of the reset instruction, traversing a JSON array stored with preset switching step information, judging whether switching flow data with a start value corresponding to the third working state, an end value corresponding to the first working state and a switching event being the third working state exists or not, and the state value judging module is used for obtaining a current equipment state real-time value of the equipment, judging whether the equipment state real-time value is in a preset section of the switching state value of the third working state and resetting the equipment to the first working state in the preset section of the switching state.
The invention also discloses a device state adjusting device, which comprises a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the processor realizes the steps of the device state adjusting method when executing the computer program.
The invention also discloses a computer readable storage medium storing a computer program which when executed by a processor implements the steps of the device state adjustment method as described above.
According to the device state adjusting method and system disclosed by the invention, the working state of the device is determined whether to be switched by acquiring the authority coding list corresponding to the conversion instruction sending account, judging whether the conversion instruction sending account authority, the switching flow data meet the verification conditions of preset steps, whether the current state value of the device is equal, whether the use times are remained, whether the timer is expired and the like, so that the switching of different states of the device according to different operations or various reasons such as different current states is realized, and the problem that the production reliability of the device is low due to the error of the switching state is avoided.
Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute a limitation on the application. In the drawings:
fig. 1 is a flow chart of a device status adjustment method disclosed in the present embodiment.
Fig. 2 is a schematic flowchart of step S5 disclosed in this embodiment.
Fig. 3 is a specific flowchart of step S53 disclosed in this embodiment.
Fig. 4 is a schematic flowchart of step S6 disclosed in this embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more clear, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. It will be apparent that the described embodiments are some, but not all, embodiments of the invention. All other embodiments, which can be made by a person skilled in the art without creative efforts, based on the described embodiments of the present invention fall within the protection scope of the present invention.
In the description of the present invention, it should be understood that the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature. In the description of the present invention, the meaning of "a plurality" is two or more, unless explicitly defined otherwise.
In the present invention, unless explicitly specified and limited otherwise, the terms "mounted," "connected," "secured," and the like are to be construed broadly, and may be, for example, fixedly connected, detachably connected, or integrally connected, mechanically connected, electrically connected, directly connected, indirectly connected via an intervening medium, or in communication between two elements. The specific meaning of the above terms in the present invention can be understood by those of ordinary skill in the art according to the specific circumstances.
In the present invention, unless expressly stated or limited otherwise, a first feature "above" or "below" a second feature may include both the first and second features being in direct contact, as well as the first and second features not being in direct contact but being in contact with each other through additional features therebetween. Moreover, a first feature being "above," "over" and "on" a second feature includes the first feature being directly above and obliquely above the second feature, or simply indicating that the first feature is higher in level than the second feature. The first feature being "under", "below" and "beneath" the second feature includes the first feature being directly under and obliquely below the second feature, or simply means that the first feature is less level than the second feature.
The device state adjustment method can be used for defining and managing the whole state life cycle of various industrial devices, and specifically can comprise the state definition of the devices, the state transition definition of the devices, the management of the state transition of the devices, the automatic management of the use times and the use time of each state of the devices and the reminding of the approaching warning state of the devices. In industrial production processes, various devices are used, and how to model the devices in related systems has been the focus of various production systems. The conventional method generally comprises the steps of adding one device, defining various parameters for the device, and repeatedly configuring similar parameters for different types of devices, so that the complexity of work is increased, and the maintainability of data is also deteriorated. Unified modifications to device parameters and states will also become complex and variable. For equipment of the same model, the attribute of the same parameter needs to be repeatedly configured, so that the maintenance difficulty is increased. In the present invention we abstract various common attributes of the device, such as date of manufacture, work center, code, name, etc. as built-in parameters of the device. And the function of adding parameters by the user is provided, so that the parameter multiplexing becomes more flexible. The creation of the device objects is provided, and each device object can select different parameters to be combined, so that the definition of the object is simpler. In the invention, rights and variable types are configured for the object, so that the device has differentiation in the running process and the device data is dynamically protected according to the requirement.
As shown in fig. 1, in this embodiment, the device status adjustment method may specifically include the following steps:
Step S1, the state configuration of the verified equipment is obtained at fixed time, each state transition of the equipment is traversed, if the timer overtime configuration exists, overtime switching information in the timer overtime configuration is obtained, and the overtime switching information comprises a third switching starting value, a third switching ending value and a fourth action code.
In this embodiment, the system first sets a device state parameter, where the device state parameter includes basic information, state information, and state transition information. The base information may include names and descriptions of state parameters. The status information may include a status name, a specified permission-change value, counter support information, timer support information, wherein the specified permission-change value is arranged to control whether the user has permission to change this working status. The counter support information is configured to control whether the state is subjected to usage count control, and the state is changed when the usage count exceeds a limit. The timer support information is configured to control whether the state has a usage time limit, and the state will change when the device state usage time exceeds the limit. The state transition information comprises a state starting point, a state ending point and a transition event, wherein the transition event can comprise an operation step, a counter overrun and a timer overtime, and the like, and concretely, the operation step indicates that the state can be switched only through manual operation of a user, the timer overrun indicates that the state is automatically switched when the state using time of the equipment is overrun, and the counter overrun indicates that the state is automatically switched when the using times of the state of the equipment are overrun.
After the setting of the device state parameters is completed, the actual data is configured. In particular, a specific right may be configured for a given right change value, and the user may typically only modify this state value if it has that right. A specific list parameter may be configured for list synchronization adaptation, and when a device state changes, all device states associated with the list parameter change simultaneously. The counter support information may configure a specific number of uses of the state, and when the number of uses of the device state exceeds a limit, the state will not be allowed to be used, and if a "counter overrun" transition event is configured, the system will automatically perform a state switch according to this event. The counter alarm threshold is configured such that when the number of uses exceeds the threshold, the system will alert. The timer support information may configure the time of use of the state, which will not be allowed for use when the time of use exceeds the configuration time, upon which the system will automatically switch states if a transition event of "timer timeout" is configured. The timer alarm threshold is configured to alert the system when the usage time exceeds the threshold.
After the setting of the state parameters is completed, the state of the equipment can be instantiated, each setting adds the state configuration according to the state object configuration, and relevant attributes are brought into after the instantiation, wherein the attributes comprise a state name and a unique name of the state, the current value is the current state of the equipment, a user can manually change the initial value of the state, the remaining times are displayed as empty before the use times of the state are left, the remaining times are displayed as empty before the verification, and the expiration time is displayed as empty after the verification.
In this embodiment, the storage of all state parameter data adopts a relational library storage, and the storage of the device state is divided into a configuration data TABLE table_obj and a real-time parameter TABLE table_param in consideration of the state complexity and expandability, and the configuration data TABLE and the real-time parameter TABLE are associated through the unique ID of the device, so that the rapid access and modification of the real-time parameters are facilitated, and the rapid storage of the configuration data is also facilitated.
In the configuration data table, the state data is compressed to 1-10% by a compression algorithm in the process of storage, and then the compressed data is converted into a character string by a BASE64 algorithm and stored in a relational database in consideration of the complexity of the state, infinite expansion of the data volume and data similarity. When reading, the BASE64 is firstly used for decoding, then the ZIP algorithm is used for reversely decompressing, and the decompressed data are sent to the corresponding front end for state display. In decompression, because the ZIP algorithm cannot confirm the size of decompressed data, the size of decompressed configuration data is currently controllable through the following decompression method.
The method comprises the steps of obtaining the data length B before decompression of a configuration data compression packet, and presetting a first amplification factor A. Specifically, defining a multiple A with an initial size of 100, defining a fixed length B with a size of data length before decompression, wherein the compression rate of data with low repeatability is not more than 2%, so that 100 times of data can meet the requirement of most data decompression, and performing gradual decompression by adopting a mode of cyclic judgment and gradual amplification for decompression with more data with high repeatability.
And performing cyclic operation, distributing decompressed target memory, wherein the size of the target memory is A, B, performing one-time decompression, and jumping out of the cycle if the decompression is successful, otherwise, entering the next step.
And adjusting the first magnification A to a second magnification C, wherein C=A×n, n is an integer, re-distributing the decompressed target memory, wherein the target memory size is C×B, decompressing again, and jumping out of the cycle if decompressing successfully, and repeating the steps until decompressing successfully and jumping out of the cycle if decompressing successfully. In this embodiment, a may be amplified by 10 times, i.e., c=a×10. And (3) re-distributing the decompressed target memory with the size of C.times.B, performing one-time decompression, and jumping out of the cycle if the decompression is successful, and performing the step again until the decompression is successful and jumping out of the cycle if the decompression is failed. By the method, the data can be successfully decompressed regardless of the compression ratio of the data.
And after the storage configuration of the state parameter data is completed, performing equipment verification. After the device verification is completed, all state base configurations of the device cannot be modified. After device verification, the system will automatically store the data in REDIS. Specifically, REDIS data storage verification is adopted in equipment verification, in order to facilitate quick comparison of data states and front and back verification of states, hash table mode is adopted to store the equipment state parameter information, wherein the state parameter main key is represented by a mode of [ EQUIP ]: equipment ID: REDIS', various data after the state parameter verification are stored in a mode of JSON object key-value, and key value types of the data are divided into the following types:
① value, which indicates the real value of the state, and when changing the state, the logic server needs to confirm whether the state transition can be continued according to the state.
② Const, which represents the state type, 1-represents the constant 0-represents the variable, when the state is changed, the logic server firstly reads the state type, and only when the state type is the variable, the state transition can be continuously executed.
③ The state parameter is that the key value is organized in a manner of 'state value' + '_' + 'parameter type'. The parameter type specifically comprises the following content that the count represents the total number of times which can be used and is the number of configured counter supports; the count_alarm represents the number of the alarm critical values of the using times, is the number of the configured alarm critical values of the counter, and when the using times exceeds the number, the system generates the critical alarm of the times; "second" means the total number of available time, accurate to seconds, the number of configured "timer support" is converted to seconds, "time" means the available period time, expressed by a timestamp, the configured "timer support" time is added with the time value of the verification time, the resulting timestamp, the "time_alarm" means the alarm time critical value, expressed by a timestamp, the configured "timer alarm critical value" time is added with the time value of the verification time, the resulting timestamp, when the system time is greater than this time, and the device is still in use, the system will generate a time critical alarm, the "count_used" means the number of times of use of the state, if the number of times of use is greater than the "total number of times of use", the system will start state switching, when the number of times of use is greater than the "number of times of use alarm critical value", the system will start to generate a number of times of critical alarm, by this way of switching, in combination with the real-time value in ①, the logic server can automatically locate the current state so as to perform the next state switching or state alarm.
Step S2, acquiring the current working state of the equipment according to the equipment identity information, and entering the next step if the current first working state accords with a third switching starting value.
Specifically, the system acquires the device state value S1 where the current state parameter is located according to the acquired ID and the state parameter ID of the device, if the S1 and the third switching start value begin in the timeout switching information G1 are equal, the state transition judgment is continued, otherwise, the judgment logic is jumped out.
Step S3, traversing the JSON array stored with the preset switching step information, and entering the next step if switching flow data with a starting state of a third switching start value, an ending state of the third switching end value and a switching event of a fourth action code exists.
In this embodiment, the logic server reads specific data G1 of the state parameter stored in the REDIS and configured conversion data G2 according to the acquired device ID and the state parameter ID, and converts the G1 and G2 into JSON objects to be temporarily placed in the memory, where G2 is a JSON object array, where 1 in "event" may represent an operation step, 2 may represent that the counter is overrun, and 3 may represent that the timer is overtime.
"param_transfer":[
{
"begin":"S1",
"end":"S2",
"event":1
},
{
"begin":"S1",
"end":"S3",
"event":2
},
{
"begin":"S2",
"end":"S3",
"event":3
}
If the data with beign value of S1, event of 3 and end value of S2 can be found, the cycle is jumped out, the state parameter is considered to be able to make state transition, the next step of judgment is continued, after the traversing is completed, the corresponding data is not found, the state transition is considered to be failed, and the transition flow is exited.
And S4, acquiring a current equipment state real-time value, judging whether the equipment state real-time value is in a switching state value preset interval of the first working state, and entering the next step if the equipment state real-time value is in the switching state value preset interval. The logic server can obtain the value of the value from the G1, if the value is equal to the value of the S1, the state is considered to be converted, the next judgment is continued, otherwise, the state conversion is considered to be failed, and the conversion flow is exited.
And S5, acquiring the used expiration time and the current time stamp of the system corresponding to the first working state in the timeout configuration of the timer, and discarding the switching if the used expiration time is greater than the current time stamp of the system, otherwise switching the equipment to the third working state. The logic server splices the value of K1S 1_time according to the 'state value' + 'parameter type', wherein the value corresponding to K1 represents the used expiration time of the S1 state, and K2 represents the current timestamp of the system, if the value corresponding to K2 is smaller than or equal to the value corresponding to K1, the state is considered to be converted, the next judgment is continued, otherwise, the state conversion is considered to be failed, and the conversion flow is exited.
As shown in fig. 2, the step S5 specifically includes:
step S51, the used period time and the current time stamp of the system corresponding to the first working state in the overtime configuration of the timer are obtained, and if the used period time is smaller than or equal to the current time stamp of the system, the total switching times in the overtime configuration of the counter and the switching times of the first working state in the current state are obtained.
Step S52, if the total switching times is larger than the switched times, the equipment is switched to a third working state.
Step S53, if the total switching times is equal to or less than the switched times, the second switching start value and the second switching end value in the counter overrun configuration are obtained, whether the second switching start value is the same as the third switching start value or the third switching end value is judged, if not, the equipment is switched to the third working state, otherwise, the working state to which the equipment is switched is determined according to the overrun switching information and the counting overrun switching information in the counter overrun configuration.
As shown in fig. 3, the step S53 specifically includes:
In step S531, if the second switching start value is the same as the third switching end value, the device is switched to the second working state corresponding to the second switching end value. I.e. if the second handover start value is S2, the second handover end value is S3. And the third handover start value is S1 and the third handover end value is S2. The device is directly switched to a second operating state S3 corresponding to the second switching end value.
Step S532, if the second switching start value is the same as the third switching start value, selecting according to the preset switching end value sequence, and switching the device to the working state corresponding to the switching end value with the previous sequence. Specifically, the identification and sorting may be performed according to the priority order of the working states, for example, the priority of S1 is higher than the priority of S2, that is, the priority is higher as the serial number is smaller, or the priority is higher as the serial number is larger, or the identification and sorting may be performed in other manners. In the present embodiment, if the second handover start value is S1, the second handover end value is S3. And the third handover start value is S1 and the third handover end value is S2. The priority of S2 of the third handover ending value is higher than S3 of the second handover ending value, and the device is directly switched to the S2 state of the third handover ending value.
By comparing the switching start value and the switching end value in the overtime configuration of the timer and the overtime configuration of the counter, when the conflict exists, the final switching state can be determined by judging the sequencing sequence such as the priority sequence of the switching end value, and the state switching conflict when the overtime of the timer and the overtime of the counter occur simultaneously can be solved, so that the contradiction of system switching caused by different switching states is avoided, and the effectiveness of system state switching is maintained.
In another embodiment, as shown in fig. 4, the device status adjustment method may further include the following steps:
Step S61, obtaining a reset instruction for switching the device from the third working state to the first working state, where the reset instruction includes the identity information of the device to be switched and the status parameter ID of the third working state.
Step S62, acquiring a right code list corresponding to the reset instruction sending account, searching whether a reset working state right code exists in the right code list, and if so, entering a next step S63. The step S62 specifically includes the following.
Step S621, a right code list corresponding to the reset instruction sending account is obtained, whether a third working state switching right code exists or not is searched in the right code list, and if the third working state switching right code exists, the next step is carried out. In this embodiment, the logic server first obtains the authority code list owned by the user a, then compares the obtained authority code list with the authority code C required by the state parameter conversion, if the authority code list of the user includes the authority C, the user is considered to be able to perform the state conversion, and goes to the next step, otherwise the state conversion fails, and the conversion flow is exited.
Step S622, if the third working state switching permission code does not exist, the account attribute information is obtained, if the account is a second-level account, the switching is exited, and if the account is a first-level account, the next step is entered. In this embodiment, the accounts may be ranked, where the first level of accounts are management accounts and the second level of accounts are normal accounts. The second-level account can be switched to the corresponding working state only by having the corresponding state switching authority, and the first-level account can be switched to each working state without specific state switching authority, so that the system management and control are convenient.
Step S63, obtaining the third action code of the reset instruction, traversing the JSON array stored with the preset switching step information, and if switching flow data of which the start value corresponds to the third working state, the end value corresponds to the first working state and the switching event is the third action code exists, proceeding to the next step S64.
The step S63 may specifically include the following:
step S631, obtaining the third action code of the reset instruction, traversing the JSON array stored with the preset switching step information, and if the switching flow data of the third action code is present, the switching event is the switching flow data of the third action code, the next step S64 is entered.
Step S632, if there is no switching flow data with the start value corresponding to the third working state, the end value corresponding to the first working state and the switching event being the third action code, judging the account grade, if it is the second grade account, then exiting the switching;
Step S633, if the account is the first level account, new switching flow data is generated with the third working state as a start value, the first working state as an end value, and the third action code as a switching event, and added to the JSON array, and then the next step S4 is performed.
Specifically, when the account sending the switching instruction is the first-level account, although the account does not accord with the preset switching step information capable of switching, as the account is a management account with high authority, the switching step information correction link can be skipped to switch, and meanwhile, the current switching step state is also saved and added to the JSON array storing the preset switching step information, so that the subsequent account with the common authority level can pass the switching request verification with the switching step information, and the corresponding JSON array is not required to be independently operated and supplemented.
Step S64, obtaining the current equipment state real-time value of the equipment, judging whether the equipment state real-time value is in a preset switching state value interval of a third working state, resetting the equipment back to the first working state if the equipment state real-time value is in the preset switching state value interval, and otherwise, abandoning the resetting.
The step S64 specifically includes:
Step S641, acquiring a real-time value of the device state, and determining whether the real-time value of the device state is in a preset switching state value interval corresponding to the third working state.
Step S642, if the current device state real-time value is within the preset switching state value interval corresponding to the third working state, the next step is entered, otherwise, the current device state real-time value is obtained at intervals of a specific time, whether the current device state real-time value is within the preset switching state value interval corresponding to the third working state is judged, if the current device state real-time value is within the preset switching state value interval corresponding to the third working state, the next step is entered, otherwise, the switching is exited after the preset time limit is reached.
In one embodiment, step S642 further includes the following steps:
Step S6421, if the account class is judged in the preset section of the switching state value corresponding to the third working state, acquiring the current real-time value of the equipment state at intervals of a specific time interval if the account class is the second-stage account, judging whether the account class is in the preset section of the switching state value corresponding to the third working state, resetting the equipment state to the first working state if the account class is in the preset section of the switching state value corresponding to the third working state, otherwise, exiting the switching after the preset time limit is reached.
Step S6422, if the account is the first account, the preset section of the switching state value is adjusted according to the real-time value of the current equipment state, one end point of the preset section of the switching state value is modified to the real-time value of the current equipment state and updated to be the preset section of the new switching state value, and then the equipment state is reset to the first working state.
Specifically, when the account sending the switching instruction is the first-level account, although the account does not accord with the preset switching state value, the account is a management account with high authority, the switching state value correction link can be skipped to switch, meanwhile, the preset space of the current switching state value is updated, and the preset interval of the switching state value is expanded to the real-time value of the current equipment state, so that the subsequent account with the common authority level can pass the switching request verification of the real-time value of the equipment state, and the preset interval of the switching state value of the equipment is not required to be independently operated and modified.
According to the device state adjusting method disclosed by the embodiment, whether the working state of the device needs to be switched is determined by acquiring the permission code list corresponding to the account sent by the conversion instruction, judging whether the account permission sent by the conversion instruction, the switching flow data accord with the preset step, whether the current state value of the device is equal, whether the use times are remained, whether the timer is expired or not and other check conditions, so that the switching of different states of the device according to different operations or various reasons such as different current states is realized, and the problem that the production reliability of the device is low due to the error of the switching state is avoided.
In other embodiments, a device state adjustment system is also disclosed, including a timeout configuration query module, a starting state verification module, an array traversal verification module, a device state verification module, and a timing verification module, where the timeout configuration query module is configured to obtain a state configuration of a verified device at regular time, traverse each state transition of the device, and if a timer timeout configuration exists, obtain timeout switching information in the timer timeout configuration, where the timeout switching information includes a third switching start value, a third switching end value, and a fourth action code. And the initial state checking module is used for acquiring the current working state of the equipment according to the equipment identity information and judging whether the current first working state accords with a third switching initial value. The array traversal checking module is used for traversing the JSON array stored with the preset switching step information, judging whether switching flow data of which the starting state is a third switching starting value, the ending state is a third switching ending value and the switching event is fourth motion coding exists or not. The device state checking module is used for acquiring the current device state real-time value and judging whether the device state real-time value is in a preset switching state value interval of the first working state. And the timing verification module is used for acquiring the used expiration time and the current time stamp of the system corresponding to the first working state in the timeout configuration of the timer, and giving up switching when the used expiration time is greater than the current time stamp of the system, otherwise, switching the equipment to the third working state.
In this embodiment, the timing verification module specifically includes a switching frequency acquisition module, configured to acquire a used expiration time and a current timestamp of the system corresponding to a first working state in a timeout configuration of the timer, and acquire a total switching frequency in the overrun configuration of the counter and a switched frequency of the first working state when the used expiration time is less than or equal to the current timestamp of the system. And the first switching module is used for switching the equipment to the third working state when the total switching times are larger than the switched times. And the second switching module is used for acquiring a second switching starting value and a second switching ending value in the counter overrun configuration when the total switching times are equal to or smaller than the switched times, judging whether the second switching starting value is the same as the third switching starting value or the third switching ending value, switching the equipment to a third working state if the second switching starting value is different from the third switching starting value or the third switching ending value, and otherwise determining the working state to which the equipment is to be switched according to the overrun switching information and the counting overrun switching information in the counter overrun configuration.
In this embodiment, the second switching module specifically includes a first judging module configured to switch the device to a second working state corresponding to the second switching end value when the second switching start value is the same as the third switching end value, and a second judging module configured to select according to the preset switching end value ranking when the second switching start value is the same as the third switching start value, and switch the device to the working state corresponding to the ranking previous switching end value.
In this embodiment, the second switching module specifically includes a reset instruction obtaining module configured to obtain a reset instruction for switching the device from the third working state to the first working state, where the reset instruction includes device identity information to be switched and a state parameter ID of the third working state, an authority checking module configured to obtain an authority code list corresponding to a reset instruction sending account, determine whether a reset working state authority code exists in the authority code list, a switching flow checking module configured to obtain the third working state of the reset instruction, traverse a JSON array storing preset switching step information, determine whether there is a switching flow data in which a start value corresponds to the third working state, an end value corresponds to the first working state, and a switching event is the third working state, and a state value determining module configured to obtain a current device state real-time value of the device, determine whether the device state real-time value is in a switching state value preset interval of the third working state, and reset the device to the first working state within the switching state value preset interval.
The specific functions of the above-mentioned device state adjustment system correspond to the device state adjustment methods disclosed in the foregoing embodiments one by one, so that detailed descriptions thereof will not be provided herein, and specific reference may be made to the embodiments of the device state adjustment methods disclosed in the foregoing. It should be noted that, in the present description, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different manner from other embodiments, and identical and similar parts between the embodiments are all enough to refer to each other.
In other embodiments, there is also provided a device state adjustment apparatus including a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the device state adjustment method as described in the above embodiments when the computer program is executed.
Wherein the device state adjustment means may include, but is not limited to, a processor, a memory. It will be appreciated by those skilled in the art that the schematic diagram is merely an example of a device state adjustment apparatus, and does not constitute a limitation of the device state adjustment apparatus, and may include more or less components than illustrated, or may combine certain components, or different components, e.g., the device state adjustment apparatus may further include an input-output device, a network access device, a bus, etc.
The Processor may be a central processing unit (Central Processing Unit, CPU), other general purpose Processor, digital signal Processor (DIGITAL SIGNAL Processor, DSP), application SPECIFIC INTEGRATED Circuit (ASIC), off-the-shelf Programmable gate array (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like, which is a control center of the device state adjusting apparatus, and which connects various parts of the entire device state adjusting apparatus using various interfaces and lines.
The memory may be used to store the computer program and/or modules, and the processor may implement various functions of the apparatus device for device state adjustment by executing or executing the computer program and/or modules stored in the memory, and invoking data stored in the memory. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like, and the memory may include a high-speed random access memory, and may further include a nonvolatile memory such as a hard disk, a memory, a plug-in hard disk, a smart memory card (SMART MEDIA CARD, SMC), a Secure Digital (SD) card, a flash memory card (FLASH CARD), at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage device.
The device state adjustment means, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the present invention may implement all or part of the flow of the method of the above embodiment, or may be implemented by instructing related hardware by a computer program, where the computer program may be stored in a computer readable storage medium, and the computer program may implement the steps of the method embodiment of device state adjustment when executed by a processor. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth. It should be noted that the computer readable medium contains content that can be appropriately scaled according to the requirements of jurisdictions in which such content is subject to legislation and patent practice, such as in certain jurisdictions in which such content is subject to legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals.
It should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present invention, and not for limiting the same, and although the present invention has been described in detail with reference to the above-mentioned embodiments, it should be understood by those skilled in the art that the technical solution described in the above-mentioned embodiments may be modified or some technical features may be equivalently replaced, and these modifications or substitutions do not deviate the essence of the corresponding technical solution from the scope of the technical solution of the embodiments of the present invention.
In summary, the foregoing description is only of the preferred embodiments of the present invention, and all equivalent changes and modifications made in accordance with the claims should be construed to fall within the scope of the invention.

Claims (8)

1. A method for adjusting a state of a device, comprising the steps of:
S1, acquiring state configuration of verified equipment at fixed time, traversing each state transition of the equipment, and acquiring timeout switching information in the timeout configuration of a timer if the timeout configuration of the timer exists, wherein the timeout switching information comprises a third switching start value, a third switching end value and a fourth action code;
S2, acquiring the current working state of the equipment according to the equipment identity information, and entering the next step if the current first working state accords with a third switching starting value;
S3, traversing the JSON array stored with the preset switching step information, and entering the next step if switching flow data with a starting state of a third switching start value, an ending state of the third switching end value and a switching event of a fourth action code exists;
s4, acquiring a current equipment state real-time value, judging whether the equipment state real-time value is in a switching state value preset interval of a first working state, and entering the next step if the equipment state real-time value is in the switching state value preset interval;
s5, acquiring the used expiration time and the current timestamp of the system corresponding to the first working state in the timeout configuration of the timer, if the used expiration time is greater than the current timestamp of the system, discarding the switching, otherwise switching the equipment to the third working state, and further comprising the following steps:
acquiring a right code list corresponding to a reset instruction sending account, searching whether right codes of the reset working state exist in the right code list, and entering the next step if the right codes exist;
Acquiring a third action code of a reset instruction, traversing the JSON array stored with preset switching step information, and entering the next step if switching flow data of which the starting value corresponds to the third working state, the ending value corresponds to the first working state and the switching event is the third action code exists;
Acquiring a current equipment state real-time value of the equipment, judging whether the equipment state real-time value is in a switching state value preset interval of a third working state, resetting the equipment back to the first working state if the equipment state real-time value is in the switching state value preset interval, and otherwise, abandoning the resetting.
2. The device state adjustment method according to claim 1, wherein the step S5 specifically includes:
S51, acquiring the used period time and the current time stamp of the system corresponding to the first working state in the overtime configuration of the timer, and if the used period time is smaller than or equal to the current time stamp of the system, acquiring the total switching times in the overrun configuration of the counter and the switching times of the first working state at present;
S52, if the total switching times are greater than the switched times, switching the equipment to a third working state;
And S53, if the total switching times is equal to or less than the switched times, acquiring a second switching start value and a second switching end value in the overrun configuration of the counter, judging whether the second switching start value is the same as a third switching start value or the third switching end value, if so, switching the equipment to a third working state, otherwise, determining the working state to which the equipment is to be switched according to the overtime switching information and the counting overtime switching information in the overrun configuration of the counter.
3. The device state adjustment method according to claim 2, wherein the step S53 specifically includes:
S531, if the second switching start value is the same as the third switching end value, switching the equipment to a second working state corresponding to the second switching end value;
S532, if the second switching start value is the same as the third switching start value, selecting according to the preset switching end value sequence, and switching the equipment to the working state corresponding to the switching end value with the prior sequence.
4.A device state adjustment system, comprising:
The timeout configuration query module is used for acquiring the state configuration of the verified equipment at regular time, traversing each state transition of the equipment, and acquiring timeout switching information in the timeout configuration of the timer if the timeout configuration of the timer exists, wherein the timeout switching information comprises a third switching start value, a third switching end value and a fourth action code;
The initial state checking module is used for acquiring the current working state of the equipment according to the equipment identity information and judging whether the current first working state accords with a third switching initial value or not;
The array traversal checking module is used for traversing the JSON array stored with the preset switching step information, judging whether switching flow data with a starting state being a third switching starting value, an ending state being a third switching ending value and a switching event being fourth motion coding exists or not;
the device state verification module is used for acquiring a current device state real-time value and judging whether the device state real-time value is in a switching state value preset interval of a first working state or not;
The timing verification module is used for acquiring the used expiration time corresponding to the first working state in the timeout configuration of the timer and the current timestamp of the system, discarding the switching when the used expiration time is larger than the current timestamp of the system, otherwise switching the equipment to the third working state, acquiring a reset instruction for switching the equipment from the third working state back to the first working state, wherein the reset instruction comprises equipment identity information to be switched and a state parameter ID of the third working state, acquiring a permission code list corresponding to a reset instruction sending account, searching whether a permission code of the reset working state exists in the permission code list, acquiring the third working code of the reset instruction if the permission code exists, traversing a JSON array storing preset switching step information, acquiring the current equipment state real-time value of the equipment if the starting value corresponds to the third working state, the ending value corresponds to the first working state and the switching event is switching flow data of the third working code, judging whether the equipment state real-time value is in a switching state value preset section of the third working state, resetting the equipment is returned to the first working state if the equipment state is in the switching state value preset section, otherwise discarding the equipment.
5. The device state adjustment system of claim 4, wherein the timing verification module specifically comprises:
the switching frequency acquisition module is used for acquiring the used expiration time and the current time stamp of the system corresponding to the first working state in the timeout configuration of the timer, and acquiring the total switching frequency in the overrun configuration of the counter and the switching frequency of the first working state when the used expiration time is smaller than or equal to the current time stamp of the system;
The first switching module is used for switching the equipment to a third working state when the total switching times are larger than the switched times;
and the second switching module is used for acquiring a second switching starting value and a second switching ending value in the counter overrun configuration when the total switching times are equal to or smaller than the switched times, judging whether the second switching starting value is the same as the third switching starting value or the third switching ending value, switching the equipment to a third working state if the second switching starting value is different from the third switching starting value or the third switching ending value, and otherwise determining the working state to which the equipment is to be switched according to the overtime switching information and the counting overtime switching information in the counter overrun configuration.
6. The device state adjustment system of claim 5, wherein the second switching module specifically comprises:
The first judging module is used for switching the equipment to a second working state corresponding to the second switching ending value when the second switching starting value is the same as the third switching ending value;
And the second judging module is used for selecting according to the preset switching end value sequence when the second switching start value is the same as the third switching start value, and switching the equipment to the working state corresponding to the switching end value with the prior sequence.
7. A device state adjustment apparatus comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any of the claims 1-3 when executing the computer program.
8. A computer-readable storage medium, in which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method according to any of the claims 1-3.
CN202110970669.3A 2021-08-23 2021-08-23 Device state adjustment method, system and storage medium Active CN113687863B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110970669.3A CN113687863B (en) 2021-08-23 2021-08-23 Device state adjustment method, system and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110970669.3A CN113687863B (en) 2021-08-23 2021-08-23 Device state adjustment method, system and storage medium

Publications (2)

Publication Number Publication Date
CN113687863A CN113687863A (en) 2021-11-23
CN113687863B true CN113687863B (en) 2025-06-03

Family

ID=78581745

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110970669.3A Active CN113687863B (en) 2021-08-23 2021-08-23 Device state adjustment method, system and storage medium

Country Status (1)

Country Link
CN (1) CN113687863B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103744772A (en) * 2014-01-28 2014-04-23 北京经纬恒润科技有限公司 Method and system for detecting task running performance
CN107341069A (en) * 2017-06-30 2017-11-10 联想(北京)有限公司 Processing method, electronic equipment, electronic installation and computer-readable recording medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002049482A (en) * 2000-08-07 2002-02-15 Fainaaku Kk Processor architecture converter
CN107553487B (en) * 2017-08-22 2021-05-25 广东美的智能机器人有限公司 Mode switching method and device for robot
CN112447027A (en) * 2019-08-12 2021-03-05 鸿富锦精密电子(成都)有限公司 State detection method, state detection device, computer device and readable storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103744772A (en) * 2014-01-28 2014-04-23 北京经纬恒润科技有限公司 Method and system for detecting task running performance
CN107341069A (en) * 2017-06-30 2017-11-10 联想(北京)有限公司 Processing method, electronic equipment, electronic installation and computer-readable recording medium

Also Published As

Publication number Publication date
CN113687863A (en) 2021-11-23

Similar Documents

Publication Publication Date Title
US11765653B2 (en) Load threshold determining method and apparatus
US11140021B2 (en) Method and apparatus for determining fault type
CN109347942B (en) A kind of industrial gateway data repay method and industrial gateway
CN113687635B (en) State management method, system and storage medium based on complete objectification equipment
CN105072191A (en) Method for determining target communication channel and server
CN113407555B (en) Operation data updating method and system of equipment handheld terminal
CN113407636B (en) Offline data synchronization method and device for digital factory and server
CN109788026B (en) Message processing method and device
CN104679858A (en) Method and device for inquiring data
CN113986939A (en) Data change method and device for database
CN113141410A (en) Dynamically adjusted QPS control method, system, device and storage medium
CN113407635B (en) Multi-terminal data synchronization method and system for intelligent manufacturing
CN113687863B (en) Device state adjustment method, system and storage medium
CN110704094A (en) Code statistical method and device
EP3726397A1 (en) Join query method and system for multiple time sequences under columnar storage
CN113687636B (en) Equipment management method, system and storage medium for industrial production
US20090177953A1 (en) Method and system for updating topology changes of a computer network
CN115953109A (en) Warehouse management method and warehouse management scheduling device
CN108536773A (en) A kind of auto alarm information integrating method, device, equipment and medium
CN117708210A (en) Data importing method and device, electronic equipment and nonvolatile storage medium
CN117874033A (en) Database sub-table method and device, electronic equipment and storage medium
CN106294721B (en) Cluster data counting and exporting methods and devices
CN108304582A (en) A kind of network information push method and system
CN116795439A (en) A server configuration list processing method and system
CN112948370B (en) Data classification method and device and computer equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB03 Change of inventor or designer information
CB03 Change of inventor or designer information

Inventor after: Wang Xinghua

Inventor after: Bao Qing

Inventor after: Xue Lijun

Inventor before: Wang Xinhua

Inventor before: Bao Qing

Inventor before: Xue Lijun

GR01 Patent grant
GR01 Patent grant