% Intialisation

% Rs      = 0.087;            %Rotor resistance
% Rr      = 0.228;            %Stator resistance
% Lls     = 0.8e-3;           %Stator leakage inducatnce
% Llr     = 0.8e-3;           %Rotor leakage inductance
% Lm      = 34.7e-3;          %Magnetizing Inductance

% Rr      =0.39;             %Rotor resistance
% Rs      =0.19;             %Stator resistance
% Lls     =0.21e-3;          %Stator inducatnce
% Llr     =0.6e-3;           %Rotor inductance
% Lm      =4e-3;             %Magnetizing Inductance
% p       =4;                %Number of poles
% J       =0.0226;           %Moment of inertia

Rr      =2.133;             %Rotor resistance
Rs      =2.283;             %Stator resistance
Ls     =0.2311;          %Stator inducatnce
Lr     =0.2311;           %Rotor inductance
Lm      =0.22;             %Magnetizing Inductance
p       =2;                %Number of poles
J       =0.005;           %Moment of inertia

% Ls      = Lls+Lm;
% Lr      = Llr+Lm;
we      = 2*pi*50;          %Base frequency
%w = we;
%P       = 4;
%p = 4;%Number of poles
%J       = 1.662;            %Moment of inertia
Vi      = 230*sqrt(2);
Ts = 100e-6;

sLs = Ls-(Lm^2/Lr);

B = [Ts/sLs  0;
    0       Ts/sLs;
    0       0;
    0       0;
    0       0;
    0       0];

H = [1 0 0 0 0 0;
     0 1 0 0 0 0];

P = diag([1 1 1 1 1 1], 0);
P = P*10e-3;
Q = diag([10e-9 10e-9 10e-9 10e-9 10e-6 10e-6], 0);
R = diag([10e-6 10e-6], 0);

% Rr=.39;			%rotor resistance
% Rs=.19;			%stator resistance
% Ls=.21e-3;		%stator inductance
% Lr=.6e-3;		%rotor inductance
% Lm=4e-3;		%magnetizing inductance
% we=2*pi*50;     %base frequency
% P=4;			%number of poles
% J=0.0226;		%moment of inertia
% Vi=230*sqrt(2);
