function [c ceq]=Petlyuk_nonlcon(x) 
global dyndata coldata
load Nominal_final1.mat
dyndata.temp_nom = temp_nom;
%Non linear equality and inequality constraints for optimization
%indmat_Yes_S1
%load Hel_halfdegree
%load csel_halfdegree
  %load Hel3
%  load csel3
   %load H1ns
  %load Csns
  load Hel
  load csel
U=zeros(11,1);
U(1:11)=x(226:236);                           %inputs 
s=x(1:225);                                   %states
%Tboil=coldata.Tboil;
     
    % xp1 =  s(II1);
     %xp2 =  s(II2);
     %xp3 =  s(II3);
     %xp4 =  s(II4);
     %xp5 =  s(II5);
     %xp6 =  s(II6);
     %xp1=[xp1 1-sum(xp1,2)]; 
   %  xp2=[xp2 1-sum(xp2,2)];
   %  xp3=[xp3 1-sum(xp3,2)];
     %xp4=[xp4 1-sum(xp4,2)];
     %xp5=[xp5 1-sum(xp5,2)];
    % xp6=[xp6 1-sum(xp6,2)];
     %xp=[xp1;xp2;xp3;xp4;xp5;xp6];
     %Temp=xp*Tboil';
[xprime Temp] = (Petlyuk_NLmodel([],s,U));
%ceq=xprime;                    % when no SOC

% ceq for 1st best temperature set using maximum minimum singular value
%ceq=[ xprime;Temp(10)-dyndata.temp_nom(10);Temp(38)-dyndata.temp_nom(38);Temp(60)-dyndata.temp_nom(60)]; 
% ceq for 2nd best temperature set using maximum minimum singular value
%ceq=[ xprime;Temp(9)-dyndata.temp_nom(9);Temp(38)-dyndata.temp_nom(38);Temp(60)-dyndata.temp_nom(60)];  
% ceq for 3rd best temperature set using maximum minimum singular value
%ceq=[ xprime;Temp(11)-dyndata.temp_nom(11);Temp(38)-dyndata.temp_nom(38);Temp(60)-dyndata.temp_nom(60)];  
%ceq for 4th best temperature set using maximum  minimum singular value
%ceq=[ xprime;Temp(10)-dyndata.temp_nom(10);Temp(38)-dyndata.temp_nom(38);Temp(63)-dyndata.temp_nom(63)];  
%ceq for 5th best temperature set using maximum  minimum singular value
%ceq=[ xprime;Temp(8)-dyndata.temp_nom(8);Temp(38)-dyndata.temp_nom(38);Temp(60)-dyndata.temp_nom(60)];  
%ceq for 6th best temperature set using maximum  minimum singular value
%ceq=[ xprime;Temp(9)-dyndata.temp_nom(9);Temp(38)-dyndata.temp_nom(38);Temp(63)-dyndata.temp_nom(63)];  
%ceq for 7th best temperature set using maximum  minimum singular value
%ceq=[ xprime;Temp(7)-dyndata.temp_nom(7);Temp(38)-dyndata.temp_nom(38);Temp(60)-dyndata.temp_nom(60)];  
%ceq for 8th best temperature set using maximum  minimum singular value
%ceq=[ xprime;Temp(10)-dyndata.temp_nom(10);Temp(38)-dyndata.temp_nom(38);Temp(59)-dyndata.temp_nom(59)];  
% ceq for 20th best temperature set using maximum MSV
%ceq=[ xprime;Temp(11)-dyndata.temp_nom(11);Temp(38)-dyndata.temp_nom(38);Temp(64)-dyndata.temp_nom(64)];  
% based on branch and bound method by Cao, the 1st set of three best
% temperatures based on bidirectional algorithm.
%ceq=[ xprime;Temp(43)-dyndata.temp_nom(43);Temp(60)-dyndata.temp_nom(60);Temp(64)-dyndata.temp_nom(64)];  
%ceq=[xprime;(Hel3*[Temp(10,1);Temp(38,1);Temp(60,1)])-csel3];
% Null space method
%ceq=[xprime;(H1ns*Temp-Csns)];
%Exact local method
ceq=[xprime;(Hel*Temp-csel)];
c = [];                                       %non linear inequality constraints
%Exact local method, add combination of measurement as constant in the
%equality constraint
