/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package mxgstest; import mxgstest.chapters.*; import mxgstest.egse.Basic; import mxgsegse.MXGSEGSE; import mxgstest.egse.Power; import java.util.Enumeration; //import javax.comm.CommPortIdentifier; import gnu.io.*; import java.io.OutputStream; import java.io.InputStream; import java.io.PrintWriter; /** * * @author stet */ public class MxgsTest { static Enumeration portList; static CommPortIdentifier portId; static String messageString = "255"; static byte[] ff = new byte[] {(byte)0xFF}; static SerialPort serialPort; static OutputStream outputStream; static InputStream inputStream; public static PrintWriter logfile; /** * @param args the command line arguments * @throws java.lang.Throwable */ public static void main(String[] args) throws Throwable { // TODO code application logic here Output output = new Output(); output.printTestStart(System.getenv("TEST"),""); Basic basic = new Basic(); Power power = new Power(); MXGSEGSE egse = basic.loadEGSE(); /* logfile = new PrintWriter(new BufferedWriter(new FileWriter(Output.home+"/Desktop/testoutput/"+Output.outname+"/"+Output.outname+".log"))); logfile.println("year day sec dpuI psuI DHPU1 DHPU2 DHPU3 DHPU4 DHPU5"); logfile.flush(); egse.tcp.addHandler(new myLogger(egse, logfile), EventHandlerInterface.Preference.EARLY); */ Chapter5 chapter5 = new Chapter5(egse, output); Chapter6 chapter6 = new Chapter6(egse, output); Chapter8 chapter8 = new Chapter8(egse, output); egse.dhpu.setAutomaticTcLength(false); try { chapter5.run(); } catch(MxgsTestException e) { System.out.println("\nTest Failed\n"); power.powerOffDPU(egse); power.powerOffPSU(egse); System.exit(0); } try { chapter6.run(); } catch(MxgsTestException e) { System.out.println("\nTest Failed\n"); power.powerOffDPU(egse); power.powerOffPSU(egse); System.exit(0); } try { chapter8.run(); } catch(MxgsTestException e) { System.out.println("\nTest Failed\n"); System.exit(0); } output.printTestEnd(); power.powerOffDPU(egse); Thread.sleep(1000); System.exit(0); } /* static class myLogger implements EventHandlerInterface { MXGSEGSE egse; Basic basic = new Basic(); Power power = new Power(); public static PrintWriter logfile0; public myLogger(MXGSEGSE egse, PrintWriter logfile0) throws Throwable { this.egse = egse; // this.logfile0 = logfile0; logfile0.println("hej"); logfile0.flush(); System.out.println("log0: "+logfile0.toString()); } @Override public void callback(Event event) throws Exception { try { System.out.println("hej"); System.out.println("log: "+logfile.toString()); int[] DHPU = null; double[] dhpuT = null; // DHPU=basic.readDHPU(); for (int i=0;i<5;i++) { DHPU[i]=1600+160*i; dhpuT[i]=-40+7.87*DHPU[i]; } double dpuI=egse.powerSupply.dpu.getCurrent(); double psuI=egse.powerSupply.psu.getCurrent(); long[] myTime=basic.time(); long year=myTime[0]; long day=myTime[1]%86400; long sec=myTime[1]-day*86400; // logfile0.println(String.format("%4d %3d %5d %5.2f %5.2f %6.2f %6.2f %6.2f %6.2f %6.2f", // year,day,sec,dpuI,psuI,dhpuT[0],dhpuT[1],dhpuT[2],dhpuT[3],dhpuT[4])); logfile.println("hej"); logfile.flush(); Output.testout.println("hej"); Output.testout.flush(); basic.dontThrowAnything(); } catch(MxgsTestException e) { throw e; } catch (Throwable ex) { Logger.getLogger(MxgsTest.class.getName()).log(Level.SEVERE, null, ex); } } } */ /* static class myLogger0 implements EventHandlerInterface { MXGSEGSE egse; Basic basic = new Basic(); Power power = new Power(); PrintWriter logfile0; public myLogger0(MXGSEGSE egse) throws Throwable { this.egse = egse; logfile.println("hej"); } @Override public void callback(Event event) throws Exception { try { System.out.println("hej"); int[] DHPU = null; double[] dhpuT = null; // DHPU=basic.readDHPU(); for (int i=0;i<5;i++) { DHPU[i]=1600+160*i; dhpuT[i]=-40+7.87*DHPU[i]; } double dpuI=egse.powerSupply.dpu.getCurrent(); double psuI=egse.powerSupply.psu.getCurrent(); long[] myTime=basic.time(); long year=myTime[0]; long day=myTime[1]%86400; long sec=myTime[1]-day*86400; // logfile0.println(String.format("%4d %3d %5d %5.2f %5.2f %6.2f %6.2f %6.2f %6.2f %6.2f", // year,day,sec,dpuI,psuI,dhpuT[0],dhpuT[1],dhpuT[2],dhpuT[3],dhpuT[4])); logfile.println("hej"); logfile.flush(); basic.dontThrowAnything(); } catch(MxgsTestException e) { throw e; } catch (Throwable ex) { Logger.getLogger(MxgsTest.class.getName()).log(Level.SEVERE, null, ex); } } } */ }