Patent Publication Number: US-11645499-B2

Title: Model calculating unit and control unit for calculating a neural layer of a multilayer perceptron model

Description:
FIELD 
     The present invention relates to the calculation of functional models in a separate hardwired model calculating unit, in particular for calculating multilayer perceptron models. 
     BACKGROUND INFORMATION 
     Functions of control units of technical system such as, e.g., internal combustion engines, electrical drives, battery stores and the like are frequently implemented using models that represent a mathematical representation of the real system. In physical models, however, especially in complex contexts, there is a lack of required precision in the calculation, and it is normally difficult, given today&#39;s computing capacities, to calculate such models within the real-time requirements demanded for a control unit. For such cases, a use of data-based models is contemplated that describe relationships between an output variable and input variables exclusively on the basis of training data obtained with the aid of a test stand or the like. Particularly suitable are data-based models for modeling complex relationships, in which multiple input variables, between which there exist reciprocal relationships, are taken into account in the model in a suitable manner. Modeling with the aid of data-based models additionally offers the possibility of complementing the model by adding individual input variables. 
     Data-based functional models are normally based on a great number of supporting points in order to achieve a modeling precision that is sufficient for the respective application. Due to the great number of supporting points, a high computing capacity is required for calculating a model value using a data-based functional model such as for example a Gaussian process model. In order to be able to calculate such a data-based functional model in a control unit application in real time, model calculating units based on a hardware design may therefore be provided. 
     SUMMARY 
     The present invention provides a model calculating unit for calculating a layer of a multilayer perceptron model, as well as a control unit and a use of the control unit. 
     Additional developments of the present invention are described herein. 
     The model calculating unit mentioned above provides an embodiment that makes it possible to calculate a layer of a multilayer perceptron model (MLP model) having a variable number of neurons. 
     According to a first aspect of the present invention, a model calculating unit is provided for calculating a layer of a multilayer perceptron model having a hardwired processor core developed in hardware for calculating a definitely specified computing algorithm in coupled functional blocks, the processor core being designed to calculate, as a function of one or multiple input variables of an input variable vector, of a weighting matrix having weighting factors and an offset value specified for each neuron, an output variable for each neuron for a neural layer of a multilayer perceptron model having a number of neurons, a sum of the values of the input variables weighted by the weighting factor, determined by the neuron and the input variable, and the offset value specified for the neuron being calculated for each neuron and the result being transformed using an activation function in order to obtain the output variable for the neuron. 
     One aspect of the above model calculating unit is to develop it in hardware structures separately in a processor core in a control unit for calculating a layer of a multilayer perceptron model. In this manner, it is possible to provide an essentially hardwired hardware circuit for implementing functions that makes it possible to calculate one or multiple neural layers of a multilayer perceptron model and in the process to produce only a very small processing load in a software-controlled microprocessor of a control unit. The hardware acceleration that is provided by the model calculating unit makes it possible to calculate a multilayer perceptron model in real time so that the use of such a model becomes interesting for control unit applications for internal combustion engines in motor vehicles. 
     In addition, the use of multilayer perceptron models allows for a data-based modeling using a smaller number of supporting points than comparable data-based models such as a Gaussian process model, for example. 
     The model calculating unit may be equipped with interfaces in order to calculate the MLP model in layerwise fashion so that the number of neural layers and the number of neurons may be freely selected in each neural layer. This layerwise division makes it possible to specify the parameters, such as for example the synapse weightings, separately for each neural layer. 
     The processor core may furthermore comprise a state machine, a memory for storing the one or multiple input variables of the input variable vector, the weighting matrix, the offset values specified for each neuron and the output variables for each neuron, one or multiple computing operation blocks, in particular a MAC block (for fixed point or floating point calculations) and an activation function calculation block. 
     There may be a provision for the processor core to be designed to select, as a function of a selection variable, the type of activation function for the multilayer perceptron model and/or to select, with the aid of another selection variable, whether a Gaussian process model or an RBF model or a neural layer of the perceptron model is to be calculated. 
     The activation function may comprise for example a kink function, a sigmoid function, a hyperbolic tangent function or a linear function. 
     The processor core furthermore may be developed in a surface area of an integrated chip. 
     According to another aspect of the present invention, a control unit having a microprocessor and the above model calculating unit is provided. The control unit may be designed in particular as an integrated circuit. 
     According to another aspect of the present invention, a use of the above control unit is provided as a control unit for controlling an engine system in a motor vehicle. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
       Specific embodiments are explained in greater detail below on the basis of the figures. 
         FIG.  1    shows a schematic representation of a control unit for use for an engine system in a motor vehicle. 
         FIG.  2    shows a schematic representation of a calculating unit as part of the control unit. 
         FIG.  3    shows a schematic representation of a neural layer of an MLP model. 
         FIGS.  4   a - 4   d    show representations of possible activation functions. 
     
    
    
     DETAILED DESCRIPTION OF EXAMPLE EMBODIMENTS 
       FIG.  1    shows in exemplary fashion a schematic representation of a control unit  2  for an engine system  1  having a combustion engine  3  as a technical system to be controlled. Control unit  2  comprises a microprocessor  21  and a model calculating unit  22 , which may be developed as separate components or in integrated fashion in separate surface areas on a chip. In particular, model calculating unit  22  represents a hardware circuit, which may be structurally separate from a processor core of microprocessor  21 . 
     Model calculating unit  22  is essentially hardwired and is accordingly not designed like microprocessor  21  to execute a software code and thereby to execute a variable function specified by software. In other words, no processor is provided in model calculating unit  22  so that the latter is not able to be operated by a software code. Focusing on a specified model function allows for a resource-optimized implementation of such a model calculating unit  22 . In an integrated structural design, the model calculating unit  22  may be implemented in surface area-optimized fashion, which additionally allows for fast calculations. 
     Control unit  2  is essentially used to process sensor signals S or sensor variables, which are recorded by a sensor system in internal combustion engine  3 , and/or external inputs V, and to apply, cyclically at definitely specified time intervals of e.g. 1-100 ms or in angular synchronous manner as a function of a crankshaft angle of an operated internal combustion engine, values of one or multiple corresponding control variables A to internal combustion engine  3  so that the latter may be operated in a manner known per se. 
       FIG.  2    shows a model calculating unit  22  in more detail. Model calculating unit  22  comprises a state machine  11 , a memory  12  and one or multiple operation blocks, which may include for example one or multiple MAC blocks  13  (MAC: Multiply ACumulate for fixed point calculation or FMA: Fused Multiply Add for floating point calculation) and an activation function calculation block (ACT)  14  for calculating an activation function. State machine  11  and the one or the multiple operation blocks  13 ,  14  form a processor core ALU of model calculating unit  22 . In addition or as an alternative to the MAC block, the operation blocks may comprise a multiplication block and an addition block. 
     With the aid of state machine  11 , values of input variables stored in an input variable memory area of memory  12  may be calculated by repeated loop calculations in order to obtain intermediate variables or output variables that are written into a corresponding output variable memory area of memory  12 . 
     State machine  11  is designed to calculate an individual neural layer of a multilayer perceptron model. State machine  11  may be described according to the following pseudocode: 
     /*input transformation*/ 
     for (k=0; k&lt;p7; k++) { 
     
         
         
           
             ut[k]=u[k]*p1[k]+p2[k]; 
           
         
       
    
     } 
     /*loop calculation*/ 
     for (j=p8; j&lt;p6; j++) { 
     
         
         
           
             i=j*p7; 
             t=p3[j]; 
             for (k=0; k&lt;p7; k++) {
           t+=V[i+k]*ut[k];   
         
             } 
             y[j]=act(t); 
           
         
       
    
     } 
     /*output transformation*/ 
     for (k=0; k&lt;p6; k++) {
         z[k]=y[k]*p4[k]+p5[k];       

     } 
     where
     p7: maximum index value for the input variables of the input variable vector   p8: minimum index value or initial value for the number of neurons   p6: maximum index value for the number of neurons   p3: offset value   p1, p2: variables for the input transformation   p4, p5: variables for the output transformation   

     With the aid of the above pseudocode, it is possible to perform the following calculation for each neuron of the neural layer to be calculated: 
     
       
         
           
             
               
                 y 
                 [ 
                 j 
                 ] 
               
               - 
               
                 
                   act 
                   ( 
                   
                     
                       p 
                       ⁢ 
                       
                         3 
                         [ 
                         j 
                         ] 
                       
                     
                     + 
                     
                       
                         ∑ 
                         
                           k 
                           = 
                           0 
                         
                         
                           
                             p 
                             ⁢ 
                             7 
                           
                           - 
                           1 
                         
                       
                         
                       
                         
                           v 
                           
                             j 
                             , 
                             k 
                           
                         
                         * 
                         
                           ut 
                           [ 
                           k 
                           ] 
                         
                       
                     
                   
                   ) 
                 
                 ⁢ 
                     
                 for 
                 ⁢ 
                     
                 j 
               
             
             = 
             
               
                 0 
                 ⁢ 
                     
                 … 
                 ⁢ 
                     
                 p 
                 ⁢ 
                 6 
               
               - 
               1 
             
           
         
       
     
     This represents a calculation for a neural layer of a multilayer perceptron model, as shown in  FIG.  3   . 
       FIG.  3    shows a neural layer of multiple neurons  20  which are supplied with values of input variables of an input variable vector ut 0  . . . ut p6-1 . The values of the input variables are weighted with the aid of a respectively specified weighting matrix of weighting values, which are specified as weighting factors v 0  . . .  p7-1,0  . . .  p6-1 . The weighting normally occurs by multiplicative application of the associated weighting factors v 0  . . .  p7-1,0  . . .  p6-1 , but may also apply the values of the input variable vector in another manner. 
     The sums of the weighted values of the input variable vector ut 0  . . . ut p6-1  respectively have an offset value O 0  . . . O p6-1  applied to them, in particular applied in an additive manner. The result is transformed using a specified activation function “act”. As a result, one obtains a corresponding value of an output variable vector y 0  . . . y p6-1  The provision of the offset value for each neuron provides another degree of freedom for the model formation. 
     Defining the controlled variables p6 makes it possible to set the number of neurons  20  of the neural layer to be calculated. 
     By using the values of the output variable vector y 0  . . . y p6-1  of a neural layer as input variable vector for calculating a subsequent neural layer, a multilayer perceptron model may be used in model calculating unit  22  so that the number of neural layers of the multilayer perceptron model may be implemented by repeatedly calling the function according to the above pseudocode or by repeatedly calling the model calculating unit  22  with accordingly changed parameters. 
     An input and/or output transformation of the input variables of the input variable vector and, respectively, of the output variables of the output variable vector may be performed with the aid of scaling variables p1 and p2, and, respectively, p4 and p5, specified for each neuron. 
     The layerwise calculation of the MLP model allows for a slim design of model calculating unit  22  so that its surface area requirement in an integrated structural design is low. Model calculating unit  22  nevertheless allows for a calculation of a multilayer perceptron model in a simple manner by returning or redefining the values of the output variables of the output variable vector as input variables of an input variable vector for the calculation of a further neural layer. 
     As activation function “act,” one of several activation functions may be provided, which may be calculated by the activation function calculation block  14  of model calculating unit  22 . The activation functions may be for example a kink function, a sigmoid function, a hyperbolic tangent function or a linear function, as shown respectively in  FIGS.  4   a    through  4   d.    
     The single-layer design of the neural model, which is implemented by the above pseudocode, additionally makes it possible to calculate, in addition to a neural layer of an MLP model, also a Gaussian process model or an RBF model (RBF: Radial Basis Function). For this purpose, the weighting values are not applied multiplicatively onto the values of the input variable, but rather additively or subtractively. Furthermore, the quadratic distance is calculated, which is weighted using specified length scales L[k]. Furthermore, an exponential function is selected as activation function for the RBF model. This makes it possible to calculate a Gaussian process model in accordance with 
             y   =       ∑     j   =   0         p   ⁢   6     -   1         p   ⁢       3   [   j   ]     ·     exp   ⁡   (     -       ∑     k   =   0         p   ⁢   7     -   1           L   [   k   ]     ·       (       -     v     j   ,   k         +     ut   [   k   ]       )     2           )                 
selectively by a modification of the pseudocode as follows.
 
     /*input transformation*/ 
     for (k=0; k&lt;p7; k++) {
         ut[k]=u[k]*p1[k]+p2[k];       

     } 
     /*loop calculation*/ 
     for (j=p8; j&lt;p6; j++) {
         i=j*p7;   t=(cfg_mlp) ? p3[j]:0.0f; // init with bias for MLP   for (k=0; k&lt;p7; k++) {
           if (cfg_mlp) {
               t+=V[i+k]*ut[k];   
               }   else {
               d=V[i+k]−ut[k];   d=d*d;   t+=L[k]*d   
               }   
           }   if (cfg_mlp) {
           switch (cfg_activation_function) {   case 1:
               e=(t&gt;=0.0f) ? t:0.0f; // kink function   break;   
               case 2: // sigmoid function
               e=sigmoid(t);   break;   
               case 3: // tan h function
               e=tan h(t);   break;   
               default: // linear function
               e=t;   
               }   y[j]=e;   
           }   else {// for Gaussian process model/RBF model
           e=exp(−t);   y[0]+=p3[j]*e;   
           }       

     /*output transformation*/ 
     j=(cfg_mlp) ? p6:1; 
     for (k=0; k&lt;j; k++) {
         z[k]=y[k]*p4[k]+p5[k];       

     } 
     It may be seen that in the execution of the loop function it is possible to perform a case distinction using variable cfg_mlp. At cfg_mlp=1, the calculation of the neural layer is selected and using cfg_activation_function=0 . . . 3 the type of the activation functions described above may be selected. 
     At cfg_mlp=0, a Gaussian process model or an RBF model is calculated. Here a selection of the activation function is not necessary since it may always be calculated using the exponential function. In this manner, it is possible to use model calculating unit  22  both for calculating Gaussian process models and RBF models as well as for calculating a neural layer of an MLP model and to require in the process only a small surface area in an integrated construction of the state machine.