Power output port protection method and vehicle
By updating the duty cycle of the pulse width modulation signal in each output cycle, determining the sampling time during the on and off periods, and obtaining the actual current value of the load device, the problem of the controller being unable to accurately judge the load device fault is solved, and effective protection of the power output port is achieved.
Patent Information
- Application Number
- CN202510744144.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-05
- Publication Date
- 2025-09-19
AI Technical Summary
In the prior art, the controller cannot accurately determine load device failures, resulting in an inability to effectively protect the power output port and being susceptible to external interference.
By updating the duty cycle of the pulse width modulation signal in each output cycle, the sampling time during the on and off periods is determined, the actual current value of the load device is obtained, and whether the load device is faulty is determined based on the actual current value, and the power output port is shut down when a fault occurs.
It improves the accuracy of judging load device failures, reduces the impact of external interference, and effectively protects the power output port.
Smart Images

Figure CN120675563A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of port protection, and in particular to a protection method for a power output port and a vehicle. Background Art
[0002] A controller is provided in the vehicle, and the controller is generally provided with a power output port, so that the controller outputs a drive signal or a control signal through the power output port to drive load devices of the vehicle, such as contactors, electromagnetic brakes, and solenoid valves.
[0003] The power output port acts like a current loop switch, employing a metal-oxide-semiconductor field-effect transistor (MOSFET) as the power device. By controlling the MOSFET's on and off state, the load device's coil is energized or de-energized, which in turn controls the closing or opening of the load device's contact terminal, thereby fulfilling the load device's function. Specifically, the controller includes a MOSFET connected to the load device's coil via the power output port. When the MOSFET is on, the load device's coil is connected to a power source or ground via the MOSFET, energizing the load device's coil. When the MOSFET is off, the load device's coil is de-energized. For example, if the load device is an electromagnetic brake, energizing the coil can engage the armature, separating the armature from the brake disc. The electromagnetic brake is in the engaged state, i.e., in the unbraking state. When the MOSFET is off, the coil is de-energized, no longer engaging the armature, causing the armature to press against the brake disc, putting the electromagnetic brake in the braking state.
[0004] In order to prevent the power output port from being affected by overcurrent or open circuit of the load device, the power output port is protected. In the related art, the current of the load device is detected by a hardware circuit, and after comparison by a comparator, the output of the power output port is cut off when the current of the load device is too large. However, the frequent flipping of the comparator makes it difficult for the controller to obtain the fault point, unable to respond accurately, and unable to effectively protect the power output port. When the controller is used in the related art to determine whether the load device is faulty, the controller is easily affected by external interference when collecting the current of the load device, and cannot accurately obtain the current of the load device, and cannot effectively protect the power output port. Summary of the Invention
[0005] The present invention provides a method for protecting a power output port and a vehicle, so as to solve the problem that the existing controller cannot better protect the power output port.
[0006] According to one aspect of the present invention, a method for protecting a power output port is provided, wherein the power output port is located on a controller, the controller includes a power device, and the power device is connected to a load device via the power output port; the method is executed by the controller, and the method includes:
[0007] When outputting a pulse width modulated signal to the power device, after updating the duty cycle of the pulse width modulated signal in each output cycle, if the current duty cycle of the pulse width modulated signal corresponding to the current output cycle is greater than a preset threshold, determining any moment within a first preset time period of the current output cycle as the sampling moment; wherein the start moment of the first preset time period is after the conduction start moment of the power device in the current output cycle, and the end moment of the first preset time period is before the conduction end moment of the power device in the current output cycle;
[0008] If the current duty cycle corresponding to the current output cycle is less than or equal to the preset threshold, determining any moment within a second preset time period of the current output cycle as the sampling moment; wherein the start moment of the second preset time period is after the shutdown start moment of the power device in the current output cycle, and the end moment of the second preset time period is before the shutdown end moment of the power device in the current output cycle;
[0009] When the duration of outputting the pulse width modulation signal reaches the sampling time, obtaining the actual current value of the load device;
[0010] Determine whether the load device is faulty according to the actual current value, and close the power output port when the load device is faulty.
[0011] Optionally, a period between a preset duration corresponding to the preset threshold and a difference between a first duration corresponding to the current duty cycle and the preset duration is used as the first preset period, and the sampling time is determined according to the first preset period;
[0012] Determining any moment within a second preset time period of the current output cycle as the sampling moment includes:
[0013] The method further comprises: determining the sampling time based on the second preset time period by taking the sum of the first duration and the preset duration and the difference between the duration of the output cycle and the preset duration as the second preset time period. Alternatively, determining the sampling time based on the first preset time period by taking the sum of the preset duration corresponding to the preset threshold and the difference between the first duration corresponding to the current duty cycle and the preset duration as the first preset time period includes:
[0014] The time corresponding to the preset duration is used as the sampling time of the current output cycle;
[0015] Alternatively, the preset time length minus the time compensation value is obtained to obtain the sampling time of the current output cycle;
[0016] The method further comprises: taking a period between a sum of the first duration and the preset duration and a difference between the duration of the output cycle and the preset duration as the second preset period, and determining the sampling time according to the second preset period, including:
[0017] The time corresponding to the sum of the first duration and the preset duration is used as the sampling time of the current output cycle;
[0018] Alternatively, the sampling moment of the current output cycle is obtained by subtracting the time compensation value from the moment corresponding to the sum of the first duration and the preset duration.
[0019] Optionally, when the duration of outputting the pulse width modulation signal reaches the sampling moment, obtaining the actual current value of the load device includes:
[0020] When the duration of outputting the pulse width modulation signal reaches the sampling moment, controlling the sampling module to collect the sampling value of the load device;
[0021] After the duration for the sampling module to collect the sampled value of the load device reaches a preset sampling duration, the sampled value is acquired and converted into the actual current value.
[0022] Optionally, determining whether the load device is faulty according to the actual current value includes:
[0023] When the actual current values obtained for a preset number of consecutive times are all greater than the first set current, or are all less than the second set current, it is determined that the load device is faulty.
[0024] Optionally, when the actual current values obtained for a preset number of consecutive times are all greater than a first set current, determining that the load device is faulty includes:
[0025] When the actual current value obtained in the current output cycle is greater than the first set current, stop outputting the pulse width modulation signal and increase the overcurrent count value by one;
[0026] In the next output cycle, continue to output the pulse width modulation signal and obtain the actual current value of the load device;
[0027] determining whether the actual current value obtained in the next output cycle is greater than the first set current; if not, setting the overcurrent count value to zero, and returning to the step of continuing to output the pulse width modulation signal in the next output cycle;
[0028] If so, stop outputting the pulse width modulation signal, increase the overcurrent count value by one, and return to the step of continuing to output the pulse width modulation signal in the next output cycle until the overcurrent count value reaches the preset number of times, and determine that the load device is faulty.
[0029] Optionally, when the actual current values obtained for a preset number of consecutive times are all less than a second set current, determining that the load device is faulty includes:
[0030] When the actual current value obtained in the current output cycle is less than the second set current, stop outputting the pulse width modulation signal and increase the circuit breaker count value by one;
[0031] In the next output cycle, continue to output the pulse width modulation signal and obtain the actual current value of the load device;
[0032] determining whether the actual current value obtained in the next output cycle is less than the second set current; if not, setting the circuit breaker count value to zero, and returning to the step of continuing to output the pulse width modulation signal in the next output cycle;
[0033] If so, stop outputting the pulse width modulation signal, increase the disconnection count value by one, and return to the step of continuing to output the pulse width modulation signal in the next output cycle until the disconnection count value reaches the preset number of times, and determine that the load device is faulty.
[0034] Optionally, when the actual current values obtained for a preset number of consecutive times are all greater than a first set current, or are all less than a second set current, determining that the load device is faulty includes:
[0035] When the actual current values obtained for a preset number of consecutive times are all greater than the first set current, determining that the load device is faulty and issuing a first fault prompt message;
[0036] When the actual current values obtained for a preset number of consecutive times are all less than the second set current, it is determined that the load device is faulty, and a second fault prompt message is issued.
[0037] Optionally, the preset time duration corresponding to the preset threshold accounts for 1% to 10% of the time duration of the output cycle.
[0038] According to another aspect of the present invention, a vehicle is provided. The vehicle includes a controller, and the controller is configured to execute the power output port protection method according to any embodiment of the present invention.
[0039] According to the technical solution of an embodiment of the present invention, when outputting a pulse-width modulated signal to a power device, after updating the duty cycle of the pulse-width modulated signal during each output cycle, if the current duty cycle of the pulse-width modulated signal is greater than a preset threshold, a sampling time is determined to be any time within a first preset period of the power device's on-time. If the current duty cycle is less than or equal to the preset threshold, a sampling time is determined to be any time within a second preset period of the power device's off-time. When the duration of the output pulse-width modulated signal reaches the sampling time, the actual current value of the load device is obtained, and whether the load device is faulty is determined based on the actual current value. If a load device fault occurs, the power output port is shut down. By ensuring that the sampling time falls within a relatively long time period, and can be a time within the middle of the relatively long time period, large current fluctuations caused by power device state switching during the sampling process can be avoided. Furthermore, sampling of the load device is facilitated after level switching and output stabilization, which helps reduce ripple in the sampling signal, thereby improving sampling accuracy and, in turn, the accuracy of load device fault diagnosis, thereby achieving better protection for the power output port.
[0040] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0042] Figure 1 This is a flow chart of a method for protecting a power output port provided by an embodiment of the present invention;
[0043] Figure 2 is a flow chart of another power output port protection method provided by an embodiment of the present invention;
[0044] Figure 3 This is a flow chart of another method for protecting a power output port provided by an embodiment of the present invention;
[0045] Figure 4 This is a schematic diagram of a circuit structure of a vehicle provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0046] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0047] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0048] An embodiment of the present invention provides a method for protecting a power output port. The power output port is located on a controller, and the controller includes a power device. The power device is connected to a load device via the power output port. The power output port protection method is executed by the controller. The power device may be a field-effect transistor, an insulated-gate bipolar transistor (IGBT), or other power transistors, and this embodiment does not limit this. The load device and the controller may be located in a vehicle. The load device may be a contactor, an electromagnetic brake, a solenoid valve, etc. The controller includes a control unit, which includes a processor chip. The control unit is connected to a control electrode of the power device. One end of the power device is connected to a first power source, and the other end of the power device is connected to the load device via the power output port. For example, the other end of the power device is connected to one end of a coil in the load device via the power output port, and the other end of the coil is connected to a second power source. The first power source provides a positive voltage, and the second power source is grounded or provides a negative voltage. Alternatively, the first power source is grounded or provides a negative voltage, and the second power source provides a positive voltage. When the control unit in the controller controls the power device to turn on, the coil is energized. When the control unit in the controller controls the power device to turn off, the coil is de-energized. This allows you to control whether the coil is energized, how long it remains energized, and the average voltage across the coil, thus enabling control of the load device.
[0049] Figure 1This is a flow chart of a method for protecting a power output port provided by an embodiment of the present invention, with reference to Figure 1 , the protection methods of the power output port include:
[0050] S101. When outputting a pulse width modulated signal to a power device, after updating the duty cycle of the pulse width modulated signal in each output cycle, determine whether the current duty cycle of the pulse width modulated signal corresponding to the current output cycle is greater than a preset threshold. If so, execute step S102; if not, execute step S103.
[0051] The pulse width modulation signal, also known as a pulse width modulation (PWM) signal, is output to the power device, i.e., to the control electrode of the power device, facilitating regulation of the output power of the power device and the electrical parameters of the load device (e.g., current, voltage, and power). The output period is the period of the output pulse width modulation signal, i.e., the period of the pulse width modulation signal. During each output period, a control unit in the controller updates the duty cycle of the output pulse width modulation signal based on the actual electrical parameters of the load device (e.g., actual current, actual voltage, or actual power) and the target electrical parameters (e.g., target current, target voltage, or target power), so that the actual electrical parameters of the load device approach or equal the target electrical parameters, thereby controlling the load device. For example, when the actual current of the load device is less than the target current, the duty cycle of the output pulse width modulation signal is increased, i.e., the duration of power supplied to the load device is increased, thereby increasing the average voltage across the load device, and thus increasing the current of the load device, so that the actual current of the load device approaches or equals the target current.
[0052] The PWM signal includes an active level and an inactive level. The active level is the level that controls the power device to turn on, and the inactive level is the level that controls the power device to turn off. The duty cycle of the PWM signal is the ratio of the duration of the active level in the PWM signal to the duration of one output cycle (the period of the PWM signal).
[0053] Specifically, when outputting a pulse width modulated signal to a power device, after updating the duty cycle of the pulse width modulated signal in each output cycle, a current duty cycle of the pulse width modulated signal corresponding to the current output cycle is obtained, and then the current duty cycle is compared with a preset threshold value. The preset threshold value may be a set duty cycle.
[0054] S102. Determine any moment within a first preset time period of the current output cycle as a sampling moment; wherein the start moment of the first preset time period is after the conduction start moment of the power device in the current output cycle, and the end moment of the first preset time period is before the conduction end moment of the power device in the current output cycle.
[0055] The start time of conduction of the power device in the current output cycle is the start time of the effective level of the pulse width modulation signal in the current output cycle, and the end time of conduction of the power device in the current output cycle is the end time of the effective level of the pulse width modulation signal in the current output cycle.
[0056] Specifically, when the current duty cycle is greater than a preset threshold, indicating a large current duty cycle, i.e., the duration of the effective level in the pulse-width modulation signal during the current output cycle is long, i.e., the duration of the power device's conduction period is long. Therefore, any moment within a first preset period of the current output cycle can be used as the sampling moment for the current output cycle. The first preset period begins after the power device's conduction start time during the current output cycle, and ends before the power device's conduction end time during the current output cycle. This means that the first preset period is within the conduction period and does not include the conduction start and end times of the conduction period. This means that the first preset period is within the conduction period. This prevents large current fluctuations caused by power device state switching during the sampling process. Furthermore, the longer duration of the effective level facilitates sampling of the load device after the effective level output stabilizes, which helps reduce ripple in the sampling signal, thereby improving sampling accuracy and, in turn, the accuracy of load device fault diagnosis, thereby achieving better protection for the power output port.
[0057] S103. Determine any moment within a second preset time period of the current output cycle as a sampling moment; wherein the start moment of the second preset time period is after the start moment of shutdown of the power device in the current output cycle, and the end moment of the second preset time period is before the end moment of shutdown of the power device in the current output cycle.
[0058] The start time of the power device shutdown in the current output cycle is the start time of the pulse width modulation signal at the invalid level in the current output cycle, and the end time of the power device shutdown in the current output cycle is the end time of the pulse width modulation signal at the invalid level in the current output cycle.
[0059] Specifically, when the current duty cycle is less than or equal to a preset threshold, it indicates that the current duty cycle is small, i.e., the duration of the effective level in the pulse-width modulation signal is short in the current output cycle. In other words, in the current output cycle, the duration of the power device's on-time period is short, and the duration of the off-time period is long, i.e., the duration of the ineffective level is long. Therefore, when the current duty cycle is less than or equal to the preset threshold, any moment within the first preset time period of the current output cycle is determined as the sampling moment of the current output cycle. The start time of the second preset time period is after the power device's shutdown start time in the current output cycle, and the end time of the second preset time period is before the power device's shutdown end time in the current output cycle. In other words, the second preset time period is within the shutdown time period and does not include the shutdown start and shutdown end times of the shutdown time period. In other words, the second preset time period is a period of time in the middle of the shutdown time period. This prevents large current fluctuations caused by power device state switching during the sampling process. In addition, the invalid level lasts for a long time, which makes it easier to sample the load device after the invalid level output stabilizes, which is beneficial to reducing the ripple of the sampling signal, thereby improving the accuracy of sampling, and further improving the accuracy of load device fault judgment, thereby achieving better protection of the power output port.
[0060] S104 : When the duration of the output pulse width modulation signal reaches the sampling time, the actual current value of the load device is obtained.
[0061] Specifically, during the current output cycle, when the duration of the output pulse-width modulated signal reaches a sampling time, the actual current value of the load device is obtained. That is, at the sampling time, the actual current value of the load device is obtained. For example, timing can be started simultaneously with the output of the pulse-width modulated signal, and the actual current value of the load device is obtained when the timing reaches the sampling time. For example, if the load device is an electromagnetic relay, the actual current value of the coil in the electromagnetic relay can be obtained.
[0062] S105 : Determine whether the load device is faulty according to the actual current value, and close the power output port when the load device is faulty.
[0063] Specifically, the load device fault is determined based on the actual current value. For example, if the actual current value is too large or too small, the load device fault is determined. For example, the determination can be based on the actual current value of the current output cycle, or based on the actual current values of multiple consecutive output cycles to improve the accuracy of the determination. If a load device fault is determined, the power output port is shut down, that is, the output of the pulse-width modulated signal to the power device is stopped. This shuts down the power device and eliminates any signal output to the power output port, thereby protecting the power output port.
[0064] In addition, the controller compares the actual current values collected to determine whether the load device is faulty, without the need for comparison through a comparator. This can avoid frequent flipping of the comparator, which makes it difficult for the controller to obtain the fault point and unable to respond accurately. This is conducive to timely judgment of whether the load device is faulty and achieves better protection of the power output port.
[0065] The technical solution of this embodiment, when outputting a pulse-width modulated signal to a power device, updates the duty cycle of the pulse-width modulated signal during each output cycle. If the current duty cycle of the pulse-width modulated signal is greater than a preset threshold, a sampling time is determined to be any time within a first preset period of the power device's on-time. If the current duty cycle is less than or equal to the preset threshold, a sampling time is determined to be any time within a second preset period of the power device's off-time. When the duration of the output pulse-width modulated signal reaches the sampling time, the actual current value of the load device is obtained, and the load device fault is determined based on the actual current value. If the load device fault occurs, the power output port is shut down. By ensuring that the sampling time falls within a longer time period, and can be within the middle of the longer time period, large current fluctuations caused by power device state switching during the sampling process can be avoided. Furthermore, sampling of the load device is facilitated after level switching and output stabilization, which helps reduce ripple in the sampling signal, thereby improving sampling accuracy and, in turn, the accuracy of load device fault diagnosis, thereby achieving better protection for the power output port.
[0066] Based on the above technical solution, the following further describes possible specific methods for determining the sampling time, but this does not limit the present application.
[0067] Figure 2 This is a flowchart of another power output port protection method provided by an embodiment of the present invention. Optionally, refer to Figure 2 , the protection methods of the power output port include:
[0068] S201. When outputting a pulse width modulated signal to a power device, after updating the duty cycle of the pulse width modulated signal in each output cycle, determine whether the current duty cycle of the pulse width modulated signal corresponding to the current output cycle is greater than a preset threshold. If so, execute step S202; if not, execute step S203.
[0069] S202: The period between the preset duration corresponding to the preset threshold and the difference between the first duration corresponding to the current duty cycle and the preset duration is taken as a first preset period, and a sampling time is determined according to the first preset period.
[0070] The first duration corresponding to the current duty cycle is the duration during which the PWM signal is at an effective level within an output cycle, i.e., the duration during which the power device is on within an output cycle. For example, during each output cycle, the effective level of the PWM signal is output first, followed by the inactive level of the PWM signal. The first duration is obtained by multiplying the current duty cycle by the duration of an output cycle (the period of the PWM signal). The preset duration is obtained by multiplying the preset threshold by the duration of an output cycle (the period of the PWM signal).
[0071] Specifically, the moment corresponding to the preset duration is used as the starting moment of the first preset period. That is, in the current output cycle, the moment after the pulse width modulation signal begins to be output for the preset duration is used as the starting moment of the first preset period. The preset duration is subtracted from the first duration to obtain the difference between the first duration and the preset duration. The moment corresponding to the difference between the first duration and the preset duration is used as the ending moment of the first preset period. That is, in the current output cycle, when the duration of the pulse width modulation signal output reaches the difference between the first duration and the preset duration, the first preset period ends. After determining the first preset period, any moment within the first preset period can be used as the sampling moment. This allows the sampling moment to be a moment of stable output of a valid voltage level, thereby ensuring that the pulse width modulation signal does not jump during the sampling process, that is, the state of the power device remains unchanged, and thus avoiding large current fluctuations caused by the state switching of the power device during the sampling process. Moreover, it is convenient to sample the load device after the effective level output is stable, so as to avoid high-frequency switching of the power device. The existence of stray capacitance and stray inductance inside the power device causes higher noise interference when the power device is turned on, which causes the sampling signal obtained by sampling to be more interfered with. This is conducive to reducing the ripple of the sampling signal, thereby improving the accuracy of sampling, and further improving the accuracy of load device fault judgment, thereby achieving better protection of the power output port.
[0072] S203 : taking the period between the sum of the first duration and the preset duration and the difference between the duration of the output cycle and the preset duration as a second preset period, and determining a sampling time according to the second preset period.
[0073] Specifically, for example, in each output cycle, the active level of the pulse width modulated signal is first output, followed by the inactive level of the pulse width modulated signal. The moment corresponding to the sum of the first duration and the preset duration is used as the start time of the second preset period, and the period between the output cycle duration and the preset duration is used as the end time of the second preset period. After determining the second preset period, any moment within the second preset period is used as the sampling moment. This allows the sampling moment to be a moment when the inactive level is stably output, thereby ensuring that the pulse width modulated signal does not jump during the sampling process, that is, the state of the power device remains unchanged. This can avoid large current fluctuations caused by the state switching of the power device during the sampling process. Furthermore, it is convenient to sample the load device after the inactive level output is stable, which helps reduce the ripple of the sampling signal, thereby improving the sampling accuracy, and further improving the accuracy of load device fault diagnosis, thereby achieving better protection for the power output port.
[0074] S204 : When the duration of the output pulse width modulation signal reaches the sampling time, the actual current value of the load device is obtained.
[0075] S205 : Determine whether the load device is faulty according to the actual current value, and close the power output port when the load device is faulty.
[0076] Based on the above technical solution, optionally, the period between the preset duration corresponding to the preset threshold and the difference between the first duration corresponding to the current duty cycle and the preset duration is used as the first preset period, and the sampling time is determined according to the first preset period, including:
[0077] The time corresponding to the preset duration is used as the sampling time of the current output cycle;
[0078] Alternatively, the preset duration is subtracted from the time compensation value to obtain the sampling moment of the current output cycle.
[0079] Specifically, in one embodiment, the moment corresponding to the preset duration is used as the sampling moment of the current output cycle, so that sampling is performed after the output signal stabilizes. The earlier the sampling moment, the earlier the load device failure is discovered, which can avoid the failure being detected after it lasts too long.
[0080] In another embodiment, the sampling time of the current output cycle is obtained by subtracting the time compensation value from the preset time length. The time compensation value is the time length required for sampling. For example, sampling is performed by a sampling module in the controller. The sampling module can be an analog-to-digital conversion module, and the time compensation value is the time length required for analog-to-digital conversion. By subtracting the difference between the first time length and the preset time length, and then subtracting the time compensation value, the sampling time of each output cycle is obtained. This can avoid the problem of late sampling time caused by acquisition delay of the acquisition module, avoid the load device failure being discovered after it persists for too long, and avoid the level jump of the pulse width modulation signal during the sampling process, that is, avoid the level jump of the pulse width modulation signal during the analog-to-digital conversion process, which is conducive to further improving the accuracy of sampling.
[0081] Optionally, the period between the sum of the first duration and the preset duration and the difference between the duration of the output cycle and the preset duration is used as the second preset period, and the sampling time is determined according to the second preset period, including:
[0082] The moment corresponding to the sum of the first duration and the preset duration is used as the sampling moment of the current output cycle;
[0083] Alternatively, the sampling moment of the current output cycle is obtained by subtracting the time compensation value from the moment corresponding to the sum of the first duration and the preset duration.
[0084] Specifically, in one embodiment, the sampling time of the current output cycle is determined by taking the sum of the first duration corresponding to the current duty cycle of the current output cycle and the preset duration as the sampling time. This can prevent jumps in the pulse width modulation signal level during the sampling process, that is, prevent jumps in the pulse width modulation signal level during the analog-to-digital conversion process. For example, if the first duration corresponding to the current duty cycle is Tcur, and the preset duration corresponding to the preset threshold is Tmin, then the sampling time Tc satisfies Tc = Tcur + Tmin.
[0085] In another embodiment, the sampling time of the current output cycle is obtained by subtracting the time compensation value from the sum of the first duration corresponding to the current duty cycle of the current output cycle and the preset duration. This can avoid the problem of late sampling due to acquisition delays in the acquisition module and prevent load device failures from being discovered only after a prolonged period of time, which can further improve sampling accuracy. For example, if the first duration corresponding to the current duty cycle is Tcur, the preset duration corresponding to the preset threshold is Tmin, and the time compensation value is Tt, then the sampling time Tc satisfies Tc = Tcur + Tmin - Tt.
[0086] Based on the above technical solutions, optionally, when the duration of the output pulse width modulation signal reaches the sampling moment, obtaining the actual current value of the load device includes:
[0087] Step a1: When the duration of the output pulse width modulation signal reaches the sampling time, control the sampling module to collect the sampling value of the load device.
[0088] Specifically, the sampling module can be an analog-to-digital conversion circuit in the controller. During each output cycle, when the duration of the output pulse-width modulated signal reaches a sampling time, the sampling module is controlled to acquire a sampled value from the load device. For example, a sampling resistor can be connected in series with the load device, and the analog-to-digital conversion module converts the voltage across the sampling resistor into a digital signal, which is the sampled value of the load device.
[0089] Step a2: After the sampling module collects the sampling value of the load device for a predetermined period of time, the sampling value is obtained and converted into an actual current value.
[0090] Specifically, the preset sampling duration is the sampling duration of the sampling module, for example, the conversion duration of the analog-to-digital conversion circuit. After the sampling module collects the sampled value of the load device for a period of time that reaches the preset sampling duration, a control unit in the controller obtains the sampled value and converts the sampled value into an actual current value, thereby obtaining the actual current value of the load device.
[0091] On the basis of the above technical solutions, Figure 3 This is a flowchart of another method for protecting a power output port provided by an embodiment of the present invention. Optionally, refer to Figure 3 , the protection methods of the power output port include:
[0092] S301. When outputting a pulse width modulated signal to a power device, after updating the duty cycle of the pulse width modulated signal in each output cycle, determine whether the current duty cycle of the pulse width modulated signal corresponding to the current output cycle is greater than a preset threshold. If so, execute step S302; if not, execute step S303.
[0093] S302. Determine any moment within a first preset time period of the current output cycle as a sampling moment; wherein the start moment of the first preset time period is after the conduction start moment of the power device in the current output cycle, and the end moment of the first preset time period is before the conduction end moment of the power device in the current output cycle.
[0094] S303. Determine any moment within a second preset time period of the current output cycle as a sampling moment; wherein the start moment of the second preset time period is after the start moment of shutdown of the power device in the current output cycle, and the end moment of the second preset time period is before the end moment of shutdown of the power device in the current output cycle.
[0095] S304 : When the duration of the output pulse width modulation signal reaches the sampling time, the actual current value of the load device is obtained.
[0096] S305: When the actual current values obtained for a preset number of consecutive times are all greater than the first set current, or are all less than the second set current, it is determined that the load device is faulty, and the power output port is closed.
[0097] Specifically, the preset number of times may be greater than or equal to three. For example, the actual current value of the load device is obtained once per output cycle. If the actual current values obtained for the preset number of consecutive times are all greater than the first set current, it indicates that the actual current values of the load device are all greater than the first set current in three consecutive output cycles. This can determine that the load device is overcurrent or short-circuited, i.e., a load device failure is determined, and the power output port is shut down to prevent the large current from affecting the power output port, thereby protecting the power output port and, in turn, protecting the controller.
[0098] If the actual current values obtained for a consecutive preset number of times are all less than the second set current, it indicates that in three consecutive output cycles, the actual current values of the load device are all less than the second set current, so that it can be determined that the load device is broken (open), that is, the load device is determined to be faulty, and the power output port is closed to avoid affecting the power output port, thereby achieving the effect of protecting the power output port and further protecting the controller.
[0099] Based on the above technical solution, optionally, when the actual current values obtained for a preset number of consecutive times are all greater than the first set current, determining that the load device is faulty includes:
[0100] Step b1: When the actual current value obtained in the current output cycle is greater than the first set current, stop outputting the pulse width modulation signal and increase the overcurrent count value by one.
[0101] Specifically, when the actual current value obtained in the current output cycle exceeds a first set current, the pulse-width modulation signal in the current output cycle is stopped. For example, if the current output cycle is the nth cycle, the pulse-width modulation signal for the nth output cycle is stopped, where n is a positive integer. This prevents the output of electrical signals through the power output port even when the actual current value of the load device is large, thereby preventing damage to the power device and the power output port. The overcurrent count value is initially zero. When the actual current value obtained in the current output cycle exceeds the first set current, the overcurrent count value is incremented by one.
[0102] Step b2: In the next output cycle, continue to output the pulse width modulation signal and obtain the actual current value of the load device.
[0103] Specifically, in the next output cycle, the PWM signal continues to be output to avoid suspending the PWM signal output due to a misjudgment, i.e., stopping the operation of the load device. The actual current value of the load device corresponding to the next output cycle is obtained. The method for obtaining the actual current value of the load device corresponding to the next output cycle is the same as the method for obtaining the actual current value of the load device in steps S101 to S104, and will not be repeated here.
[0104] Step b3: determine whether the actual current value obtained in the next output cycle is greater than the first set current. If not, set the overcurrent count value to zero and return to step b2 to continue outputting the pulse width modulation signal in the next output cycle.
[0105] Specifically, if the actual current value obtained in the next output cycle is less than or equal to the first set current, the overcurrent counter value is reset to zero, and the pulse width modulation signal continues to be output to the power device, allowing the load device to continue normal operation. This prevents the load device from being stopped due to accidental current fluctuations, which helps ensure the normal operation of the load device and improves the reliability of load device control.
[0106] Step b4: If yes, stop outputting the PWM signal, increase the overcurrent count by one, and return to step b2: continue outputting the PWM signal in the next output cycle until the overcurrent count reaches a preset number of times, thereby determining that the load device is faulty.
[0107] Specifically, if the actual current value obtained during the next output cycle is greater than the first set current, output of the pulse-width modulated signal is stopped. For example, if the next output cycle is the n+1th cycle, output of the pulse-width modulated signal for the n+1th output cycle is stopped. This prevents output of electrical signals through the power output port even when the actual current value of the load device is large, thereby preventing damage to the power device and the power output port. Furthermore, the overcurrent count value is incremented by one. This process is repeated until the overcurrent count value reaches a preset number of times, at which point a short circuit or overcurrent condition is determined in the load device, i.e., a load device failure is determined.
[0108] This can avoid misjudgments, ensure the accuracy of load device fault determination, and thus improve the accuracy of power output port protection. For example, the preset number of times can be greater than or equal to 3 and less than or equal to 5. This can avoid misjudgments and promptly determine load device faults when they occur, allowing the power output port to be shut down promptly, achieving better protection for the power output port.
[0109] Optionally, when the actual current values obtained for a preset number of consecutive times are all less than the second set current, determining that the load device is faulty includes:
[0110] Step c1: when the actual current value acquired in the current output cycle is less than the second set current, stop outputting the pulse width modulation signal and increase the circuit breaker count value by one.
[0111] Specifically, when the actual current value obtained in the current output cycle is less than the second set current, the pulse width modulation signal in the current output cycle is stopped. For example, if the current output cycle is the nth cycle, the pulse width modulation signal for the nth output cycle is stopped, where n is a positive integer. This prevents the output of electrical signals through the power output port when the actual current value of the load device is too low, thereby preventing damage to the power device and the power output port. The initial value of the circuit breaker count is zero. When the actual current value obtained in the current output cycle is less than the second set current, the circuit breaker count is incremented by one.
[0112] Step c2: In the next output cycle, continue to output the pulse width modulation signal and obtain the actual current value of the load device.
[0113] Specifically, in the next output cycle, the PWM signal continues to be output to avoid suspending the PWM signal output due to a misjudgment, i.e., stopping the operation of the load device. The actual current value of the load device corresponding to the next output cycle is obtained. The method for obtaining the actual current value of the load device corresponding to the next output cycle is the same as the method for obtaining the actual current value of the load device in steps S101 to S104, and will not be repeated here.
[0114] Step c3: determine whether the actual current value obtained in the next output cycle is less than the second set current. If not, set the circuit breaker count value to zero and return to step c2 to continue outputting the pulse width modulation signal in the next output cycle.
[0115] Specifically, if the actual current value obtained in the next output cycle is greater than the second set current, the circuit breaker count value is reset to zero, and the pulse width modulation signal continues to be output to the power device, allowing the load device to continue normal operation. This prevents the load device from being stopped due to accidental current fluctuations, which helps ensure the normal operation of the load device and improves the reliability of load device control.
[0116] Step c4: If yes, stop outputting the PWM signal, increase the disconnection count by one, and return to step c2: continue outputting the PWM signal in the next output cycle until the disconnection count reaches a preset number of times, thereby determining that the load device is faulty.
[0117] Specifically, if the actual current value obtained during the next output cycle is less than the second set current, output of the pulse-width modulated signal is stopped. For example, if the next output cycle is the n+1th cycle, output of the pulse-width modulated signal for the n+1th output cycle is stopped. This prevents output of electrical signals through the power output port when the actual current value of the load device is too low, thereby preventing damage to the power device and the power output port. Furthermore, the circuit-breaking count value is incremented by one. This process is repeated until the circuit-breaking count value reaches a preset number of times, at which point the load device is determined to be disconnected (open), i.e., a load device failure is determined.
[0118] In this way, misjudgment can be avoided, the accuracy of load device fault judgment can be guaranteed, and the accuracy of power output port protection can be improved.
[0119] Based on the above technical solutions, optionally, when the actual current values obtained for a preset number of consecutive times are all greater than the first set current, or are all less than the second set current, determining that the load device is faulty includes:
[0120] Step d1: When the actual current values obtained for a preset number of consecutive times are all greater than the first set current, it is determined that the load device is faulty, and a first fault prompt message is issued.
[0121] Specifically, if the actual current values obtained for a preset number of consecutive times are greater than the first set current, indicating that the load device is short-circuited or overcurrent, a load device fault is determined and a first fault prompt message, such as "Load device overcurrent," is issued. This provides the user with accurate prompt information, allowing the user to be notified of the fault in a timely manner.
[0122] Step d2: When the actual current values obtained for a preset number of consecutive times are all less than the second set current, it is determined that the load device is faulty, and a second fault prompt message is issued.
[0123] Specifically, if the actual current values obtained for a predetermined number of consecutive times are all less than the second set current, indicating that the load device is open-circuited, a load device fault is determined, and a second fault prompt message, such as "Load device open circuit," is issued. This provides the user with accurate prompt information, allowing the user to be notified of the fault in a timely manner.
[0124] On the basis of the above technical solutions, optionally, the preset time duration corresponding to the preset threshold accounts for 1% to 10% of the time duration of the output cycle.
[0125] In this way, the sampling time determined based on the preset duration, or the difference between the first duration corresponding to the current duty cycle and the preset duration corresponding to the preset threshold, can be sampled after the effective level of the output pulse-width modulated signal stabilizes, achieving accurate sampling. Furthermore, the sampling time determined based on the sum of the first duration and the preset duration can be sampled after the ineffective level of the output pulse-width modulated signal stabilizes, achieving accurate sampling. The specific value of the preset threshold can be determined based on actual conditions, for example, based on the fluctuation of the pulse-width modulated signal and the total duration of an output cycle. For example, the longer the total duration of an output cycle, the larger the preset threshold.
[0126] An embodiment of the present invention further provides a vehicle, Figure 4 This is a schematic diagram of a circuit structure of a vehicle provided by an embodiment of the present invention, with reference to Figure 4 The vehicle 100 includes a controller 110, which is configured to execute the power output port protection method provided by any embodiment of the present invention.
[0127] For example, Figure 4 As shown, controller 110 includes at least one power output port P1. Protection of each power output port P1 can be implemented using the power output port protection method provided in any embodiment of the present invention. Controller 110 includes a power device 111 and a control unit 112. Control unit 112 may include a processor chip. Control unit 112 in controller 110 is configured to execute the power output port protection method provided in any embodiment of the present invention. Control unit 112 is connected to the gate electrode of power device 111. One end of power device 111 is connected to a first power source V1. The other end of power device 111 is connected to a first end of load device 210 via power output port P1. A second end of load device 210 is connected to a second power source V2. When control unit 112 in controller 110 controls power device 111 to turn on, load device 210 is powered. When control unit 112 in controller 110 controls power device 111 to turn off, load device 210 is de-energized. In this manner, control of load device 210 is achieved.
[0128] The controller 110 in the vehicle provided in this embodiment is used to execute the power output port protection method provided in any embodiment of the present invention, and therefore has the same beneficial effects as the power output port protection method provided in any implementation scheme of the present invention, which will not be repeated here.
[0129] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved. This is not limited herein.
[0130] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.
Claims
1. A method for protecting a power output port, characterized in that: The power output port is located on a controller, the controller includes a power device, and the power device is connected to a load device through the power output port; the method is executed by the controller; the method includes: When outputting a pulse width modulated signal to the power device, after updating the duty cycle of the pulse width modulated signal in each output cycle, if the current duty cycle of the pulse width modulated signal corresponding to the current output cycle is greater than a preset threshold, determining any moment within a first preset time period of the current output cycle as the sampling moment; wherein the start moment of the first preset time period is after the conduction start moment of the power device in the current output cycle, and the end moment of the first preset time period is before the conduction end moment of the power device in the current output cycle; If the current duty cycle corresponding to the current output cycle is less than or equal to the preset threshold, determining any moment within a second preset time period of the current output cycle as the sampling moment; wherein the start moment of the second preset time period is after the shutdown start moment of the power device in the current output cycle, and the end moment of the second preset time period is before the shutdown end moment of the power device in the current output cycle; When the duration of outputting the pulse width modulation signal reaches the sampling time, obtaining the actual current value of the load device; Determine whether the load device is faulty according to the actual current value, and close the power output port when the load device is faulty.
2. The method according to claim 1, characterized in that Determining any moment within a first preset time period of the current output cycle as a sampling moment includes: The period between the preset time length corresponding to the preset threshold and the difference between the first time length corresponding to the current duty cycle and the preset time length is used as the first preset time length, and the sampling time is determined according to the first preset time length; Determining any moment within a second preset time period of the current output cycle as the sampling moment includes: The period between the sum of the first duration and the preset duration and the difference between the duration of the output cycle and the preset duration is used as the second preset period, and the sampling time is determined according to the second preset period.
3. The method according to claim 2, characterized in that The method further comprises: using a period between a preset duration corresponding to the preset threshold and a difference between a first duration corresponding to the current duty cycle and the preset duration as the first preset period, and determining a sampling time according to the first preset period, including: The time corresponding to the preset duration is used as the sampling time of the current output cycle; Alternatively, the preset time length minus the time compensation value is obtained to obtain the sampling time of the current output cycle; The method further comprises: taking a period between a sum of the first duration and the preset duration and a difference between the duration of the output cycle and the preset duration as the second preset period, and determining the sampling time according to the second preset period, including: The time corresponding to the sum of the first duration and the preset duration is used as the sampling time of the current output cycle; Alternatively, the sampling moment of the current output cycle is obtained by subtracting the time compensation value from the moment corresponding to the sum of the first duration and the preset duration.
4. The method according to claim 1, wherein When the duration of outputting the pulse width modulation signal reaches the sampling moment, obtaining the actual current value of the load device, including: When the duration of outputting the pulse width modulation signal reaches the sampling moment, controlling the sampling module to collect the sampling value of the load device; After the duration for the sampling module to collect the sampled value of the load device reaches a preset sampling duration, the sampled value is acquired and converted into the actual current value.
5. The method according to claim 1, wherein Determining whether the load device is faulty according to the actual current value includes: When the actual current values obtained for a preset number of consecutive times are all greater than the first set current, or are all less than the second set current, it is determined that the load device is faulty.
6. The method according to claim 5, characterized in that When the actual current values obtained for a preset number of consecutive times are all greater than the first set current, determining that the load device is faulty includes: When the actual current value obtained in the current output cycle is greater than the first set current, stop outputting the pulse width modulation signal and increase the overcurrent count value by one; In the next output cycle, continue to output the pulse width modulation signal and obtain the actual current value of the load device; determining whether the actual current value obtained in the next output cycle is greater than the first set current; if not, setting the overcurrent count value to zero, and returning to the step of continuing to output the pulse width modulation signal in the next output cycle; If so, stop outputting the pulse width modulation signal, increase the overcurrent count value by one, and return to the step of continuing to output the pulse width modulation signal in the next output cycle until the overcurrent count value reaches the preset number of times, and determine that the load device is faulty.
7. The method according to claim 5, characterized in that When the actual current values obtained for a preset number of consecutive times are all less than the second set current, determining that the load device is faulty includes: When the actual current value obtained in the current output cycle is less than the second set current, stop outputting the pulse width modulation signal and increase the circuit breaker count value by one; In the next output cycle, continue to output the pulse width modulation signal and obtain the actual current value of the load device; determining whether the actual current value obtained in the next output cycle is less than the second set current; if not, setting the circuit breaker count value to zero, and returning to the step of continuing to output the pulse width modulation signal in the next output cycle; If so, stop outputting the pulse width modulation signal, increase the disconnection count value by one, and return to the step of continuing to output the pulse width modulation signal in the next output cycle until the disconnection count value reaches the preset number of times, and determine that the load device is faulty.
8. The method according to claim 5, characterized in that When the actual current values obtained for a preset number of consecutive times are all greater than the first set current, or are all less than the second set current, determining that the load device is faulty includes: When the actual current values obtained for a preset number of consecutive times are all greater than the first set current, determining that the load device is faulty and issuing a first fault prompt message; When the actual current values obtained for a preset number of consecutive times are all less than the second set current, it is determined that the load device is faulty, and a second fault prompt message is issued.
9. The method according to claim 2, characterized in that The preset time duration corresponding to the preset threshold accounts for 1% to 10% of the time duration of the output cycle.
10. A vehicle, characterized in that: The device comprises a controller, wherein the controller is used to execute the power output port protection method according to any one of claims 1 to 9.