function [err,errmsg] = OsiSetInputData(val,ConNo)
%
% OsiSetInputData.m		Set/Send input data to OLGA Server. 
%
% The calling syntax is:
%
%   err = OsiSetInputData(val,ConNo);
%
% Input:
%   VAL: input values.
%   ConNo: Connection Number (default: ConNo=1)
%
% 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
  if nargin==1
      ConNo==1;
  end
  if nargin >2 | nargin==0 
     errmsg = 'OsiSetInputData usage: [err, errmsg] = OsiSetInputData(vardesc,ConNo)';
     disp(errmsg);
     err = -1;
     return
  end
  ID=sprintf('Con%s',num2str(ConNo));
  antvar = sum(getfield(OsiIBODYsetInputVar,ID)); 
  if size(val,1) ~= antvar
     err = -1;
     errmsg = 'OsiSetInputData error: sizeof VAL does not agree with number of input variables';
     disp(errmsg); 
     return 
  end
  [err, msg, ibody, rbody, errmsg] = osmi(ConNo, 'OLGA_INP_DATA', [], val, []);




































































































































