function [err,errmsg] = OsiSetInputVar(vardesc, sizes,ConNo)
%
% OsiSetInputVar.m	   Advertise input variables (prepare OLGA Server to receive input).
%
% The calling syntax is:
%
%   err = OsiSetInputVar(vardesc,sizes,ConNo);
%
% Input:
%   VARDESC: String identifying the variables to be reported from olga.
%   SIZES:   An array containing the size (#elements) for each variables. 
%
% Copyright (c) 1998 by ABB Corporate Research.
% All Rights Reserved.
%
% $Revision: 1.0, 8/10-1998 by Kjetil Havre$
% $Revision: 1.1, 20/7-2005 by Espen Storkaas, ABB-EOP, included user-defined connection number$ 

  global OsiIBODYsetInputVar % Store number of elements in the inputs
                             % so that tests can be made later. 
  if nargin==2
      ConNo=1;
  end
  if nargin > 3 | nargin==0 
     errmsg = 'OsiSetInputVar usage: [err, errmsg] = OsiSetInputVar(vardesc, sizes)';
     disp(errmsg);
     err = -1;
     return
  end

  %OsiIBODYsetInputVar = [];
  [err, msg, ibody, rbody, errmsg] = osmi(ConNo, 'OLGA_INP_NAMES', [], [], vardesc);
  if err == 0 
     [err, msg, ibody, rbody, errmsg] = osmi(ConNo, 'OLGA_INP_SIZES', sizes, [], []); 
  end 
  if err == 0
      ID=sprintf('Con%s',num2str(ConNo));
      OsiIBODYsetInputVar=setfield(OsiIBODYsetInputVar,ID,sizes);
  end



































































































































