Interface

//******************************************************
// INTERFACE
//
// ainp(), aout()
//
// AUTHOR: G.Doeben-Henisch
// First: Dec-10, 2013
// Last: Dec-11, 2013
//
//****************************************
// IDEA
// 
// The function
//
// ainp: WORLD ---> SSTR
//
// maps for every participating system in POP the actual conditions from the WORLD
// into the structure SSTR of every system
//
// The function
//
// aout: SSTR ---> WORLD
//
// maps for every system in POP the actual SSTR values into the world input buffer WIB
//
//************************************************************


//****************************************
// ainp()
//
// The function
//
// ainp: WORLD ---> SSTR
//
// maps for every participating system in POP the actual conditions from the WORLD
// into the structure SSTR of every system
//
// This is the version for random systems
// It checks the field for new energy in POP
// and maps this value to SSTR

function [SSTR]=ainp(POP,SSTR)
  
  // Get size of POP
  [r,c]=size(POP)
  
  //Take values from POP to SSTR
  for i=1:r
     SSTR(i,2)=SSTR(i,2)+eval(POP(i,8))
     POP(i,8)='0'// Set value back to zero
  end
  
endfunction

//*************************************************
// aout()
//
// The function
//
// aout: SSTR ---> WORLD
//
// maps for every system in POP the actual SSTR values into the world input buffer WIB
//

function [WIB]=aout(POP,SSTR,WIB)
  
  // Get size of POP
  [r,c]=size(POP)
  
  //Take values from  SSTR to WIB
  for i=1:r
     WIB(i,2)=dec2bin(SSTR(i,4)), //copy movement
     WIB(i,3)=dec2bin(SSTR(i,5)) //copy non-movement
  end
  
endfunction



Gerd Doeben-Henisch 2014-01-14