bug 7514 fixed - Some demo files were broken due to changes in x_mdialog function. 62/1362/2
Yann Collette [Tue, 20 Jul 2010 12:54:10 +0000 (14:54 +0200)]
Change-Id: Ic4c356848b5ffeb4b96f3fecc394d2251bbee674

scilab/CHANGES_5.3.X
scilab/modules/cacsd/demos/lqg/lqg.dem
scilab/modules/cacsd/demos/pid.dem

index 5692da6..e0d1cc0 100644 (file)
@@ -105,6 +105,8 @@ Bug Fixes:
 
 * bug 7508 fixed - There was a wrong error message in gmres function.
 
+* bug 7514 fixed - Some demo files were broken due to changes in x_mdialog function.
+
 * bug 7520 fixed - The Xcos context was not translated from parent diagram to 
                    child.
 
index 90513b0..c8b21db 100644 (file)
@@ -104,9 +104,9 @@ while %t do
   case 2
     if Plant(4)=='c' then
       mode(1)
-      defv=['0.1','20'];
-      title='Enter Sampling period and Tmax';
-      rep=x_mdialog(title,['Sampling period?';'Tmax?'],defv)
+      defv=['0.1';'20'];
+      _title='Enter Sampling period and Tmax';
+      rep=x_mdialog(_title,['Sampling period?';'Tmax?'],defv)
       if rep==[] then break,end
       dttmax=evstr(rep)
       dt=evstr(dttmax(1));tmax=evstr(dttmax(2));
@@ -114,41 +114,41 @@ while %t do
       n1=x_choose(['Step response?';'Impulse response?'],'Simulation:');
       select n1
       case 1 then
-       scf(1);clf();show_window();
-       plot2d([t',t'],[(csim('step',t,Tlqg))',ones(t')]);
+        scf(1);clf();show_window();
+        plot2d([t',t'],[(csim('step',t,Tlqg))',ones(t')]);
       case 2 then
-       scf(1);clf();show_window();
-       plot2d([t',t'],[(csim('impul',t,Tlqg))',0*t']);
+        scf(1);clf();show_window();
+        plot2d([t',t'],[(csim('impul',t,Tlqg))',0*t']);
       end
       mode(-1)
     elseif Plant(4)=='d' then
       mode(1)
       defv=['30'];
-      title='Tmax?';
-      rep=x_mdialog(title,['Tmax='],defv)
+      _title='Tmax?';
+      rep=x_mdialog(_title,['Tmax='],defv)
       if rep==[] then break,end
       Tmax=evstr(rep);
       mode(-1)
       n2=x_choose(['Step response?';'Impulse response?'],'Simulation:');
       select n2
       case 0 then
-       break;
+        break;
       case 1 then
-       mode(1)
-       u=ones(1,Tmax);u(1)=0;
-       scf(1);clf();show_window();
-       plot2d([(1:Tmax)',(1:Tmax)'],[(dsimul(Tlqg,u))',(ones(1:Tmax)')])
-       mode(-1)
+        mode(1)
+        u=ones(1,Tmax);u(1)=0;
+        scf(1);clf();show_window();
+        plot2d([(1:Tmax)',(1:Tmax)'],[(dsimul(Tlqg,u))',(ones(1:Tmax)')])
+        mode(-1)
       case 2 then
-       mode(1)
-       u=zeros(1,Tmax);u(1)=1;
-       scf(1);clf();show_window();
-       plot2d((1:Tmax)',(dsimul(Tlqg,u))')
-       mode(-1)
+        mode(1)
+        u=zeros(1,Tmax);u(1)=1;
+        scf(1);clf();show_window();
+        plot2d((1:Tmax)',(dsimul(Tlqg,u))')
+        mode(-1)
       end
     end
   end
 end
 lines(oldln(2))
 clear s z n str rep Plant P22 ny nu nx Qx Qu bigQ Rx Ry bigR  Plqg r 
-clear Klqg Slqg Rlqg Tlqg resp title dttmax dt t n1 defv Tmax n2 u oldln
+clear Klqg Slqg Rlqg Tlqg resp _title dttmax dt t n1 defv Tmax n2 u oldln
index 3a2125f..aa6692f 100644 (file)
@@ -13,7 +13,7 @@ y=[22,28,30,32];ymin=12;ymax=40;
 
 xx=[xmin,xmin,x([1 2 2 7 4 6 3 4 5 6 3 3 5 5]);xmax,xmax,x([3,2,7,7,5,8,3,4,5,6,4,4,6,6])];
 yy=[ymin,ymax,y([3,1,1,1,3,3,2,2,2,2,2,4,2,4]);ymin,ymax,y([3,3,1,3,3,3,4,4,4,4,2,4,2,4])];
-    
+
 xset("window",0);clf();show_window();
 plot2d(xx,yy,ones(1,16),'022');
 xstring(28,30,'K');xstring(56,30,'Plant');xstring(12,28.80,'-');
@@ -22,7 +22,7 @@ mode(2);
 
 s=poly(0,'s');z=poly(0,'z');
 messagebox(['Example of PID Design '
-          'file: '+SCI+'/modules/cacsd/demos/pid.dem'],"modal");
+            'file: '+SCI+'/modules/cacsd/demos/pid.dem'],"modal");
 
 n=x_choose(['Continuous time';'Discrete time'],'Select time domain');
 select n
@@ -35,11 +35,11 @@ select n
   str='[(s-1)/(s^2+5*s+1)]';
   rep=x_dialog('Nominal plant?',str);
   if rep==[] then return,end
-  Plant=evstr(rep); 
+  Plant=evstr(rep);
   Plant=syslin('c',Plant);
   mode(-1)
 case 2
-  mode(1)  
+  mode(1)
   dom='d'
   z=poly(0,'z');
   str='(z+1)/(z^2-5*z+2)'
@@ -48,21 +48,21 @@ case 2
   Plant=evstr(rep)
   Plant=syslin('d',Plant);
   mode(-1)
-end   
+end
 //Nominal Plant
 P22=tf2ss(Plant);    //...in state-space form
 [ny,nu,nx]=size(P22);
-defv=['-1.2','1','0.1'];
-if dom=='d' then defv=['-10','1','0.1'];end
+defv=['-1.2';'1';'0.1'];
+if dom=='d' then defv=['-10';'1';'0.1'];end
 while %t
   mode(1)
   if dom=='c' then
-    title='Enter your PID controller K(s)=Kp*(1+T0/s+T1*s)';
+    _title='Enter your PID controller K(s)=Kp*(1+T0/s+T1*s)';
   end
   if dom=='d' then
-    title='Enter your PID controller K(z)=Kp*(1+T0/z+T1*z)';
+    _title='Enter your PID controller K(z)=Kp*(1+T0/z+T1*z)';
   end
-  defv=x_mdialog(title,['Kp=';'T0=';'T1='],defv);
+  defv=x_mdialog(_title,['Kp=';'T0=';'T1='],defv);
   if defv==[] then warning('Demo stops!');return;end
   Kp=evstr(defv(1));T0=evstr(defv(2));T1=evstr(defv(3));
   if dom=='c' then
@@ -109,52 +109,51 @@ while %t do
     if Plant(4)=='c' then
       mode(1)
       defv=['0.1','50'];
-      title='Enter Sampling period and Tmax';
-      rep=x_mdialog(title,['Sampling period?';'Tmax?'],defv);
+      _title='Enter Sampling period and Tmax';
+      rep=x_mdialog(_title,['Sampling period?';'Tmax?'],defv);
       if rep==[] then break,end
       dttmax=evstr(rep);
       dt=evstr(dttmax(1));tmax=evstr(dttmax(2));
       t=0:dt/5:tmax;
       n1=x_choose(['Step response?';'Impulse response?'],'Simulation:');
       if n1==0 then
-       warning('Demo stops!');return;
+        warning('Demo stops!');return;
       end
       if n1==1 then 
-       clf(1);xset("window",1);show_window();
-       plot2d([t',t'],[(csim('step',t,Tpid))',ones(t')])
+        clf(1);xset("window",1);show_window();
+        plot2d([t',t'],[(csim('step',t,Tpid))',ones(t')])
       end
       if n1==2 then
-       clf(1);xset("window",1);show_window();
-       plot2d([t',t'],[(csim('impul',t,Tpid))',0*t'])
+        clf(1);xset("window",1);show_window();
+        plot2d([t',t'],[(csim('impul',t,Tpid))',0*t'])
       end
       mode(-1)
     elseif Plant(4)=='d' then
       mode(1)
       defv=['100'];
-      title='Tmax?'
-      rep=x_mdialog(title,['Tmax='],defv);
+      _title='Tmax?'
+      rep=x_mdialog(_title,['Tmax='],defv);
       if rep==[] then break,end
       Tmax=evstr(rep);
       mode(-1)
       while %t do
-       n=x_choose(['Step response?';'Impulse response?'],'Simulation:');
-       select n
-       case 0 then
-         break
-       case 1 then
-         mode(1)
-         u=ones(1,Tmax);u(1)=0;
-         clf(1);xset("window",1);show_window();
-         plot2d([(1:Tmax)',(1:Tmax)'],[(dsimul(Tpid,u))',(ones(1:Tmax)')])
-         
-         mode(-1)
-       case 2 then
-         mode(1)
-         u=zeros(1,Tmax);u(1)=1;
-         clf(1);xset("window",1);show_window();
-         plot2d((1:Tmax)',(dsimul(Tpid,u))')
-         mode(-1)
-       end
+        n=x_choose(['Step response?';'Impulse response?'],'Simulation:');
+        select n
+        case 0 then
+          break
+        case 1 then
+          mode(1)
+          u=ones(1,Tmax);u(1)=0;
+          clf(1);xset("window",1);show_window();
+          plot2d([(1:Tmax)',(1:Tmax)'],[(dsimul(Tpid,u))',(ones(1:Tmax)')])
+          mode(-1)
+        case 2 then
+          mode(1)
+          u=zeros(1,Tmax);u(1)=1;
+          clf(1);xset("window",1);show_window();
+          plot2d((1:Tmax)',(dsimul(Tpid,u))')
+          mode(-1)
+        end
       end
     end
   end