/** * The constructor for TL controllers * * @param The model being used. */ public SL1TLC(Infrastructure infra) throws InfraException { super(infra); Node[] nodes = infra.getAllNodes(); // Moet Edge zijn eigenlijk, alleen testSimModel knalt er dan op int num_nodes = nodes.length; count = new Vector(); int numSigns = infra.getAllInboundLanes().size(); q_table = new float[numSigns + 1][][][]; int num_specialnodes = infra.getNumSpecialNodes(); for (int i = 0; i < nodes.length; i++) { Node n = nodes[i]; Drivelane[] dls = n.getInboundLanes(); for (int j = 0; j < dls.length; j++) { Drivelane d = dls[j]; Sign s = d.getSign(); int id = s.getId(); int num_pos_on_dl = d.getCompleteLength(); q_table[id] = new float[num_pos_on_dl][][]; for (int k = 0; k < num_pos_on_dl; k++) { q_table[id][k] = new float[num_specialnodes][]; for (int l = 0; l < q_table[id][k].length; l++) { q_table[id][k][l] = new float[2]; q_table[id][k][l][0] = 0.0f; q_table[id][k][l][1] = 0.0f; } } } } System.out.println("Startet med Alpha = " + alpha); random_number = new Random(); }
/** * Default constructor, should be invoked by any class that extends {@link Equipment}. Finds the * device on GPIB and clears its internal state (cf. {@link #clear}). * * @param name Name of the device, as given in /proj/async/cad/linux/src/gpib/nienet/ibconf */ public Equipment(String name) { this.name = name; if (isDisabled()) { Logger.logInit(" GPIB device " + name + " not enabled for this test."); return; } if (Infrastructure.gpibControllers == null) { Infrastructure.fatal( "You must set Infrastructure.gpibControllers " + "before initializing any GPIB devices"); } ud = GPIB.findDevice(name); Logger.logInit(" Initializing GPIB device: " + name + ", ud: " + ud); int board = this.ask(CONTROLLER_ID_NUMBER); for (int ind = 0; ind < Infrastructure.gpibControllers.length; ind++) { if (board == Infrastructure.gpibControllers[ind]) { // clear(); return; } } Infrastructure.fatal( "Device " + name + " is on controller number " + board + ", which is not in Infrastructure.gpibControllers"); }
/** * For device bringup and command testing, takes commands from the terminal and sends them to the * device. If a command includes a question mark, then it waits for the reply from the device * before prompting for the next command to send. */ public void interactive() { String command, response; do { command = Infrastructure.readln("Enter command: "); write(command); if (command.indexOf("?") > 0) { response = read(100); if (response.length() > 0) { System.out.println("response: " + response); } } } while (true); }
/** * Receive up to <code>length</code> bytes from the device. * * @param length length of the data to read * @return data string which is read */ public String read(int length) { if (isDisabled()) { return ""; } if (ud < 0) { System.out.println("can't read from uninitized device:" + this); } String result = GPIB.ibRead(ud, name, length).trim(); // System.out.println(id + ": " + result + ". " + result.length()); if (result.length() == 0) { Infrastructure.nonfatal("Empty string from id " + ud); } return result.trim(); }
public LoaderTester(Object owner) { Infrastructure.setContextToAndroidTestCase(this); Infrastructure.setPerformanceWriterIfPerformanceCollectorTestCase(owner); }
public void setInfrastructure( Infrastructure infra ) { super.setInfrastructure(infra); Node[] nodes = infra.getAllNodes(); num_nodes = nodes.length; try{ int numSigns = infra.getAllInboundLanes().size(); q_table = new float [numSigns][][][]; qa_table = new float [numSigns][][][]; v_table = new float [numSigns][][]; va_table = new float [numSigns][][]; count = new Vector[numSigns][][]; p_table = new Vector[numSigns][][]; pKtl_table = new Vector[numSigns][][]; int num_specialnodes = infra.getNumSpecialNodes(); for (int i=0; i<num_nodes; i++) { Node n = nodes[i]; Drivelane[] dls = dls = n.getInboundLanes(); int num_dls = num_dls = dls.length; // huh? Drivelane [] lanes = new Drivelane[numSigns]; infra.getAllInboundLanes().copyInto(lanes); for (int j=0; j<num_dls; j++) { Drivelane d = dls[j]; Sign s = d.getSign(); int id = d.getId(); int num_pos_on_dl = d.getCompleteLength(); q_table[id] = new float [num_pos_on_dl][][]; qa_table[id] = new float [num_pos_on_dl][][]; v_table[id] = new float [num_pos_on_dl][]; va_table[id] = new float [num_pos_on_dl][]; count[id] = new Vector[num_pos_on_dl][]; p_table[id] = new Vector[num_pos_on_dl][]; pKtl_table[id] = new Vector[num_pos_on_dl][]; for (int k=0; k<num_pos_on_dl; k++) { q_table[id][k] = new float[num_specialnodes][2]; qa_table[id][k] = new float[num_specialnodes][2]; v_table[id][k] = new float[num_specialnodes]; va_table[id][k] = new float[num_specialnodes]; count[id][k] = new Vector[num_specialnodes]; p_table[id][k] = new Vector[num_specialnodes]; pKtl_table[id][k] = new Vector[num_specialnodes]; for (int l=0; l<num_specialnodes;l++) { q_table[id][k][l][0] = 0.0f; q_table[id][k][l][1] = 0.0f; qa_table[id][k][l][0] = 0.0f; qa_table[id][k][l][1] = 0.0f; v_table[id][k][l] = 0.0f; va_table[id][k][l] = 0.0f; count[id][k][l] = new Vector(); p_table[id][k][l] = new Vector(); pKtl_table[id][k][l] = new Vector(); } } } } random_number = new Random(); } catch(Exception e) { System.out.println("Error."); } }