make_abg.m 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. function abg = make_abg(system)
  2. global mtt_environment
  3. start_time = mttGetTime ;
  4. input = [] ;
  5. abg = [] ;
  6. switch class(system)
  7. case 'char',
  8. input = 'spec' ;
  9. case 'struct',
  10. if isfield(system,'representation')
  11. input = system.representation ;
  12. end
  13. end
  14. if strcmp(input,'spec')
  15. mttWriteNewLine ;
  16. mttNotify('Making "abg" representation') ;
  17. mttWriteNewLine ;
  18. if isempty(mtt_environment)
  19. mttNotify('...WARNING: No "env" definition => all domain references will be ignored') ;
  20. mttWriteNewLine ;
  21. mttNotify(' => paths will not be recognised') ;
  22. mttWriteNewLine ;
  23. end
  24. abg = mttCreateAcausalBondgraph(system) ;
  25. input = 'abg' ;
  26. end
  27. mttAssert(strcmp(input,'abg'),'Input representation not recognised') ;
  28. if isempty(abg)
  29. mttWriteNewLine ;
  30. mttNotify('Copying "abg" representation') ;
  31. mttWriteNewLine ;
  32. mttNotify('...INFO: Input already defined as a "abg": copying to Output') ;
  33. mttWriteNewLine ;
  34. mttWriteNewLine ;
  35. abg = system ;
  36. end
  37. elapsed_time = mttElapseTime(start_time) ;
  38. cpu_utilisation = round(100*elapsed_time.cpu/elapsed_time.clock) ;
  39. mttWriteNewLine ;
  40. mttNotify(['Completed in ',num2str(elapsed_time.clock),' seconds']) ;
  41. mttNotify([' (',num2str(cpu_utilisation),'%% cpu)']) ;
  42. mttWriteNewLine ;
  43. mttWriteNewLine ;