ikayaki.squid
Class SquidEmulator

java.lang.Object
  extended by ikayaki.squid.SquidEmulator

Deprecated. This emulator is no up to date and behaves differently from the real machine. Test the program with the real machine instead.

public class SquidEmulator
extends Object

This class tries to emulate behavior of real squid-system. It starts 3 threads (handler,magnetometer,degausser), opens COM-ports for them and adds SerialIO Listeners. Threads generates random data values or loaded values as results and generates random error situations to see that program using real squid system does survive those. Uses 2-3 COM ports. Usage SquidEmulator x z.. filename where x is 0 or 1 and indicates if Magnetometer and Demagnetizer are on same COM port. z... values are COM ports (Handler,Magnetometer,Degausser). filename is name of log file we are using or it is existing log file, which is used to generate same sequence used to verify that old and new program behaves same way.

Author:
Aki Korpua

Nested Class Summary
private static class SquidEmulator.DegausserEmu
          Deprecated. Runs degausser emulation process.
private static class SquidEmulator.HandlerEmu
          Deprecated. Runs handler emulation process.
private static class SquidEmulator.MagnetometerEmu
          Deprecated. Runs magnetometer emulation process.
 
Field Summary
private static int acceleration
          Deprecated. value between 0 and 127 default 5.
private static int commandedDistance
          Deprecated. value between 1 and 16,777,215
private static int commandedRotation
          Deprecated. angles are between 0 (0) and 2000 (360)
private static int currentPosition
          Deprecated. value between 1 and 16,777,215
private static int currentRotation
          Deprecated. angles are between 0 (0) and 2000 (360)
private static int deceleration
          Deprecated. value between 0 and 127 default 10.
private static SquidEmulator.DegausserEmu degausser
          Deprecated.  
private static int degausserAmplitude
          Deprecated. 0->3000 default amp 0
private static int degausserCoil
          Deprecated. (X, Y, Z) = (0,1,2) default axis Z
private static int degausserDelay
          Deprecated. 1-9 seconds default delay 1 second
private static SerialIO degausserPort
          Deprecated.  
private static int degausserRamp
          Deprecated. (3, 5, 7, 9) default 3
private static char degausserStatus
          Deprecated. Z=Zero, T=Tracking, ?
private static SquidEmulator.HandlerEmu handler
          Deprecated.  
private static SerialIO handlerPort
          Deprecated. starts Threads which reads messages from selected COM port.
private static String handlerStatus
          Deprecated. 5 end of move, previous G command complete, 7 hard limit stop, G motor is currently indexing
private static int homePosition
          Deprecated. value between 1 and 16,777,215
private static File logFile
          Deprecated. log file we are using read or write
private static FileWriter logWriter
          Deprecated.  
private static SquidEmulator.MagnetometerEmu magnetometer
          Deprecated.  
private static SerialIO magnetometerPort
          Deprecated.  
private static boolean online
          Deprecated. indicates if system have been started
private static boolean running
          Deprecated.  
private static boolean usingOldLog
          Deprecated. indicates have we loaded log file for using or are we writing it
private static int velocity
          Deprecated. value between 50 and 12 000.
 
Constructor Summary
SquidEmulator()
          Deprecated.  
 
Method Summary
private  void jbInit()
          Deprecated.  
static void main(String[] args)
          Deprecated. First creates or loads log file and sets settings.
static void writeMessage(String message, SerialIO port)
          Deprecated. send message to SerialIO to be sented.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

online

private static boolean online
Deprecated. 
indicates if system have been started


logFile

private static File logFile
Deprecated. 
log file we are using read or write


usingOldLog

private static boolean usingOldLog
Deprecated. 
indicates have we loaded log file for using or are we writing it


acceleration

private static int acceleration
Deprecated. 
value between 0 and 127 default 5. Settings in the 20-50 range are usually employed.


deceleration

private static int deceleration
Deprecated. 
value between 0 and 127 default 10. Settings in the 20-50 range are usually employed.


velocity

private static int velocity
Deprecated. 
value between 50 and 12 000. The decimal number issued is 10 times the actual pulse rate to the motor. Since the motor requires 200 pulses (full step) or 400 pulses (half step) per revolution, a speed setting of M10000 sets the motor to revolve at 5 revolutions per second in full step or 2.5 revolutions in half step. This rate is one-half the sample rate rotation due to the pulley ratios. The sample handler is set up at the factory for half stepping.


handlerStatus

private static String handlerStatus
Deprecated. 
5 end of move, previous G command complete, 7 hard limit stop, G motor is currently indexing


commandedDistance

private static int commandedDistance
Deprecated. 
value between 1 and 16,777,215


currentPosition

private static int currentPosition
Deprecated. 
value between 1 and 16,777,215


homePosition

private static int homePosition
Deprecated. 
value between 1 and 16,777,215


commandedRotation

private static int commandedRotation
Deprecated. 
angles are between 0 (0) and 2000 (360)


currentRotation

private static int currentRotation
Deprecated. 
angles are between 0 (0) and 2000 (360)


degausserCoil

private static int degausserCoil
Deprecated. 
(X, Y, Z) = (0,1,2) default axis Z


degausserAmplitude

private static int degausserAmplitude
Deprecated. 
0->3000 default amp 0


degausserDelay

private static int degausserDelay
Deprecated. 
1-9 seconds default delay 1 second


degausserRamp

private static int degausserRamp
Deprecated. 
(3, 5, 7, 9) default 3


degausserStatus

private static char degausserStatus
Deprecated. 
Z=Zero, T=Tracking, ?=Unknown


handlerPort

private static SerialIO handlerPort
Deprecated. 
starts Threads which reads messages from selected COM port. Own listener for each. Offers write commads to port too.


magnetometerPort

private static SerialIO magnetometerPort
Deprecated. 

degausserPort

private static SerialIO degausserPort
Deprecated. 

logWriter

private static FileWriter logWriter
Deprecated. 

handler

private static SquidEmulator.HandlerEmu handler
Deprecated. 

magnetometer

private static SquidEmulator.MagnetometerEmu magnetometer
Deprecated. 

degausser

private static SquidEmulator.DegausserEmu degausser
Deprecated. 

running

private static boolean running
Deprecated. 
Constructor Detail

SquidEmulator

public SquidEmulator()
Deprecated. 
Method Detail

writeMessage

public static void writeMessage(String message,
                                SerialIO port)
Deprecated. 
send message to SerialIO to be sented.

Parameters:
message - any message reply we are sending back
port - port number to be sent

main

public static void main(String[] args)
Deprecated. 
First creates or loads log file and sets settings. Runs sequence where read data from buffer and run cheduled actions (move, rotate, demag, measure) and send feedback to COM ports.


jbInit

private void jbInit()
             throws Exception
Deprecated. 
Throws:
Exception