Posted By

bfrank on 04/09/11


Tagged

1010


Versions (?)

simCaller


 / Published in: MatLab
 

  1. % 10.10 Project
  2. % Spring 2011
  3. % Jackie Simpson and Ben Frank
  4.  
  5. %==========================================================================
  6. % Program flow has been decided-the user wants to simulate the process ||
  7. %==========================================================================
  8. %::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9. % A small function necessary as an event handler for button pushes ::
  10. %::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11. function simCaller(hObject,eventdata)
  12. %this function is called in the event that the "simulate" button is pushed.
  13. %when it is called, it takes the values from the text fields and passes
  14. %them to the Simulator.
  15. global ReactorHeater ReactionHeatingPeriod AmountSolvent_S2 field1 field2 field3
  16. ReactorHeater = str2double(get(field1,'String'));
  17. % if isnan(ReactorHeater)
  18. % errordlg('You must enter a valid numeric value.','Bad Input','modal')
  19. % uicontrol(hObject)
  20. % return
  21. % end
  22.  
  23.  
  24. ReactionHeatingPeriod = str2double(get(field2,'String'));
  25.  
  26. % if isnan(ReactionHeatingPeriod)
  27. % errordlg('You must enter a valid numeric value.','Bad Input','modal')
  28. % uicontrol(hObject)
  29. % return
  30. % end
  31.  
  32. AmountSolvent_S2 = str2double(get(field3,'String'));
  33. % if isnan(AmountSolvent_S2)
  34. % errordlg('You must enter a valid numeric value.','Bad Input','modal')
  35. % uicontrol(hObject)
  36. % return
  37. % end
  38. X(1) = ReactorHeater;
  39. X(2) = ReactionHeatingPeriod;
  40. X(3) = AmountSolvent_S2;
  41.  
  42. %::::::::::::::::::::::::::::::::::::::::::::::::::
  43. % Step 2(A) - Simulate the entire process ::
  44. %::::::::::::::::::::::::::::::::::::::::::::::::::------------------------
  45. Simulator(X); % carries out simulation of process
  46. %
  47. %F = Overall_Process_Economic_Objective(X); % computes economics associated
  48. %with process
  49. %
  50. Results_Displayer;
  51. end

Report this snippet  

You need to login to post a comment.