Main.java 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package holon_control_unit_evaluation;
  2. import java.io.File;
  3. import java.io.FileNotFoundException;
  4. import java.io.IOException;
  5. import java.io.PrintStream;
  6. import javax.swing.UIManager;
  7. import javax.swing.UnsupportedLookAndFeelException;
  8. import org.apache.commons.compress.archivers.ArchiveException;
  9. import ui.controller.Control;
  10. import ui.model.Model;
  11. import ui.view.GUI;
  12. import ui.view.IndexTranslator;
  13. public class Main {
  14. public static void main(String[] args) throws FileNotFoundException {
  15. if (!System.getProperty("os.name").startsWith("Linux")) {
  16. try {
  17. UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  18. } catch(ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
  19. e.printStackTrace();
  20. }
  21. }
  22. // Model model = new Model();
  23. // Control control = new Control(model);
  24. // GUI view = new GUI(control);
  25. // IndexTranslator.model = model;
  26. // view.getFrmCyberPhysical().setVisible(true);
  27. String fileName = "C:\\Users\\Jonas\\Dropbox\\Mein PC (DESKTOP-L7IQHES)\\Documents\\Uni\\TUD\\Bachelorarbeit\\bachelor-evaluation\\Eval\\inputs\\scenario03-50h_"+System.currentTimeMillis();
  28. String path = "C:\\Users\\Jonas\\Dropbox\\Mein PC (DESKTOP-L7IQHES)\\Documents\\Uni\\TUD\\Bachelorarbeit\\HOLEG\\exampleNetworks\\MyExamples\\scenario03-50h.holon";
  29. PrintStream systemOut = System.out;
  30. Model model = new Model();
  31. Control control = new Control(model);
  32. GUI view = new GUI(control);
  33. IndexTranslator.model = model;
  34. view.getFrmCyberPhysical().setVisible(true);
  35. File outputFile = new File(fileName+".txt");
  36. PrintStream printStream = new PrintStream(outputFile);
  37. System.setOut(printStream);
  38. for(int i=0; i<50; i++) {
  39. try {
  40. control.loadFile(path);
  41. } catch (IOException | ArchiveException e) {
  42. // TODO Auto-generated catch block
  43. e.printStackTrace();
  44. return;
  45. }
  46. for(int j=0; j<100; j++) {
  47. control.getSimManager().calculateStateForTimeStep(j, true);
  48. }
  49. }
  50. printStream.close();
  51. System.setOut(systemOut);
  52. }
  53. }