This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28379D: TMS320F28379D matrix dimention problem

Part Number: TMS320F28379D

Hi everyone,

I'm using TMS320F28379D launchpad and I'm studying model predictive control. In the control schema, I need big-size multiple matrices like 45*60 and 60*60 size.

If I use only one or two matrices, I don't have any problem but if I use three or many more matrices, all values in expression windows are incorrect value. 

Is there any limit for number of matrices or dimention?

Thanks...

Best regards...

  • How do you create these matrices?  Are they global variables?  Are they created with calls to malloc?  Are they local to a function?  Or what?

    Thanks and regards,

    -George

  • my definations as belows.

    int a=1, sayac1;
    float E[60][80];
    float F[60][1];
    float MM[60][80];
    float zref[40][1];

    And my code part is as below.

        for (j=1;j<=N;j++) {
            zref[4*j-4][0]=7500;
            zref[4*j-3][0]=0.75;
            zref[4*j-2][0]=0.75;
            zref[4*j-1][0]=7500;
        }
    
        sayac=1;
        E[0][0]=1;
            for (j=1;j<=4*N-4;j+=4) {
            E[j][j]=powf(w3,sayac);
            E[j+1][j+1]=powf(w4,sayac);
            E[j+2][j+2]=powf(w2,sayac);
            E[j+2][j+3]=powf(w2,sayac);
            E[j+3][j+2]=powf(w2,sayac);
            E[j+3][j+3]=(powf(w1,sayac)+powf(w2,sayac));
            sayac=sayac+1;
        }
        E[4*N-3][4*N-2]=powf(w3,sayac);
        E[4*N-2][4*N-1]=powf(w4,sayac);
        E[4*N-1][4*N-1]=powf(w2,sayac);
    
        for (j=0;j<4*N-1;j++) {
            for (jj=0;jj<4*N-1;jj++) {
                a=a+E[j][jj]*zref[jj][1];
            }
            F[j][1]=-a;
        }
        MM[1][1]=h*sayac/Energy_bat_f;
        MM[2][1]=-h*sayac/Energy_sc_f;
        MM[3][1]=-1;
        MM[1][2]=1;
        MM[2][3]=1;
        MM[3][4]=1;
        sayac1=2;
        sayac=1;
            for (j=4;j<=3*N-1;j+=3) {
                sayac=sayac+1;
                MM[j][sayac1]=-1;
                MM[j+1][sayac1+1]=-1;
                MM[j+2][sayac1+2]=-1;
                MM[j][sayac1+3]=h*sayac/Energy_bat_f;
                MM[j+1][sayac1+3]=-h*sayac/Energy_sc_f;
                MM[j+2][sayac1+3]=-1;
                MM[j][sayac1+4]=1;
                MM[j+1][sayac1+5]=1;
                MM[j+2][sayac1+6]=1;
                sayac1=sayac1+4;
            }
    

    As it can be seen above, If I add to code colculation of MM matrice, all values are incorrect but if I delete this part, values are correct. There is no any mistake in MM matrix calculation. Instade of this calculation, when I use calculation like below, then I am getting again same problem.

    MM[5][1]=5;

  • These variables ...

    int a=1, sayac1;
    float E[60][80];
    float F[60][1];
    float MM[60][80];
    float zref[40][1];

    ... take up 19402 words of memory.  If these variables are local to a function, then they reside on the stack.  Thus, you need to reserve much more memory than is typical for the stack.  

    Is that the problem?

    Thanks and regards,

    -George

  • Dear George,

    These variables are used in CPU2 and they are created in subfunction. But they use in main function. Before this problem, I did have memory problem but I solved it by increasing RAMM= memory size.

  • For the source file that contains the lines which define the variables that require 19402 words of memory, please follow the directions in the article How to Submit a Compiler Test Case.

    Thanks and regards,

    -George

  • Dear George, 

    This is not a solution to my problem. When I build the code, I don't get any error in the console window. 

    If I don't use MM matrice (I explained before this matrice) my expression window is seen as below;

    But if I add MM matrice my expression window is seen as below;

  • This is not a solution to my problem.

    I asked for a test case because I don't understand the problem well enough to offer a solution.  Please provide the requested test case.

    Thanks and regards,

    -George