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.

error expression must have integral type

Other Parts Discussed in Thread: CONTROLSUITE

Hi all,

I am trying an exaple code from control suite for Field Oriented Control for Sensorless AC induction motor.

On compiling I am getting an error which says expression must have integral type for following line

// ------------------------------------------------------------------------------
// Connect inputs of the SVGEN_DQ module and call the space-vector gen. macro
// ------------------------------------------------------------------------------
svgen_dq1.Ualpha = ipark1.Alpha;
svgen_dq1.Ubeta = ipark1.Beta;
SVGEN_MACRO(svgen_dq1);             <-----------------------expression must have integral type

following is the expansion of macro

Sector = 0; \
temp_sv1=(((0.5)) * (svgen_dq1.Ubeta)); \
temp_sv2=(((0.8660254)) * (svgen_dq1.Ualpha)); /* 0.8660254 = sqrt(3)/2*/ \
\
/* Inverse clarke transformation */ \
Va = svgen_dq1.Ubeta; \
Vb = -temp_sv1 + temp_sv2; \
Vc = -temp_sv1 - temp_sv2; \
/* 60 degree Sector determination */ \
if (Va>(0)) Sector = 1; \
if (Vb>(0)) Sector = Sector+2; \
if (Vc>(0)) Sector = Sector+4; \
/* X,Y,Z (Va,Vb,Vc) calculations X = Va, Y = Vb, Z = Vc */ \
Va = svgen_dq1.Ubeta; \
Vb = temp_sv1 + temp_sv2; \
Vc = temp_sv1 - temp_sv2; \
/* Sector 0: this is special case for (Ualpha,Ubeta) = (0,0)*/ \
\
switch(Sector) \
{ \
case 0: \
svgen_dq1.Ta = (0.5); \
svgen_dq1.Tb = (0.5); \
svgen_dq1.Tc = (0.5); \
break; \
case 1: /*Sector 1: t1=Z and t2=Y (abc ---> Tb,Ta,Tc)*/ \
t1 = Vc; \
t2 = Vb; \
svgen_dq1.Tb = ((1)-t1-t2)>>1; /* tbon = (1-t1-t2)/2 */ \
svgen_dq1.Ta = svgen_dq1.Tb+t1; /* taon = tbon+t1 */ \
svgen_dq1.Tc = svgen_dq1.Ta+t2; /* tcon = taon+t2 */ \
break; \
case 2: /* Sector 2: t1=Y and t2=-X (abc ---> Ta,Tc,Tb)*/ \
t1 = Vb; \
t2 = -Va; \
svgen_dq1.Ta = ((1)-t1-t2)>>1; /* taon = (1-t1-t2)/2 */ \
svgen_dq1.Tc = svgen_dq1.Ta+t1; /* tcon = taon+t1 */ \
svgen_dq1.Tb = svgen_dq1.Tc+t2; /* tbon = tcon+t2 */ \
break; \
case 3: /* Sector 3: t1=-Z and t2=X (abc ---> Ta,Tb,Tc)*/ \
t1 = -Vc; \
t2 = Va; \
svgen_dq1.Ta = ((1)-t1-t2)>>1; /* taon = (1-t1-t2)/2 */ \
svgen_dq1.Tb = svgen_dq1.Ta+t1; /* tbon = taon+t1 */ \
svgen_dq1.Tc = svgen_dq1.Tb+t2; /* tcon = tbon+t2 */ \
break; \
case 4: /* Sector 4: t1=-X and t2=Z (abc ---> Tc,Tb,Ta)*/ \
t1 = -Va; \
t2 = Vc; \
svgen_dq1.Tc = ((1)-t1-t2)>>1; /* tcon = (1-t1-t2)/2 */ \
svgen_dq1.Tb = svgen_dq1.Tc+t1; /* tbon = tcon+t1 */ \
svgen_dq1.Ta = svgen_dq1.Tb+t2; /* taon = tbon+t2 */ \
break; \
case 5: /* Sector 5: t1=X and t2=-Y (abc ---> Tb,Tc,Ta)*/ \
t1 = Va; \
t2 = -Vb; /* tbon = (1-t1-t2)/2 */ \
svgen_dq1.Tb = ((1)-t1-t2)>>1; /* tcon = tbon+t1 */ \
svgen_dq1.Tc = svgen_dq1.Tb+t1; /* taon = tcon+t2 */ \
svgen_dq1.Ta = svgen_dq1.Tc+t2; \
break; \
case 6: /* Sector 6: t1=-Y and t2=-Z (abc ---> Tc,Ta,Tb)*/ \
t1 = -Vb; \
t2 = -Vc; \
svgen_dq1.Tc = ((1)-t1-t2)>>1; /* tcon = (1-t1-t2)/2 */ \
svgen_dq1.Ta = svgen_dq1.Tc+t1; /* taon = tcon+t1 */ \
svgen_dq1.Tb = svgen_dq1.Ta+t2; /* tbon = taon+t2 */ \
break; \
} \
/* Convert the unsigned GLOBAL_Q format (ranged (0,1)) ->.. */ \
/* ..signed GLOBAL_Q format (ranged (-1,1))*/ \
svgen_dq1.Ta = (svgen_dq1.Ta-(0.5))<<1; \
svgen_dq1.Tb = (svgen_dq1.Tb-(0.5))<<1; \
svgen_dq1.Tc = (svgen_dq1.Tc-(0.5))<<1;

  • We who watch this forum do not have expertise with controlSUITE.  That said, I have a few suggestions which may help.

    You can have the compiler show you, in a more precise manner, the source of the problem.  First, preprocess the file like this.  But don't submit that preprocessed file here.  Instead, build that preprocessed file like any other file in your project, but add the option --verbose_diagnostics.  That causes the compiler to echo the problem source line with a ^ character pointing to the spot in the line where the problem begins.  

    My guess on the root cause problem: You have something misconfigured, or you are mixing things of incompatible versions.

    Thanks and regards,

    -George

  • Hi George,

    Thank you for your suggestion but I still have a doubt. While building the .pp file do we to revert back to normal build settings?

  • Anagha Paradkar32 said:
    While building the .pp file do we to revert back to normal build settings?

    Yes.

    -George

  • Hi George,

    I did as you suggested. Now I know where my error is. It is indicating at the start of my function, but still I see no error in it.

  • The actual error is more likely in the previous expression. Perhaps you are missing the closing } on a function, or semicolon on a declaration. This declaration might not be in the same file. I recommend incrementally cutting down the size of the .pp file and recompiling until it is just a few lines; this should be very instructive in spotting the error.