
function [ys,params,check]=closed_economy_steadystate(ys,exo,M_,options_)

% read out parameters to access them with their name
NumberOfParameters = M_.param_nbr;
for ii = 1:NumberOfParameters
  paramname = M_.param_names{ii};
  eval([ paramname ' = M_.params(' int2str(ii) ');']);
end
% initialize indicator
check = 0;



ASS = 1;
KSS = (0.1203)^(1/(calpha-1));
YSS = (KSS)^(calpha);
GSS=cg_bar*YSS; 
ISS =cdelta_0*KSS;
IhatSS = ISS; 
CSS= YSS-ISS -GSS;
LSS = 1;
R_sup_DSS =  1/cbeta;
R_sup_BSS = R_sup_DSS +0.0025; 
R_sup_FSS = R_sup_DSS +0.0075;
Q_sub_BSS = 1/(R_sup_BSS - ckappa);
QSS = 1/(R_sup_FSS - ckappa);
R_sup_RESS =  R_sup_DSS;
R_sup_TRSS = R_sup_DSS;
f_sub_CBSS = 0;
b_sub_CBSS = (0.06*4*YSS)/Q_sub_BSS;
reSS = QSS*f_sub_CBSS+ Q_sub_BSS*b_sub_CBSS;
T_sub_CBSS = (1+ckappa*QSS)*f_sub_CBSS + (1+ckappa*Q_sub_BSS)*b_sub_CBSS-R_sup_RESS*reSS ;
TSS = GSS +cb_bar_G - T_sub_CBSS - Q_sub_BSS*cb_bar_G*(1-ckappa);
Y_sub_MSS =YSS;
bSS = cb_bar_G - b_sub_CBSS;
phiSS = 4;
lambdaSS = (phiSS*(R_sup_FSS-R_sup_DSS))/(R_sup_DSS);
thetaSS = (cbeta*(1-csigma)*(R_sup_FSS - R_sup_DSS))/((lambdaSS/(1+lambdaSS))-cbeta*csigma*phiSS*(R_sup_FSS - R_sup_DSS));
p_sub_MSS = (cepsilon_p - 1)/cepsilon_p;
wSS = (1-calpha)*p_sub_MSS*KSS^calpha;
w_starSS = wSS ;
mrsSS = (w_starSS)/((cepsilon_w/(cepsilon_w - 1)));
uSS =1;
f_sub_1SS = (1/(1 - cphi_w*cbeta))*(mrsSS*(wSS)^cepsilon_w);
f_sub_2SS = (1/(1 - cphi_w*cbeta))*((wSS)^cepsilon_w);
p_starSS = (cepsilon_p/(cepsilon_p - 1))*p_sub_MSS;
p_sup_KSS = 1;
x_sub_1SS = (1/(1-cphi_p*cbeta))*p_sub_MSS*YSS;
x_sub_2SS = (1/(1-cphi_p*cbeta))*YSS;
LambdaSS = cbeta;
PiSS = 1;
f_sub_MSS = (cpsi*p_sup_KSS*IhatSS)/(QSS*(1-ckappa));
fSS =f_sub_MSS;
nSS = (QSS*fSS + cDelta*Q_sub_BSS*bSS)/phiSS;
OmegaSS = 1-csigma + csigma*thetaSS*phiSS;
muSS = (1-cbeta*cb)/(CSS*(1-cb));
upsilon_sup_PSS =1;
upsilon_sup_WSS = (w_starSS/wSS)^(-cepsilon_w);
L_sub_DSS =LSS/ upsilon_sup_WSS;
omegaSS = 0;
dSS = QSS*fSS + Q_sub_BSS*bSS+reSS - nSS;
M_sub_2SS = LambdaSS/(QSS*(1-ckappa*LambdaSS));
M_sub_1SS = cpsi*(M_sub_2SS - 1)+1;
varsigmaSS = 0;


%% end own model equations

params=NaN(NumberOfParameters,1);
for iter = 1:length(M_.params) %update parameters set in the file
  eval([ 'params(' num2str(iter) ') = ' M_.param_names{iter} ';' ])
end

NumberOfEndogenousVariables = M_.orig_endo_nbr; %auxiliary variables are set automatically
for ii = 1:NumberOfEndogenousVariables
  varname = M_.endo_names{ii};
  eval(['ys(' int2str(ii) ') = ' varname ';']);
end
