Dynamic compensation method and device for opto-coupled isolation communication and communication equipment
By adjusting the high and low level times of the optocoupler isolation communication signal, estimating the CTR value, and calculating the control compensation amount, the signal distortion problem caused by individual differences in optocouplers and temperature changes is solved, achieving adaptive compensation of the signal waveform and improved communication stability.
Patent Information
- Application Number
- CN202210848731.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-19
- Publication Date
- 2026-02-13
- Estimated Expiration
- 2042-07-19
AI Technical Summary
In optocoupler-isolated communication, variations in CTR value and conduction delay time caused by individual differences in optocouplers and temperature changes lead to communication signal distortion, which existing technologies have not been able to effectively solve.
By adjusting the high and low level times during high-low level switching in the communication signal according to the current ambient temperature, the CTR of the optocoupler is estimated, and the control compensation amount is calculated. The high and low level times are dynamically compensated during communication to ensure the stability of the signal waveform.
It achieves adaptive dynamic compensation for optically isolated communication signals, avoiding signal distortion and improving the stability and reliability of communication.
Smart Images

Figure CN115276381B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of communication technology, in particular to a dynamic compensation method and device for opto-coupler isolation communication and a communication device. BACKGROUND
[0002] An opto-coupler is a device for transmitting electrical signals by using light as a medium. A light emitter (such as a light emitting diode) and a light receiver (such as a photoconductive semiconductor tube) are packaged in the same tube. When an electrical signal is input, the light emitter emits light, and the light receiver receives the light and generates a photoelectric current, which flows out from the output end, thereby realizing "electrical-optical-electrical" conversion and coupling the input signal to the output by using light as a medium.
[0003] When using an opto-coupler isolation communication circuit for communication, the communication signal may be distorted, and the main cause of the distortion is the influence of the CTR (Current Transfer Ratio) value of the opto-coupler. For mass-produced products, the CTR values of different individuals of the same model may have a large deviation, such as 80% to 160%, 130% to 300%, 100% to 500%, etc. The temperature also affects the CTR value. Generally, the higher the temperature, the larger the CTR value. When the CTR value is too small, the opto-coupler may not conduct, resulting in the inability to transmit the signal. When the CTR value is too large, the high-level time of the output of the opto-coupler will be shortened, affecting the waveform of the communication signal. Taking PC817 opto-coupler as an example, the higher the temperature, the longer the conduction delay time of the opto-coupler, and the conduction delay time of the opto-coupler changes little, which will result in a shorter high-level time and a longer low-level time. The distortion of the above waveform mainly occurs when the high and low levels are switched, that is, the waveform distortion occurs in the process of switching from high level to low level and from low level to high level.
[0004] The individual differences of the opto-coupler and the temperature change will affect the CTR value and the conduction delay time, and further cause the distortion of the communication waveform during transmission, which may cause communication abnormalities. The purpose of using an opto-coupler isolation communication circuit is to isolate, and the two ends being isolated do not have an actual electrical connection. The signal transmission is performed by the conversion between light and electricity, and the signal of the opto-coupler only has on and off, so it can only transmit high and low level signals and cannot accurately transmit voltage values. Therefore, the waveform distortion before and after signal transmission cannot be actually known, and thus the control chip of the mainboard cannot directly detect the actual waveform after isolation to adjust the communication waveform.
[0005] In view of the problem that the individual differences of the opto-coupler and the temperature change affect the CTR value and the conduction delay time, resulting in the distortion of the communication signal, no effective solution has been proposed in the prior art. SUMMARY
[0006] The embodiment of the present application provides a dynamic compensation method, device and communication equipment for optocoupler isolation communication, so as to at least solve the problem that the individual difference and temperature change of the optocoupler affect the CTR value and the conduction delay time, and cause the communication signal distortion.
[0007] To solve the above technical problems, the embodiment of the present application provides a dynamic compensation method for optocoupler isolation communication, comprising:
[0008] According to the current environment temperature, the high level time and the low level time when the high and low levels in the communication signal are switched are adjusted to determine the optocoupler CTR estimation value;
[0009] The control compensation amount is calculated according to the current environment temperature and the optocoupler CTR estimation value;
[0010] Then, in the actual communication process, the high level time is increased by the control compensation amount, and the low level time is reduced by the control compensation amount.
[0011] Optionally, according to the current environment temperature, the high level time and the low level time when the high and low levels in the communication signal are switched are adjusted to determine the optocoupler CTR estimation value, comprising:
[0012] The first time compensation amount is determined according to the current environment temperature;
[0013] The second time compensation amount is determined by adjusting the high level time and the low level time;
[0014] The optocoupler CTR estimation value is calculated according to the first time compensation amount and the second time compensation amount.
[0015] Optionally, the first time compensation amount is determined according to the current environment temperature, comprising:
[0016] The current environment temperature is obtained;
[0017] According to the preset temperature compensation information, the compensation amount corresponding to the current environment temperature is determined as the first time compensation amount.
[0018] Optionally, the second time compensation amount is determined by adjusting the high level time and the low level time, comprising:
[0019] The high level time is increased by the first time compensation amount, and the low level time is reduced by the first time compensation amount;
[0020] Whether the first communication is successful is detected;
[0021] If the first communication is successful, the current high level time and low level time are adjusted successively until the communication fails, and the second time compensation is determined according to the number of adjustments.
[0022] If the first communication fails, the high level time and low level time are adjusted to a limit value, the high level time and low level time are adjusted successively from the limit value until the communication succeeds, and the second time compensation is determined according to the number of adjustments.
[0023] Optionally, the current high level time and low level time are adjusted successively until the communication fails, and the second time compensation is determined according to the number of adjustments, comprising:
[0024] The current high level time is reduced by a preset time, and the current low level time is increased by the preset time, or the current high level time is increased by the preset time, and the current low level time is reduced by the preset time;
[0025] Detecting whether the communication is successful;
[0026] If the communication is successful, returning to execute the step of reducing the current high level time by a preset time, and increasing the current low level time by the preset time, or increasing the current high level time by the preset time, and reducing the current low level time by the preset time;
[0027] If the communication fails, calculating T1×(N-1) to obtain the second time compensation, wherein T1 represents the preset time, and N represents a first adjustment number of the high level time or the low level time adjusted by the preset time.
[0028] Optionally, the high level time and low level time are adjusted to a limit value, the high level time and low level time are adjusted successively from the limit value until the communication succeeds, and the second time compensation is determined according to the number of adjustments, comprising:
[0029] Adjusting the high level time to a lower limit and adjusting the low level time to an upper limit;
[0030] Detecting whether the communication is successful;
[0031] If the communication fails, increasing the current high level time by a preset time, and reducing the current low level time by the preset time, and returning to execute the step of detecting whether the communication is successful;
[0032] If the communication succeeds, calculating T smin +T1×M to obtain the second time compensation, wherein T smin represents a minimum value of the second time compensation, T1 represents the preset time, and M represents a second adjustment number of the high level time or the low level time adjusted by the preset time.
[0033] Optionally, after the current high level time is increased by the preset time and the current low level time is decreased by the preset time, the method further comprises:
[0034] When the high level time is increased to the upper limit or the low level time is decreased to the lower limit, and the communication failure is still detected, the detection is terminated and a communication abnormality prompt is output.
[0035] Optionally, the high level time and the low level time are adjusted to the limit value, the high level time and the low level time are adjusted successively from the limit value until the communication is successful, and the second time compensation amount is determined according to the adjustment times, comprising:
[0036] The high level time is adjusted to the upper limit and the low level time is adjusted to the lower limit;
[0037] The communication is detected;
[0038] If the communication fails, the current high level time is decreased by the preset time and the current low level time is increased by the preset time, and the step of detecting the communication is performed again;
[0039] If the communication succeeds, T smin +T1×M is calculated to obtain the second time compensation amount, wherein T smin represents the minimum value of the second time compensation amount, T1 represents the preset time, and M represents the second adjustment times of adjusting the high level time or the low level time by the preset time.
[0040] Optionally, after the current high level time is decreased by the preset time and the current low level time is increased by the preset time, the method further comprises:
[0041] When the high level time is decreased to the lower limit or the low level time is increased to the upper limit, and the communication failure is still detected, the detection is terminated and a communication abnormality prompt is output.
[0042] Optionally, if the second time compensation amount is determined by decreasing the high level time and increasing the low level time at the same time, the optical coupling CTR estimation value is calculated by the following formula:
[0043] C=K / (T0-T cmin -T s -Tplh+Tphl+T n ),
[0044] If the second time compensation amount is determined by increasing the high level time and decreasing the low level time at the same time, the optical coupling CTR estimation value is calculated by the following formula:
[0045] C=K / (T0-T cmin-T s +Tplh-Tphl-T n ),
[0046] wherein C represents the photo-coupler CTR estimated value; K represents a constant; T0 represents a unit bit width time; T cmin represents the minimum time of the detected level duration; T s represents the second time compensation; Tplh represents the normal temperature photo-coupler turn-on delay time; Tphl represents the normal temperature photo-coupler turn-off delay time; T n represents the first time compensation.
[0047] Optionally, according to the current ambient temperature and the photo-coupler CTR estimated value, the following formula is used to calculate the control compensation:
[0048] T2=Tplh-Tphl+K / C+T n ,
[0049] wherein T2 represents the control compensation; Tplh represents the normal temperature photo-coupler turn-on delay time; Tphl represents the normal temperature photo-coupler turn-off delay time; K represents a constant; C represents the photo-coupler CTR estimated value; T n represents the first time compensation.
[0050] Optionally, after the high level time is increased by the control compensation and the low level time is reduced by the control compensation, the method further comprises:
[0051] The ambient temperature is continuously monitored, and when the ambient temperature changes is monitored, the control compensation is recalculated according to the current ambient temperature and the current photo-coupler CTR estimated value, and the compensation is performed again according to the new control compensation.
[0052] Optionally, after the high level time is increased by the control compensation and the low level time is reduced by the control compensation, the method further comprises:
[0053] The photo-coupler CTR estimated value is periodically recalculated;
[0054] According to the current ambient temperature and the new photo-coupler CTR estimated value, a new control compensation is calculated;
[0055] The high level time is increased by the new control compensation, and the low level time is reduced by the new control compensation.
[0056] Optionally, the photo-coupler CTR estimated value is periodically recalculated, comprising:
[0057] decrease the current high level time by the preset time while increasing the current low level time by the preset time, or increase the current high level time by the preset time while decreasing the current low level time by the preset time;
[0058] detecting whether the communication is successful;
[0059] if the communication is successful, returning to the step of decreasing the current high level time by the preset time while increasing the current low level time by the preset time, or increasing the current high level time by the preset time while decreasing the current low level time by the preset time;
[0060] if the communication fails, calculating T1×(N-1)+T s0 , to obtain a new second time compensation amount, wherein T1 represents the preset time, N represents a first adjustment number of times of adjusting the high level time or the low level time by the preset time, and T s0 represents an original second time compensation amount;
[0061] calculating a new optical coupling CTR estimation value according to the first time compensation amount corresponding to the current environment temperature and the new second time compensation amount.
[0062] Optionally, when one of the two parties in the communication performs the calculation of the optical coupling CTR estimation value, the other party maintains the current state to perform the communication and is not allowed to perform the calculation of the optical coupling CTR value and the time adjustment of the high level and the low level.
[0063] The embodiment of the present application further provides a dynamic compensation device for optical coupling isolation communication, which comprises:
[0064] a determination module configured to adjust the high level time and the low level time when the high level and the low level are switched in the communication signal according to a current environment temperature, so as to determine an optical coupling CTR estimation value;
[0065] a calculation module configured to calculate a control compensation amount according to the current environment temperature and the optical coupling CTR estimation value;
[0066] a compensation module configured to increase the high level time by the control compensation amount while decreasing the low level time by the control compensation amount in an actual communication process.
[0067] The embodiment of the present application further provides a communication device, which comprises the dynamic compensation device for optical coupling isolation communication.
[0068] The embodiment of the present application further provides a nonvolatile computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the steps of the method.
[0069] According to the technical scheme, the optical coupler CTR estimation value is estimated according to the current environment temperature and the actual situation of the optical coupler, the required control compensation is calculated according to the current environment temperature and the optical coupler CTR estimation value, and the high level time and the low level time when the high level and the low level of the communication signal are switched are compensated by using the control compensation, so that the high level time and the low level time when the high level and the low level of the communication signal are switched can be adaptively and dynamically compensated in the case that the optical coupler CTR value and the conduction delay time change due to the individual differences of the optical coupler and the environment temperature, the waveform of the communication signal is automatically adjusted, the communication signal distortion is avoided, the communication stability is ensured, and the reliability and stability of the optical coupler isolation communication circuit are improved. BRIEF DESCRIPTION OF DRAWINGS
[0070] Figure 1 is a flow chart of the optical coupler isolation communication dynamic compensation method provided by the embodiment one of the present application;
[0071] Figure 2 is a schematic diagram of the optical coupler isolation communication circuit provided by the embodiment one of the present application;
[0072] Figure 3 is a dynamic compensation control flow chart of the optical coupler isolation communication provided by the embodiment two of the present application;
[0073] Figure 4 is a compensation control flow chart of the optical coupler aging problem provided by the embodiment two of the present application;
[0074] Figure 5 is a schematic diagram of the dynamic compensation system provided by the embodiment two of the present application;
[0075] Figure 6 is a structure block diagram of the optical coupler isolation communication dynamic compensation device provided by the embodiment three of the present application. DETAILED DESCRIPTION
[0076] In order to make the purpose, technical scheme and advantages of the present application clearer, the present application will be further described in detail below with reference to the drawings. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0077] It should be noted that the terms "first", "second", and the like in the description and in the claims of the present application and the drawings are used to distinguish similar objects and are not necessarily used to describe a particular sequential or chronological order. It should be understood that the data thus used can be interchanged, where appropriate, so that the embodiments of the present application described herein can be carried out in sequences other than those illustrated or described herein. Furthermore, the terms "comprise" and "have", and any variations thereof, are intended to cover non-exclusive inclusion, for example, processes, methods, systems, products, or devices that comprise a list of steps or units are not necessarily limited to those clearly listed, but can include other steps or units not clearly listed or inherent to such processes, methods, products, or devices.
[0078] It should be noted that the steps shown in the flowchart of the drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in an order different from that shown herein.
[0079] The optional embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0080] Embodiment one
[0081] The present embodiment provides a dynamic compensation method for optocoupler isolation communication, Figure 1 is a flowchart of the dynamic compensation method for optocoupler isolation communication provided by the first embodiment of the present application, as shown in the figure, the method comprises the following steps: Figure 1
[0082] S101, according to the current ambient temperature, the high level time and the low level time when the high-low level of the communication signal is switched are adjusted to determine the optocoupler CTR estimation value.
[0083] S102, the control compensation amount is calculated according to the current ambient temperature and the optocoupler CTR estimation value.
[0084] S103, then, in the actual communication process, the high level time when the high-low level of the communication signal is switched is increased by the control compensation amount, and the low level time when the high-low level of the communication signal is switched is reduced by the control compensation amount.
[0085] The high level time refers to the time duration of a single high level, and the low level time refers to the time duration of a single low level. Normally, the high level time and the low level time in the communication signal are equal and fixed. The individual differences of the optocoupler and the change of the ambient temperature will affect the CTR value and the conduction delay time of the optocoupler, resulting in waveform distortion of the communication signal output by the optocoupler when the high level and the low level are switched, i.e., waveform distortion when the high level is switched to the low level and the low level is switched to the high level, which specifically results in a shorter high level time and a longer low level time when the high level and the low level are switched.
[0086] In the embodiment, the adjustment and compensation are mainly for the high level time and the low level time when the high level and the low level are switched in the communication signal, i.e., for the two processes of switching the high level to the low level and switching the low level to the high level. Instead of adjusting and compensating all the high level time and the low level time in the communication signal, because the continuous high level and the continuous low level do not have distortion.
[0087] In the embodiment, the CTR estimated value of the optocoupler is estimated according to the current ambient temperature and the actual situation of the optocoupler, and the required control compensation is calculated according to the current ambient temperature and the CTR estimated value of the optocoupler. The high level time and the low level time when the high level and the low level are switched in the communication signal are compensated by using the control compensation, so that the high level time and the low level time when the high level and the low level are switched in the communication signal can be adaptively and dynamically compensated, the waveform of the communication signal can be automatically adjusted, the distortion of the communication signal can be avoided, the communication stability can be ensured, and the reliability and stability of the optocoupler isolation communication circuit are improved.
[0088] In one embodiment, S101 adjusts the high level time and the low level time when the high level and the low level are switched in the communication signal according to the current ambient temperature to determine the CTR estimated value of the optocoupler, including: determining a first time compensation according to the current ambient temperature; determining a second time compensation by adjusting the high level time and the low level time; and calculating the CTR estimated value of the optocoupler according to the first time compensation and the second time compensation.
[0089] The first time compensation is a time compensation determined according to the current ambient temperature. The second time compensation is a limit time compensation for ensuring the success of the communication on the basis of the preliminary compensation of the high level time and the low level time when the high level and the low level are switched according to the first time compensation. The CTR value of the optocoupler is an inherent property of the optocoupler itself. The CTR value of the optocoupler may be different due to the individual differences of the optocoupler, and may also change due to the change of the ambient temperature. The change of the CTR value of the optocoupler will affect the specific work of the optocoupler, resulting in different limit time compensations for ensuring the success of the communication. The present embodiment can inversely deduce the CTR estimated value of the optocoupler at room temperature by finding the limit time compensation.
[0090] The embodiment comprehensively considers the ambient temperature and the actual situation of the photocoupler, and can obtain a relatively accurate photocoupler CTR estimation value.
[0091] Specifically, the first time compensation amount is determined according to the current ambient temperature, including: obtaining the current ambient temperature; determining the compensation amount corresponding to the current ambient temperature as the first time compensation amount according to preset temperature compensation information.
[0092] The temperature compensation information can be obtained through test in advance, and the temperature compensation information can be stored in the form of a table. The temperature compensation information includes the ambient temperature and the corresponding compensation amount, or the temperature compensation information includes the temperature difference and the corresponding compensation amount, the temperature difference refers to the difference between the current ambient temperature and the preset temperature, and the preset temperature can be the normal temperature set according to the local situation. For example, if the current ambient temperature exceeds the preset temperature by a certain range, the corresponding compensation amount can be obtained by looking up the table according to the temperature difference.
[0093] The embodiment can quickly obtain the first time compensation amount matched with the current ambient temperature based on the preset temperature compensation information.
[0094] Specifically, the second time compensation amount is determined by adjusting the high-level time and the low-level time, including: increasing the high-level time by the first time compensation amount, and decreasing the low-level time by the first time compensation amount; detecting whether the first communication is successful; if the first communication is successful, adjusting the current high-level time and low-level time successively until the communication fails, and determining the second time compensation amount according to the number of adjustments; if the first communication fails, adjusting the high-level time and the low-level time to a limit value, and adjusting the high-level time and the low-level time successively from the limit value until the communication is successful, and determining the second time compensation amount according to the number of adjustments.
[0095] If the data is received and the data verification is passed, the communication is considered successful; if the data is not received or the data verification is not passed, the communication is considered failed.
[0096] If the first communication fails, the high-level time and the low-level time are adjusted successively from the limit value to attempt to restore the communication until the communication is successful, so as to determine the limit time compensation amount that can just restore the communication.
[0097] If the first communication is successful, the high-level time and the low-level time (i.e. the intermediate value) are adjusted successively from the current high-level time and the low-level time until the communication fails, so as to determine the limit time compensation amount corresponding to the last adjustment operation before the communication fails.
[0098] The embodiment first compensates the high level time and the low level time according to the first time compensation amount, and then continues to adjust the high level time and the low level time according to whether the communication is successful, so as to obtain the accurate second time compensation amount.
[0099] The two cases of obtaining the second time compensation amount are described below.
[0100] (1) First communication success
[0101] The current high level time and the low level time are adjusted successively until the communication fails, and the second time compensation amount is determined according to the number of adjustments, including:
[0102] The current high level time is reduced by a preset time, and the current low level time is increased by the preset time, or the current high level time is increased by the preset time, and the current low level time is reduced by the preset time;
[0103] Detect whether the communication is successful;
[0104] If the communication is successful, return to execute the step of reducing the current high level time by a preset time, and increasing the current low level time by the preset time, or increasing the current high level time by the preset time, and reducing the current low level time by the preset time;
[0105] If the communication fails, calculate T1×(N-1) to obtain the second time compensation amount, wherein T1 represents the preset time, and N represents the first adjustment number of the high level time or the low level time according to the preset time, that is, the number of times of executing the step of reducing the current high level time by a preset time, and increasing the current low level time by the preset time.
[0106] The preset time is generally small, for example, 5μs. The smaller the preset time, the longer the time consumption of adjustment, but the detection is more accurate.
[0107] The embodiment can obtain the accurate second time compensation amount in the case of first communication success.
[0108] (2) First communication failure
[0109] In the case of first communication failure, the high level time and the low level time are adjusted successively from the limit value, and under the premise of ensuring that the sum of the high level time and the low level time is unchanged when the high level and the low level are switched, the high level time can be adjusted to the lower limit, or the low level time can be adjusted to the lower limit. The two cases are described below:
[0110] 1) adjusting the high level time and the low level time to the limit value, and adjusting the high level time and the low level time successively from the limit value until the communication succeeds, and determining a second time compensation amount according to the number of adjustments, comprising:
[0111] adjusting the high level time to the lower limit value and adjusting the low level time to the upper limit value;
[0112] detecting whether the communication succeeds;
[0113] if the communication fails, increasing the current high level time by a preset time and decreasing the current low level time by the preset time, and returning to the step of detecting whether the communication succeeds;
[0114] if the communication succeeds, calculating T smin +T1×M, to obtain the second time compensation amount, wherein T smin represents the minimum value of the second time compensation amount, T1 represents the preset time, and M represents the second number of adjustments of the high level time or the low level time according to the preset time, i.e. the number of times of executing the step of increasing the current high level time by the preset time and decreasing the current low level time by the preset time.
[0115] wherein the lower limit value and the upper limit value of the high level time and the low level time are preset. The minimum value of the second time compensation amount is a negative number, for example, -200 μs.
[0116] The embodiment can obtain an accurate second time compensation amount by traversing detection from the limit value and attempting to recover the communication in the case of first communication failure.
[0117] Further, after increasing the current high level time by the preset time and decreasing the current low level time by the preset time, the embodiment further comprises: when the high level time is increased to the upper limit value or the low level time is decreased to the lower limit value, and the communication still fails, terminating the detection and outputting a communication abnormality prompt.
[0118] wherein for the high level time, the high level time is increased successively by the preset time from the lower limit value, and when the high level time is increased to the upper limit value and the communication still fails, the high level time has been traversed and cannot be adjusted any more, indicating that the communication is abnormal. For the low level time, the low level time is decreased successively by the preset time from the upper limit value, and when the low level time is decreased to the lower limit value and the communication still fails, the low level time has been traversed and cannot be adjusted any more, indicating that the communication is abnormal.
[0119] The embodiment can timely prompt the communication abnormality.
[0120] 2) adjusting the high level time and the low level time to the limit value, adjusting the high level time and the low level time successively from the limit value until the communication is successful, and determining the second time compensation according to the adjustment times, comprising:
[0121] adjusting the high level time to the upper limit and adjusting the low level time to the lower limit;
[0122] detecting whether the communication is successful;
[0123] if the communication fails, decreasing the current high level time by a preset time and increasing the current low level time by the preset time, and returning to the step of detecting whether the communication is successful;
[0124] if the communication succeeds, calculating T smin +T1×M, to obtain the second time compensation, wherein T smin represents the minimum value of the second time compensation, T1 represents the preset time, and M represents the second adjustment times of adjusting the high level time or the low level time by the preset time.
[0125] Further, after decreasing the current high level time by the preset time and increasing the current low level time by the preset time, the method further comprises:
[0126] when the high level time is decreased to the lower limit or the low level time is increased to the upper limit and the communication still fails, terminating the detection and outputting a communication abnormality prompt.
[0127] According to the above case 2), the communication can also be detected from the limit value in the case of first communication failure, the communication can be tried to be recovered, the accurate second time compensation can be obtained, and the communication abnormality can be prompted in time.
[0128] In one embodiment, if the second time compensation is determined by decreasing the high level time and increasing the low level time at the same time, the following formula is used to calculate the optical coupling CTR estimation value:
[0129] C=K / (T0-T cmin -T s -Tplh+Tphl+T n ),
[0130] If the second time compensation is determined by increasing the high level time and decreasing the low level time at the same time, the following formula is used to calculate the optical coupling CTR estimation value:
[0131] C=K / (T0-T cmin -T s +Tplh-Tphl-T n ),
[0132] Wherein, C represents the optical coupling CTR estimation value; K represents a constant, which is a constant value obtained by testing at normal temperature, and is related to the rising time and falling time of the waveform; T0 represents the unit bit width time, i.e. the time required for transmitting one bit; T cmin represents the minimum time of the detected level duration, and when the level duration is less than T cmin , it cannot be detected, and T cmin can be obtained by experimental statistics; T s represents the second time compensation amount; Tplh represents the normal temperature optical coupling conduction delay time; Tphl represents the normal temperature optical coupling turn-off delay time; T n represents the first time compensation amount.
[0133] The above formula can be used to estimate an accurate and reliable optical coupling CTR estimation value.
[0134] In an embodiment, S102 calculates the control compensation amount according to the current environmental temperature and the optical coupling CTR estimation value by using the following formula:
[0135] T2 = Tplh - Tphl + K / C + T n ,
[0136] Wherein, T2 represents the control compensation amount; Tplh represents the normal temperature optical coupling conduction delay time; Tphl represents the normal temperature optical coupling turn-off delay time; K represents a constant; C represents the optical coupling CTR estimation value; T n represents the first time compensation amount.
[0137] The above formula can be used to obtain an accurate and reliable control compensation amount.
[0138] In an embodiment, after the high level time is increased by the control compensation amount and the low level time is reduced by the control compensation amount in S103, the method further comprises: continuously monitoring the environmental temperature, and when the environmental temperature is monitored to change, the control compensation amount is recalculated according to the current environmental temperature and the current optical coupling CTR estimation value, and the high and low level times are compensated according to the new control compensation amount. In this embodiment, when the environmental temperature does not change, the current compensation control is maintained, and the change of the environmental temperature is continuously monitored, and when the environmental temperature changes, the control compensation amount is recalculated, and the high and low level times are compensated according to the new control compensation amount. Specifically, the high level time is increased by the new control compensation amount, and the low level time is reduced by the new control compensation amount, so as to ensure the compensation matching based on the change of the environmental temperature, and ensure the stability of the communication.
[0139] Considering that the optical coupling has an aging problem, the optical coupling CTR value will decrease with the use time, and therefore the optical coupling CTR value can be periodically detected to correct the control compensation amount.
[0140] Specifically, after increasing the high level time and decreasing the low level time by the control compensation, the method further comprises: periodically recalculating the optocoupler CTR estimation value in the normal communication state; calculating a new control compensation according to the current ambient temperature and the new optocoupler CTR estimation value; increasing the high level time by the new control compensation and decreasing the low level time by the new control compensation.
[0141] The embodiment further adjusts the high level time and the low level time to obtain a new second time compensation on the basis of the compensation of the high level time and the low level time by the original control compensation, and then obtains a new optocoupler CTR estimation value and a new control compensation, so that the optocoupler aging problem can be compensated, the communication signal waveform distortion can be avoided, and the communication stability can be ensured.
[0142] Further, the periodically recalculating the optocoupler CTR estimation value comprises: decreasing the current high level time by a preset time and increasing the current low level time by the preset time, or increasing the current high level time by the preset time and decreasing the current low level time by the preset time; detecting whether the communication is successful; if the communication is successful, returning to execute the step of decreasing the current high level time by the preset time and increasing the current low level time by the preset time, or increasing the current high level time by the preset time and decreasing the current low level time by the preset time; and if the communication is unsuccessful, calculating T1×(N-1)+T s0 , to obtain a new second time compensation, wherein T1 represents the preset time, N represents a first adjustment number of adjusting the high level time or the low level time by the preset time, and T s0 represents the original second time compensation; and calculating a new optocoupler CTR estimation value according to the first time compensation corresponding to the current ambient temperature and the new second time compensation.
[0143] The step of recalculating the optocoupler CTR estimation value is similar to the specific steps in the case of the first successful communication, and the calculation formula is not described herein.
[0144] Similarly, after increasing the high level time by the new control compensation and decreasing the low level time by the new control compensation, the ambient temperature can be continuously monitored, the current compensation control can be maintained when the ambient temperature is unchanged, and the ambient temperature can be continuously monitored; when the ambient temperature changes, the control compensation is recalculated according to the current ambient temperature and the current optocoupler CTR estimation value, and the high level time and the low level time are compensated according to the new control compensation, so that the compensation based on the change of the ambient temperature can be ensured, and the communication stability can be ensured.
[0145] In order to realize the isolated communication between two nodes, two optocouplers (i.e. double optocoupler communication) are needed, one optocoupler is responsible for sending data, and one is responsible for optocoupler receiving data. Because of the individual differences of the optocoupler, the CTR values of the two optocouplers need to be detected respectively. For the case of double optocouplers, one of the two communication parties calculates the CTR estimation value of the optocoupler, and the other party maintains the current state for communication and does not allow the calculation of the CTR value of the optocoupler and the time adjustment of the high and low levels. Thus, it can ensure normal communication and avoid the situation of misjudgment caused by communication failure when both sides adjust at the same time, for example, when one side detects the CTR value, the other side may adjust the high and low level time, which may cause communication failure, and at this time, the detection of the CTR value by one side will be inaccurate.
[0146] As shown in Figure 2 , it is a schematic diagram of an optocoupler isolated communication circuit, which includes a first optocoupler O1 and a second optocoupler O2. Two communication nodes are denoted as an upper computer and a lower computer, the upper computer sends data to the lower computer first, and the lower computer replies data to the upper computer. The upper computer is connected to UI1 as a data sending end, and is connected to UO2 as a data receiving end. The lower computer is connected to UI2 as a data sending end, and is connected to UO1 as a data receiving end. The upper computer is responsible for detecting the CTR value of the first optocoupler O1 and performing compensation control, and the lower computer is responsible for detecting the CTR value of the second optocoupler O2 and performing compensation control.
[0147] Regarding the detection sequence of the CTR value of the double optocoupler and the judgment of whether the communication is successful, the following is explained: the upper computer first detects the CTR value of the first optocoupler O1, at this time the lower computer maintains the current state for communication and does not allow the detection of the CTR value of the optocoupler and the time adjustment of the high and low levels. If the upper computer can correctly receive the reply information of the lower computer, it is judged as successful communication, otherwise it is judged as communication failure. After the upper computer detects the CTR value of the first optocoupler O1, the lower computer detects the CTR value of the second optocoupler O2, at this time the upper computer maintains the current state for communication and does not allow the detection of the CTR value of the optocoupler and the time adjustment of the high and low levels. If the lower computer can receive the data sent by the upper computer with the information of successful reception, it is judged as successful communication, otherwise it is judged as communication failure.
[0148] In the above process, one node first detects the CTR value of the corresponding optocoupler, and after the detection is completed, the other node detects the CTR value of the corresponding optocoupler, thereby ensuring normal communication and avoiding the situation of misjudgment caused by communication failure when both sides adjust at the same time, for example, when the upper computer detects the CTR value, the lower computer may adjust the high and low level time, which may cause communication failure, at this time, the detection of the CTR value by the upper computer will be inaccurate.
[0149] Embodiment two
[0150] The dynamic compensation method for optically isolated communication described above will be illustrated below with a specific example. However, it is worth noting that this specific embodiment is only for better illustrating this application and does not constitute an undue limitation of this application. The same or corresponding terminology as in the above embodiments will not be repeated in this embodiment.
[0151] like Figure 3 As shown, the dynamic compensation control scheme for optically isolated communication includes the following steps:
[0152] S301 powers on, initializes the high-level and low-level times to be equal, detects the current ambient temperature, obtains the first-time compensation amount corresponding to the current ambient temperature based on preset temperature compensation information, and performs temperature compensation on the high-level and low-level times according to the first-time compensation amount. Specifically, the high-level time is increased by the first-time compensation amount, while the low-level time is decreased by the first-time compensation amount. Temperature compensation includes compensation for changes in CTR value and optocoupler conduction delay time.
[0153] S302, Check if the first communication was successful. If successful, proceed to step S303; if it fails, proceed to step S305.
[0154] S303: Decrease the high-level time by T1, increase the low-level time by T1, and calculate the second time compensation amount T corresponding to this adjustment operation. s =T1×N, where N represents the number of times step S303 is executed, that is, the number of times the high and low level times are adjusted according to T1 in S303.
[0155] S304: Check if communication is successful. If successful, return to repeat step S303 to continue adjusting the high and low level times and updating T. s If it fails, then determine the final second time compensation amount T. s The second time compensation amount T during the previous execution of step S303 s That is, the final second time compensation amount is T1×(N-1), and then step S310 is executed.
[0156] Through steps S303 to S304, adjust the high and low level times until communication fails, in order to quickly obtain the second time compensation amount T. s In other words, starting from the current high-level time (i.e., the intermediate value), the high-level time is continuously reduced until the communication fails, at which point the previous high-level time T... s That is the final T s .
[0157] S305 adjusts the high-level time to the lower limit and the low-level time to the upper limit, and adjusts the second time compensation amount T. s Set it to the minimum value (a negative number, such as -200μs).
[0158] S306, detecting whether the communication is successful, if not, executing step S307, if yes, determining the final second time compensation T s for the second time compensation T when step S307 is executed for the last time s , that is, the final second time compensation is T1 x M, and then executing step S310.
[0159] S307, increasing the high level time by T1, decreasing the low level time by T1, and calculating the second time compensation T corresponding to the current adjustment operation s = T smin + T1 x M, wherein, T smin represents the minimum value of the second time compensation, and M represents the number of times of executing step S307, that is, the number of times of adjusting the high and low level times by T1 in S307.
[0160] S308, judging whether the high level time is increased to the upper limit or the low level time is decreased to the lower limit, if yes, executing step S309, if not, returning to step S306.
[0161] S309, judging that the communication is abnormal and unrecoverable. That is, if the high level time is increased to the upper limit or the low level time is decreased to the lower limit, and the communication is not successful all the time, it is determined that the communication is abnormal and unrecoverable.
[0162] Through steps S305 to S309, the second time compensation T s is obtained by traversing the adjustable range, which may take a long time. That is, for the high level time, the traversal detection is performed from the minimum value to the maximum value, and the T s when the communication is just recovered is the final T s .
[0163] S310, calculating the optocoupler CTR estimation value according to the first time compensation obtained in step S301 and the second time compensation T s obtained through steps S304 or S306.
[0164] S311, calculating the control compensation T2 according to the first time compensation and the optocoupler CTR estimation value.
[0165] S312, increasing the high level time by T2 at the high-low level switching position in the communication waveform, and decreasing the low level time by T2.
[0166] S313, detecting whether the environmental temperature changes, if yes, returning to execute step S311 again to update T2; if not, keeping the current control and continuously detecting the change of the environmental temperature.
[0167] Figure 3 The step shown compensates the high level time and low level time in the communication signal dynamically when the high level and low level are switched, so as to realize the stable communication.
[0168] It should be noted that, in the above embodiment, Figure 3 , step S303 can also be: increasing the high level time by T1 and decreasing the low level time by T1. Step S305 can also be: adjusting the high level time to the upper limit and adjusting the low level time to the lower limit; correspondingly, step S307 is changed to: decreasing the high level time by T1 and increasing the low level time by T1; correspondingly, step S308 is changed to: judging whether the high level time is decreased to the lower limit or the low level time is increased to the upper limit.
[0169] The calculation of the optical coupling CTR estimation value and the control compensation amount T2 is described in Embodiment 1, which will not be repeated here.
[0170] As shown in the above embodiment, Figure 4 , the compensation control scheme for the optical coupling aging problem includes the following steps:
[0171] S401, periodically performing optical coupling aging detection, i.e., periodically performing detection of the optical coupling CTR estimation value.
[0172] S402, currently in normal communication state, further adjusting on the basis of the existing control compensation amount.
[0173] S403, decreasing the high level time by T1 and increasing the low level time by T1, and calculating the second time compensation amount T s = T1 x N + T s0 , corresponding to the current adjustment operation, where T s0 represents the original second time compensation amount, and N represents the number of times of executing step S403, i.e., the number of times of adjusting the high and low level times by T1 in S403.
[0174] S404, detecting whether the communication is successful, if yes, returning to repeat S403 to continue adjusting the high and low level times and updating T s ; if no, determining that the final second time compensation amount T s is the second time compensation amount T s when the last step S403 is executed, i.e., the final second time compensation amount is T1 x (N-1) + T s0 , and then executing step S405.
[0175] Through steps S403 to S404, the high and low level times are adjusted until the communication fails, so as to quickly obtain the second time compensation amount Ts.
[0176] S405, obtaining a corresponding first time compensation amount according to the current environment temperature and the second time compensation amount T obtained through step S404 s , and a new optocoupler CTR estimation value is recalculated.
[0177] S406, calculating a new control compensation amount T2 according to the first time compensation amount and the new optocoupler CTR estimation value.
[0178] S407, increasing the high level time at the high-low level switching place in the communication waveform by T2, and decreasing the low level time by T2.
[0179] S408, detecting whether the environment temperature changes, if changes, returning to re-execute step S406 to update T2; if no changes, maintaining the current control and continuously detecting the change of the environment temperature.
[0180] Figure 4 As shown in the steps, the optocoupler CTR value is periodically detected to correct the control compensation amount, which can avoid the distortion of the communication signal caused by the change of the CTR value due to the aging of the optocoupler, thereby achieving the purpose of realizing stable communication.
[0181] It should be noted that in Figure 4 , step S403 can also be changed to: increasing the high level time by T1, and decreasing the low level time by T1.
[0182] As shown in Figure 5 , the dynamic compensation system of the embodiment of the application comprises: a temperature detection module 10, an optocoupler isolation communication module 20 and a control module 30. The temperature detection module 10 is used to detect the environment temperature. The optocoupler isolation communication module 20 is used to realize the communication between different communication nodes, and has the functions of circuit isolation, signal conversion and transmission. The control module 30 is used to collect the temperature information of the temperature detection module 10, and control the data receiving and sending of the optocoupler isolation communication module 20.
[0183] Embodiment three
[0184] Based on the same inventive concept, the embodiment provides an optocoupler isolation communication dynamic compensation device, which can be used to realize the optocoupler isolation communication dynamic compensation method described in the above embodiments. The device can be realized by software and / or hardware.
[0185] Figure 6 is a structural block diagram of the optocoupler isolation communication dynamic compensation device provided by the embodiment three of the application, as shown in Figure 6 , the device comprises:
[0186] A determination module 61 is configured to adjust the high level time and the low level time at the high-low level switching place in the communication signal according to the current environment temperature, so as to determine the optocoupler CTR estimation value.
[0187] The computing module 62 is configured to calculate a control compensation amount according to the current ambient temperature and the optocoupler CTR estimation value.
[0188] The compensation module 63 is configured to increase the high-level time by the control compensation amount and decrease the low-level time by the control compensation amount in an actual communication process.
[0189] Optionally, the determining module 61 comprises:
[0190] A first determining unit is configured to determine a first time compensation amount according to the current ambient temperature.
[0191] A second determining unit is configured to determine a second time compensation amount by adjusting the high-level time and the low-level time.
[0192] A calculating unit is configured to calculate the optocoupler CTR estimation value according to the first time compensation amount and the second time compensation amount.
[0193] Optionally, the first determining unit comprises:
[0194] An obtaining subunit is configured to obtain the current ambient temperature.
[0195] A determining subunit is configured to determine a compensation amount corresponding to the current ambient temperature as the first time compensation amount according to preset temperature compensation information.
[0196] Optionally, the second determining unit comprises:
[0197] An adjusting subunit is configured to increase the high-level time by the first time compensation amount and decrease the low-level time by the first time compensation amount.
[0198] A detecting subunit is configured to detect whether the first communication is successful.
[0199] A first determining subunit is configured to, if the first communication is successful, adjust the current high-level time and low-level time successively until the communication fails, and determine the second time compensation amount according to the number of adjustments.
[0200] A second determining subunit is configured to, if the first communication fails, adjust the high-level time and the low-level time to a limit value, adjust the high-level time and the low-level time successively from the limit value until the communication is successful, and determine the second time compensation amount according to the number of adjustments.
[0201] Optionally, the first determining subunit is specifically configured to:
[0202] decrease the current high level time by the preset time while increasing the current low level time by the preset time, or increase the current high level time by the preset time while decreasing the current low level time by the preset time;
[0203] detect whether the communication is successful;
[0204] if the communication is successful, return to execute the step of decreasing the current high level time by the preset time while increasing the current low level time by the preset time, or increasing the current high level time by the preset time while decreasing the current low level time by the preset time;
[0205] if the communication fails, calculate T1×(N-1) to obtain the second time compensation amount, wherein T1 represents the preset time, and N represents a first adjustment number of adjusting the high level time or the low level time by the preset time.
[0206] Optionally, the second determination subunit is specifically configured to:
[0207] adjust the high level time to the lower limit while adjusting the low level time to the upper limit;
[0208] detect whether the communication is successful;
[0209] if the communication fails, increase the current high level time by the preset time while decreasing the current low level time by the preset time, and return to execute the step of detecting whether the communication is successful;
[0210] if the communication is successful, calculate T smin +T1×M to obtain the second time compensation amount, wherein T smin represents the minimum value of the second time compensation amount, T1 represents the preset time, and M represents a second adjustment number of adjusting the high level time or the low level time by the preset time.
[0211] Optionally, the second determination subunit is further configured to, after increasing the current high level time by the preset time while decreasing the current low level time by the preset time, when the high level time is increased to the upper limit or the low level time is decreased to the lower limit, still detect the communication failure, terminate the detection, and output a communication abnormality prompt.
[0212] Optionally, the second determination subunit is specifically configured to:
[0213] adjust the high level time to the upper limit while adjusting the low level time to the lower limit;
[0214] detect whether the communication is successful;
[0215] If the communication fails, the current high level time is reduced by a preset time, the current low level time is increased by the preset time, and the step of detecting whether the communication succeeds is performed again;
[0216] If the communication succeeds, T smin +T1×M is calculated to obtain the second time compensation amount, wherein T smin represents the minimum value of the second time compensation amount, T1 represents the preset time, and M represents the second adjustment number of times of adjusting the high level time or the low level time by the preset time.
[0217] Optionally, after the current high level time is reduced by the preset time and the current low level time is increased by the preset time, when the high level time is reduced to the lower limit or the low level time is increased to the upper limit, and the communication still fails, the detection is terminated, and a communication abnormality prompt is output.
[0218] Optionally, the calculation unit is specifically configured to:
[0219] If the second time compensation amount is determined by reducing the high level time and increasing the low level time at the same time, the following formula is used to calculate the optocoupler CTR estimation value:
[0220] C=K / (T0-T cmin -T s -Tplh+Tphl+T n ),
[0221] If the second time compensation amount is determined by increasing the high level time and reducing the low level time at the same time, the following formula is used to calculate the optocoupler CTR estimation value:
[0222] C=K / (T0-T cmin -T s +Tplh-Tphl-T n ),
[0223] wherein C represents the optocoupler CTR estimation value, K represents a constant, T0 represents a unit bit width time, T cmin represents the minimum time of the detected level duration, T s represents the second time compensation amount, Tplh represents a normal temperature optocoupler turn-on delay time, Tphl represents a normal temperature optocoupler turn-off delay time, and T n represents the first time compensation amount.
[0224] Optionally, the calculation module 62 specifically uses the following formula to calculate the control compensation amount:
[0225] T2=Tplh-Tphl+K / C+T n ,
[0226] Wherein, T2 represents a control compensation amount; Tplh represents a light coupling on delay time at normal temperature; Tphl represents a light coupling off delay time at normal temperature; K represents a constant; C represents a light coupling CTR estimation value; T n represents a first time compensation amount.
[0227] Optionally, the device further comprises:
[0228] The first updating module is configured to, after increasing the high level time by the control compensation amount and decreasing the low level time by the control compensation amount, continuously monitor the ambient temperature, and when a change in the ambient temperature is monitored, recompute the control compensation amount according to the current ambient temperature and the current light coupling CTR estimation value, and recompensate according to the new control compensation amount.
[0229] Optionally, the device further comprises:
[0230] The second updating module is configured to, after increasing the high level time by the control compensation amount and decreasing the low level time by the control compensation amount, periodically recompute the light coupling CTR estimation value, and compute a new control compensation amount according to the current ambient temperature and the new light coupling CTR estimation value.
[0231] Correspondingly, the compensation module 63 is further configured to increase the high level time by the new control compensation amount and decrease the low level time by the new control compensation amount.
[0232] Optionally, the second updating module is specifically configured to:
[0233] decrease the current high level time by a preset time and increase the current low level time by the preset time, or increase the current high level time by the preset time and decrease the current low level time by the preset time.
[0234] detect whether the communication is successful;
[0235] If the communication is successful, return to execute the step of decreasing the current high level time by a preset time and increasing the current low level time by the preset time, or increasing the current high level time by the preset time and decreasing the current low level time by the preset time.
[0236] If the communication fails, compute T1×(N-1)+T s0 , to obtain a new second time compensation amount, wherein T1 represents a preset time, N represents a first adjustment number of times of adjusting the high level time or the low level time by the preset time, T s0 represents an original second time compensation amount.
[0237] According to the first time compensation corresponding to the current environment temperature and the new second time compensation, a new optical coupling CTR estimation value is calculated.
[0238] Optionally, when one of the two parties performs the calculation of the optical coupling CTR estimation value, the other party maintains the current state for communication and does not allow the calculation of the optical coupling CTR value and the time adjustment of the high and low levels.
[0239] The device described above can perform the dynamic compensation method of the optical coupling isolation communication provided by the embodiments of the present application, and has the corresponding function modules and beneficial effects of the execution method. Technical details not described in detail in the present embodiment can be referred to the dynamic compensation method of the optical coupling isolation communication provided by the embodiments of the present application.
[0240] Embodiment four
[0241] The present embodiment provides a kind of communication equipment, comprising: the dynamic compensation device of optical coupling isolation communication described in the above embodiment.
[0242] Embodiment five
[0243] The present embodiment provides a kind of nonvolatile computer readable storage medium, which stores computer program, the computer program is executed by processor to realize the steps of the method described in the above embodiment.
[0244] Embodiment six
[0245] The present embodiment provides a kind of computer equipment, comprising: memory, processor and computer program stored in memory and can be run on processor, when the processor executes the computer program, realize the steps of the method described in the above embodiment.
[0246] The device embodiments described above are only schematic, wherein the units illustrated as separate components can or can not be physically separated, and the components illustrated as units can or can not be physical units, i.e., they can be located in one place, or distributed on multiple network units. According to actual needs, part or all of the modules can be selected to achieve the purpose of the present embodiment scheme.
[0247] Those skilled in the art can clearly understand the technical solutions of the various embodiments from the above description of the embodiments, and the various embodiments can be implemented by means of software with the necessary general hardware platforms, and of course, can also be implemented by hardware. Based on such understanding, the above technical solutions, essentially or in other words, the part of the prior art that makes a contribution, can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, and the like, and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0248] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for some technical features therein; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A dynamic compensation method for optically isolated communication, characterized in that, include: Based on the current ambient temperature, the high-level time and low-level time during the high-low level switching in the communication signal are adjusted to determine the estimated value of the optocoupler CTR. The control compensation amount is calculated based on the current ambient temperature and the estimated CTR value of the optocoupler. Subsequently, during actual communication, the high-level time is increased by the control compensation amount, while the low-level time is decreased by the control compensation amount. Based on the current ambient temperature, the high-level and low-level times during high-low level switching in the communication signal are adjusted to determine the estimated CTR of the optocoupler, including: The compensation amount for the first time is determined based on the current ambient temperature. By adjusting the high-level time and the low-level time, a second time compensation amount is determined. The second time compensation amount is the ultimate time compensation amount to ensure successful communication, based on the preliminary compensation of the high and low level times during switching according to the first time compensation amount. The estimated CTR of the optical coupler is calculated based on the first time compensation amount and the second time compensation amount. Determining a first-time compensation amount based on the current ambient temperature includes: acquiring the current ambient temperature; and determining a compensation amount corresponding to the current ambient temperature based on preset temperature compensation information, as the first-time compensation amount. The second time compensation amount is determined by adjusting the high-level time and the low-level time, including: Increase the high-level time by the first time compensation amount, and decrease the low-level time by the first time compensation amount. Check if the initial communication was successful; If the first communication is successful, the current high-level time and low-level time are adjusted successively until the communication fails, and the second time compensation amount is determined according to the number of adjustments. If the first communication fails, the high-level time and low-level time are adjusted to the limit value. Starting from the limit value, the high-level time and low-level time are adjusted one by one until the communication is successful. The second time compensation amount is determined according to the number of adjustments.
2. The method according to claim 1, characterized in that, The current high-level and low-level times are adjusted sequentially until communication fails, and the second time compensation amount is determined based on the number of adjustments, including: Decrease the current high-level time by a preset time while increasing the current low-level time by a preset time, or increase the current high-level time by a preset time while decreasing the current low-level time by a preset time. Check if the communication was successful; If communication is successful, return to the step of reducing the current high level time by a preset time and increasing the current low level time by a preset time, or increasing the current high level time by a preset time and reducing the current low level time by a preset time. If communication fails, calculate T1×(N-1) to obtain the second time compensation amount, where T1 represents the preset time and N represents the first adjustment number to adjust the high-level time or low-level time according to the preset time.
3. The method according to claim 1, characterized in that, The high-level and low-level times are adjusted to their limits. Starting from these limits, the high-level and low-level times are adjusted sequentially until communication is successful. The second time compensation amount is determined based on the number of adjustments, including: Adjust the high-level time to the lower limit, and at the same time adjust the low-level time to the upper limit; Check if the communication was successful; If communication fails, the current high-level time is increased by a preset time, while the current low-level time is decreased by a preset time, and the process returns to the step of detecting whether communication was successful. If communication is successful, calculate T. smin +T1×M, to obtain the second time compensation amount, where T smin T1 represents the minimum value of the second time compensation amount, M represents the preset time, and M represents the second adjustment number of the high-level time or low-level time according to the preset time.
4. The method according to claim 3, characterized in that, After increasing the current high-level time by a preset time and decreasing the current low-level time by a preset time, the process also includes: If a communication failure is still detected when the high-level time increases to the upper limit or the low-level time decreases to the lower limit, the detection will terminate and a communication error message will be output.
5. The method according to claim 1, characterized in that, The high-level and low-level times are adjusted to their limits. Starting from these limits, the high-level and low-level times are adjusted sequentially until communication is successful. The second time compensation amount is determined based on the number of adjustments, including: Adjust the high-level time to the upper limit and the low-level time to the lower limit; Check if the communication was successful; If communication fails, the current high-level time is reduced by a preset time, while the current low-level time is increased by a preset time, and the process returns to the step of detecting whether communication was successful. If communication is successful, calculate T. smin +T1×M, to obtain the second time compensation amount, where T smin T1 represents the minimum value of the second time compensation amount, M represents the preset time, and M represents the second adjustment number of the high-level time or low-level time according to the preset time.
6. The method according to claim 5, characterized in that, After reducing the current high-level time by a preset time and increasing the current low-level time by a preset time, the process also includes: If a communication failure is still detected when the high-level time decreases to the lower limit or the low-level time increases to the upper limit, the detection will terminate and a communication error message will be output.
7. The method according to claim 1, characterized in that, If the second time compensation amount is determined by reducing the high-level time while simultaneously increasing the low-level time, the estimated CTR of the optocoupler is calculated using the following formula: C = K / (T0-T cmin -T s -Tplh+Tphl+T n ), If the second time compensation amount is determined by increasing the high-level time while simultaneously decreasing the low-level time, the estimated CTR of the optocoupler is calculated using the following formula: C = K / (T0-T cmin -T s +Tplh-Tphl-T n ), Where C represents the estimated CTR of the optocoupler; K represents a constant; T0 represents the time per unit bit width; T cmin T represents the minimum duration of the detectable voltage level. s Indicates the second time compensation amount; Tplh represents the room temperature optocoupler turn-on delay time; Tphl represents the room temperature optocoupler turn-off delay time; T n This indicates the amount of compensation provided immediately.
8. The method according to claim 1, characterized in that, Based on the current ambient temperature and the estimated CTR of the optocoupler, the control compensation amount is calculated using the following formula: T2 = Tplh-Tphl+K / C+T n , Where T2 represents the control compensation amount; Tplh represents the on-delay time of the room-temperature optocoupler; Tphl represents the off-delay time of the room-temperature optocoupler; K represents a constant; C represents the estimated CTR of the optocoupler; T n This indicates the amount of compensation provided immediately.
9. The method according to any one of claims 1 to 8, characterized in that, After increasing the control compensation amount by the high-level time and decreasing the control compensation amount by the low-level time, the method further includes: The ambient temperature is continuously monitored. When a change in ambient temperature is detected, the control compensation amount is recalculated based on the current ambient temperature and the current estimated CTR value of the optocoupler, and compensation is performed again according to the new control compensation amount.
10. The method according to any one of claims 1 to 8, characterized in that, After increasing the control compensation amount by the high-level time and decreasing the control compensation amount by the low-level time, the method further includes: Periodically recalculate the CTR estimate of the optocoupler; Based on the current ambient temperature and the new optocoupler CTR estimate, the new control compensation amount is calculated. The new control compensation amount is increased during the high-level time, and the new control compensation amount is decreased during the low-level time.
11. The method according to claim 10, characterized in that, Periodically recalculate the CTR estimate of the optocoupler, including: Decrease the current high-level time by a preset time while increasing the current low-level time by a preset time, or increase the current high-level time by a preset time while decreasing the current low-level time by a preset time. Check if the communication was successful; If communication is successful, return to the step of reducing the current high level time by a preset time and increasing the current low level time by a preset time, or increasing the current high level time by a preset time and reducing the current low level time by a preset time. If communication fails, calculate T1×(N-1)+T s0 This yields a new second time compensation value, where T1 represents the preset time, N represents the first adjustment number of times the high-level time or low-level time is adjusted according to the preset time, and T... s0 This indicates the original amount of compensation for the second time period; Based on the first time compensation amount corresponding to the current ambient temperature and the new second time compensation amount, a new CTR estimate for the optocoupler is calculated.
12. The method according to any one of claims 1 to 8, characterized in that, When one of the communicating parties calculates the CTR estimate of the optocoupler, the other party maintains the current state and continues communication without being allowed to calculate the CTR value of the optocoupler or adjust the high and low level time.
13. A dynamic compensation device for optically isolated communication, characterized in that, include: The determination module is used to adjust the high-level time and low-level time during high-low level switching in the communication signal according to the current ambient temperature, so as to determine the estimated value of the optocoupler CTR. The calculation module is used to calculate the control compensation amount based on the current ambient temperature and the estimated CTR value of the optocoupler; The compensation module is used to increase the control compensation amount during the high-level time and decrease the control compensation amount during the low-level time in the actual communication process. The determining module includes: The first determining unit is used to determine the first time compensation amount based on the current ambient temperature; The second determining unit is used to determine a second time compensation amount by adjusting the high level time and the low level time, wherein the second time compensation amount is a limit time compensation amount to ensure communication success based on the preliminary compensation of the high and low level time during switching according to the first time compensation amount. The calculation unit is used to calculate the estimated CTR value of the optical coupler based on the first time compensation amount and the second time compensation amount; The first determining unit includes: The acquisition subunit is used to acquire the current ambient temperature; The determination subunit is used to determine the compensation amount corresponding to the current ambient temperature based on preset temperature compensation information, as the first time compensation amount; The second determining unit includes: An adjustment subunit is used to increase the high-level time by the first time compensation amount and simultaneously decrease the low-level time by the first time compensation amount. The detection subunit is used to detect whether the initial communication was successful. The first determining subunit is used to adjust the current high-level time and low-level time successively if the first communication is successful, until the communication fails, and determine the second time compensation amount according to the number of adjustments. The second determining subunit is used to adjust the high-level time and low-level time to the limit value if the first communication fails, and to adjust the high-level time and low-level time successively from the limit value until the communication is successful, and to determine the second time compensation amount according to the number of adjustments.
14. A communication device, characterized in that, include: The dynamic compensation device for optically isolated communication as described in claim 13.
15. A non-volatile computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 12.
Citation Information
Patent Citations
Food processor
CN213850233U