Distributed measuring instrument synchronous control method and system

By designing a synchronization control center and a synchronization controller in a distributed measurement system, the precise software synchronization control of the distributed measurement instrument is realized, which solves the problem of insufficient software synchronization control accuracy in the existing technology, and improves the measurement accuracy and reliability of the system.

CN119628777APending Publication Date: 2025-03-14CHINA ELECTRONIS TECH INSTR CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411795105.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-09
Publication Date
2025-03-14

AI Technical Summary

Technical Problem

In the multi-tasking environment of CPU modules, existing distributed measurement systems are difficult to achieve high-precision software synchronization control, resulting in reduced system accuracy.

Method used

A software synchronization control method for distributed measurement instruments is designed. Through the synchronization control center and the synchronization controller, precise clock synchronization, unified transmission and precise execution of synchronous control instructions are realized, ensuring that the instrument host and test terminal execute control instructions at the same time.

Benefits of technology

It realizes accurate synchronous control of each device in a distributed measurement instrument, and the error control is at level 10us, which improves the measurement accuracy and reliability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119628777A_ABST
    Figure CN119628777A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of distributed measuring instruments, and particularly relates to a distributed measuring instrument synchronous control method and system, the system comprises an instrument host and a plurality of test terminals, different devices have different positions and are connected through a local area network; distributed measurement requires synchronous measurement of different test terminals, that is, all devices of the instrument start a test function at the same time. The method has the advantages that a complete synchronous control scheme from precise time service to precise control of the distributed measuring instrument is realized, the problem that precise synchronous control cannot be realized through software in current distributed measurement is solved, synchronous execution of operation between the instrument host and the test terminal in the distributed instrument can be realized, and the accuracy of measurement is improved. And the measurement precision of the distributed measurement instrument is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the technical field of distributed measuring instruments, and specifically relates to a distributed measuring instrument synchronization control method and system. Background Art

[0002] At present, the Ethernet-based distributed measurement system solution is to achieve clock synchronization and timekeeping of distributed terminals through the PTP protocol. High-precision clock synchronization is achieved through hardware in each distributed terminal to ensure the time consistency of each terminal. Control commands are sent between terminals through the network, and the hardware performs sampling after receiving the control commands.

[0003] Existing technical solutions such as Figure 2 As shown in the figure, the underlying control logic and time synchronization tasks are directly implemented by the I / O module at the bottom of the control system through hardware. Clock synchronization uses the PTP protocol, and each distributed terminal (console, I / O module) is synchronized through the time server to achieve time consistency. The console transmits the instruction schedule to the I / O module, and the I / O module compares the high-precision absolute time with the instruction schedule. After the comparison is successful, the instruction is output to the CPU module. If the CPU module executes a single task, high-precision control may be achieved, but the CPU module in distributed measurement generally runs an operating system and is multi-tasking, which means that there is a CPU time slice rotation. Even if the I / O module implements high-precision output instructions, the software execution time of each CPU module is inconsistent, and the accuracy of the entire system will be reduced. Summary of the invention

[0004] Aiming at the problem that the existing scheme cannot realize software synchronization control, the present invention designs a software synchronization control scheme for distributed measuring instruments. Through the software synchronization control module, the precise clock synchronization strategy, the unified sending scheme of synchronization control instructions, and the precise execution scheme of synchronization control instructions are realized. It can be realized that any device in the distributed measuring instrument sends a control instruction, and the instrument host and the test terminal execute the instruction at the same time, with an error of 10us. Its technical scheme is:

[0005] A distributed measuring instrument synchronization control method includes a synchronization control center and a synchronization controller. The synchronization control process is as follows:

[0006] After receiving the synchronization control instruction, the synchronization control center first performs a PTP clock synchronization; after the PTP clock synchronization in the synchronization controller is completed, a response message is sent to the synchronization control center;

[0007] After receiving the response message, the synchronous control center determines the time when the control instruction starts to be executed;

[0008] The synchronization control center queries the status of the synchronization controller, and the synchronization controller sends the current status to the synchronization control center;

[0009] After the synchronization control center queries that the synchronization controller is idle, it sends a synchronization control instruction to the synchronization controller; after receiving the synchronization control instruction, the synchronization controller waits for the execution time of the control instruction. After the execution time of the control instruction arrives, it executes the specific control instruction.

[0010] Preferably, determine the start execution time of the control instruction:

[0011] The maximum time t required for the control instruction to be sent from the synchronization control center to the synchronization controller for reception s is as follows:

[0012] t s = max[D t1 , D tx + S t + max[R t1 , R tx ;

[0013] D t : The clock synchronization delay of the test terminal;

[0014] S t : The time required for the synchronization control center to send the synchronization control instruction;

[0015] R t : The time required for the synchronization controller to receive the synchronization control instruction;

[0016] The execution time t of the control instruction is as follows:

[0017]

[0018] C t : The current time.

[0019] Preferably, the steps for waiting for the command to start execution are as follows:

[0020] First, increase the priority of the current thread to ensure that the current thread can quickly preempt the CPU; obtain the current time and calculate the difference Δ with the start execution time of the synchronization control instruction t ; if Δ t is greater than N1 milliseconds and less than N2 milliseconds, then delay for N3 milliseconds within the time slice, N1 < N3 < N2, and then switch threads through the sleep method; if Δ t is greater than N2 milliseconds, then directly switch threads through the sleep method, and loop this process until Δ t is less than N1 milliseconds; then continuously loop to obtain the current time and calculate the difference Δ with the start execution time of the synchronization control instruction t , when Δ tWhen it is within the threshold range, the synchronization control instruction is executed and finally the current thread priority is restored.

[0021] Preferably, the control instruction execution time must be greater than N1 milliseconds. After each synchronous controller receives the control instruction, it performs a thread switching through sleep to avoid the situation where some test terminals have just received the control instruction and the time slice switching occurs, while some test terminals directly reach the control instruction execution time within the current time slice, resulting in control asynchrony. In order to avoid the time slice switching within a few milliseconds before the control instruction execution time arrives in the synchronous controller, before each execution of the sleep switching thread, first determine whether the time of the final cycle judgment threshold is between N3 milliseconds and N1 milliseconds, and there is a risk of occupying a time slice. If there is a risk, delay N3 milliseconds before sleep to avoid switching the time slice before the control instruction is executed.

[0022] A distributed measuring instrument synchronous control system includes an instrument host and multiple test terminals. Different devices are located in different locations and are connected through a local area network. Distributed measurement requires measurement synchronization of different test terminals, that is, all devices of the instrument start a test function at the same time.

[0023] Preferably, the synchronization control center is the hub of synchronization control. There is only one synchronization control center in the distributed measuring instrument, which is deployed in the instrument host and is used to receive synchronization control instructions initiated by each device;

[0024] The synchronization controller is the executor of synchronization control. A synchronization controller is deployed in both the instrument host and the test terminal. The synchronization controller receives instructions from the synchronization control center and finally executes them;

[0025] The synchronous control process realizes the PTP clock synchronization function and the synchronous instruction execution function.

[0026] Preferably, the synchronous control process is: when synchronous control is required during the operation of the instrument, the device initiating the control will send a control instruction to the synchronous control center through a control request; after receiving the synchronous control instruction, the synchronous control center sends the synchronous control command to the synchronous controller, and the synchronous controller finally executes the synchronous instruction.

[0027] Preferably, the synchronization control center deploys a PTP server, the synchronization controller deploys a PTP client, and the PTP server initiates clock synchronization for the PTP client at regular intervals to ensure that the time between various devices of the distributed measuring instrument is basically consistent.

[0028] Compared with the prior art, the present invention has the following beneficial effects:

[0029] The present invention first designs a clock synchronization strategy in a distributed measuring instrument to achieve time consistency between different distributed devices during synchronous control. On this basis, a synchronous instruction sending and receiving scheme is designed. By calculating the execution time of the synchronous control instruction and waiting for the execution time of the synchronous control instruction, the precise synchronous control of the instrument host and the test terminal in the distributed measuring instrument is achieved. At the same time, the present invention designs the distributed measuring instrument synchronous control technology into two independent modules: a synchronous control center and a synchronous controller, which can be flexibly deployed in various distributed devices. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 This is a diagram of the prior art solution.

[0031] Figure 2 It is a distributed measurement instrument.

[0032] Figure 3 It is a synchronous control flow chart.

[0033] Figure 4 Synchronous control detailed process.

[0034] Figure 5 Waiting for the command to start executing. DETAILED DESCRIPTION

[0035] The technical solution of the present application is described in detail below through specific embodiments and drawings. It should be understood that the embodiments of the present application and the specific features in the embodiments are detailed descriptions of the technical solution of the present application, rather than limitations on the technical solution of the present application, and the specific technical features may be combined with each other.

[0036] Figure 2 As shown, this solution enables the control of each device of the distributed measuring instrument to be carried out simultaneously. In this solution, the distributed measuring instrument includes an instrument host and multiple test terminals. Different devices are located in different locations and are connected through a local area network. Distributed measurement requires measurement synchronization of different test terminals, that is, all devices of the instrument start a test function at the same time. Otherwise, the measurement data obtained by different devices are not obtained at the same time, which seriously affects the measurement accuracy of the distributed instrument.

[0037] Figure 3 As shown, the synchronization control center is the hub of synchronization control. There is only one synchronization control center in the distributed measuring instrument, which is deployed in the instrument host and is used to receive synchronization control instructions initiated by each device.

[0038] The synchronization controller is the executor of synchronization control. A synchronization controller is deployed in both the instrument host and the test terminal. The synchronization controller receives instructions from the synchronization control center and finally executes them.

[0039] Synchronous control process: When synchronous control is required during the operation of the instrument, the device initiating the control will send a control instruction to the synchronous control center through a control request. After receiving the synchronous control instruction, the synchronous control center sends the synchronous control command to the synchronous controller. The synchronous controller finally executes the synchronous instruction.

[0040] The synchronization control process mainly realizes the PTP clock synchronization function and the synchronization instruction execution function.

[0041] PTP (Precision Time Protocol) is a high-precision clock synchronization protocol used between devices. When implemented in hardware, the clock accuracy can reach sub-microseconds. This solution is implemented in software and adopts a client / server strategy. The accuracy in the local area network can reach ten microseconds. The synchronization control center deploys the PTP server, and the synchronization controller deploys the PTP client (the synchronization controller in the instrument host does not deploy the PTP client). The PTP server initiates clock synchronization to the PTP client every 1 minute to ensure that the time between the various devices of the distributed measurement instrument is basically consistent.

[0042] A distributed measuring instrument synchronization control method, the synchronization process is as follows:

[0043] S1. The synchronization control center receives the control request and performs a PTP clock synchronization;

[0044] S2. After the PTP clock synchronization in the synchronization controller is completed, a response message is sent to the synchronization control center;

[0045] S3. After receiving the response message, the synchronization control center determines the time when the control instruction starts to execute;

[0046] S4. The synchronization control center queries the status of the synchronization controller, and the synchronization controller sends the current status (whether there is an instruction being executed) to the synchronization control center;

[0047] S5. When the synchronization control center finds that the synchronization controller is idle, it sends a synchronization control instruction to the synchronization controller;

[0048] S6. After receiving the synchronous control instruction, the synchronous controller waits for the execution time of the control instruction. After the execution time of the control instruction arrives, the specific control instruction is executed.

[0049] Determine the start time of control instruction execution:

[0050] The maximum time t required for the control command to be sent from the synchronous control center to the synchronous controller s as follows:

[0051] t s =max[D t1,D tx ]+S t +max[R t1 ,R tx ];

[0052] D t : Test the clock synchronization delay of the terminal.

[0053] S t : The time required for the synchronization control center to send the synchronization control command.

[0054] R t : The time required for the synchronous controller to receive the synchronous control instruction.

[0055] The control instruction execution time t is as follows:

[0056]

[0057] C t : current time.

[0058] Wait for the command to start executing. Figure 5 As shown: First, increase the priority of the current thread to ensure that the current thread can quickly seize the CPU. Get the current time and calculate the difference Δ with the start time of the synchronous control instruction execution t If Δ t If it is greater than 15 milliseconds and less than 30 milliseconds, first delay 5 milliseconds in the time slice, and then switch threads through the sleep mode; if Δ t If it is greater than 30 milliseconds, the thread is switched directly through the sleep mode. This process is repeated until Δ t Less than 15 milliseconds. Then keep looping to get the current time and calculate the difference Δ from the start time of the synchronous control instruction execution t , when Δ t When it is within the threshold range, the synchronization control instruction is executed and finally the current thread priority is restored.

[0059] This solution sets the control instruction execution time to be greater than 15 milliseconds. After receiving the control instruction, each synchronous controller performs a thread switch through sleep to avoid the situation where some test terminals switch time slices as soon as they receive the control instruction, while some test terminals directly reach the control instruction execution time within the current time slice, resulting in control asynchrony. In order to avoid time slice switching within a few milliseconds before the control instruction execution time in the synchronous controller arrives, this solution first determines whether the time of the final loop judgment threshold is between 5 milliseconds and 15 milliseconds before executing the sleep switch thread each time, which poses a risk of occupying a time slice. If there is a risk, delay 5 milliseconds before sleep to avoid switching time slices before the control instruction is executed.

[0060] The key points of the present invention are as follows Figure 3 , Figure 4 , Figure 5 shown. Figure 3 To realize the overall synchronous control scheme of distributed measuring instruments, the synchronous control process between various devices is completed through the synchronous control center and the synchronous controller. All controls first pass through the synchronous control center and are finally executed by the synchronous controller in each device. Figure 4 The PTP clock synchronization of the client / server strategy between the synchronization control center and the synchronization controller is realized, and the time accuracy is guaranteed within a certain range through timed synchronization. At the same time, in order to ensure the accuracy of synchronization control, synchronization is performed before each control. The execution time of the synchronization control instruction is determined by the synchronization control center, and the synchronization control instruction and instruction execution time are sent to the synchronization controller. The synchronization controller is responsible for monitoring the execution time of the control instruction and executing the control instruction after the time is reached. Figure 4 and Figure 5 The scheme for determining the execution time of synchronous control instructions and the waiting scheme realize the delayed synchronization through at least one thread switching, avoid the random switching of random time slices in different test terminals, and ensure the accuracy of synchronous control.

[0061] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A distributed measuring instrument synchronization control method, characterized in that: Including the synchronous control center and the synchronous controller, the synchronous control process is as follows: After receiving the synchronization control instruction, the synchronization control center first performs a PTP clock synchronization; after the PTP clock synchronization in the synchronization controller is completed, a response message is sent to the synchronization control center; After receiving the response message, the synchronous control center determines the time when the control instruction starts to be executed; The synchronization control center queries the status of the synchronization controller, and the synchronization controller sends the current status to the synchronization control center; When the synchronization control center finds that the synchronization controller is idle, it sends a synchronization control instruction to the synchronization controller; after receiving the synchronization control instruction, the synchronization controller waits for the execution time of the control instruction, and executes the specific control instruction after the execution time of the control instruction arrives.

2. The distributed measuring instrument synchronization control method according to claim 1, characterized in that: Determine the start time of control instruction execution: The maximum time t required for the control command to be sent from the synchronous control center to the synchronous controller s as follows: t s =max[D t1 ,D tx ]+S t +max[R t1 ,R tx ]; D t : Test the clock synchronization delay of the terminal; S t : The time required for the synchronization control center to send the synchronization control command; R t : The time required for the synchronous controller to receive the synchronous control instruction; The control instruction execution time t is as follows: C t : current time.

3. The distributed measuring instrument synchronization control method according to claim 1, characterized in that: The steps for waiting for the command to start executing are as follows: First, increase the priority of the current thread to ensure that the current thread can quickly seize the CPU; obtain the current time and calculate the difference Δ with the start time of the synchronous control instruction execution t ; If Δ t If it is greater than N1 milliseconds and less than N2 milliseconds, first delay N3 milliseconds in the time slice, N1<N3<N2, and then switch threads through sleep mode; if Δ t If it is greater than N2 milliseconds, the thread is switched directly through the sleep mode, and the process is repeated until Δ t Less than N1 milliseconds; then keep looping to get the current time and calculate the difference Δ from the start time of the synchronous control instruction execution t , when Δ t When it is within the threshold range, the synchronization control instruction is executed and finally the current thread priority is restored.

4. The distributed measuring instrument synchronization control method according to claim 3, characterized in that: The execution time of the control instruction must be greater than N1 milliseconds. After receiving the control instruction, each synchronous controller performs a thread switching through sleep to avoid the situation where some test terminals just receive the control instruction and the time slice switches, while some test terminals directly reach the control instruction execution time within the current time slice, resulting in control asynchrony. To avoid the time slice switching within a few milliseconds before the control instruction execution time in the synchronous controller arrives, before each sleep thread switching, first determine whether the time of the final cycle judgment threshold is between N3 milliseconds and N1 milliseconds, and there is a risk of occupying a time slice. If there is a risk, delay N3 milliseconds before sleep to avoid switching the time slice before the control instruction is executed.

5. A distributed measuring instrument synchronous control system, characterized in that: A control method as described in any one of claims 1 to 4 is adopted, including an instrument host and multiple test terminals, different devices are located in different locations and are connected through a local area network; distributed measurement requires measurement synchronization of different test terminals, that is, all devices of the instrument start a test function at the same time.

6. A distributed measuring instrument synchronous control system according to claim 5, characterized in that: The synchronization control center is the hub of synchronization control. There is only one synchronization control center in the distributed measuring instrument, which is deployed in the instrument host and is used to receive synchronization control instructions initiated by each device; The synchronization controller is the executor of synchronization control. A synchronization controller is deployed in both the instrument host and the test terminal. The synchronization controller receives the instructions from the synchronization control center and finally executes them; The synchronous control process realizes the PTP clock synchronization function and the synchronous instruction execution function.

7. A distributed measuring instrument synchronous control system according to claim 5, characterized in that: The process of synchronous control: When synchronous control is required during the operation of the instrument, the device initiating the control will send a control instruction to the synchronous control center through a control request; after receiving the synchronous control instruction, the synchronous control center will send the synchronous control command to the synchronous controller, and the synchronous controller will finally execute the synchronous instruction.

8. A distributed measuring instrument synchronous control system according to claim 5, characterized in that: The synchronization control center deploys the PTP server, the synchronization controller deploys the PTP client, and the PTP server initiates clock synchronization to the PTP client at regular intervals to ensure that the time between the various devices of the distributed measuring instruments is basically consistent.