function [ys,params,check] = G_1110_steadystate(ys,exo,M_,options_)
% Inputs: 
%   - ys        [vector] vector of initial values for the steady state of the endogenous variables
%   - exo       [vector] vector of values for the exogenous variables
%   - M_        [structure] Dynare model structure
%   - options   [structure] Dynare options structure
%
% Output: 
%   - ys        [vector] vector of steady state values for the the endogenous variables
%   - params    [vector] vector of parameter values
%   - check     [scalar] 0 if steady state computation worked and to
%                        1 of not (allows to impose restrictions on parameters)

NumberOfParameters = M_.param_nbr;
for ii = 1:NumberOfParameters
  paramname = deblank(M_.param_names{ii,:});
  eval([ paramname ' = M_.params(' int2str(ii) ');']);
end
% initialize indicator
check = 0;

%% Enter model equations here
%%epsilontheta theta om c cr cw l lw lr lambda a hr hw y ii w R k Z
options=optimset(); % set options for numerical solver


%% solve (48) to (52) for psi, chi, C, L numerically
if matlab_ver_less_than('9.1')
    options=optimset('TolFun',1e-10,'TolX',1e-10);
else
    options=optimoptions(@fsolve, 'MaxFunctionEvaluations', 100000000, 'MaxIterations', 100000000);
end
[outvalue,fval,exitflag]=fsolve(@(par_var)solve_calibration(par_var,gammaa,xii,omegaa,rhoo,alphaa,nuu,deltaa,betaa,nn,xx,Gamm),[0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.5],options);

if exitflag <1
    %indicate the SS computation was not sucessful; this would also be detected by Dynare
    %setting the indicator here shows how to use this functionality to
    %filter out parameter draws
    check=1; %set failure indicator
    return; %return without updating steady states
end

Z=outvalue(1);
R=outvalue(2);
epsilontheta=outvalue(3);
theta=outvalue(4);
om=outvalue(5);
c=outvalue(6);
cr=outvalue(7);
cw=outvalue(8);
l=outvalue(9);
lw=outvalue(10);
lr=outvalue(11);
lambda=outvalue(12);
a=outvalue(13);
hr=outvalue(14);
hw=outvalue(15);
y=outvalue(16);
ii=outvalue(17);
w=outvalue(18);
k=outvalue(19);


%% end own model equations

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

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


