"COMM" : Commande et Observation Mono- et Multivariables

by

 

27 Jun 2005 (Updated )

Companion software to french book "Commande et estimation multivariables"

scopes_simul.m
% scopes_simul
%
% Trac de divers oscillogrammes relevs pendant les simulations
%
% Les noms choisis dans les oscilloscopes des schmas de simulation, dans la
% rubrique Variable name, sous l'onglet Data history, doivent correspondre aux
% noms utiliss dans ce programme.
%
%  Auteur : E. Ostertag  27 juin 2005  
%  Dernire mise  jour : 28 fvrier 2006

rep = input('Tracer les oscillogrammes de la simulation (O/N) ? [N] --> ','s');
if isempty(rep)
	rep = 'N';
else
	rep = rep(1);
end
if rep == 'N' || rep == 'n',
	return;
end
%
% Oscillogrammes des variables d'tat et de leurs estimes
%
rep2 = input('Etats rels et estims (O/N) ? [N] --> ','s');
if isempty(rep2)
	rep2 = 'N';
else
	rep2 = rep2(1);
end
if rep2 == 'O' || rep2 == 'o',
	rep2a = input('   2 premiers tats, courbes relles et estimes superposes (O/N) ? [N] --> ','s');
	if isempty(rep2a)
		rep2a = 'N';
	else
		rep2a = rep2a(1);
	end
	if rep2a == 'O' || rep2a == 'o',
		figure; set(gcf,'defaultlineLineWidth',1.5);
		if plant == 'C',
			plot(ScopeComp.time, ScopeComp.signals(1).values(:,1),'r-'); hold on;
			plot(ScopeComp.time, ScopeComp.signals(1).values(:,2),'b--'); grid on;
		else
			stairs(ScopeComp.time, ScopeComp.signals(1).values(:,1),'r-'); hold on;
			stairs(ScopeComp.time, ScopeComp.signals(1).values(:,2),'b--'); grid on;
		end
		xlabel(tscale,'FontName','Times New Roman','FontSize',14.0);
		title('y1=x1, rel et estim','FontName','Times New Roman','FontSize',14.0);
		if q >= 2,
			figure; set(gcf,'defaultlineLineWidth',1.5);
			if plant == 'C',
				plot(ScopeComp.time, ScopeComp.signals(2).values(:,1),'r-'); hold on;
				plot(ScopeComp.time, ScopeComp.signals(2).values(:,2),'b--'); grid on;
			else stairs(ScopeComp.time, ScopeComp.signals(2).values(:,1),'r-'); hold on;
				stairs(ScopeComp.time, ScopeComp.signals(2).values(:,2),'b--'); grid on;
			end
			xlabel(tscale,'FontName','Times New Roman','FontSize',14.0);
			title('y2=x2, rel et estim','FontName','Times New Roman','FontSize',14.0);
		end
	else
		for i = 1:n
			figure; set(gcf,'defaultlineLineWidth',1.5);
			if plant == 'C',
				plot(ScopeEtat.time, ScopeEtat.signals(i).values,'r-'); grid on;
			else
				stairs(ScopeEtat.time, ScopeEtat.signals(i).values,'r-'); grid on;
			end
			xlabel(tscale,'FontName','Times New Roman','FontSize',14.0);
			title(['x' num2str(i) ' rel'],'FontName','Times New Roman','FontSize',14.0);
			figure; set(gcf,'defaultlineLineWidth',1.5);
			if plant == 'C',
				plot(ScopeEstimee.time, ScopeEstimee.signals(i).values,'b--'); grid on;
			else
				stairs(ScopeEstimee.time, ScopeEstimee.signals(i).values,'b--'); grid on;
			end
			xlabel(tscale,'FontName','Times New Roman','FontSize',14.0);
			title(['x' num2str(i) ' estim'],'FontName','Times New Roman','FontSize',14.0);
		end
	end
end
%
% Oscillogrammes de la (des) sortie(s) mesure(s)
%
if q == 1
	rep3 = input('Sortie y (O/N) ? [N] --> ','s');
else
	rep3 = input('Sorties y1 et y2 (O/N) ? [N] --> ','s');
end
if isempty(rep3)
	rep3 = 'N';
else
	rep3 = rep3(1);
end
if rep3 == 'O' || rep3 == 'o',
	if q >= 2
		rep3a = input('   courbes superposes (O/N) ? [N] --> ','s');
		if isempty(rep3a)
			rep3a = 'N';
		else
			rep3a = rep3a(1);
		end
	end
	figure; set(gcf,'defaultlineLineWidth',1.5);
	if plant == 'C',
		plot(ScopeMesure.time, ScopeMesure.signals(1).values,'r-'); grid on;
	else
		stairs(ScopeMesure.time, ScopeMesure.signals(1).values,'r-'); grid on;
	end
	if q == 1,
		xlabel(tscale,'FontName','Times New Roman','FontSize',14.0);
		title('Sortie y','FontName','Times New Roman','FontSize',14.0);
	else
		if rep3a == 'O' || rep3a == 'o',
			hold on;
			xlabel(tscale,'FontName','Times New Roman','FontSize',14.0);
			title('Sorties y1 et y2','FontName','Times New Roman','FontSize',14.0);
		else
			xlabel(tscale,'FontName','Times New Roman','FontSize',14.0);
			title('Sortie y1','FontName','Times New Roman','FontSize',14.0);
			figure; set(gcf,'defaultlineLineWidth',1.5);
			xlabel(tscale,'FontName','Times New Roman','FontSize',14.0); hold on;
			title('Sortie y2','FontName','Times New Roman','FontSize',14.0); hold on;
		end
		if plant == 'C',
			plot(ScopeMesure.time, ScopeMesure.signals(2).values,'b-'); grid on;
		else
			stairs(ScopeMesure.time, ScopeMesure.signals(2).values,'b-'); grid on;
		end
	end
end
%
% Oscillogrammes de la (des) grandeur(s) de commande
%
rep4 = input('Commandes ui (i=1,...,p) sur la mme courbe (O/N) ? [N] --> ','s');
if isempty(rep4)
	rep4 = 'N';
else
	rep4 = rep4(1);
end
if rep4 == 'O' || rep4 == 'o',
	figure; set(gcf,'defaultlineLineWidth',1.5);
	if plant == 'C',
		plot(ScopeCommande.time, ScopeCommande.signals.values(:,1),'r-'); hold on;
	else
		stairs(ScopeCommande.time, ScopeCommande.signals.values(:,1),'r-'); hold on;
	end
	if p >= 2,
		if plant == 'C',
			plot(ScopeCommande.time, ScopeCommande.signals.values(:,2),'b-'); hold on;
		else
			stairs(ScopeCommande.time, ScopeCommande.signals.values(:,2),'b-'); hold on;
		end
	end
	if p >= 3,
		if plant == 'C',
			plot(ScopeCommande.time, ScopeCommande.signals.values(:,3),'g-');
		else
			stairs(ScopeCommande.time, ScopeCommande.signals.values(:,3),'g-');
		end
	end;
	grid on;
	xlabel(tscale,'FontName','Times New Roman','FontSize',14.0);
	title('Rponse des commandes ui (i=1,...,p)','FontName','Times New Roman','FontSize',14.0);
end

Contact us