Permanent magnet synchronous motor time sequence task scheduling and space state scheduling cooperative control system for pure electric vehicle

文档序号:1218466 发布日期:2020-09-04 浏览:11次 中文

阅读说明:本技术 纯电动汽车用永磁同步电机时序任务调度和空间状态调度协同控制系统 (Permanent magnet synchronous motor time sequence task scheduling and space state scheduling cooperative control system for pure electric vehicle ) 是由 蔡良生 浦蓉杰 林利 高翔 杨梦军 吴佳祥 王薪淼 于 2020-05-28 设计创作,主要内容包括:本发明涉及一种基于纯应用层开发的纯电动汽车用永磁同步电机实现时序任务调度和空间状态调度协同控制的系统,其结构包括“算法模块”和“逻辑模块”,所述的算法模块包括高速采样、矢量控制算法等;所述的逻辑模块包括一种特殊的任务调度机制,该机制,时序上以不同的优先级和功能集将控制策略划分为不同周期的任务包,同时采用主次时序嵌套调度的方式,对同一时序线路上任务的个数进行有效分流,避免任务重入和堆积;空间上将有限状态机逻辑置于实时性最高的周期任务中,将状态的输出介入时序调度,以更高的优先级驱动不同周期任务中的功能函数。本发明基于纯应用层开发,实现纯电动汽车用永磁同步电机时序任务调度和空间状态调度协同控制。(The invention relates to a system for realizing sequential task scheduling and space state scheduling cooperative control of a permanent magnet synchronous motor for a pure electric vehicle based on pure application layer development, which structurally comprises an algorithm module and a logic module, wherein the algorithm module comprises high-speed sampling, a vector control algorithm and the like; the logic module comprises a special task scheduling mechanism, the mechanism divides a control strategy into task packets with different periods according to different priorities and function sets in time sequence, and effectively divides the number of tasks on the same time sequence line by adopting a primary and secondary time sequence nested scheduling mode to avoid task reentry and accumulation; and (3) spatially placing the logic of the finite state machine in the periodic task with the highest real-time performance, and intervening the output of the state in time sequence scheduling to drive the function functions in different periodic tasks with higher priority. The method is developed based on a pure application layer, and realizes the cooperative control of the time sequence task scheduling and the space state scheduling of the permanent magnet synchronous motor for the pure electric vehicle.)

1. A system for realizing sequential task scheduling and space state scheduling cooperative control of a permanent magnet synchronous motor for a pure electric vehicle based on pure application layer development is characterized by comprising an algorithm module and a logic module, wherein the system is divided into the algorithm module and the logic module by taking the given position of direct axis current id _ ref and quadrature axis current iq _ ref of two coordinate systems as a boundary;

the Main function initialization unit is used for initializing peripherals and variables, the external interrupt unit is used for hardware fault and diagnosis, and the Timer0 timing interrupt unit is used for providing accurate timing for Scheduler task scheduling.

The algorithm module comprises an AD conversion interruption unit, and the AD conversion interruption unit is used for realizing high-speed sampling, calculation and filtering of the sensor and simultaneously calculating the vector control main algorithm.

The logic module comprises a main circulation unit, the main circulation unit comprises functions of different function sets, and the functions are packaged into different task packages according to different periods.

2. The system for realizing the cooperative control of the time sequence task scheduling and the space state scheduling of the permanent magnet synchronous motor for the pure electric vehicle developed based on the pure application layer as claimed in claim 1, wherein the given front end of the direct-axis current id _ ref and the given rear end of the quadrature-axis current iq _ ref are logic modules and are realized in a main cycle unit, and the given rear end of the direct-axis current id _ ref and the given rear end of the quadrature-axis current iq _ ref are algorithm modules and are realized in an AD conversion interrupt unit.

3. The system for realizing the cooperative control of the time sequence task scheduling and the space state scheduling of the permanent magnet synchronous motor for the pure electric vehicle developed based on the pure application layer according to claim 1 is characterized in that the system distributes a function with lower real-time requirement in AD conversion interruption to a main cycle and distributes the function to different periodic tasks according to the function and the priority; the system assigns functions with high real-time requirements to periodic tasks with higher frequency and assigns functions with low real-time requirements to periodic tasks with lower frequency.

4. The system for achieving sequential task scheduling and spatial state scheduling cooperative control of a permanent magnet synchronous motor for a pure electric vehicle developed based on a pure application layer according to claim 1, wherein execution judgment of the Timer0 interrupt unit and the AD conversion interrupt unit is parallel to Scheduler task scheduling, and task priority in the Scheduler task scheduling is lower than task priority of execution of the Timer0 interrupt unit and the AD conversion interrupt unit.

5. The system for realizing the cooperative control of the time sequence task scheduling and the spatial state scheduling for the permanent magnet synchronous motor for the pure electric vehicle developed based on the pure application layer according to claim 1 is characterized in that the main cycle unit comprises a 500us task, a 1ms task, a 2ms task, a 10ms task, a 20ms task and a 50ms task, the 10ms task, the 20ms task and the 50ms task are arranged in the 2ms task in a sub-scheduling mode, and the 500us task and the 1ms task are executed as a main task and a sub-task.

6. The pure application layer development-based system for realizing the cooperative control of the time sequence task scheduling and the space state scheduling for the permanent magnet synchronous motor for the pure electric vehicle according to claim 1 is characterized in that the system adopts a state transfer mode to cooperate with time sequence to realize scheduling, and the state output of a state machine is used as the drive of other periodic task contents.

7. The system for achieving coordinated control of time sequence task scheduling and space state scheduling of the permanent magnet synchronous motor for the pure electric vehicle developed based on the pure application layer as claimed in claim 1, wherein the states of the state machine include an INITIAL state INITIAL, a transition STANDBY state STANDBY, a precharge-on state CHARGE, a vehicle READY state, a vehicle normal running state running, a controller active DISCHARGE state DISCHARGE, a controller strong power-off state power, a FAULT state FAULT, and a controller weak power and strong power-off state power.

Technical Field

The invention relates to the technical field of electric transmission, in particular to the field of a control method of a vehicle main drive permanent magnet synchronous motor of an electric vehicle, and specifically relates to a system for realizing sequential task scheduling and space state scheduling cooperative control of the permanent magnet synchronous motor for the pure electric vehicle based on pure application layer development.

Background

With the rise of pure electric vehicles all over the world in recent years, the permanent magnet synchronous motor is widely applied to the pure electric vehicles as a main drive motor. Permanent magnet synchronous motors are being applied to pure electric vehicles from industrial applications, and control methods thereof are becoming more complex and diversified.

The permanent magnet synchronous motor is applied to the initial stage of a pure electric vehicle, the control method is only based on a vector control basic algorithm, and basic logics of some mode control such as a protocol layer, a diagnostic layer and the like are added, all programs are basically and completely placed in PWM (pulse-width modulation) periodic interruption, a complex high-speed control algorithm is not provided, and the software modulation updating period is consistent with the switching period of a hardware module of a motor controller.

In recent years, the country increases the supporting force of new energy electric vehicles, the market of pure electric vehicles is gradually expanded, higher requirements are also placed on the control of main drive permanent magnet synchronous motors of pure electric vehicles, and the torque calibration precision, the sensor sampling method and precision, the expansion of a control high-efficiency area, the loss reduction, the torque pulsation suppression and compensation and the like become major breakthrough directions of research and development personnel. Controlling the requirement on the sampling of the sensor, and enabling the interruption of the AD conversion to forbid the interruption of the PWM period; controlling the expansion of the high-efficiency area and the reduction of loss, and also requiring continuous change of PWM modulation frequency within the full rotating speed range; high speed and even ultra-high speed control put higher demands on the frequency of PWM updating.

The control strategy and algorithm of the permanent magnet synchronous motor for the pure electric vehicle are gradually improved, and the code amount is increased. In high-speed or even ultra-high-speed control, the PWM modulation update frequency is required to be high enough, that is, in order to meet the requirement of the carrier ratio in high-speed control, the AD conversion interruption time needs to be short enough. The selection of the core number of the vehicle-grade micro control chip needs to consider a plurality of factors such as cost, and the like, and under the premise of the limitation of the hardware of the core number of the main control chip, the interruption time of the AD conversion is short and the increased code amount is contrary to the engineering realization. It is obviously not suitable to put all the control strategy and algorithm code in the AD conversion interrupt.

The method is characterized in that basic logic strategies and algorithms for controlling the permanent magnet synchronous motor for the pure electric vehicle are independently developed, a pure algorithm part based on vector control PWM modulation and a current and angle sampling part with highest sampling requirements are placed in AD conversion interruption in a sequential structure, and the pure algorithm part needs to be sufficiently simplified; the pure logic part puts the relevant code into the main loop in a special task scheduling form according to the execution priority and the function set. The special task scheduling is a 'time sequence task scheduling' and 'space state scheduling' cooperative control method developed based on a pure application layer. In the whole new energy industry at present, the control of the permanent magnet synchronous motor for the pure electric commercial vehicle is relatively simple, even most of the permanent magnet synchronous motors are not used in a real-Time Operating system, in the control of the permanent magnet synchronous motor for the pure electric passenger vehicle, some permanent magnet synchronous motors adopt the common μ C _ OS-II in an embedded system, some permanent magnet synchronous motors adopt the commercial RTOS (real Time Operating system), some permanent magnet synchronous motors adopt the common OSEK of the traditional vehicle, and the like. The task scheduling in the invention is completely based on application layer software development, is not dependent on bottom layer drive to realize, has strong portability, and adopts a time sequence scheduling and space scheduling cooperative control mode, thereby simultaneously considering the real-time system task scheduling characteristics of ' a hard ' real-time system needing to complete tasks within a specified time and ' a soft ' real-time system completing operations according to priority '.

Disclosure of Invention

The invention aims to overcome the defects of the prior art, and provides the system for realizing the cooperative control of the time sequence task scheduling and the space state scheduling of the permanent magnet synchronous motor for the pure electric vehicle, which is developed based on the pure application layer, has the advantages of good real-time performance, simple and convenient operation, strong platform portability, no dependence on a specific micro-control chip integrated environment, low software development cost and market application cost and wider application range.

In order to achieve the purpose, the system for realizing the cooperative control of the time sequence task scheduling and the space state scheduling of the permanent magnet synchronous motor for the pure electric vehicle developed based on the pure application layer is as follows:

the system for realizing the sequential task scheduling and the spatial state scheduling cooperative control of the permanent magnet synchronous motor for the pure electric vehicle based on the pure application layer development is mainly characterized by comprising an algorithm module and a logic module, wherein the system is divided into the algorithm module and the logic module by taking the given position of a direct axis current id _ ref and a quadrature axis current iq _ ref of two coordinate systems as a boundary;

the Main function initialization unit is used for initializing peripherals and variables, the external interrupt unit is used for hardware fault and diagnosis, and the Timer0 timing interrupt unit is used for providing accurate timing for Scheduler task scheduling.

The algorithm module comprises an AD conversion interruption unit, and the AD conversion interruption unit is used for realizing high-speed sampling, calculation and filtering of the sensor and simultaneously calculating the vector control main algorithm.

The logic module comprises a main circulation unit, the main circulation unit comprises functions of different function sets, and the functions are packaged into different task packages according to different periods.

Preferably, the given front end of the direct-axis current id _ ref and the given back end of the quadrature-axis current iq _ ref are logic modules and are implemented in the main cycle unit, and the given back end of the direct-axis current id _ ref and the given back end of the quadrature-axis current iq _ ref are algorithm modules and are implemented in the AD conversion interrupt unit.

Preferably, the system allocates a function with low real-time requirement in the AD conversion interruption to the main cycle, and allocates the function and the priority to different periodic tasks; the system assigns functions with high real-time requirements to periodic tasks with higher frequency and assigns functions with low real-time requirements to periodic tasks with lower frequency.

Preferably, the execution determination of the Timer0 interrupt unit and the AD conversion interrupt unit is parallel to the Scheduler task scheduling, and the task priority in the Scheduler task scheduling is lower than the task priority of the execution of the Timer0 interrupt unit and the AD conversion interrupt unit.

Preferably, the main cycle unit comprises 500us tasks, 1ms tasks, 2ms tasks, 10ms tasks, 20ms tasks and 50ms tasks, the 10ms tasks, 20ms tasks and 50ms tasks are arranged in the 2ms tasks in a sub-scheduling mode, and the 500us tasks and the 1ms tasks are all executed as main and auxiliary tasks.

Preferably, the system adopts a state transition mode to realize scheduling by matching with a time sequence, and the state output of the state machine is used as the drive of the task content of other periods.

Preferably, the states of the state machine include an INITIAL state INITIAL, a transition STANDBY state STANDBY, a precharge-on state CHARGE, a READY state of the entire vehicle, a normal running state running of the entire vehicle, a DISCHARGE state of the controller, a power-off state of the controller, a FAULT state FAULT, and a power-off state of the controller.

The system for realizing the cooperative control of the time sequence task scheduling and the space state scheduling by adopting the permanent magnet synchronous motor for the pure electric vehicle developed based on the pure application layer arranges the control program into a logic part and an algorithm part, has definite real-time requirement and priority relation, and provides a platform for realizing the time sequence task scheduling and the space scheduling of the finite-state machine. The method is completely realized based on application layer software development, the platform portability is strong, the method does not depend on a specific micro-control chip integration environment, and the software development cost and the market application cost are low. The time sequence task scheduling form of the invention defines the time interval between tasks in different periods, and effectively avoids the arrival of the tasks in different periods at the same moment by considering the relationship of taking the surplus of one number and the multiple thereof and the least common multiple of the remainder; by adopting the method of the cyclic comparison of the counting state values of the scheduler, the repeated entry of tasks in the same period can be effectively avoided. The invention reduces the execution time of the task in each period from the perspective of space scheduling, optimizes the busy degree of the control system and ensures that the set task is completed within the specified time.

Drawings

Fig. 1 is a pure application layer development-based pure electric vehicle permanent magnet synchronous motor program brand-new architecture diagram of a system for realizing cooperative control of time sequence task scheduling and spatial state scheduling for a pure electric vehicle permanent magnet synchronous motor.

Fig. 2 is a diagram of an algorithm module and a logic module execution timing sequence relationship of the system for realizing the cooperative control of the timing task scheduling and the spatial state scheduling by the permanent magnet synchronous motor for the pure electric vehicle based on the pure application layer development.

Fig. 3 is a Scheduler flow chart of the system for realizing the cooperative control of the time sequence task scheduling and the spatial state scheduling by the permanent magnet synchronous motor for the pure electric vehicle based on the pure application layer development, which is realized based on the pure application layer.

Fig. 4 is a 'time sequence task scheduling' and 'space state scheduling' cooperative control structure diagram of a system for realizing the cooperative control of the time sequence task scheduling and the space state scheduling by the permanent magnet synchronous motor for the pure electric vehicle developed based on the pure application layer.

Fig. 5 is a spatial state scheduling and state transition relationship diagram of a system for realizing time sequence task scheduling and spatial state scheduling cooperative control of a permanent magnet synchronous motor for a pure electric vehicle developed based on a pure application layer.

Fig. 6 is a schedule timing relationship diagram under the condition that the AD conversion interruption period is the shortest limit in the high-speed control of the system for realizing the cooperative control of the timing task scheduling and the spatial state scheduling by the permanent magnet synchronous motor for the pure electric vehicle developed based on the pure application layer.

Detailed Description

In order to more clearly describe the technical contents of the present invention, the following further description is given in conjunction with specific embodiments.

The system for realizing the sequential task scheduling and the spatial state scheduling cooperative control of the permanent magnet synchronous motor for the pure electric vehicle based on the pure application layer development comprises an algorithm module and a logic module, wherein the system is divided into the algorithm module and the logic module by taking the given position of a direct axis current id _ ref and a quadrature axis current iq _ ref of two coordinate systems as a boundary;

the Main function initialization unit is used for initializing peripherals and variables, the external interrupt unit is used for hardware fault and diagnosis, and the Timer0 timing interrupt unit is used for providing accurate timing for Scheduler task scheduling.

The algorithm module comprises an AD conversion interruption unit, and the AD conversion interruption unit is used for realizing high-speed sampling, calculation and filtering of the sensor and simultaneously calculating the vector control main algorithm.

The logic module comprises a main circulation unit, the main circulation unit comprises functions of different function sets, and the functions are packaged into different task packages according to different periods.

As a preferred embodiment of the present invention, the front end of the direct current id _ ref and the quadrature current iq _ ref is a logic module and implemented in the main cycle unit, and the rear end of the direct current id _ ref and the quadrature current iq _ ref is an algorithm module and implemented in the AD conversion interrupt unit.

As a preferred embodiment of the present invention, the system allocates a function with low real-time requirement in the interruption of AD conversion to the main loop, and allocates the function to different periodic tasks according to the function and priority; the system assigns functions with high real-time requirements to periodic tasks with higher frequency and assigns functions with low real-time requirements to periodic tasks with lower frequency.

As a preferred embodiment of the present invention, the execution determination of the Timer0 interrupt unit and the AD conversion interrupt unit is parallel to the Scheduler task scheduling, and the task priority in the Scheduler task scheduling is lower than the task priority of the execution of the Timer0 interrupt unit and the AD conversion interrupt unit.

As a preferred embodiment of the present invention, the main loop unit includes 500us tasks, 1ms tasks, 2ms tasks, 10ms tasks, 20ms tasks and 50ms tasks, the 10ms tasks, 20ms tasks and 50ms tasks are arranged in the 2ms tasks in a sub-scheduling manner, and the 500us tasks and the 1ms tasks are executed as the main and auxiliary tasks.

In a preferred embodiment of the present invention, the system implements scheduling by using a state transition method in coordination with a timing sequence, and outputs the state of the state machine as a driver of the content of other periodic tasks.

As a preferred embodiment of the present invention, the states of the state machine include an INITIAL state INITIAL, a transition STANDBY state STANDBY, a precharge-on state CHARGE, a READY state of the entire vehicle, a normal operation state running of the entire vehicle, a controller active DISCHARGE state DISCHARGE, a controller strong power-down state power, a FAULT state FAULT, and a controller weak power-down and strong power-down state power.

In a specific embodiment of the invention, a completely new framework for controlling the permanent magnet synchronous motor for the pure electric vehicle, which is practical in engineering, is provided, and the framework adopts a completely independent control thinking of logic and algorithm; the task scheduling mechanism divides a control strategy into task packets with different periods according to different priorities and function sets in time sequence, and effectively divides the number of tasks on the same time sequence line by adopting a primary and secondary time sequence nested scheduling mode so as to avoid repeated entry and task accumulation of the tasks; placing finite state machine logic in a periodic task with highest real-time performance in space, and driving function functions in different periodic tasks with higher priority according to output intervention time sequence scheduling of states; the cooperative control method of the 'time sequence task scheduling' and the 'space state scheduling' is completely realized based on pure application layer software development and does not depend on bottom layer driving.

The method is completely realized based on application layer software development, has strong platform portability, does not depend on a specific micro-control chip integration environment, and has low software development cost and market application cost.

The invention creates a brand new program framework, integrates programs in advance, takes the given of direct axis current id _ ref and quadrature axis current iq _ ref as a boundary, and simplifies the high-speed sampling of the sensor and the vector pulse width modulation algorithm with the highest real-time property and then arranges the simplified sensor and the vector pulse width modulation algorithm as an algorithm part; the functions of 'state transition', 'mode control' and 'logic scheduling' with lower instantaneity and priority are simplified and then are arranged into a 'logic' part. The method has the advantages of brand-new control architecture, simplified program, clear real-time requirement and priority relation and provides a platform for realizing time sequence task scheduling and finite-state machine space scheduling.

The invention creates a special task scheduling mechanism, which divides a control strategy into task packets with different periods according to different priorities and function sets in time sequence, and effectively divides the number of tasks on the same time sequence line by adopting a primary and secondary time sequence nested scheduling mode, thereby avoiding repeated entry and task accumulation of the tasks; and (3) spatially placing the logic of the finite state machine in the periodic task with the highest real-time performance, and driving the function functions in different periodic tasks with higher priority according to the output intervention time sequence scheduling of the state.

The execution time of the algorithm part is strict, the algorithm execution time plus the AD conversion time is required to be less than the interruption period time, the interruption period is shortest during high-speed control, under the limit condition, the algorithm execution time not only ensures that the algorithm can be executed and completed without interruption and accumulation, but also ensures that the residual time of the algorithm execution can execute periodic tasks, and ensures that the total execution time does not exceed the task interval time after the tasks are broken for multiple times, thereby avoiding the task accumulation.

According to the special task scheduling mechanism, a task scheduling mode of primary and secondary time sequence nesting is adopted in time sequence, the number of tasks of a primary time sequence is divided, the time interval between tasks in different periods is enlarged, the execution time of the tasks in different periods is allowed to be sufficient, the task accumulation is avoided, the number of the tasks of the secondary time sequence is reduced, and the same effect of the primary time sequence can be achieved; the time interval between tasks in different periods is determined by the time sequence task scheduling form, and the tasks in different periods are effectively prevented from arriving at the same time by considering the relationship of the least common multiple of the remainder after taking one number and the multiple thereof; the scheduler completes logic polling from a high-frequency task to a low-frequency task from top to bottom, determines that the priority of the high-frequency task is higher than that of the low-frequency task, and also determines that the priority of the main time sequence task is higher than that of the secondary time sequence task; by adopting a method of circularly comparing the counting state values of the schedulers, the repeated entering of tasks in the same period can be effectively avoided; the method comprises the steps that a finite state machine which is completely developed based on application software is placed in a periodic task with the highest real-time performance in space, state output of other periodic tasks is completed in a fixed period, function execution under time sequence scheduling is determined according to a state instruction which is higher than the priority of the time sequence scheduling, therefore, each periodic task is not operated under a full load in each state, the execution time of each periodic task is reduced from the perspective of the space scheduling, the busy degree of a control system is optimized, and meanwhile, the specified time is guaranteed to complete the established task; the 'time sequence task scheduling' and 'space state scheduling' cooperative control method can give consideration to the real-time system task scheduling characteristics of 'a hard' real-time system requires to complete tasks within a specified time 'and' a soft 'real-time system completes operations according to priority'.

The specific technical scheme of the invention is as follows:

the construction of a brand new framework controlled by the permanent magnet synchronous motor for the pure electric vehicle has the following difficulties:

(1) it is necessary to completely separate the "logic" and "algorithm" in the program. As shown in fig. 1, the main body of the entire permanent magnet synchronous motor control program for the pure electric vehicle is as follows: main function initialization, external interruption, Timer0 timing interruption, AD conversion interruption and Main circulation. This is a basic setting based on a completely new architecture engineering. Initialization of peripheral equipment and variables is carried out in a Main function; the related realization of hardware faults and diagnosis layers requires the support of external interruption; timer0 Timer interrupt provides accurate timing for Scheduler task scheduling; the method comprises the following steps that the requirements of high-frequency sampling of a sensor, expansion of a control high-efficiency area, reduction of loss, high-speed and even ultrahigh-speed control and other control requirements are met, and a plurality of methods such as 'PWM periodic interruption' is replaced by simple AD conversion interruption or 'AD interruption and PWM interruption are matched and realized'; the main cycle is the main carrier of the cooperative control of the 'time sequence task scheduling' and the 'space state scheduling', wherein the main cycle is the functions of different function sets, and the functions are encapsulated into different task packets according to different periods.

Five major aspects of the programmatic new architecture design of fig. 1 are implemented by the underlying driver and the packaging of the underlying library. The invention discloses a 'time sequence task scheduling' and 'space state scheduling' cooperative control method of a permanent magnet synchronous motor for an electric vehicle, which is realized completely based on application layer codes, and the codes depend on 'AD conversion interruption' and 'main circulation', and any function in the middle is realized without changing bottom layer driving codes. The "logical" and "algorithm" completely separate requires a clear limit, which is given for the "direct current id _ ref" and the "quadrature current iq _ ref" of the ac pm synchronous machine.

The two coordinate system current given front ends are: the method comprises the steps of receiving and analyzing CAN line data, receiving and analyzing bottom layer data, scaling data, bus voltage, rotating speed, collecting relatively low physical quantity required by real-time performance such as motor temperature and controller temperature, calculating and filtering, diagnosing and processing faults in different periods and different levels, a program state machine, analyzing and executing various driving modes (driving, generating, 0 torque, active discharging and the like) and a whole vehicle mode (driving, cruising, shifting, slope staying and the like), analyzing and executing torque instruction analysis and torque external characteristic limit calculation, current table lookup and motor parameter table lookup, angle compensation, dead zone compensation, harmonic suppression, active damping, feedforward decoupling, calculating and filtering actual torque, packaging CAN line data, scheduling and sending and the like;

the back end given by "direct current id _ ref" and "quadrature current iq _ ref" is: sampling frequencies such as current and angle require higher physical quantity sampling and calculation, and are based on a voltage space vector pulse width modulation correlation algorithm. The front-end program has more state transition, mode control and logic scheduling, and the back-end program basically has pure calculation, so that the former is classified into a logic part on software and is realized in a main loop, and the latter is classified into an algorithm part and is realized in an AD conversion interrupt.

(2) During high-speed control, the carrier ratio is higher, the interruption of AD conversion is realized by PWM triggering, and the interruption frequency of AD conversion is higher at high speed, namely the period is shorter. This requires a short time for interrupting the program of the "algorithm" part of the AD conversion, which also takes a certain time for AD conversion.

As shown in fig. 2, the "algorithm execution time" plus the "AD conversion time" must be smaller than the interrupt cycle time. Executing a main loop by using a gap between the execution of the algorithm and the next AD conversion execution interruption subprogram, wherein the main loop is scheduled, and if the main loop is idle, no task with any period exists at the moment; the main loop, if busy, needs to perform periodic tasks. If the periodic task time is too short and is less than the algorithm execution interval, the periodic task can be completed before the next AD conversion interruption algorithm execution; if the periodic task time is longer, the execution of the periodic task is interrupted by the execution of the AD conversion interruption algorithm, and the interrupted times depend on the duration of the periodic task.

As can be seen from fig. 2, the execution time requirements are very high, whether it is the "algorithm" execution in AD or the "logic" execution in the main loop; the objective reason that the AD conversion needs to occupy time exists, and the algorithm execution time is required to be short enough, so that a program with lower real-time requirement in the interruption of the AD conversion needs to be moved to a main loop, and the program is also distributed to different periodic tasks according to functions and priorities, and a function with high real-time requirement is distributed to a periodic task with higher frequency, and the program is distributed to a periodic task with lower frequency. In order to ensure the busy degree of the system, the allocation of periodic tasks also needs to be balanced, the time occupied by each periodic task cannot be too long, the periodic tasks can not repeatedly enter in the period of the algorithm execution interval, and the phenomenon that the tasks in the period are not completely executed due to repeated interruption caused by the interruption of AD conversion, so that the tasks in the period are accumulated with the tasks in the next period can not occur. The results of two kinds of wrong scheduling are easy to judge, the task repeatedly enters the error, and the actual period is shorter than the specified task period; the tasks are piled up in error, the actual period is longer than the specified task period or the intermittence period is too long.

The difficulty of the cooperative control of the time sequence task scheduling and the space state scheduling is as follows:

(1) at present, in the market of pure electric commercial vehicles and passenger vehicles, the implementation of task scheduling related to real-time operating systems such as a micro-C _ OS-II, an RTOS, an OSEK and the like commonly used in the control of permanent magnet synchronous motors for vehicles all needs the coordination and the support of hardware bottom layer driving codes, and the integration level of the hardware and the hardware is higher. However, under the intense market competition, the frequent replacement of the vehicle permanent magnet synchronous motor controller platform and the demand of reducing the cost of the controller software become a common phenomenon. Therefore, a real-time task scheduling system with strong platform portability is needed. As shown in fig. 3, the cooperative control method of "time sequence task scheduling" and "spatial state scheduling" developed by the present invention is completely implemented based on application layer software, and has low bottom layer dependency.

(2) As can be seen in fig. 3, the execution decisions of the Timer0 interrupt and the AD conversion interrupt are in parallel with the Scheduler, and the task priority in the Scheduler is lower than the execution of the Timer0 interrupt and the AD conversion interrupt, and can be interrupted by the Timer 3578 interrupt and the AD conversion interrupt at any time; no other program except the Scheduler exists in the main cycle, so that the phenomenon of task accumulation caused by long-term occupation of the system is avoided; the equivalence judgment is carried out on the current state value Counter and the last state value Counter _ old of the Counter every time the Scheduler enters, and repeated entering errors of tasks can be effectively avoided.

As can be seen from fig. 1, the 500us task, the 1ms task, the 2ms task, the 10ms task, the 20ms task, and the 50ms task are set in the framework of the present invention, in order to effectively reduce the task occupation time, the 500us task and the 1ms task are divided into main tasks and auxiliary tasks for execution, and the 10ms task, the 20ms task, and the 50ms task are arranged in the 2ms task in a sub-scheduling manner.

Therefore, the software can be implemented according to the method in fig. 3, the Scheduler outer-layer main body schedules the Counter to respectively take the remainder of x, 2x and 4x, x is set according to personal requirements, the remainders are respectively y, y +2 and y +4, which represent that task intervals with different periods are two counting periods, the interval can be adjusted according to the actual task time length, the probability and the times of interruption of the task time due to AD conversion interruption are higher, so that the task accumulation caused by the fact that the task cannot be completed within the task interval time after repeated interruption can be avoided, and the task interval time with different periods can be properly lengthened to three times or even four times of the counting period. However, this interval cannot be lengthened without limitation, because the pure software implementation of the remainder to x involves the problem of the mathematical least common multiple, when the number of the main tasks is large, the time interval between different tasks is allowed to be shorter, otherwise, the tasks in different periods come at the same time, and thus, the task period is wrong and task accumulation occurs at the same time. Therefore, in the invention, a scheduling mode of matching primary and secondary time sequences is adopted in time sequence, and the primary time sequence is provided with 500us tasks, 1ms tasks and 2ms tasks, so that the task interval of the three primary time sequences can be enlarged to 3-4 times of the counting period, and task accumulation is avoided when the task program quantity of each period is large; the method of secondary time sequence scheduling is to add a sub Scheduler in three main time sequence tasks, the method of sub scheduling is still realized based on pure application layer software, a 500us task and a 1ms task are mainly to set a main sub task and an auxiliary sub task in order to reduce the occupied time of the tasks, only a circular interleaving logic is needed to realize, the 2ms task needs to realize the distinction of a 10ms task, a 20ms task and a 50ms task, the method of main time sequence scheduling needs to be imitated, a sub scheduling counter Subcounter2ms respectively carries out surplus on 5, 10 and 25, the remainders are a, a +3 and a +5, and similarly, only three main tasks are included in the 2ms sub scheduling, so the task interval can be randomly set to 3 to 4 times of counting period, and the execution time of the sub tasks is abundant. The scheduling mode has priority relation arranged actually, the scheduler completes logic polling from a high-frequency task to a low-frequency task from top to bottom, and the priority of the high-frequency task is higher than that of the low-frequency task, and the priority of the main time sequence task is higher than that of the secondary time sequence task. Therefore, the scheduling mode can take into account the real-time system task scheduling characteristics of 'hard' real-time system requires to complete tasks within a specified time 'and' soft 'real-time system completes operations according to priority'.

In order to optimize the execution time of tasks in different periods to the maximum, a predetermined time is ensured for completing a predetermined task. The invention realizes scheduling by adopting a state transfer mode in space and matching with time sequence, effectively reduces the busy degree of the system, and the state transfer intervention scheduling mode is realized based on a pure application layer software state machine. As shown in fig. 4. The state output of the software state machine is used as a driver of other periodic task contents, and the real-time requirement is the highest in task scheduling, so the software state machine must be placed in a master task with the highest frequency of 500 us. As can be seen in fig. 5, the finite state machine program is mainly divided into: INITIAL, STANDBY, CHARGE, READY, RUNING, DISCHARGE, POWER, FAULT, NOPOWER nine basic states. INITIAL is an INITIAL state, which includes the invocation of functional functions such as hardware power-on inspection and sensor self-inspection; STANDBY is a transitional STANDBY state in which low-voltage power-on is completed and ignition pre-charging is waited; CHARGE is power-on precharge; READY is the READY state of the whole vehicle; the RUNING is in a normal running state of the whole vehicle, and can realize the drive of a motor and the related mode of the whole vehicle; the DISCHARGE is in an active DISCHARGE state of the controller; POWEROFF is the strong power-off state of the controller; FAULT is a FAULT condition; NOPOWER is in the power-off state of weak current and strong current of the controller; the initialization state to the READY state are the power-on process of the controller; RUNING and FAULT belong to the operating process state; DISCHARGE, POWEROFF and NOPOWER belong to controller power-down procedures. With reference to fig. 4, it can be seen that tasks in different periods in all states do not need to run at full load, for example, sensor self-test in the power-on process of the controller only needs to complete a predetermined number of loop detections in the INITIAL state; controller precharge is done only in the CHARGE state; controller active DISCHARGE is only completed in DISCHARGE state, and so on. Therefore, the state output is carried out while state transition is realized in the 500us main task, the state output is used as the input of other periodic tasks, and the function in the task packet is selectively executed as a higher priority instruction while time sequence scheduling is carried out, so that the execution time of the tasks in different periods can be reduced from the perspective of space scheduling, and the cooperative control with the time sequence scheduling can be completed.

Here, the cooperative control of "timing task scheduling" and "spatial state scheduling" during the high-speed control of the permanent magnet synchronous motor for the pure electric vehicle is used as an example, as shown in fig. 6. When the permanent magnet synchronous motor is controlled at a high speed, due to the requirement of a carrier ratio, the modulation frequency of PWM is very high, and due to the application of double sampling and double updating, the frequency of AD conversion interruption is more double of the PWM modulation frequency, namely the AD conversion interruption period is very short, which is the working condition with the strictest requirements on the execution time of an algorithm part and the execution time of a periodic task in interruption, so that the limit condition is more representative as a case. In the actual experiment, the high-speed experiment is also an indispensable step for verifying the cooperative control of the time sequence task scheduling and the space state scheduling.

A permanent magnet synchronous motor for a pure electric vehicle with 4 pole pairs, rated power of 40kw, peak power of 80kw and rated voltage of 370V is selected in an experiment.

Experimental equipment: 40/80kw vehicle permanent magnet synchronous motor, 370V power supply, oscilloscope, logic analyzer, power analyzer, torque sensor, electric dynamometer, 40/80kw vehicle motor controller, 12V DC regulated power supply, cooling water supply equipment, etc.

The tested motor is dragged to 10000 r/min-15000 r/min by the experiment bench and the rotating speed loop mode of the electric dynamometer, and the tested motor runs at high speed. The specific embodiments of this patent are hereby incorporated by reference.

Firstly, starting a rotating speed loop mode of the electric dynamometer, dragging a tested motor to 10000 r/min-15000 r/min, wherein the tested motor is 4 pairs of stages, the frequency at the moment is 0.66 k-1 k, the frequency of one fundamental wave is generally modulated for at least 20 times according to the requirement of a carrier ratio, and the modulation frequency is required to reach 13.2 k-20 k in practical experiments although the modulation frequency is 7.5-10 times in practical experiments, but the modulation effect is relatively poor, and the modulation frequency is calculated according to 20 times. A modulation mode of 'double sampling and double updating' is adopted in the program, and the PWM updating frequency is increased to 20k when the hardware switching frequency is 10 k.

And secondly, dragging the tested motor by the rotating speed ring of the electric dynamometer, enabling the tested motor, and giving a 0-torque mode to the tested motor. The tested motor is dragged to 10000 r/min-15000 r/min, the variable carrier frequency, the random PWM and the double sampling and double updating are simultaneously acted in the program, so that the PWM updating frequency reaches 20k at the moment, namely the period of AD conversion interruption is 50us, as shown in figure 6. In the experiment, the execution time of the algorithm in the interruption of the AD conversion is 38us, and the phenomenon of interruption accumulation occurs by increasing about 2us, and the time interval between the PWM trigger point and the execution starting point of the interruption of the AD conversion is 9us by testing, that is, the AD conversion time shown in fig. 2 occupies 9 us. This requires that the algorithm takes less than 40us, 38us being satisfactory in this experiment, in the interruption of the AD conversion. The interruption period of Timer0 in the program is 100us, only the accumulation program of the scheduler Counter occupies time not exceeding 1us, in order to ensure the timing sequence scheduling timing is accurate, the interruption priority of Timer0 is higher than that of the AD conversion interruption, even if the AD conversion interruption is interrupted by the interruption of Timer0, the execution time increased by 1us is still less than 40us, therefore, the limit requirement under the high-speed control condition is still satisfied. In fig. 6, only the tasks of three cycles in the master time series are shown, respectively: 500us tasks, 1ms tasks and 2ms tasks. The 500us task is interrupted at the Timer0 and starts to be executed at the fifth counting time, and in order to avoid that tasks in different periods arrive at the same time to cause task accumulation, an interval is made from the first starting time of three tasks in fig. 6, and the interval period is two counting periods 200 us. In the figure, the 500us task, the 1ms task and the 2ms task are 30us, 20us and 10us respectively, the algorithm part is 38us long, namely, only 12us of time (including the AD conversion time) is left for executing the task in each cycle, so that the 500us task, the 1ms task and the 2ms task are interrupted 3 times, 2 times and 1 time respectively by the AD conversion interruption. As can be known from the method for calculating the actual execution time of the task in fig. 2, the actual execution times of the 500us task, the 1ms task, and the 2ms task in fig. 6 are respectively: 144us, 96us and 48us, the actual execution time is less than the 200us time interval between two different periodic tasks, and no pile-up of tasks occurs. When the time length of each period task is longer, the time interval between tasks in different periods can be properly increased to 3 to 4 times of the counting period, so that the premise of expanding the task interval time is that the number of main time sequence tasks is less, preferably about 2 to 3 tasks, and other tasks with lower priority and instantaneity are put into secondary time sequence scheduling.

The upper computer controls the controlled motor to complete the transfer of nine basic states including INITIAL, STANDBY, CHARGE, READY, RUNING, DISCHARGE, POWER, FAULT and NOPOWER, records the execution time length of each period task in each state, observes whether the period of each period task in each state is consistent or not, and avoids the phenomenon of repeated entry and task accumulation of the tasks. The tasks of each cycle in the RUNING state almost reach full load operation, which can be tested at the limit of 15000 r/min.

And thirdly, slowly applying current to the controlled motor when the rotating speed is maintained at 15000r/min, wherein the maximum torque value under the rotating speed can be achieved by applying the current to a table look-up, and in the current application process, whether the period of each period task is normal needs to be observed besides the real-time observation of the response condition of the 'direct axis current' and the 'quadrature axis current' and the calculation condition of terminal voltage, namely, under the limit condition of high-speed full-load control, the phenomenon of repeated entering of the tasks and task accumulation is avoided.

Fourthly, when the rotating speed of the electric dynamometer is maintained at 15000r/min, the controlled motor works in a RUNING state. The controlled motor is dynamically stepped to the maximum torque under the limit rotating speed, and under the cooperative control of 'time sequence task scheduling' and 'space state scheduling', whether software and hardware have faults, whether current response is good, whether terminal voltage exceeds the limit, and whether each period task cycle under the primary time sequence and the secondary time sequence is normal is observed.

The experimental verification is completed, and the basic functions of the 'time sequence task scheduling' and 'space state scheduling' cooperative control method based on pure application layer software development are realized.

The method has the advantages that the given direct-axis current id _ ref and quadrature-axis current iq _ ref of the permanent magnet synchronous motor for the pure electric vehicle are used as boundaries, and a control program is classified into a logic part and an algorithm part.

The cooperative control method of 'time sequence task scheduling' and 'space state scheduling' is completely realized based on application layer software development, has strong platform portability, does not depend on a specific micro-control chip integrated environment, and has low software development cost and market application cost;

according to the cooperative control method of 'time sequence task scheduling' and 'space state scheduling', a task scheduling mode of primary and secondary time sequence nesting is adopted in time sequence, so that the number of tasks of a primary time sequence can be effectively divided, the time interval between tasks in different periods is enlarged, the allowed execution time of the tasks in different periods is sufficient, the task accumulation is avoided, the number of the tasks of a secondary time sequence is reduced, and the same effect of the primary time sequence can be achieved; the time interval between tasks in different periods is determined by the time sequence task scheduling form, and the tasks in different periods are effectively prevented from arriving at the same time by considering the relationship of the least common multiple of the remainder after taking one number and the multiple thereof; the scheduler completes logic polling from a high-frequency task to a low-frequency task from top to bottom, determines that the priority of the high-frequency task is higher than that of the low-frequency task, and also determines that the priority of the main time sequence task is higher than that of the secondary time sequence task; by adopting a method of circularly comparing the counting state values of the schedulers, the repeated entering of tasks in the same period can be effectively avoided;

according to the cooperative control method of the 'time sequence task scheduling' and the 'space state scheduling', a finite state machine which is completely developed based on application software is placed in a periodic task with the highest real-time performance in space, the state output of other periodic tasks is completed in a fixed period, and the function execution under the time sequence scheduling is determined by a state instruction which is higher than the priority of the time sequence scheduling, so that each periodic task is not operated under the full load in each state, the execution time of each periodic task is reduced from the perspective of the space scheduling, the busy degree of a control system is optimized, and the fixed task is completed in the specified time;

the cooperative control method of the time sequence task scheduling and the space state scheduling can give consideration to the real-time system task scheduling characteristics of ' a hard ' real-time system needs to complete tasks within the specified time and ' a soft ' real-time system completes operations according to the priority '.

The system for realizing the cooperative control of the time sequence task scheduling and the space state scheduling by adopting the permanent magnet synchronous motor for the pure electric vehicle developed based on the pure application layer arranges the control program into a logic part and an algorithm part, has definite real-time requirement and priority relation, and provides a platform for realizing the time sequence task scheduling and the space scheduling of the finite-state machine. The method is completely realized based on application layer software development, the platform portability is strong, the method does not depend on a specific micro-control chip integration environment, and the software development cost and the market application cost are low. The time sequence task scheduling form of the invention defines the time interval between tasks in different periods, and effectively avoids the arrival of the tasks in different periods at the same moment by considering the relationship of taking the surplus of one number and the multiple thereof and the least common multiple of the remainder; by adopting the method of the cyclic comparison of the counting state values of the scheduler, the repeated entry of tasks in the same period can be effectively avoided. The invention reduces the execution time of the task in each period from the perspective of space scheduling, optimizes the busy degree of the control system and ensures that the set task is completed within the specified time.

In this specification, the invention has been described with reference to specific embodiments thereof. It will, however, be evident that various modifications and changes may be made thereto without departing from the broader spirit and scope of the invention. The specification and drawings are, accordingly, to be regarded in an illustrative rather than a restrictive sense.

16页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种基于熵权法的永磁同步电机多目标参数优化方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!