/* * 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.mxgs; import asim.envsim.dhpu.Tm; import asim.envsim.dhpu.tmutils.ParameterValueEvent; import asim.envsim.dhpu.tmutils.ParameterValueFilter; import java.io.BufferedWriter; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.Writer; import java.util.Date; import java.util.logging.Logger; import mxgs.science.data.*; import mxgsegse.MXGSEGSE; import mxgstest.MxgsTestException; import mxgstest.egse.Basic; import mxgstest.Output; /** * * @author stet */ public class Hk { Basic bas = new Basic(); Output output = new Output(); static final String ANSI_RESET = "\u001B[0m"; static final String ANSI_BLACK = "\u001B[30m"; static final String ANSI_RED = "\u001B[31m"; static final String ANSI_GREEN = "\u001B[32m"; static final String ANSI_YELLOW = "\u001B[33m"; static final String ANSI_BLUE = "\u001B[34m"; static final String ANSI_PURPLE = "\u001B[35m"; static final String ANSI_CYAN = "\u001B[36m"; static final String ANSI_WHITE = "\u001B[37m"; static String stepResult; static String stepComment; static boolean stepErr; /** * Verify Monitored Housekeeping is received. * * @param egse * @param wait maximum wait time * @throws Throwable * @author stet */ public void verifyMonHKReceiving(MXGSEGSE egse, double wait) throws Throwable { egse.dhpu.getMonitoredHkTm().clear(); while((egse.dhpu.getMonitoredHkTm().size() < 1) && (wait > 0)) { Thread.sleep(100); wait = wait - 0.1; } if(wait <= 0){ stepErr=false; stepResult="Failed"; stepComment="No Monitored HK Received"; System.out.println(ANSI_RED+"No response received from verifyMonHKReceiving (Timeout)."+ANSI_RESET); } if (egse.dhpu.getMonitoredHkTm().size() <= 0) { stepErr=false; stepResult="Failed"; stepComment="No Monitored HK Received"; System.out.println(ANSI_RED+"No Monitored Housekeeping Received."+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" Receiving Monitored HK: "+ANSI_GREEN+"OK"+ANSI_RESET); } output.printStepOut("Receiving", stepResult, stepComment, stepErr); } /** * Discards 3 housekeeping packets to ensure that the Errors and Warnings 4224 packet is discarded. * @param egse * @param wait * @throws Throwable */ public void protocolResync(MXGSEGSE egse, double wait) throws Throwable { egse.dhpu.getMonitoredHkTm().clear(); while((egse.dhpu.getMonitoredHkTm().size() < 3) && (wait > 0)) { Thread.sleep(100); wait = wait - 0.1; } if(wait <= 0){ output.printStepOut("protocolResync", "Failed", "No response received from protocolResync (Timeout)", false); throw new MxgsTestException("No response received from protocolResync (Timeout)."); } if (egse.dhpu.getMonitoredHkTm().size() <= 0) { output.printStepOut("protocolResync", "Failed", "No Monitored Housekeeping Recieved", false); throw new MxgsTestException("No Monitored Housekeeping Recieved."); } } /* not used /** * Verify Alive counter is incrementing. * @param egse * @param wait maximum wait time * @throws Throwable * @author stet / public void verifyAliveCounter(MXGSEGSE egse, double wait) throws Throwable { //Clear HK list and verify that there is no data in the list egse.dhpu.getMonitoredHkTm().clear(); while((egse.dhpu.getMonitoredHkTm().size() < 3) && (wait > 0)) { Thread.sleep(100); wait = wait - 0.1; } if(wait <= 0){ throw new MxgsTestException("No response received (Timeout)."); } //Verify that alive counter increases with 1 int ac1 = Integer.valueOf(egse.packetTool.getTmParameter(egse.dhpu.getMonitoredHkTm().removeFirst(), "Packet Data.Alive Counter")); int ac2 = Integer.valueOf(egse.packetTool.getTmParameter(egse.dhpu.getMonitoredHkTm().removeFirst(), "Packet Data.Alive Counter")); int ac3 = Integer.valueOf(egse.packetTool.getTmParameter(egse.dhpu.getMonitoredHkTm().removeFirst(), "Packet Data.Alive Counter")); if(ac3-ac2 != 1){ throw new MxgsTestException("Alive counter is not incrementing correctly."); } if(ac2-ac1 != 1){ throw new MxgsTestException("Alive counter is not incrementing correctly."); } } */ /* Not used /** * Verify Housekeeping Parameters. * @param egse * @param wait maximum wait time * @param expSwMode expected SW Mode * @param expSwSubMode expected SW Submode * @param expBootStatus expected Boot Status * @throws Throwable * @author stet / public void verifyMonHKParameters(MXGSEGSE egse, double wait, int expSwMode, int expSwSubMode, int expBootStatus) throws Throwable { egse.dhpu.getMonitoredHkTm().clear(); while((egse.dhpu.getMonitoredHkTm().size() < 1) && (wait > 0)) { Thread.sleep(100); wait = wait - 0.1; } if(wait <= 0){ throw new MxgsTestException("No response received from verifyMonHKParameters (Timeout)."); } if (egse.dhpu.getMonitoredHkTm().size() <= 0) { throw new MxgsTestException("No Monitored Housekeeping Received."); } Tm tm = egse.dhpu.getMonitoredHkTm().removeLast(); // Verify Parameters int source = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Private Header.Routing Information.Source")); if(source != 128){ throw new MxgsTestException("Routing Information Source Incorrect."); } int destination = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Private Header.Routing Information.Destination")); if(destination != 146){ throw new MxgsTestException("Routing Information Destination Incorrect."); } int length = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Length")); if(length != 77){ throw new MxgsTestException("Packet Length Incorrect."); } int bootStatus = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Boot Status")); if(bootStatus != expBootStatus){ throw new MxgsTestException("Boot Status Incorrect."); } int tmtype = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Private Header.Packet Identification.TM Type")); if(tmtype != 17){ throw new MxgsTestException("TM Type Incorrect."); } int swMode = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.SW Mode")); if(swMode != expSwMode){ throw new MxgsTestException("SW Mode Incorrect. expected: " + expSwMode + " recevied: " + swMode); } byte swSubMode = Byte.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.SW Submode")); if(swSubMode != expSwSubMode){ throw new MxgsTestException("SW Submode Incorrect. expected: " + expSwSubMode + " received: " + swSubMode); } int errorsAndWarnings = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Errors and Warnings")); if(errorsAndWarnings != 0){ throw new MxgsTestException("Errors and Warnings Incorrect. Value is: "+errorsAndWarnings); } } */ public void verifyValue(int getValue, String itemName, int expectedValue, int offset) throws Throwable { if(offset>0) { if(getValue < (expectedValue-offset)){ stepErr=false; stepResult="Failed"; stepComment="Too low"; System.out.println(" HK parameter "+ itemName +" too low." +ANSI_RED+" Accepted Min: "+String.valueOf(expectedValue-offset)+". Received: "+String.valueOf(getValue)+ANSI_RESET); } else if(getValue > (expectedValue+offset)){ stepErr=false; stepResult="Failed"; stepComment="Too high"; System.out.println(" HK parameter "+ itemName +" too high."+ANSI_RED+" Accepted Max: "+String.valueOf(expectedValue+offset)+". Received: "+String.valueOf(getValue)+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" HK parameter "+ itemName + " within bounds. Low - Received - High: "+ANSI_GREEN+String.format("%4d - %4d - %4d",(expectedValue-offset),getValue,(expectedValue+offset))+ANSI_RESET); } output.printStepOut(itemName,expectedValue-offset,expectedValue,expectedValue+offset,getValue,stepResult,stepComment,stepErr); } else if(offset==0) { if(expectedValue!=getValue) { stepErr=false; stepResult="Failed"; stepComment=""; System.out.println(" HK parameter "+ itemName +" not correct. "+ANSI_RED+"Expected: "+expectedValue+". Received: "+getValue+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" HK parameter "+ itemName +" correct: "+ANSI_GREEN+getValue+ANSI_RESET); } output.printStepOut(itemName,expectedValue,getValue,stepResult,stepComment,stepErr); } else if(offset==-1) { if(getValue > expectedValue){ stepErr=false; stepResult="Failed"; stepComment="Too high"; System.out.println(" HK parameter "+ itemName +" too high." +ANSI_RED+" Accepted Max: "+expectedValue+". Received: "+getValue+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" HK parameter "+ itemName + " within bounds. Received - High: "+ANSI_GREEN+String.format("%4d - %4d",getValue,expectedValue)+ANSI_RESET); } output.printStepOut(itemName, "", "", String.valueOf(expectedValue), String.valueOf(getValue), stepResult, stepComment, stepErr); } else if(offset==-2) { if(getValue < expectedValue){ stepErr=false; stepResult="Failed"; stepComment="Too low"; System.out.println(" HK parameter "+ itemName +" too low." +ANSI_RED+" Accepted Min: "+expectedValue+". Received: "+getValue+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" HK parameter "+ itemName + " within bounds. Low - Received: "+ANSI_GREEN+String.format("%4d - %4d",expectedValue,getValue)+ANSI_RESET); } output.printStepOut(itemName, String.valueOf(expectedValue), "", "", String.valueOf(getValue), stepResult, stepComment, stepErr); } else if(offset==-99) { stepErr=true; stepResult="OK"; stepComment="As run"; System.out.println(itemName + ": "+ANSI_GREEN+String.format("%4d",getValue)+ANSI_RESET); output.printStepOut(itemName, String.valueOf(getValue), stepResult, stepComment, stepErr); } } /** * Verify Monitored Housekeeping Parameters array. * @param egse * @param wait maximum wait time * @param params HK parameter names and values * @param nofTMs needed number of TMs to receive * @throws Throwable * @author frec */ public void verifyMonHKarr(MXGSEGSE egse, double wait, String[][] params, int nofTMs) throws Throwable { egse.dhpu.getMonitoredHkTm().clear(); while((egse.dhpu.getMonitoredHkTm().size() < nofTMs) && (wait > 0)) { Thread.sleep(100); wait = wait - 0.1; } if(wait <= 0){ output.printStepOut("Monitored HK", "Failed", "No response received", false); throw new MxgsTestException("No response received from verifyMonHKarr (Timeout)."); } egse.dhpu.getMonitoredHkTm().removeFirst(); for(int i=0; i< params.length; i++) { if(params[i][0].equals("Alive Counter")) { int ac1 = Integer.valueOf(egse.packetTool.getTmParameter(egse.dhpu.getMonitoredHkTm().removeFirst(), "Packet Data.Alive Counter")); int ac2 = Integer.valueOf(egse.packetTool.getTmParameter(egse.dhpu.getMonitoredHkTm().removeFirst(), "Packet Data.Alive Counter")); int ac3 = Integer.valueOf(egse.packetTool.getTmParameter(egse.dhpu.getMonitoredHkTm().getFirst(), "Packet Data.Alive Counter")); if(ac3-ac2 != 1){ stepErr=false; stepResult="Failed"; stepComment="ac2="+ac2+" ac3="+ac3; System.out.println(" Alive counter is not incrementing correctly. "+ANSI_RED+stepComment+ANSI_RESET); } else if(ac2-ac1 != 1){ stepErr=false; stepResult="Failed"; stepComment="ac1="+ac1+" ac2="+ac2; System.out.println(" Alive counter is not incrementing correctly. "+ANSI_RED+stepComment+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" Alive Counter is incrementing correctly: "+ANSI_GREEN+"OK"+ANSI_RESET); } output.printStepOut("Alive Counter incrementing", stepResult, stepComment, stepErr); } else if(params[i][0].equals("UTC")) { int sec1 = Integer.valueOf(egse.packetTool.getTmParameter(egse.dhpu.getMonitoredHkTm().removeFirst(), "Packet Data.Time.Seconds")); int sec2 = Integer.valueOf(egse.packetTool.getTmParameter(egse.dhpu.getMonitoredHkTm().removeFirst(), "Packet Data.Time.Seconds")); int sec3 = Integer.valueOf(egse.packetTool.getTmParameter(egse.dhpu.getMonitoredHkTm().getFirst(), "Packet Data.Time.Seconds")); if(sec3-sec2 != 1){ stepErr=false; stepResult="Failed"; stepComment="sec2="+sec2+" sec3="+sec3; System.out.println(" Second field is not incrementing correctly in verifyMonHKarr. "+ANSI_RED+stepComment+ANSI_RESET); } else if(sec2-sec1 != 1){ stepErr=false; stepResult="Failed"; stepComment="sec1="+sec1+" sec2="+sec2; System.out.println(" Second field is not incrementing correctly in verifyMonHKarr. "+ANSI_RED+stepComment+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" UTC Second is incrementing correctly: "+ANSI_GREEN+"OK"+ANSI_RESET); } output.printStepOut("UTC second incrementing", stepResult, stepComment, stepErr); } else { int offset=Integer.valueOf(params[i][2]); if(offset>0) { long expectedValue=Long.valueOf(params[i][1]); int getValue = Integer.valueOf(egse.packetTool.getTmParameter(egse.dhpu.getMonitoredHkTm().getFirst(), "Packet Data."+params[i][0])); if(getValue < (expectedValue-offset)){ stepErr=false; stepResult="Failed"; stepComment="Too low"; System.out.println(" HK parameter "+ params[i][0] +" too low." +ANSI_RED+" Accepted Min: "+String.valueOf(expectedValue-offset)+". Received: "+String.valueOf(getValue)+ANSI_RESET); } else if(getValue > (expectedValue+offset)){ stepErr=false; stepResult="Failed"; stepComment="Too high"; System.out.println(" HK parameter "+ params[i][0] +" too high."+ANSI_RED+" Accepted Max: "+String.valueOf(expectedValue+offset)+". Received: "+String.valueOf(getValue)+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] + " within bounds. Low - Received - High: "+ANSI_GREEN+String.format("%4d - %4d - %4d",(expectedValue-offset),getValue,(expectedValue+offset))+ANSI_RESET); } output.printStepOut(params[i][0], expectedValue-offset, expectedValue, expectedValue+offset, Long.valueOf(getValue), stepResult, stepComment, stepErr); } else { String getValueStr=egse.packetTool.getTmParameter(egse.dhpu.getMonitoredHkTm().getFirst(), "Packet Data."+params[i][0]); if(!params[i][1].equals(getValueStr)) { stepErr=false; stepResult="Failed"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] +" not correct. "+ANSI_RED+"Expected: "+params[i][1]+". Received: "+getValueStr+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] +" correct. "+ANSI_GREEN+params[i][1]+ANSI_RESET); } output.printStepOut(params[i][0], params[i][1], getValueStr, stepResult, stepComment, stepErr); } } } } /** * Verify Full Monitored Housekeeping Parameters array. * @param egse * @param wait maximum wait time * @param params HK parameter names and values * @param nofTMs needed number of TMs to receive * @throws Throwable * @author frec */ public void verifyFullMonHKarr(MXGSEGSE egse, double wait, String[][] params, int nofTMs) throws Throwable { egse.dhpu.getMonitoredHkTm().clear(); while((egse.dhpu.getMonitoredHkTm().size() < nofTMs) && (wait > 0)) { Thread.sleep(100); wait = wait - 0.1; } Tm tm = egse.dhpu.getMonitoredHkTm().getLast(); long mytime[]=bas.time(); if(wait <= 0){ output.printStepOut("Monitored HK", "Failed", "No response received", false); throw new MxgsTestException("No response received from verifyMonHKarr (Timeout)."); } egse.dhpu.getMonitoredHkTm().removeFirst(); String getValueStr; long expectedValue; int getValue; for(int i=0; i< params.length; i++) { if(params[i][0].equals("Packet Data.Alive Counter")) { int ac1 = Integer.valueOf(egse.packetTool.getTmParameter(egse.dhpu.getMonitoredHkTm().removeFirst(), "Packet Data.Alive Counter")); int ac2 = Integer.valueOf(egse.packetTool.getTmParameter(egse.dhpu.getMonitoredHkTm().removeFirst(), "Packet Data.Alive Counter")); int ac3 = Integer.valueOf(egse.packetTool.getTmParameter(egse.dhpu.getMonitoredHkTm().getFirst(), "Packet Data.Alive Counter")); if(ac3-ac2 != 1){ stepErr=false; stepResult="Failed"; stepComment="ac2="+ac2+" ac3="+ac3; System.out.println(" Alive counter is not incrementing correctly. "+ANSI_RED+stepComment+ANSI_RESET); } else if(ac2-ac1 != 1){ stepErr=false; stepResult="Failed"; stepComment="ac1="+ac1+" ac2="+ac2; System.out.println(" Alive counter is not incrementing correctly. "+ANSI_RED+stepComment+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" Alive Counter is incrementing correctly: "+ANSI_GREEN+"OK"+ANSI_RESET); } output.printStepOut("Alive Counter incrementing", stepResult, stepComment, stepErr); } else if(params[i][0].equals("Packet Data.UTC")) { int sec1 = Integer.valueOf(egse.packetTool.getTmParameter(egse.dhpu.getMonitoredHkTm().removeFirst(), "Packet Data.Time.Seconds")); int sec2 = Integer.valueOf(egse.packetTool.getTmParameter(egse.dhpu.getMonitoredHkTm().removeFirst(), "Packet Data.Time.Seconds")); int sec3 = Integer.valueOf(egse.packetTool.getTmParameter(egse.dhpu.getMonitoredHkTm().getFirst(), "Packet Data.Time.Seconds")); if(sec3-sec2 != 1){ stepErr=false; stepResult="Failed"; stepComment="sec2="+sec2+" sec3="+sec3; System.out.println(" Second field is not incrementing correctly in verifyMonHKarr. "+ANSI_RED+stepComment+ANSI_RESET); } else if(sec2-sec1 != 1){ stepErr=false; stepResult="Failed"; stepComment="sec1="+sec1+" sec2="+sec2; System.out.println(" Second field is not incrementing correctly in verifyMonHKarr. "+ANSI_RED+stepComment+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" UTC Second is incrementing correctly: "+ANSI_GREEN+"OK"+ANSI_RESET); } output.printStepOut("UTC second incrementing", stepResult, stepComment, stepErr); long year = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Time.Year")); long ms = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Time.Milliseconds")); long sec = Long.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Time.Seconds")); if (year != mytime[0]-Basic.year_start) { stepErr=false; stepResult="Failed"; stepComment=""; System.out.println(" UTC Time.Year not correct. "+ANSI_RED+"Expected: "+mytime[0]+" Received:"+year+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; } output.printStepOut("Time.Year", mytime[0], year, stepResult, stepComment, stepErr); if(Math.abs(sec-mytime[1]+Basic.sec_start)>1){ stepErr=false; stepResult="failed"; stepComment=""; System.out.println(" UTC Time.Seconds not correct. "+ANSI_RED+"Expected: "+mytime[1]+" Received:"+sec+ANSI_RESET); } else { stepErr=true; stepResult="OK"; if(sec!=mytime[1]) { stepComment="1 sec diff. accepted"; } else { stepComment=""; } System.out.println(" UTC Time correct: "+ANSI_GREEN+year+" "+sec+ANSI_YELLOW+" (milliseconds not verified)"+ANSI_RESET); } output.printStepOut("Time.Seconds", mytime[1], sec, stepResult, stepComment, stepErr); output.printStepOut("Time.Milliseconds", mytime[2], ms, "", "Not verified", true); } else { int offset=Integer.valueOf(params[i][2]); if(offset>0) { expectedValue=Long.valueOf(params[i][1]); getValue = Integer.valueOf(egse.packetTool.getTmParameter(egse.dhpu.getMonitoredHkTm().getFirst(), params[i][0])); if(getValue < (expectedValue-offset)){ stepErr=false; stepResult="Failed"; stepComment="Too low"; System.out.println(" HK parameter "+ params[i][0] +" too low." +ANSI_RED+" Accepted Min: "+String.valueOf(expectedValue-offset)+". Received: "+String.valueOf(getValue)+ANSI_RESET); } else if(getValue > (expectedValue+offset)){ stepErr=false; stepResult="Failed"; stepComment="Too high"; System.out.println(" HK parameter "+ params[i][0] +" too high."+ANSI_RED+" Accepted Max: "+String.valueOf(expectedValue+offset)+". Received: "+String.valueOf(getValue)+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] + " within bounds. Low - Received - High: "+ANSI_GREEN+String.format("%4d - %4d - %4d",(expectedValue-offset),getValue,(expectedValue+offset))+ANSI_RESET); } output.printStepOut(params[i][0], expectedValue-offset, expectedValue, expectedValue+offset, Long.valueOf(getValue), stepResult, stepComment, stepErr); } else if(offset==0) { getValueStr=egse.packetTool.getTmParameter(egse.dhpu.getMonitoredHkTm().getFirst(), params[i][0]); if(!params[i][1].equals(getValueStr)) { stepErr=false; stepResult="Failed"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] +" not correct. "+ANSI_RED+"Expected: "+params[i][1]+". Received: "+getValueStr+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] +" correct. "+ANSI_GREEN+params[i][1]+ANSI_RESET); } output.printStepOut(params[i][0], params[i][1], getValueStr, stepResult, stepComment, stepErr); } else if(offset==-1) { expectedValue=Long.valueOf(params[i][1]); getValue = Integer.valueOf(egse.packetTool.getTmParameter(egse.dhpu.getMonitoredHkTm().getFirst(), params[i][0])); if(getValue > expectedValue){ stepErr=false; stepResult="Failed"; stepComment="Too high"; System.out.println(" HK parameter "+ params[i][0] +" too high." +ANSI_RED+" Accepted Max: "+String.valueOf(expectedValue)+". Received: "+String.valueOf(getValue)+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] + " within bounds. Received - High: "+ANSI_GREEN+String.format("%4d - %4d",getValue,expectedValue)+ANSI_RESET); } output.printStepOut(params[i][0], "", "", String.valueOf(expectedValue), String.valueOf(getValue), stepResult, stepComment, stepErr); } else if(offset==-99) { expectedValue=Long.valueOf(params[i][1]); getValue = Integer.valueOf(egse.packetTool.getTmParameter(egse.dhpu.getMonitoredHkTm().getFirst(), params[i][0])); stepErr=true; stepResult="OK"; stepComment="As run"; System.out.println(" HK parameter "+ params[i][0] + ": "+ANSI_GREEN+String.format("%4d",getValue)+ANSI_RESET); output.printStepOut(params[i][0], String.valueOf(getValue), stepResult, stepComment, stepErr); } } } } /** * Verify Housekeeping Parameters array. * @param egse * @param wait maximum wait time * @param tmType * @param generationPeriod * @param params HK parameter names and values * @param nofTMs needed number of TMs to receive * @throws Throwable * @author frec */ public void verifyHKarr(MXGSEGSE egse, double wait, int tmType, int generationPeriod, String[][] params, int nofTMs) throws Throwable { long expectedValue, offset, getValue; int i; String getValueStr; ParameterValueEvent hkEvent = new ParameterValueEvent(egse.dhpu.getNonscienceTm(), egse.packetTool, "Private Header.Packet Identification.TM Type", String.valueOf(tmType), Logger.global); ParameterValueFilter hkTm = new ParameterValueFilter(hkEvent, Logger.global); hkTm.clear(); while((hkTm.size() < nofTMs) && (wait > 0)) { Thread.sleep(100); wait = wait - 0.1; } if(wait <= 0){ output.printStepOut("HK ID="+tmType, "Failed", "No response received", false); throw new MxgsTestException("No response received from verifyHKParameter (Timeout)."); } for(i=0; i< params.length; i++) { System.out.println(params[i][0]); if(params[i][0].equals("TCP Count")) { int tcp1 = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.removeFirst(), "Packet Data.Acquisition Start Time.TCP Count")); int tcp2 = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.removeFirst(), "Packet Data.Acquisition Start Time.TCP Count")); int tcp3 = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getFirst(), "Packet Data.Acquisition Start Time.TCP Count")); if(tcp3-tcp2 != generationPeriod){ stepErr=false; stepResult="Failed"; stepComment="tcp2="+tcp2+" tcp3="+tcp3; System.out.println(" TCP field is not incrementing correctly in verifyHKarr: "+ANSI_RED+stepComment+ANSI_RESET); } else if(tcp2-tcp1 != generationPeriod){ stepErr=false; stepResult="Failed"; stepComment="tcp1="+tcp1+" tcp2="+tcp2; System.out.println(" TCP field is not incrementing correctly in verifyHKarr: "+ANSI_RED+stepComment+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" TCP field is incrementing correctly:"+ANSI_GREEN+" OK"+ANSI_RESET); } output.printStepOut("Acquisition Start Time.TCP Count incrementing", stepResult, stepComment, stepErr); } else if(params[i][0].equals("UTC")) { int sec1 = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.removeFirst(), "Packet Data.Time.Seconds")); int sec2 = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.removeFirst(), "Packet Data.Time.Seconds")); int sec3 = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getFirst(), "Packet Data.Time.Seconds")); if(sec3-sec2 != generationPeriod){ stepErr=false; stepResult="Failed"; stepComment="sec2="+sec2+" sec3="+sec3; System.out.println("Second field is not incrementing correctly in verifyHKarr: "+ANSI_RED+sec2+" "+sec3+ANSI_RESET); } else if(sec2-sec1 != generationPeriod){ stepErr=false; stepResult="Failed"; stepComment="sec1="+sec1+" sec2="+sec2; System.out.println("Second field is not incrementing correctly in verifyHKarr: "+ANSI_RED+sec1+" "+sec2+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" UTC Second is incrementing correctly:"+ANSI_GREEN+" OK"+ANSI_RESET); } output.printStepOut("UTC second incrementing", stepResult, stepComment, stepErr); } /* else if(params[i][0].equals("Boot Status")) { int BootStatus=0; System.out.println(egse.packetTool.getTmParameter(hkTm.getFirst(), "Packet Data.Boot Status")); for(int j=0;j<8;j++) { if(egse.packetTool.getTmParameter(hkTm.getFirst(), "Packet Data.Boot Status."+String.valueOf(j)).equals("true")) { BootStatus+=Math.pow(2,(7-j)); } } expectedValue=Integer.valueOf(params[i][1]); if(BootStatus!=expectedValue) { stepErr=false; stepResult="Failed"; stepComment=""; System.out.println(" HK Boot Status not correct. Expected: "+ANSI_RED+expectedValue+" Received: "+BootStatus+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" Boot Status correct: "+ANSI_GREEN+BootStatus+ANSI_RESET); } output.printStepOut(params[i][0], expectedValue, BootStatus, stepResult, stepComment, stepErr); }*/ else { offset=Integer.valueOf(params[i][2]); if(offset>0) { expectedValue=Integer.valueOf(params[i][1]); getValue = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getFirst(), "Packet Data."+params[i][0])); if(getValue < (expectedValue-offset)){ stepErr=false; stepResult="Failed"; stepComment="Too low"; System.out.println(" HK parameter "+ params[i][0] +" too low." +ANSI_RED+" Accepted Min: "+String.valueOf(expectedValue-offset)+". Received: "+String.valueOf(getValue)+ANSI_RESET); } else if(getValue > (expectedValue+offset)){ stepErr=false; stepResult="Failed"; stepComment="Too high"; System.out.println(" HK parameter "+ params[i][0] +" too high."+ANSI_RED+" Accepted Max: "+String.valueOf(expectedValue+offset)+". Received: "+String.valueOf(getValue)+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] + " within bounds. Low - Received - High: "+ANSI_GREEN+String.format("%4d - %4d - %4d",(expectedValue-offset),getValue,(expectedValue+offset))+ANSI_RESET); } output.printStepOut(params[i][0],expectedValue-offset,expectedValue,expectedValue+offset,getValue,stepResult,stepComment,stepErr); } else if(offset==0) { getValueStr=egse.packetTool.getTmParameter(hkTm.getFirst(), "Packet Data."+params[i][0]); if(!params[i][1].equals(getValueStr)) { stepErr=false; stepResult="Failed"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] +" not correct. "+ANSI_RED+"Expected: "+params[i][1]+". Received: "+getValueStr+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] +" correct: "+ANSI_GREEN+params[i][1]+ANSI_RESET); } output.printStepOut(params[i][0],params[i][1],getValueStr,stepResult,stepComment,stepErr); } else if(offset==-1) { expectedValue=Integer.valueOf(params[i][1]); getValue = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getFirst(), "Packet Data."+params[i][0])); if(getValue > expectedValue){ stepErr=false; stepResult="Failed"; stepComment="Too high"; System.out.println(" HK parameter "+ params[i][0] +" too high." +ANSI_RED+" Accepted Max: "+String.valueOf(expectedValue)+". Received: "+String.valueOf(getValue)+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] + " within bounds. Received - High: "+ANSI_GREEN+String.format("%4d - %4d",getValue,expectedValue)+ANSI_RESET); } output.printStepOut(params[i][0], "", "", String.valueOf(expectedValue), String.valueOf(getValue), stepResult, stepComment, stepErr); } else if(offset==-99) { expectedValue=Integer.valueOf(params[i][1]); getValue = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getFirst(), "Packet Data."+params[i][0])); stepErr=true; stepResult="OK"; stepComment="As run"; System.out.println(" HK parameter "+ params[i][0] + ": "+ANSI_GREEN+String.format("%4d",getValue)+ANSI_RESET); output.printStepOut(params[i][0], String.valueOf(getValue), stepResult, stepComment, stepErr); } } } } /** * Verify TM array. * @param egse * @param tm * @param params HK parameter names and values * @throws Throwable * @author frec */ public void verifyTMarr(MXGSEGSE egse, Tm tm, String[][] params) throws Throwable { long expectedValue, offset, getValue; int i; String getValueStr; for(i=0; i< params.length; i++) { if(params[i][0].equals("Enabled Housekeeping")) { getValue=0; for(int j=0;j<16;j++) { if(egse.packetTool.getTmParameter(tm, "Packet Data."+params[i][0]+"."+String.valueOf(j)).equals("true")) { getValue+=Math.pow(2,(15-j)); } } expectedValue=Integer.valueOf(params[i][1]); if(getValue!=expectedValue) { stepErr=false; stepResult="Failed"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] +" not correct. "+ANSI_RED+"Expected: "+expectedValue+". Received: "+getValue+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] +" correct. "+ANSI_GREEN+getValue+ANSI_RESET); } output.printStepOut(params[i][0], expectedValue, getValue, stepResult, stepComment, stepErr); } else if(params[i][0].equals("Enabled Events")) { long getValue1=0; long getValue2=0; for(int j=0;j<32;j++) { if(egse.packetTool.getTmParameter(tm, "Packet Data."+params[i][0]+"."+String.valueOf(j)).equals("true")) { getValue1+=Math.pow((long)2,(31-j)); } if(egse.packetTool.getTmParameter(tm, "Packet Data."+params[i][0]+"."+String.valueOf(j+32)).equals("true")) { getValue2+=Math.pow((long)2,(31-j)); } } long expectedValue1=Long.valueOf(params[i][1]); long expectedValue2=Long.valueOf(params[i][2]); String expectedValueStr=Long.toHexString(expectedValue1)+Long.toHexString(expectedValue2); getValueStr=Long.toHexString(getValue1)+Long.toHexString(getValue2); if(!expectedValueStr.equals(getValueStr)) { stepErr=false; stepResult="Failed"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] +" not correct. "+ANSI_RED+"Expected: "+expectedValueStr+". Received: "+getValueStr+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] +" correct. "+ANSI_GREEN+getValueStr+ANSI_RESET); } output.printStepOut(params[i][0], expectedValueStr, getValueStr, stepResult, stepComment, stepErr); } else { offset=Integer.valueOf(params[i][2]); if(offset>0) { expectedValue=Integer.valueOf(params[i][1]); getValue = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data."+params[i][0])); if(getValue < (expectedValue-offset)){ stepErr=false; stepResult="Failed"; stepComment="Too low"; System.out.println(" HK parameter "+ params[i][0] +" too low." +ANSI_RED+" Accepted Min: "+String.valueOf(expectedValue-offset)+". Received: "+String.valueOf(getValue)+ANSI_RESET); } else if(getValue > (expectedValue+offset)){ stepErr=false; stepResult="Failed"; stepComment="Too high"; System.out.println(" HK parameter "+ params[i][0] +" too high."+ANSI_RED+" Accepted Max: "+String.valueOf(expectedValue+offset)+". Received: "+String.valueOf(getValue)+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] + " within bounds. Low - Received - High: "+ANSI_GREEN+String.format("%4d - %4d - %4d",(expectedValue-offset),getValue,(expectedValue+offset))+ANSI_RESET); } output.printStepOut(params[i][0],expectedValue-offset,expectedValue,expectedValue+offset,getValue,stepResult,stepComment,stepErr); } else if(offset==0) { getValueStr=egse.packetTool.getTmParameter(tm, "Packet Data."+params[i][0]); if(!params[i][1].equals(getValueStr)) { stepErr=false; stepResult="Failed"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] +" not correct. "+ANSI_RED+"Expected: "+params[i][1]+". Received: "+getValueStr+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] +" correct: "+ANSI_GREEN+params[i][1]+ANSI_RESET); } output.printStepOut(params[i][0],params[i][1],getValueStr,stepResult,stepComment,stepErr); } else if(offset==-1) { expectedValue=Integer.valueOf(params[i][1]); getValue = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data."+params[i][0])); if(getValue > expectedValue){ stepErr=false; stepResult="Failed"; stepComment="Too high"; System.out.println(" HK parameter "+ params[i][0] +" too high." +ANSI_RED+" Accepted Max: "+String.valueOf(expectedValue)+". Received: "+String.valueOf(getValue)+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] + " within bounds. Received - High: "+ANSI_GREEN+String.format("%4d - %4d",getValue,expectedValue)+ANSI_RESET); } output.printStepOut(params[i][0], "", "", String.valueOf(expectedValue), String.valueOf(getValue), stepResult, stepComment, stepErr); } else if(offset==-99) { expectedValue=Integer.valueOf(params[i][1]); getValueStr = egse.packetTool.getTmParameter(tm, "Packet Data."+params[i][0]); stepErr=true; stepResult="OK"; stepComment="As run"; System.out.println(" HK parameter "+ params[i][0] + ": "+ANSI_GREEN+getValueStr+ANSI_RESET); output.printStepOut(params[i][0], getValueStr, stepResult, stepComment, stepErr); } } } } /** * Verify Housekeeping Parameters array. * @param egse * @param wait maximum wait time * @param tmType * @param generationPeriod * @param params HK parameter names and values * @param nofTMs needed number of TMs to receive * @throws Throwable * @author frec */ public void verifyFullHKarr(MXGSEGSE egse, double wait, int tmType, int generationPeriod, String[][] params, int nofTMs) throws Throwable { int offset, i; long getValue, expectedValue; String getValueStr; ParameterValueEvent hkEvent = new ParameterValueEvent(egse.dhpu.getNonscienceTm(), egse.packetTool, "Private Header.Packet Identification.TM Type", String.valueOf(tmType), Logger.global); ParameterValueFilter hkTm = new ParameterValueFilter(hkEvent, Logger.global); hkTm.clear(); while((hkTm.size() < nofTMs) && (wait > 0)) { Thread.sleep(1); wait = wait - 0.001; } Tm tm = hkTm.getLast(); // System.out.println(tm.hex()); long mytime[]=bas.time(); long tcp = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Acquisition Start Time.TCP Count")); long tcp0=0; if(tmType==32) tcp0= Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.TCP Count")); long tcpExpected=mytime[1]-Basic.tcp_start; if(wait <= 0){ output.printStepOut("HK ID="+tmType, "Failed", "No response received", false); throw new MxgsTestException("No response received from verifyFullHKParameter (Timeout)."); } for(i=0; i< params.length; i++) { if(params[i][0].equals("Packet Data.Acquisition Start Time")) { int tcp1 = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.removeFirst(), "Packet Data.Acquisition Start Time.TCP Count")); int tcp2 = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.removeFirst(), "Packet Data.Acquisition Start Time.TCP Count")); int tcp3 = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getFirst(), "Packet Data.Acquisition Start Time.TCP Count")); if(tcp3-tcp2 != generationPeriod){ stepErr=false; stepResult="Failed"; stepComment="tcp2="+tcp2+" tcp3="+tcp3; System.out.println(" TCP field is not incrementing correctly in verifyHKarr: "+ANSI_RED+stepComment+ANSI_RESET); } else if(tcp2-tcp1 != generationPeriod){ stepErr=false; stepResult="Failed"; stepComment="tcp1="+tcp1+" tcp2="+tcp2; System.out.println(" TCP field is not incrementing correctly in verifyHKarr: "+ANSI_RED+stepComment+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" TCP field is incrementing correctly:"+ANSI_GREEN+" OK"+ANSI_RESET); } output.printStepOut("Acquisition Start Time.TCP Count incrementing", stepResult, stepComment, stepErr); if(Math.abs(tcp-tcpExpected)>1) { stepErr=false; stepResult="Failed"; stepComment=""; System.out.println(" Packet Data.Acquisition Start Time.TCP Count not correct: "+ANSI_RED+"Expected: "+tcpExpected+" Received: "+tcp+ANSI_RESET); } else { stepErr=true; stepResult="OK"; if(tcp!=tcpExpected) { stepComment="1 TCP diff. accepted"; } else { stepComment=""; } System.out.println(" Packet Data.Acquisition Start Time.TCP Count correct: "+ANSI_GREEN+tcp+ANSI_RESET); } output.printStepOut("Acquisition Start Time.TCP Count", tcpExpected, tcp, stepResult, stepComment, stepErr); String currentValue=egse.packetTool.getTmParameter(tm, "Packet Data.Acquisition Start Time.Current Value"); output.printStepOut("Acquisition Start Time.Current Value", "", currentValue, "","verification not implemented", true); System.out.println(" Packet Data.Acquisition Start Time.Current Value: "+ANSI_YELLOW+" received "+currentValue+ANSI_RESET); } else if(params[i][0].equals("Packet Data.TCP Count")) { int tcp1 = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.removeFirst(), "Packet Data.TCP Count")); int tcp2 = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.removeFirst(), "Packet Data.TCP Count")); int tcp3 = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getFirst(), "Packet Data.TCP Count")); if(tcp3-tcp2 != generationPeriod){ stepErr=false; stepResult="Failed"; stepComment="tcp2="+tcp2+" tcp3="+tcp3; System.out.println(" Packet Data.TCP Count is not incrementing correctly in verifyFullHKarr: "+ANSI_RED+stepComment+ANSI_RESET); } else if(tcp2-tcp1 != generationPeriod){ stepErr=false; stepResult="Failed"; stepComment="tcp1="+tcp1+" tcp2="+tcp2; System.out.println(" Packet Data.TCP Count is not incrementing correctly in verifyHKarr: "+ANSI_RED+stepComment+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" Packet Data.TCP Count is incrementing correctly:"+ANSI_GREEN+" OK"+ANSI_RESET); } output.printStepOut("TCP Count incrementing", stepResult, stepComment, stepErr); if(Math.abs(tcp0-tcpExpected)>1) { stepErr=false; stepResult="Failed"; stepComment=""; System.out.println(" Packet Data.TCP Count not correct: "+ANSI_RED+"Expected: "+tcpExpected+" Received: "+tcp0+ANSI_RESET); } else { stepErr=true; stepResult="OK"; if(tcp0!=tcpExpected) { stepComment="1 TCP diff. accepted"; } else { stepComment=""; } System.out.println(" Packet Data.TCP Count correct: "+ANSI_GREEN+tcp+ANSI_RESET); } output.printStepOut("TCP Count", tcpExpected, tcp0, stepResult, stepComment, stepErr); } else if(params[i][0].equals("Packet Data.UTC")) { int sec1 = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.removeFirst(), "Packet Data.Time.Seconds")); int sec2 = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.removeFirst(), "Packet Data.Time.Seconds")); int sec3 = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getFirst(), "Packet Data.Time.Seconds")); if(sec3-sec2 != generationPeriod){ stepErr=false; stepResult="Failed"; stepComment="sec2="+sec2+" sec3="+sec3; System.out.println(" Second field is not incrementing correctly in verifyMonHKarr. "+ANSI_RED+stepComment+ANSI_RESET); } else if(sec2-sec1 != generationPeriod){ stepErr=false; stepResult="Failed"; stepComment="sec1="+sec1+" sec2="+sec2; System.out.println(" Second field is not incrementing correctly in verifyMonHKarr. "+ANSI_RED+stepComment+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" UTC Second is incrementing correctly: "+ANSI_GREEN+"OK"+ANSI_RESET); } output.printStepOut("UTC second incrementing", stepResult, stepComment, stepErr); long year = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Time.Year")); long ms = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Time.Milliseconds")); long sec = Long.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Time.Seconds")); if (year != mytime[0]-Basic.year_start) { stepErr=false; stepResult="Failed"; stepComment=""; System.out.println(" UTC Time.Year not correct. "+ANSI_RED+"Expected: "+mytime[0]+" Received:"+year+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; } output.printStepOut("Time.Year", mytime[0], year, stepResult, stepComment, stepErr); if(Math.abs(sec-mytime[1]+Basic.sec_start)>1){ stepErr=false; stepResult="failed"; stepComment=""; System.out.println(" UTC Time.Seconds not correct. "+ANSI_RED+"Expected: "+mytime[1]+" Received:"+sec+ANSI_RESET); } else { stepErr=true; stepResult="OK"; if(sec!=mytime[1]) { stepComment="1 sec diff. accepted"; } else { stepComment=""; } System.out.println(" UTC Time correct: "+ANSI_GREEN+year+" "+sec+ANSI_YELLOW+" (milliseconds not verified)"+ANSI_RESET); } output.printStepOut("Time.Seconds", mytime[1], sec, stepResult, stepComment, stepErr); output.printStepOut("Time.Milliseconds", mytime[2], ms, "", "Not verified", true); } else if(params[i][0].equals("Packet Data.DAUs Low Voltage On") | params[i][0].equals("Packet Data.DAUs High Voltage On")) { getValue=0; for(int j=0;j<8;j++) { if(egse.packetTool.getTmParameter(hkTm.getFirst(), params[i][0]+"."+String.valueOf(j)).equals("true")) { getValue+=Math.pow(2,(7-j)); } } expectedValue=Integer.valueOf(params[i][1]); if(getValue!=expectedValue) { stepErr=false; stepResult="Failed"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] +" not correct. "+ANSI_RED+"Expected: "+expectedValue+". Received: "+getValue+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] +" correct. "+ANSI_GREEN+getValue+ANSI_RESET); } output.printStepOut(params[i][0], expectedValue, getValue, stepResult, stepComment, stepErr); } else if(params[i][0].equals("Packet Data.Enabled Housekeeping")) { getValue=0; for(int j=0;j<16;j++) { if(egse.packetTool.getTmParameter(hkTm.getFirst(), params[i][0]+"."+String.valueOf(j)).equals("true")) { getValue+=Math.pow(2,(15-j)); } } expectedValue=Integer.valueOf(params[i][1]); if(getValue!=expectedValue) { stepErr=false; stepResult="Failed"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] +" not correct. "+ANSI_RED+"Expected: "+expectedValue+". Received: "+getValue+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] +" correct. "+ANSI_GREEN+getValue+ANSI_RESET); } output.printStepOut(params[i][0], expectedValue, getValue, stepResult, stepComment, stepErr); } else if(params[i][0].equals("Packet Data.Enabled Events")) { long getValue1=0; long getValue2=0; for(int j=0;j<32;j++) { if(egse.packetTool.getTmParameter(hkTm.getFirst(), params[i][0]+"."+String.valueOf(j)).equals("true")) { getValue1+=Math.pow((long)2,(31-j)); } if(egse.packetTool.getTmParameter(hkTm.getFirst(), params[i][0]+"."+String.valueOf(j+32)).equals("true")) { getValue2+=Math.pow((long)2,(31-j)); } } long expectedValue1=Long.valueOf(params[i][1]); long expectedValue2=Long.valueOf(params[i][2]); String expectedValueStr=Long.toHexString(expectedValue1)+Long.toHexString(expectedValue2); getValueStr=Long.toHexString(getValue1)+Long.toHexString(getValue2); if(!expectedValueStr.equals(getValueStr)) { stepErr=false; stepResult="Failed"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] +" not correct. "+ANSI_RED+"Expected: "+expectedValueStr+". Received: "+getValueStr+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] +" correct. "+ANSI_GREEN+getValueStr+ANSI_RESET); } output.printStepOut(params[i][0], expectedValueStr, getValueStr, stepResult, stepComment, stepErr); } else { offset=Integer.valueOf(params[i][2]); if(offset>0) { expectedValue=Long.valueOf(params[i][1]); getValue = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getFirst(), params[i][0])); if(getValue < (expectedValue-offset)){ stepErr=false; stepResult="Failed"; stepComment="Too low"; System.out.println(" HK parameter "+ params[i][0] +" too low." +ANSI_RED+" Accepted Min: "+String.valueOf(expectedValue-offset)+". Received: "+String.valueOf(getValue)+ANSI_RESET); } else if(getValue > (expectedValue+offset)){ stepErr=false; stepResult="Failed"; stepComment="Too high"; System.out.println(" HK parameter "+ params[i][0] +" too high."+ANSI_RED+" Accepted Max: "+String.valueOf(expectedValue+offset)+". Received: "+String.valueOf(getValue)+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] + " within bounds. Low - Received - High: "+ANSI_GREEN+String.format("%4d - %4d - %4d",(expectedValue-offset),getValue,(expectedValue+offset))+ANSI_RESET); } output.printStepOut(params[i][0], expectedValue-offset, expectedValue, expectedValue+offset, Long.valueOf(getValue), stepResult, stepComment, stepErr); } else if(offset==0) { getValueStr=egse.packetTool.getTmParameter(hkTm.getFirst(), params[i][0]); if(!params[i][1].equals(getValueStr)) { stepErr=false; stepResult="Failed"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] +" not correct. "+ANSI_RED+"Expected: "+params[i][1]+". Received: "+getValueStr+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] +" correct. "+ANSI_GREEN+params[i][1]+ANSI_RESET); } output.printStepOut(params[i][0], params[i][1], getValueStr, stepResult, stepComment, stepErr); } else if(offset==-1) { expectedValue=Long.valueOf(params[i][1]); getValue = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getFirst(), params[i][0])); if(getValue > expectedValue){ stepErr=false; stepResult="Failed"; stepComment="Too high"; System.out.println(" HK parameter "+ params[i][0] +" too high." +ANSI_RED+" Accepted Max: "+String.valueOf(expectedValue)+". Received: "+String.valueOf(getValue)+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" HK parameter "+ params[i][0] + " within bounds. Received - High: "+ANSI_GREEN+String.format("%4d - %4d",getValue,expectedValue)+ANSI_RESET); } output.printStepOut(params[i][0], "", "", String.valueOf(expectedValue), String.valueOf(getValue), stepResult, stepComment, stepErr); } else if(offset==-99) { getValueStr = egse.packetTool.getTmParameter(hkTm.getFirst(), params[i][0]); stepErr=true; stepResult="OK"; stepComment="As run"; System.out.println(" HK parameter "+ params[i][0] + ": "+ANSI_GREEN+getValueStr+ANSI_RESET); output.printStepOut(params[i][0], getValueStr, stepResult, stepComment, stepErr); } } } } /* public void verifyMonHKErrWarn(MXGSEGSE egse, double wait, int expErrorsAndWarnings) throws Throwable { egse.dhpu.getMonitoredHkTm().clear(); while((egse.dhpu.getMonitoredHkTm().size() < 1) && (wait > 0)) { Thread.sleep(100); wait = wait - 0.1; } if(wait <= 0){ throw new MxgsTestException("No response received from verifyMonHKErrWarn (Timeout)."); } if (egse.dhpu.getMonitoredHkTm().size() <= 0) { throw new MxgsTestException("No Monitored Housekeeping Recieved in verifyMonHKErrWarn."); } Tm tm = egse.dhpu.getMonitoredHkTm().removeLast(); // Verify Errors and Warnings int errorsAndWarnings = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Errors and Warnings")); if(errorsAndWarnings != expErrorsAndWarnings){ throw new MxgsTestException("Errors and Warnings Incorrect. Expected: "+expErrorsAndWarnings+" Value is: "+errorsAndWarnings); } } */ /** * Verifies UTC time in Monitored HK (not milliseconds) * @param egse * @throws Throwable * @author frec */ public void verifyMonHKUtcTime(MXGSEGSE egse) throws Throwable { egse.dhpu.getMonitoredHkTm().clear(); double wait = 25.; while((egse.dhpu.getMonitoredHkTm().size() < 3) && (wait > 0)) { Thread.sleep(100); wait = wait - 0.1; } if(wait <= 0){ output.printStepOut("Monitored HK", "Failed", "No response received", false); throw new MxgsTestException("No response received from verifyMonHKUtcTime (Timeout)."); } Tm tm = egse.dhpu.getMonitoredHkTm().getLast(); long mytime[]=bas.time(); long year = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Time.Year")); long ms = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Time.Milliseconds")); long sec = Long.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Time.Seconds")); //Verify Year, milliseconds and seconds: if (year != mytime[0]-Basic.year_start) { stepErr=false; stepResult="Failed"; stepComment=""; System.out.println(" UTC Time.Year not correct. "+ANSI_RED+"Expected: "+mytime[0]+" Received:"+year+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; } output.printStepOut("Time.Year", mytime[0]-Basic.year_start, year, stepResult, stepComment, stepErr); if (Math.abs(sec - mytime[1]+Basic.sec_start)>1) { stepErr=false; stepResult="Failed"; stepComment=""; System.out.println(" UTC Time.Seconds not correct. "+ANSI_RED+"Expected: "+(mytime[1]-Basic.sec_start)+" Received:"+sec+ANSI_RESET); } else { stepErr=true; stepResult="OK"; if(sec!=mytime[1]-Basic.sec_start) { stepComment="1 sec diff. accepted"; } else { stepComment=""; } System.out.println(" UTC Time correct: "+ANSI_GREEN+year+" "+sec+ANSI_YELLOW+" (milliseconds not verified)"+ANSI_RESET); } output.printStepOut("Time.Seconds", mytime[1]-Basic.sec_start, sec, stepResult, stepComment, stepErr); output.printStepOut("Time.Milliseconds", mytime[2], ms, "", "Not verified", true); } /** * Verifies UTC time in HK (not milliseconds) * @param egse * @param tmType TM Type of HK * @param gp Generation Period * @throws Throwable * @author frec */ public void verifyHKUtcTime(MXGSEGSE egse, int tmType, int gp) throws Throwable { ParameterValueEvent hkEvent = new ParameterValueEvent(egse.dhpu.getNonscienceTm(), egse.packetTool, "Private Header.Packet Identification.TM Type", String.valueOf(tmType), Logger.global); ParameterValueFilter hkTm = new ParameterValueFilter(hkEvent, Logger.global); hkTm.clear(); double wait=gp+15; while((hkTm.size() < 1) && (wait > 0)) { Thread.sleep(100); wait = wait - 0.1; } long mytime[]=bas.time(); if(wait <= 0){ output.printStepOut("HK ID="+tmType, "Failed", "No response received", false); throw new MxgsTestException("No response received from verifyHKUtcTime (Timeout). TN Type: "+tmType); } Tm tm = hkTm.getLast(); long year = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Time.Year")); long ms = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Time.Milliseconds")); long sec = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Time.Seconds")); //Verify Year, milliseconds and seconds: if (year != mytime[0]-Basic.year_start) { stepErr=false; stepResult="Failed"; stepComment=""; System.out.println(" UTC Time.Year not correct. "+ANSI_RED+"Expected: "+mytime[0]+" Received:"+year+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; } output.printStepOut("Time.Year", mytime[0]-Basic.year_start, year, stepResult, stepComment, stepErr); if (Math.abs(sec - mytime[1]+Basic.sec_start)>1) { stepErr=false; stepResult="Failed"; stepComment=""; System.out.println(" UTC Time.Seconds not correct. "+ANSI_RED+"Expected: "+mytime[1]+" Received:"+sec+ANSI_RESET); } else { stepErr=true; stepResult="OK"; if(sec!=mytime[1]-Basic.sec_start) { stepComment="1 sec diff. accepted"; } else { stepComment=""; } System.out.println(" UTC Time correct: "+ANSI_GREEN+year+" "+sec+ANSI_YELLOW+" (milliseconds not verified)"+ANSI_RESET); } output.printStepOut("Time.Seconds", mytime[1]-Basic.sec_start, sec, stepResult, stepComment, stepErr); output.printStepOut("Time.Milliseconds", mytime[2], ms, "", "Not verified", true); } /** * Sends EnableInstrumentHousekeepingTC and verifies the (result). * @param egse * @param wait maximum wait time (seconds). * @param hkid housekeeping ID * @param gc Generation Control * @param gp Generation Period * @param result Expected result * @throws Throwable * @author stet */ public void verifyEnableInstrumentHKTc(MXGSEGSE egse, double wait, String hkid, String gc, String gp, int result) throws Throwable { //Look for Monitored housekeeping only ParameterValueEvent hkEvent = new ParameterValueEvent(egse.dhpu.getNonscienceTm(), egse.packetTool, "Private Header.Packet Identification.TM Type", String.valueOf(0x10), Logger.global); ParameterValueFilter hkTm = new ParameterValueFilter(hkEvent, Logger.global); egse.packetTool.setTcParameter("EnableInstrumentHousekeepingTC", "Packet Data.Housekeeping ID", hkid); egse.packetTool.setTcParameter("EnableInstrumentHousekeepingTC", "Packet Data.Generation Control", gc); egse.packetTool.setTcParameter("EnableInstrumentHousekeepingTC", "Packet Data.Generation Period", gp); egse.dhpu.sendNormalTc(egse.packetTool.getTc("EnableInstrumentHousekeepingTC")); while((hkTm.size() < 1) && (wait > 0)) { Thread.sleep(100); wait = wait - 0.1; } if(wait <= 0){ output.printStepOut("Enable HK ID="+hkid, "Failed", "No response received", false); throw new MxgsTestException("No response received from verifyEnableInstrumentHKTc (Timeout)."); } int resultCode = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.removeLast(), "Packet Data.Result")); if (result != resultCode) { stepErr=false; stepResult="Failed"; stepComment=""; System.out.println("Failed comparing Result. "+ANSI_GREEN+"Expected: "+result+". Recieved: "+resultCode+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println("Command Verification Report received: "+ANSI_GREEN+"OK"+ANSI_RESET); } output.printStepOut("Result", result, resultCode, stepResult, stepComment, stepErr); } public void sendEnableInstrumentHKTc(MXGSEGSE egse, double wait, String hkid, String gc, String gp) throws Throwable { egse.dhpu.getNonscienceTm().clear(); egse.packetTool.setTcParameter("EnableInstrumentHousekeepingTC", "Packet Data.Housekeeping ID", hkid); egse.packetTool.setTcParameter("EnableInstrumentHousekeepingTC", "Packet Data.Generation Control", gc); egse.packetTool.setTcParameter("EnableInstrumentHousekeepingTC", "Packet Data.Generation Period", gp); egse.dhpu.sendNormalTc(egse.packetTool.getTc("EnableInstrumentHousekeepingTC")); } public void verifyHKReceiving(MXGSEGSE egse, double wait, int tmType, int generationPeriod) throws Throwable { ParameterValueEvent hkEvent = new ParameterValueEvent(egse.dhpu.getNonscienceTm(), egse.packetTool, "Private Header.Packet Identification.TM Type", String.valueOf(tmType), Logger.global); ParameterValueFilter hkTm = new ParameterValueFilter(hkEvent, Logger.global); double waitHkTm = wait; while((hkTm.size() < 1) && (waitHkTm > 0)) { Thread.sleep(1); waitHkTm = waitHkTm - 0.001; } if(waitHkTm <= 0){ output.printStepOut("HK ID="+tmType, "Failed", "No response received", false); throw new MxgsTestException("No response received (Timeout)."); } egse.dhpu.getMonitoredHkTm().clear(); double waitMonHkTm =wait; while((egse.dhpu.getMonitoredHkTm().size() < 1) && (waitMonHkTm > 0)) { Thread.sleep(1); waitHkTm = waitHkTm - 0.001; } egse.dhpu.getMonitoredHkTm().clear(); hkTm.clear(); //increase the wait time acoarding to the generationPeriod: wait = wait * generationPeriod; //wait for recieving 2 x generationPeriod housekeeping: while((egse.dhpu.getMonitoredHkTm().size() < (2*generationPeriod)) && (wait > 0)) { Thread.sleep(1); wait = wait - 0.001; } int hkTmSize=hkTm.size(); int monHkTmSize=egse.dhpu.getMonitoredHkTm().size(); if(wait <= 0){ output.printStepOut("Monitored HK", "Failed", "No response received", false); throw new MxgsTestException("No response received from verifyHKReceiving with TM type="+tmType+" (Timeout)."); } if ((hkTmSize * generationPeriod) != monHkTmSize ) { stepErr=false; stepResult="Failed"; stepComment="Wrong number of HK"; System.out.println("Failed verifying number of HK packages with TM type="+tmType+" received. "+ANSI_RED+"Expected: "+(monHkTmSize/generationPeriod)+". Received: "+hkTmSize+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println("Number of HK packages with TM type="+tmType+" received: "+ANSI_GREEN+"OK"+ANSI_RESET); } output.printStepOut("Receiving", stepResult, stepComment, stepErr); } public void verifyHKNotReceiving(MXGSEGSE egse, double wait, int tmType) throws Throwable { ParameterValueEvent hkEvent = new ParameterValueEvent(egse.dhpu.getNonscienceTm(), egse.packetTool, "Private Header.Packet Identification.TM Type", String.valueOf(tmType), Logger.global); ParameterValueFilter hkTm = new ParameterValueFilter(hkEvent, Logger.global); hkTm.clear(); double waitHkTm = wait; while((hkTm.size() < 1) && (waitHkTm > 0)) { Thread.sleep(100); waitHkTm = waitHkTm - 0.1; } if(waitHkTm > 0){ stepErr=false; stepResult="Failed"; stepComment="Still receiving"; System.out.println(ANSI_RED+" Still receiving HK with TM Type ="+tmType+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println("Stopped receiving HK with TM type="+tmType+ANSI_GREEN+": OK"+ANSI_RESET); } output.printStepOut("Not receiving", stepResult, stepComment, stepErr); } /* public void verifyHKUtcTime(MXGSEGSE egse, double wait, int tmType, int expectedYear, int expectedMilliseconds, int expectedSecondsWithinYear, int generationPeriod) throws Throwable { //Create the PSU summary housekeeping queue: ParameterValueEvent hkEvent = new ParameterValueEvent(egse.dhpu.getNonscienceTm(), egse.packetTool, "Private Header.Packet Identification.TM Type", String.valueOf(tmType), Logger.global); ParameterValueFilter hkTm = new ParameterValueFilter(hkEvent, Logger.global); hkTm.clear(); //Recieve 3 packets: wait = wait * 3; while((hkTm.size() < 3) && (wait > 0)) { Thread.sleep(100); wait = wait - 0.1; } if(wait <= 0){ throw new MxgsTestException("No response received from verifyPsuUtcTime (Timeout)."); } Tm tm = hkTm.getLast(); //Time below is hardcoded into this function. Parsed values are over written: System.out.println(" UTC Time Verification - set in function, manual inspection: "); long mytime[]=bas.time(); expectedYear = (int)mytime[0]; expectedMilliseconds = (int)mytime[2]; expectedSecondsWithinYear = (int)mytime[1]; int year = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Time.Year")); int ms = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Time.Milliseconds")); int sec = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Time.Seconds")); //Verify Year, milliseconds and seconds: if (year != expectedYear) { //throw new MxgsTestException("Failed comparing UTC Year. Expected:"+String.valueOf(expectedYear)+". Received"+String.valueOf(year)); System.out.println(ANSI_YELLOW+" HKUtcTime: expected year: "+ expectedYear +" Received:"+year); } if (ms != expectedMilliseconds) { //throw new MxgsTestException("Failed comparing UTC Milliseconds. Expected:"+String.valueOf(expectedMilliseconds)+". Received"+String.valueOf(ms)); System.out.println(ANSI_YELLOW+" HKUtcTime: expected milliseconds:"+ expectedMilliseconds +" Received:"+ms+ANSI_RESET); } if (sec != expectedSecondsWithinYear) { //throw new MxgsTestException("Failed comparing UTC Seconds within a year. Expected:"+String.valueOf(expectedSecondsWithinYear)+". Received"+String.valueOf(sec)); System.out.println(ANSI_YELLOW+" HKUtcTime: expected seconds: "+ expectedSecondsWithinYear +" Received:"+sec+ANSI_RESET); } //Verify that seconds field increments with one: int sec1 = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.removeFirst(), "Packet Data.Time.Seconds")); int sec2 = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.removeFirst(), "Packet Data.Time.Seconds")); int sec3 = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.removeFirst(), "Packet Data.Time.Seconds")); if(sec3-sec2 != generationPeriod){ throw new MxgsTestException("Second field is not incrementing correctly in verifyHKUtcTime: "+sec2+" "+sec3); } if(sec2-sec1 != generationPeriod){ throw new MxgsTestException("Second field is not incrementing correctly in verifyHKUtcTime: "+sec1+" "+sec2); } } */ /* public void verifyHKAquisitionStartTime(MXGSEGSE egse, double wait, int tmType, int generationPeriod, int expectedCurrentValue) throws Throwable { //Create the PSU summary housekeeping queue: ParameterValueEvent hkEvent = new ParameterValueEvent(egse.dhpu.getNonscienceTm(), egse.packetTool, "Private Header.Packet Identification.TM Type", String.valueOf(tmType), Logger.global); ParameterValueFilter hkTm = new ParameterValueFilter(hkEvent, Logger.global); hkTm.clear(); //Recieve 3 packets: while((hkTm.size() < 3) && (wait > 0)) { Thread.sleep(100); wait = wait - 0.1; } if(wait <= 0){ throw new MxgsTestException("No response received from verifyHKAquisitionStartTime (Timeout)."); } //Verify that seconds field increments with one: int tcp1 = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.removeFirst(), "Packet Data.Acquisition Start Time.TCP Count")); int tcp2 = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.removeFirst(), "Packet Data.Acquisition Start Time.TCP Count")); int tcp3 = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getFirst(), "Packet Data.Acquisition Start Time.TCP Count")); if(tcp3-tcp2 != generationPeriod){ throw new MxgsTestException("TCP field is not incrementing correctly in verifyHKAquisitionStartTime."); } if(tcp2-tcp1 != generationPeriod){ throw new MxgsTestException("TCP field is not incrementing correctly in verifyHKAquisitionStartTime."); } //Verify current value int currentValue = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getFirst(), "Packet Data.Acquisition Start Time.Current Value")); if(currentValue != expectedCurrentValue) { System.out.println(" Bypassing HKAquisitionStartTime Current value. Received: "+currentValue+" Need to know current value." ); } } */ /* public void verifyHKAquisitionStartTime(MXGSEGSE egse, double wait, int tmType, int generationPeriod) throws Throwable { //Create the PSU summary housekeeping queue: ParameterValueEvent hkEvent = new ParameterValueEvent(egse.dhpu.getNonscienceTm(), egse.packetTool, "Private Header.Packet Identification.TM Type", String.valueOf(tmType), Logger.global); ParameterValueFilter hkTm = new ParameterValueFilter(hkEvent, Logger.global); hkTm.clear(); //Recieve 3 packets: while((hkTm.size() < 3) && (wait > 0)) { Thread.sleep(100); wait = wait - 0.1; } if(wait <= 0){ throw new MxgsTestException("No response received from verifyHKAquisitionStartTime (Timeout)."); } //Verify that seconds field increments with one: int tcp1 = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.removeFirst(), "Packet Data.Acquisition Start Time.TCP Count")); int tcp2 = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.removeFirst(), "Packet Data.Acquisition Start Time.TCP Count")); int tcp3 = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getFirst(), "Packet Data.Acquisition Start Time.TCP Count")); if(tcp3-tcp2 != generationPeriod){ throw new MxgsTestException("TCP field is not incrementing correctly in verifyHKAquisitionStartTime."); } if(tcp2-tcp1 != generationPeriod){ throw new MxgsTestException("TCP field is not incrementing correctly in verifyHKAquisitionStartTime."); } } */ /* public void verifyHKParameter(MXGSEGSE egse, double wait, int tmType, String parameterName, int expectedValue, int offset) throws Throwable { //Create the PSU summary housekeeping queue: ParameterValueEvent hkEvent = new ParameterValueEvent(egse.dhpu.getNonscienceTm(), egse.packetTool, "Private Header.Packet Identification.TM Type", String.valueOf(tmType), Logger.global); ParameterValueFilter hkTm = new ParameterValueFilter(hkEvent, Logger.global); hkTm.clear(); while((hkTm.size() < 1) && (wait > 0)) { Thread.sleep(100); wait = wait - 0.1; } if(wait <= 0){ throw new MxgsTestException("No response received from verifyHKParameter (Timeout)."); } String parameterString = "Packet Data." + parameterName; int getValue = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.removeLast(), parameterString)); if(getValue < (expectedValue-offset)){ //throw new MxgsTestException("HK parameter value too low. Accepted Min: "+String.valueOf(expectedValue-offset)+". Received: "+String.valueOf(getValue)); System.out.println(" HK parameter "+ parameterName +" too low."+ANSI_RED+" Accepted Min: "+String.valueOf(expectedValue-offset)+". Received: "+String.valueOf(getValue)+ANSI_RESET); } else if(getValue > (expectedValue+offset)){ //throw new MxgsTestException("HK parameter value too high. Accepted Max: "+String.valueOf(expectedValue+offset)+". Received: "+String.valueOf(getValue)); System.out.println(" HK parameter "+ parameterName +" too high."+ANSI_RED+" Accepted Max: "+String.valueOf(expectedValue+offset)+". Received: "+String.valueOf(getValue)+ANSI_RESET); } else { System.out.println(" HK parameter "+ parameterName + " within bounds. Low - Received - High: "+ANSI_GREEN+String.format("%4d - %4d - %4d",(expectedValue-offset),getValue,(expectedValue+offset))+ANSI_RESET); } } */ /* public void verifyHKRegister(MXGSEGSE egse, double wait, int tmType, String registerName, int expectedValue) throws Throwable { ParameterValueEvent hkEvent = new ParameterValueEvent(egse.dhpu.getNonscienceTm(), egse.packetTool, "Private Header.Packet Identification.TM Type", String.valueOf(tmType), Logger.global); ParameterValueFilter hkTm = new ParameterValueFilter(hkEvent, Logger.global); hkTm.clear(); while((hkTm.size() < 1) && (wait > 0)) { Thread.sleep(100); wait = wait - 0.1; } if(wait <= 0){ throw new MxgsTestException("No response received from verifyHKRegister (Timeout)."); } String parameterString = "Packet Data." + registerName; if(registerName.equals("Boot Status")) { int BootStatus=0; for(int i=0;i<8;i++) { if(egse.packetTool.getTmParameter(hkTm.getLast(), parameterString+"."+String.valueOf(i)).equals("true")) { BootStatus+=Math.pow(2,(7-i)); } } if(BootStatus!=expectedValue) { throw new MxgsTestException("HK Boot Status not correct. Expected: "+expectedValue+" Received: "+BootStatus); } } else { int getValue = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.removeLast(), parameterString)); if (getValue != expectedValue) { // throw new MxgsTestException("Failed comparing HK resgisters. Expected: "+expectedValue+". Received: "+getValue); System.out.println(" HK register "+ registerName +" not correct. "+ANSI_RED+"Expected: "+String.valueOf(expectedValue)+". Received: "+String.valueOf(getValue)+ANSI_RESET); } } } */ /* public void verifyEventReport(MXGSEGSE egse, double wait, int eventSeverity, int eventID, int expYear, int expMilliseconds, int expSecondsWithinYear) throws Throwable { //Create the PSU summary housekeeping queue: ParameterValueEvent hkEvent = new ParameterValueEvent(egse.dhpu.getNonscienceTm(), egse.packetTool, "Private Header.Packet Identification.TM Type", String.valueOf(0x00), Logger.global); ParameterValueFilter hkTm = new ParameterValueFilter(hkEvent, Logger.global); hkTm.clear(); while((hkTm.size() < 1) && (wait > 0)) { Thread.sleep(100); wait = wait - 0.1; } if(wait <= 0){ throw new MxgsTestException("No response received from verifyEventReport (Timeout)."); } int getEventSeverity = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getLast(), "Packet Data.Event Severity")); int getEventID = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getLast(), "Packet Data.Event ID")); int year = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getLast(), "Packet Data.Time.Year")); int ms = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getLast(), "Packet Data.Time.Milliseconds")); int sec = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getLast(), "Packet Data.Time.Seconds")); if(getEventSeverity != eventSeverity){ throw new MxgsTestException("Failed comparing event severity. Expected: "+eventSeverity+". Received: "+getEventSeverity); } if(getEventID != eventID){ throw new MxgsTestException("Failed comparing Event ID. Expected: "+eventID+". Received: "+getEventID); } if(year != expYear){ System.out.println(" Bypasing: Year compare not implemented. Need to set UTC time."); //throw new MxgsTestException("Failed comparing year. Expected: "+expYear+". Received: "+year); } if(ms != expMilliseconds){ System.out.println(" Bypasing: Milliseconds compare not implemented. Need to set UTC time"); //throw new MxgsTestException("Failed comparing milliseconds. Expected: "+expMilliseconds+". Received: "+ms); } if(sec != expSecondsWithinYear){ System.out.println(" Bypasing: Seconds compare not implemented. Need to set UTC time"); //throw new MxgsTestException("Failed comparing seconds within year. Expected: "+expSecondsWithinYear+". Received: "+sec); } } */ /** * Return a data queue with data which with the applied filter. * * @param egse * @param filter * @return data queue */ public ParameterValueFilter dataQueueCreate(MXGSEGSE egse, int filter) { ParameterValueEvent hkEvent = new ParameterValueEvent(egse.dhpu.getNonscienceTm(), egse.packetTool, "Private Header.Packet Identification.TM Type", String.valueOf(filter), Logger.global); ParameterValueFilter hkTm = new ParameterValueFilter(hkEvent, Logger.global); return hkTm; } /** * Return a science data queue with data with the applied filter. * * @param egse * @param filter * @return data queue */ public ParameterValueFilter scienceQueueCreate(MXGSEGSE egse, int filter) { ParameterValueEvent hkEvent = new ParameterValueEvent(egse.dhpu.getScienceTm(), egse.packetTool, "Private Header.Packet Identification.TM Type", String.valueOf(filter), Logger.global); ParameterValueFilter hkTm = new ParameterValueFilter(hkEvent, Logger.global); return hkTm; } public void dataQueueWaitForSize(MXGSEGSE egse, double wait, int waitForSize, ParameterValueFilter hkTm) throws Throwable{ int startSize = hkTm.size(); while((hkTm.size() < waitForSize) && (wait > 0)) { Thread.sleep(1); wait = wait - 0.001; } if(wait <= 0){ int rxTotal = hkTm.size()-startSize; output.printStepOut("dataQueue size", waitForSize,rxTotal,"Failed", "", false); System.out.println("Timeout on dataQueueWaitForSize. "+ANSI_RED+"Received " + rxTotal + " while waiting."+ANSI_RESET); } else { String tmtype=egse.packetTool.getTmParameter(hkTm.getFirst(), "Private Header.Packet Identification.TM Type"); System.out.println("Number of TMs with TM Type="+tmtype+" received: "+ANSI_GREEN+waitForSize+ANSI_RESET); } } public ParameterValueFilter verifyEventReport(MXGSEGSE egse, ParameterValueFilter hkTm, int eventSeverity, int eventID, int expYear, int expMilliseconds, int expSecondsWithinYear, int expValue1, int expValue2) throws Throwable { if(hkTm.size()==0) { output.printStepOut("Verify Event Report", "Failed", "No event report in queue", false); System.out.println("No event report in queue: "+ANSI_RED+eventID+ANSI_RESET); } else { Tm tm = hkTm.removeFirst(); int getEventSeverity = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Event Severity")); int getEventID = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Event ID")); int year = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Time.Year")); int ms = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Time.Milliseconds")); int sec = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Time.Seconds")); if(getEventSeverity != eventSeverity){ stepErr=false; stepResult="failed"; stepComment=""; System.out.println("Failed comparing event severity. "+ANSI_RED+"Expected: "+eventSeverity+". Received: "+getEventSeverity+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" EventSeverity correct: "+ANSI_GREEN+getEventSeverity+ANSI_RESET); } output.printStepOut("Event Severity", eventSeverity, getEventSeverity, stepResult, stepComment, stepErr); if(getEventID != eventID){ stepErr=false; stepResult="failed"; stepComment=""; System.out.println("Failed comparing Event ID. "+ANSI_RED+"Expected: "+eventID+". Received: "+getEventID+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" EventID correct: "+ANSI_GREEN+getEventID+ANSI_RESET); } output.printStepOut("Event ID", eventID, getEventID, stepResult, stepComment, stepErr); if(!stepErr) { return hkTm; } if(year != expYear){ stepErr=false; stepResult="failed"; stepComment=""; System.out.println("Failed comparing year. "+ANSI_RED+"Expected: "+expYear+". Received: "+year+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" Year correct: "+ANSI_GREEN+year+ANSI_RESET); } output.printStepOut("Time.Year", expYear, year, stepResult, stepComment, stepErr); if(Math.abs(sec-expSecondsWithinYear)>2){ stepErr=false; stepResult="failed"; stepComment=""; System.out.println(" Failed comparing SecondsWithinYear: "+ANSI_RED+"Expected: "+expSecondsWithinYear+" Received: "+sec+ANSI_RESET); } else { stepErr=true; stepResult="OK"; if(sec!=expSecondsWithinYear) { stepComment="2 sec diff. accepted"; } else { stepComment=""; } System.out.println(" Seconds correct: "+ANSI_GREEN+sec+ANSI_RESET); } output.printStepOut("Time.Seconds", expSecondsWithinYear, sec, stepResult, stepComment, stepErr); if(ms != expMilliseconds){ System.out.println(" Bypassing compare MilliSeconds in verifyEventReport. "+ANSI_YELLOW+"Expected: "+expMilliseconds+" Received: "+ms+ANSI_RESET); //throw new MxgsTestException("Failed comparing year. Expected: "+expYear+". Received: "+year); } else { System.out.println(" Milliseconds correct: "+ANSI_GREEN+ms+ANSI_RESET); } output.printStepOut("Time.Milliseconds", expMilliseconds, ms, "", "Not verified", true); int itemValue; String itemName; if(eventID == 30000) { // 30000 int getCurrentSW; getCurrentSW = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Event Data.Current Mode")); itemValue=getCurrentSW; itemName="Current Mode"; if(getCurrentSW != expValue1){ stepErr=false; stepResult="failed"; stepComment=""; System.out.println("Failed comparing Software mode in verifyEventReport 30000. "+ANSI_RED+"Expected: "+expValue1+". Received: "+getCurrentSW+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" Current SW mode for Event ID="+eventID+": "+ANSI_GREEN+getCurrentSW+ANSI_RESET+"\n"); } output.printStepOut(itemName, expValue1, itemValue, stepResult, stepComment, stepErr); } else if (eventID == 30010) { // 30010 int getCurrentSWsub = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Event Data.Current Sub-mode")); itemValue=getCurrentSWsub; itemName="Current Sub-mode"; if(getCurrentSWsub != expValue1){ stepErr=false; stepResult="failed"; stepComment=""; System.out.println("Failed comparing Software Sub-mode in verifyEventReport 30010. "+ANSI_RED+"Expected: "+expValue1+". Received: "+getCurrentSWsub+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" Current SW Submode for Event ID="+eventID+": "+ANSI_GREEN+getCurrentSWsub+ANSI_RESET+"\n"); } output.printStepOut(itemName, expValue1, itemValue, stepResult, stepComment, stepErr); } else if (eventID == 30120) { // 30120 int getObservationPriority = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Event Data.Observation Priority")); itemValue=getObservationPriority; itemName="Observation Priority"; if(getObservationPriority != expValue1){ stepErr=false; stepResult="failed"; stepComment=""; System.out.println("Failed comparing "+itemName+" in verifyEventReport 30120. "+ANSI_RED+"Expected: "+expValue1+". Received: "+getObservationPriority+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" "+itemName+" for Event ID="+eventID+": "+ANSI_GREEN+getObservationPriority+ANSI_RESET+"\n"); } output.printStepOut(itemName, expValue1, itemValue, stepResult, stepComment, stepErr); } else if(eventID == 30160) { // 30160 int tcpCount=Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Event Data.MXGS Trigger Time.TCP Count")); itemValue=tcpCount; itemName="MXGS Trigger Time.TCP Count"; if(Math.abs(tcpCount-expValue1)>1){ stepErr=false; stepResult="failed"; stepComment=""; System.out.println("Failed comparing TCP Count in verifyEventReport 30160. "+ANSI_RED+"Expected: "+expValue1+". Received: "+tcpCount+ANSI_RESET); } else { stepErr=true; stepResult="OK"; if(tcpCount!=expValue1) { stepComment="1 TCP diff. accepted"; } else { stepComment=""; } System.out.println("MXGS Trigger Time.TCP Count Event ID "+eventID+": "+ANSI_GREEN+tcpCount+ANSI_RESET); } output.printStepOut(itemName, (int) expValue1, itemValue, stepResult, stepComment, stepErr); int dpuTimer=Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Event Data.MXGS Trigger Time.Current DPU Timer Value")); itemValue=dpuTimer; itemName="Current DPU Timer Value"; stepErr=true; stepResult=""; stepComment="Not verified"; System.out.println("MMIA Trigger Time.Current DPU Timer Value Event ID "+eventID+": "+ANSI_YELLOW+dpuTimer+ANSI_RESET); output.printStepOut(itemName, expValue2, itemValue, stepResult, stepComment, stepErr); } else if (eventID == 40050) { // 40050 int triggerWindowFlags=0; String triggerWindowFlagsNames[]={"LED Short Window 1","LED Short Window 2","LED Short Window 3","LED Long Window", "HED Short Window 1","HED Short Window 2","HED Short Window 3","HED Long Window", "Trigger From MMIA Enabled","Trigger From MMIA Received"}; for(int i=0;i<10;i++) { if(Boolean.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Event Data.Trigger Window Flags."+triggerWindowFlagsNames[i]))){ triggerWindowFlags+=Math.pow(2,15-i); } } itemValue=triggerWindowFlags; itemName="Trigger Window Flags"; if(triggerWindowFlags != expValue2){ stepErr=false; stepResult="failed"; stepComment=""; System.out.println("Failed comparing Trigger Window Flags in verifyEventReport 40050. "+ANSI_RED+"Expected: "+expValue2+". Received: "+triggerWindowFlags+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println("TriggerWindowFlags for Event ID "+eventID+": "+ANSI_GREEN+triggerWindowFlags+ANSI_RESET); } output.printStepOut(itemName, expValue2, itemValue, stepResult, stepComment, stepErr); int tcpCount=Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Event Data.MMIA Trigger Time.TCP Count")); itemValue=tcpCount; itemName="MMIA Trigger Time.TCP Count"; if(Math.abs(tcpCount-expValue1)>1){ stepErr=false; stepResult="failed"; stepComment=""; System.out.println("Failed comparing TCP Count in verifyEventReport 40050. "+ANSI_RED+"Expected: "+expValue1+". Received: "+tcpCount+ANSI_RESET); } else { stepErr=true; stepResult="OK"; if(tcpCount!=expValue1) { stepComment="1 TCP diff. accepted"; } else { stepComment=""; } System.out.println("MMIA Trigger Time.TCP Count Event ID "+eventID+": "+ANSI_GREEN+tcpCount+ANSI_RESET); } output.printStepOut(itemName, expValue1, itemValue, stepResult, stepComment, stepErr); int dpuTimer=Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Event Data.MMIA Trigger Time.Current DPU Timer Value")); itemValue=dpuTimer; itemName="Current DPU Timer Value"; stepErr=true; stepResult=""; stepComment="Not verified"; System.out.println("MMIA Trigger Time.Current DPU Timer Value Event ID "+eventID+": "+ANSI_YELLOW+dpuTimer+ANSI_RESET); output.printStepOut(itemName, 0, itemValue, stepResult, stepComment, stepErr); } else if (eventID == 40090) { // 40090 int observationSize = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Event Data.Observation Size")); itemValue=observationSize; itemName="Observation Size"; if(Math.abs(observationSize-expValue1) > expValue2){ stepErr=false; stepResult="failed"; stepComment=""; System.out.println("Failed comparing "+itemName+" in verifyEventReport 40090. "+ANSI_RED+"Expected: "+expValue1+". Received: "+observationSize+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" "+itemName+" for Event ID="+eventID+": "+ANSI_GREEN+observationSize+ANSI_RESET+"\n"); } output.printStepOut(itemName, expValue1-expValue2, expValue1, expValue1+expValue2, itemValue, stepResult, stepComment, stepErr); } else if (eventID == 40120) { // 40120 int observationSize = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Event Data.Observation Size")); itemValue=observationSize; itemName="Observation Size"; if(Math.abs(observationSize-expValue1) > expValue2){ stepErr=false; stepResult="failed"; stepComment=""; System.out.println("Failed comparing Software Sub-mode in verifyEventReport 40120. "+ANSI_RED+"Expected: "+expValue1+". Received: "+observationSize+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" Observation Size for Event ID="+eventID+": "+ANSI_GREEN+observationSize+ANSI_RESET+"\n"); } output.printStepOut(itemName, expValue1-expValue2, expValue1, expValue1+expValue2, itemValue, stepResult, stepComment, stepErr); } else if (eventID == 40150) { // 40150 int detectorID = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Event Data.Detector ID")); itemValue=detectorID; itemName="Detector ID"; if(detectorID!=expValue1){ stepErr=false; stepResult="failed"; stepComment=""; System.out.println("Failed comparing "+itemName+" in verifyEventReport 40150. "+ANSI_RED+"Expected: "+expValue1+". Received: "+detectorID+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" Observation Size for Event ID="+eventID+": "+ANSI_GREEN+detectorID+ANSI_RESET+"\n"); } output.printStepOut(itemName, expValue1, itemValue, stepResult, stepComment, stepErr); } else if(eventID == 40180) { // 40180 int prevQ = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Event Data.Previous Q Value")); itemValue=prevQ; itemName="Previous Q Value"; if(prevQ != expValue1){ stepErr=false; stepResult="failed"; stepComment=""; System.out.println("Failed comparing Previous Q Value in verifyEventReport 40180. "+ANSI_RED+"Expected: "+expValue1+". Received: "+prevQ+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" Previous Q Value for Event ID="+eventID+": "+ANSI_GREEN+prevQ+ANSI_RESET); } output.printStepOut(itemName, expValue1, itemValue, stepResult, stepComment, stepErr); int currQ = Integer.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Event Data.Current Q Value")); itemValue=currQ; itemName="Current Q Value"; if(currQ != expValue2){ stepErr=false; stepResult="failed"; stepComment=""; System.out.println("Failed comparing Current Q Value in verifyEventReport 40180. "+ANSI_RED+"Expected: "+expValue2+". Received: "+currQ+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" Current Current Q Value for Event ID="+eventID+": "+ANSI_GREEN+currQ+ANSI_RESET); } output.printStepOut(itemName, expValue2, itemValue, stepResult, stepComment, stepErr); } else if(eventID == 40260) { // 40260 System.out.println(tm.hex()); String[] daus ={"CZT DAU 1", "CZT DAU 2", "CZT DAU 3", "CZT DAU 4", "BGO DAU 1", "BGO DAU 2", "BGO DAU 3", "BGO DAU 4", "PSU"}; int statusFlags = 0; for (int i=0;i<9;i++) { if(Boolean.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Event Data.Status Flags."+daus[i]))){ statusFlags+=Math.pow(2,(15-i)); } } itemValue=statusFlags; itemName="Status Flags"; if(statusFlags != expValue1){ stepErr=false; stepResult="failed"; stepComment=""; System.out.println("Failed comparing Staus Flags in verifyEventReport 40260. "+ANSI_RED+"Expected: "+expValue1+". Received: "+statusFlags+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" Status Flags for Event ID="+eventID+": "+ANSI_GREEN+statusFlags+ANSI_RESET); } output.printStepOut(itemName, expValue1, itemValue, stepResult, stepComment, stepErr); } else if(eventID == 40270) { // 40270 String[] daus ={"CZT DAU 1", "CZT DAU 2", "CZT DAU 3", "CZT DAU 4", "BGO DAU 1", "BGO DAU 2", "BGO DAU 3", "BGO DAU 4", "PSU"}; int statusFlags = 0; for (int i=0;i<9;i++) { if(Boolean.valueOf(egse.packetTool.getTmParameter(tm, "Packet Data.Event Data.Status Flags."+daus[i]))){ statusFlags+=Math.pow(2,(15-i)); } } itemValue=statusFlags; itemName="Status Flags"; if(statusFlags != expValue1){ stepErr=false; stepResult="failed"; stepComment=""; System.out.println("Failed comparing Staus Flags in verifyEventReport 40270. "+ANSI_RED+"Expected: "+expValue1+". Received: "+statusFlags+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" Status Flags for Event ID="+eventID+": "+ANSI_GREEN+statusFlags+ANSI_RESET); } output.printStepOut(itemName, expValue1, itemValue, stepResult, stepComment, stepErr); } else { // Bypass this check - do nothing } } return hkTm; } /* public void verifyEventReport(MXGSEGSE egse, double wait, int eventSeverity, int eventID, int expYear, int expMilliseconds, int expSecondsWithinYear, int currentSW) throws Throwable { //Create the PSU summary housekeeping queue: ParameterValueEvent hkEvent = new ParameterValueEvent(egse.dhpu.getNonscienceTm(), egse.packetTool, "Private Header.Packet Identification.TM Type", String.valueOf(0x00), Logger.global); ParameterValueFilter hkTm = new ParameterValueFilter(hkEvent, Logger.global); hkTm.clear(); while((hkTm.size() < 1) && (wait > 0)) { Thread.sleep(100); wait = wait - 0.1; System.out.println(" Size: "+egse.dhpu.getNonscienceTm()); System.out.println(" TM:: "+egse.dhpu.getNonscienceTm().getLast()); } if(wait <= 0){ throw new MxgsTestException("No response received from verifyEventReport (Timeout)."); } int getEventSeverity = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getLast(), "Packet Data.Event Severity")); int getEventID = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getLast(), "Packet Data.Event ID")); int year = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getLast(), "Packet Data.Time.Year")); int ms = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getLast(), "Packet Data.Time.Milliseconds")); int sec = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getLast(), "Packet Data.Time.Seconds")); if(getEventSeverity != eventSeverity){ throw new MxgsTestException("Failed comparing event severity. Expected: "+eventSeverity+". Received: "+getEventSeverity); } if(getEventID != eventID){ throw new MxgsTestException("Failed comparing Event ID. Expected: "+eventID+". Received: "+getEventID); } if(year != expYear){ System.out.println(" Bypassing: Year compare not implemented. Expected: "+expYear+". Received: "+year+" Need to set UTC time."); //throw new MxgsTestException("Failed comparing year. Expected: "+expYear+". Received: "+year); } if(ms != expMilliseconds){ System.out.println(" Bypassing: Milliseconds compare not implemented. Expected: "+expMilliseconds+". Received: "+ms+" Need to set UTC time."); //throw new MxgsTestException("Failed comparing milliseconds. Expected: "+expMilliseconds+". Received: "+ms); } if(sec != expSecondsWithinYear){ System.out.println(" Bypasing: Seconds compare not implemented. Expected: "+expSecondsWithinYear+". Received: "+sec+" Need to set UTC time"); //throw new MxgsTestException("Failed comparing seconds within year. Expected: "+expSecondsWithinYear+". Received: "+sec); } int getCurrentSW; if(eventID == 30000) { getCurrentSW = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.removeLast(), "Packet Data.Event Data.Current Mode")); if(getCurrentSW != currentSW){ throw new MxgsTestException("Failed comparing Software mode in verifyEventReport 30000. Expected: "+currentSW+". Received: "+getCurrentSW); } } else if (eventID == 30010) { getCurrentSW = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.removeLast(), "Packet Data.Event Data.Current Sub-mode")); if(getCurrentSW != currentSW){ throw new MxgsTestException("Failed comparing Software mode in verifyEventReport 30010. Expected: "+currentSW+". Received: "+getCurrentSW); } } else { // Bypass this check - do nothing. } } */ /* public void verifyEventReport(MXGSEGSE egse, double wait, int eventSeverity, int eventID, int expYear, int expMilliseconds, int expSecondsWithinYear, int expTcpCount, int expDpuTimer) throws Throwable { //Create the PSU summary housekeeping queue: ParameterValueEvent hkEvent = new ParameterValueEvent(egse.dhpu.getNonscienceTm(), egse.packetTool, "Private Header.Packet Identification.TM Type", String.valueOf(0x00), Logger.global); ParameterValueFilter hkTm = new ParameterValueFilter(hkEvent, Logger.global); hkTm.clear(); while((hkTm.size() < 1) && (wait > 0)) { Thread.sleep(100); wait = wait - 0.1; } if(wait <= 0){ throw new MxgsTestException("No response received from verifyEventReport (Timeout)."); } int getEventSeverity = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getLast(), "Packet Data.Event Severity")); int getEventID = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getLast(), "Packet Data.Event ID")); int year = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getLast(), "Packet Data.Time.Year")); int ms = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getLast(), "Packet Data.Time.Milliseconds")); int sec = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getLast(), "Packet Data.Time.Seconds")); int tcpCount = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getLast(), "Packet Data.Acquisition Start Time.TCP Count")); int dpuTimer = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getLast(), "Packet Data.Acquisition Start Time.Current Value")); if(getEventSeverity != eventSeverity){ throw new MxgsTestException("Failed comparing event severity. Expected: "+eventSeverity+". Received: "+getEventSeverity); } if(getEventID != eventID){ throw new MxgsTestException("Failed comparing Event ID. Expected: "+eventID+". Received: "+getEventID); } if(year != expYear){ throw new MxgsTestException("Failed comparing year. Expected: "+expYear+". Received: "+year); } if(ms != expMilliseconds){ throw new MxgsTestException("Failed comparing milliseconds. Expected: "+expMilliseconds+". Received: "+ms); } if(sec != expSecondsWithinYear){ throw new MxgsTestException("Failed comparing seconds within year. Expected: "+expSecondsWithinYear+". Received: "+sec); } if(tcpCount != expTcpCount){ throw new MxgsTestException("Failed comparing TCP Count. Expected: "+expTcpCount+". Received: "+tcpCount); } if(dpuTimer != expDpuTimer){ throw new MxgsTestException("Failed comparing Current DPU Timer Value. Expected: "+expDpuTimer+". Received: "+dpuTimer); } } */ public void verifyDummyScienceData(MXGSEGSE egse, ParameterValueFilter hkTm) throws Throwable { int queueSize=hkTm.size(); if(queueSize == 0) { output.printStepOut("Dummy science", "Failed", "Nothing in Science Queue", false); throw new MxgsTestException("Nothing in Science Queue"); } int packetLength = Integer.valueOf(egse.packetTool.getTmParameter(hkTm.getFirst(), "Packet Length")); if(packetLength != 718) { stepErr=false; stepResult="Failed"; stepComment=""; System.out.println(ANSI_RED+"Packet Length is not 718 for Dummy Science Data"+ANSI_RESET); } else { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" Packet Length for dummy science data: "+ANSI_GREEN+packetLength+ANSI_RESET); } output.printStepOut("Packet Length", 718, packetLength, stepResult, stepComment, stepErr); int nofErrors=0; String observationData = egse.packetTool.getTmParameter(egse.dhpu.getScienceTm().removeFirst(), "Packet Data.Observation Data"); int thisValue = Integer.valueOf(observationData.substring(3, 5),16); for(int j=1; j<1430; j++) { if(Integer.valueOf(observationData.substring(2*j+3, 2*j+5),16)!=thisValue) { System.out.println(ANSI_RED+" All octets in Dummy Science data not identical "+j+ANSI_RESET); nofErrors++; } } if(nofErrors==0) { stepErr=true; stepResult="OK"; stepComment=""; System.out.println(" Octets all identical for dummy science data: "+ANSI_GREEN+"OK"+ANSI_RESET); } else { stepErr=false; stepResult="Failed"; stepComment=""; } output.printStepOut("Octets identical", stepResult, stepComment, stepErr); int nextValue = thisValue+1; if(nextValue==256) nextValue=32; for(int i=0; i