% computes the steady state of dog.mod (growthless deterministic growth model). 
% stephane [DOT] adjemian [AT] ens [DOT] fr

function [ys,check] = dog_steadystate(ys,exe)
global M_

%% DO NOT CHANGE THIS PART.
%%
%% Here we load the values of the deep parameters in a loop.
%%
NumberOfParameters = M_.param_nbr;                            % Number of deep parameters.
for i = 1:NumberOfParameters                                  % Loop...
  paramname = deblank(M_.param_names(i,:));                   %    Get the name of parameter i. 
  eval([ paramname ' = M_.params(' int2str(i) ');']);         %    Get the value of parameter i.
end                                                           % End of the loop.  
check = 0;
%%
%% END OF THE FIRST MODEL INDEPENDENT BLOCK.


%% THIS BLOCK IS MODEL SPECIFIC.
%%
%% Here the user has to define the steady state.
%%

%parameters

c1shareocc = (c1shareoy-c1shareoyy)/c1sharecy; 

c1omegaoc = c1shareocc; %given by def_parm_assembled
c1omegacc = 1-c1omegaoc; 
c1omegamc = c1sharemccn; %given by def_parm_assembled
c1omegac = 1-c1omegamc; 
c1omegami = c1sharemii;
c1omegai  = 1-c1omegami;

%quantities
c1l = 100;
c1y = 1/(c1sharely/c1l); % given by def_parm_assembled
c1muz = 1.0026;
c1rpopd = 1;

c1yd = c1y;
c1i = c1shareiy*c1yd;
c1k = 1/(1-(1-c1delta)/c1muz)*c1shareiy*c1yd;
c1c = c1sharecy*c1yd;
c1cne = c1omegacc*c1c;
c1oc = c1omegaoc*c1c;
c1cd = c1omegac*c1cne;
c1mc = c1omegamc*c1cne;
c1id = c1omegai*c1i;
c1mi = c1omegami*c1i;
c1omegaoy = c1shareoyy;
c1omegavy = 1-c1omegaoy;
c1oy = c1omegaoy*c1yd;
c1v = c1omegavy*c1yd;
c1o = c1oc+c1oy;
c1m = c1mi+c1mc;
c1g = c1sharegy*c1yd;
c1x = c1sharexy*c1yd;

c1ow = c1shareowy*c1yd;
c1op = c1shareopow*c1ow;
c1os = 1/1*c1op; 
c1oi = c1shareoiow*c1ow;
c1rpwopd = c1pwoss;
c1gdp = 0.99*c1yd;

c1tbal = (c1x-c1m+c1rpwopd*(c1shareyoy*c1yd-c1ow))/c1yd;
c1gtbal = (c1x-c1m)/c1yd;

%prices
c1dpd = 0;
c1pitar = 0;
c1dw = 0;

c1lambdaq = (c1c-c1vkappa/c1muz*c1c)^(-1);

c1rk = 1.0026/c1beta-1+c1delta;
c1w = c1rk/((c1omegak*c1sharevy/c1shareky*c1muz)/(c1omegal*c1sharevy/c1sharely))^(c1rhov/(1+c1rhov));

c1rrs = 1/(c1beta/c1muz)-1;
c1rs = 1/(c1beta/c1muz)-1;
c1rpipd = 1;
c1rpcpd = 1;
c1rpnepd = 1;
c1rpmipd = 1;
c1rpmcpd = 1;
c1q = 1;
c1tauw = c1thetaw;
c1taup = c1thetap;
c1wdes = (1+c1tauw)/(1+c1thetaw)*c1w;
c1rmcpd = (1+c1taup)/(1+c1thetap);
c1chi0 = (c1wdes)*(c1lambdaq)/((1-(c1l))^(-c1chi));
c1rhoi = c1rhoc;

c1rer = 1;
c1b = 0;
c1phibparm = 0.0001;  

c1zc = 0;
c1zclag = 0;
c1zi = 0;
c1yo = 0;
c1lagyo = 0;
c1muoc = 0;
c1lagmuoc = 0;
c1muc = 0;
c1omegacm = 0;
c1lagomegacm = 0;
c1omegaim = c1omegacm;
c1thetapvar = 0;
c1thetawvar = 0;
//c1pitar = 0;
c1zw = 0;
c1z = c1zc + c1zw;
c1zwlag = c1zw;
c1muow = 0;
c1muowlag = c1muow;
c1muo = c1muoc + c1muow;
c1shockgy = 0;



//c1grmuoss = 1.0026;

c1grmuzss = 1.0026;
c1grmuzoss = 1;

c1welf = (log(c1c-c1vkappa/c1grmuzss*c1c)+ c1chi0/(1-c1chi)*(1-c1l)^(1-c1chi))/(1-c1beta);


%parameters
c2omegaoc = c2shareocc; %given by def_parm_assembled
c2omegacc = 1-c2omegaoc; 
c2omegamc = c2sharemccn; %given by def_parm_assembled
c2omegac = 1-c2omegamc; 
c2omegami = c2sharemii;
c2omegai  = 1-c2omegami;

%quantities
c2l = 120;
c2y = 1/(c2sharely); % given by def_parm_assembled
c2muz = 1.0026;
c2rpopd = 1;

c2yd = c2y;
c2i = c2shareiy*c2yd;
c2k = 1/(1-(1-c2delta)/c2muz)*c2shareiy*c2yd;
c2c = c2sharecy*c2yd;
c2cne = c2omegacc*c2c;
c2oc = c2omegaoc*c2c;
c2cd = c2omegac*c2cne;
c2mc = c2omegamc*c2cne;
c2id = c2omegai*c2i;
c2mi = c2omegami*c2i;
c2omegaoy = c2shareoyy;
c2omegavy = 1-c2omegaoy;
c2oy = c2omegaoy*c2yd;
c2v = c2omegavy*c2yd;
c2o = c2oc+c2oy;
c2m = c2mi+c2mc;
c2g = c2sharegy*c2yd;
c2x = c2sharexy*c2yd;

c2ow = c2shareowy*c2yd;
c2op = c2shareopow*c2ow;
c2os = 1/1*c2op; 
c2oi = c2shareoiow*c2ow;
c2rpwopd = c2pwoss;
c2gdp = 0.99*c2yd;

c2tbal = (c2x-c2m+c2rpwopd*(c2shareyoy*c2yd-c2ow))/c2yd;
c2gtbal = (c2x-c2m)/c2yd;

%prices
c2dpd = 0;
c2pitar = 0;
c2dw = 0;

c2lambdaq = (c2c-c2vkappa/c2muz*c2c)^(-1);

c2rk = 1.0026/c2beta-1+c2delta;
c2w = c2rk/((c2omegak*c2sharevy/c2shareky*c2muz)/(c2omegal*c2sharevy/c2sharely))^(c2rhov/(1+c2rhov));

c2rrs = 1/(c2beta/c2muz)-1;
c2rs = 1/(c2beta/c2muz)-1;
c2rpipd = 1;
c2rpcpd = 1;
c2rpnepd = 1;
c2rpmipd = 1;
c2rpmcpd = 1;
c2q = 1;
c2tauw = c2thetaw;
c2taup = c2thetap;
c2wdes = (1+c2tauw)/(1+c2thetaw)*c2w;
c2rmcpd = (1+c2taup)/(1+c2thetap);
c2chi0 = (c2w)*(c2lambdaq)/((1-(c2l))^(-c2chi));
c2rhoi = c2rhoc;

c2rer = 1;
c2b = 0;

c2zc = 0;
c2zclag = 0;
c2zi = 0;
c2yo = 
c2lagyo = 0;
c2muoc = 0;
c2lagmuoc = 0;
c2muc = 0;
c2omegacm = 0;
c2lagomegacm = 0;
c2omegaim = c2omegacm;
c2thetapvar = 0;
c2thetawvar = 0;
//c2pitar = 0;
c2zw = 0;
c2z = c2zc + c2zw;
c2zwlag = c2zw;
c2muow = 0;
c2muowlag = c2muow;
c2muo = c2muoc + c2muow;
c2shockgy = 0;

c1grmuoss = 1.0026 ;
c2muoss =  1.0026 ;
c2grmuzoss = 1;
c2grmuzss = 1;

c2pistar = c1pistar;

c2welf = (log(c2c-c2vkappa/c2grmuzss*c2c)+ c2chi0/(1-c2chi)*(1-c2l)^(1-c2chi))/(1-c2beta);

c1rkstar = c1muzss/c1beta - 1 + c1delta; 
c2rkstar = c2muzss/c2beta - 1 + c2delta; 
//c1shareoop =   0.999;  (c1beta*(1-c1alphaop)/c1alphaop/(c1muoss-c1beta*(1-c1deltao)))^(1-c1alphaop);
//c1shareoop = (c2beta*(1-c2alphaop)/c2alphaop/(c2muoss-c2beta*(1-c2deltao)))^(1-c2alphaop);
c1muoss = 1.0026;
c2muoss = 1.0026; 
//c2sharemcm = c2sharecnc*c2sharecy/(c2sharecnc*c2sharecy+c2shareiy);
c2muzoss = c2muzss/c2muoss;    
//c1sharecnc = 1-c2shareocc;
//c2sharemim = 1-c2sharemcm;
//c2ratiooyoc = c1ratiooyoc;
//c2shareowo  = 1/c2shareoop+(1-(1-c2deltao)/c2muoss)*c2muoss*(c2muoss*c2shareopos)^-c2alphaop;
c1less = 1/3; 
c2less = 1/3; 
//c2shareopos = (1-c2beta/c2muzss*c2muzoss*(1-c2deltao))/(c2beta*(1-c2alphaop)/c2alphaop);

%%kstar = ((1-alfa)^(1/PSI))*((1/betta+delta-1)/(alfa*A*effstar)-alfa)^(-1/PSI);
%%ystar =  A*effstar*( alfa*kstar^PSI + 1-alfa)^(1/PSI) ;
%%cstar = ystar-delta*kstar;
%%k = kstar;
%%c = cstar;
%%eff = effstar;
%%
%% END OF THE MODEL SPECIFIC BLOCK.


%% DO NOT CHANGE THIS PART.
%%
%% Here we define the steady state values of the endogenous variables of
%% the model.
%%
NumberOfEndogenousVariables = M_.endo_nbr;                    % Number of endogenous variables.
ys = zeros(NumberOfEndogenousVariables,1);                    % Initialization of ys (steady state).
for i = 1:NumberOfEndogenousVariables                         % Loop...
  varname = deblank(M_.endo_names(i,:));                      %    Get the name of endogenous variable i.                     
  eval(['ys(' int2str(i) ') = ' varname ';']);                %    Get the steady state value of this variable.
end                                                           % End of the loop.
%%
%% END OF THE SECOND MODEL INDEPENDENT BLOCK.