
% octave -q 

clear;                  % All user-defined variables (local and global) are cleared from the symbol table.
clf;                    % Clear the current figure window.

vhe_model='calc01';     % Tsim input data model to be used in this wear prediction loop

iloop=  0;              % Start wheel profile #
nloop=  3;              % End wheel profile #



%
%   Plot wheel profiles on wheelset 111 & 122
%   -----------------------------------------
  figure(1)
  printf("\n");
  printf("Wheel profiles on wheelset 111 & 122:\n");
  title ("Wheel profiles on wheelset 111 & 122")
  hold on
  for iprof= iloop:nloop
   ident= sprintf('%s_%3.3d', vhe_model, iprof);
   outer_wheel_prof= sprintf('outer_wheel_%s', ident);
   string= ['[outer_wheel_prof_X, outer_wheel_prof_Y]= read_2col_file ("kpf/w_prof/',outer_wheel_prof,'.wheel");'];   % Read the initial profiles
   try
       eval(string)
   catch
       error("Exit status from command %s\n       not equal zero\n%s\n", string, lasterr ());
   end

   ident_underscoore= ident(1:1);
   for i= 2:length(ident)
    if (ident(i:i)=='_')    ident_underscoore= [ ident_underscoore, '\', ident(i:i) ];
    else                    ident_underscoore= [ ident_underscoore, ident(i:i) ];
    endif
   endfor
   plot(outer_wheel_prof_X, outer_wheel_prof_Y, [';' ident_underscoore ';'])
  endfor
  hold off
  axis([ -27 -7   -.7 .3 ])
  grid
  printf("Press Return to continue:\n");
pause
close

%
%   Plot wheel profiles on wheelset 121 & 112
%   -----------------------------------------
  figure(2)
  printf("\n");
  printf("Wheel profiles on wheelset 121 & 112:\n");
  title ("Wheel profiles on wheelset 121 & 112")
  hold on
  for iprof= iloop:nloop
   ident= sprintf('%s_%3.3d', vhe_model, iprof);
   inner_wheel_prof= sprintf('inner_wheel_%s', ident);
   string= ['[inner_wheel_prof_X, inner_wheel_prof_Y]= read_2col_file ("kpf/w_prof/',inner_wheel_prof,'.wheel");'];
   try
       eval(string)
   catch
       error("Exit status from command %s\n       not equal zero\n%s\n", string, lasterr ());
   end

   ident_underscoore= ident(1:1);
   for i= 2:length(ident)
    if (ident(i:i)=='_')    ident_underscoore= [ ident_underscoore, '\', ident(i:i) ];
    else                    ident_underscoore= [ ident_underscoore, ident(i:i) ];
    endif
   endfor
   plot(inner_wheel_prof_X, inner_wheel_prof_Y, [';' ident_underscoore ';'])
  endfor
  hold off
  axis([ -25 -10  -.5 .5 ])
  axis([ -27 -7   -.7 .3 ])
  grid
  printf("Press Return to continue:\n");
pause
close
