Main

March 16, 2006

Computation

Computation was taken care of by our PC/104 stack. This device was a computer on its own and ran all out simulink processes on it. The simulink file is here. There are no embedded matlab functions present anywhere within our simulink file.

simu_main.gif

The model begins by storing a state variable to keep track of the present dealing positions. Feeding this into the state machine, it can grab out what dealing positions it wants and create motor control signals from that. The subsystems within the top level include the state machine, the motor control, and the motor steady test.

March 15, 2006

State Machine

simu_state_machine.gif

The state machine was implimented using what simulink calls a "multiport switch" as a ROM table. By inputing the present value of the state variable, the program indexed and addressed the current variables it needed to deal the card ot the right position. The variables it used included Left(0) or Right(1), Card Position (positive or negative integer based on starrtup position being 0), Whether to wait for the PushButton or the Motors to settle, and what the next state would be.

State Machine

simu_state_machine.gif

March 14, 2006

Motor Control

simu_motors.gif

Using simulink, the motors were controlled via PID compensators. The Kp gain was 100, the Kd gain was 5, and the Ki gain was set to zero.

March 13, 2006

Motor Steady Check

simu_motor_steady.gif

The motor steady check would output a true signal if the motor was within a certain error tolerance (set by a constant) for the last half second (also changeable by a constant). It would use an incremental counter multiplied by appropriate gains to convert to seconds, but essentially would carry out the following equation:

Counts = (Within_Tolerance*(Not Stable) + Counts)*Within_Tolerance

This way, counts would increment by Within_Tolerance each dt, and since Within_Tolerance only holds zero or one, it would either increment, or become zero, thus multiplying the whole sum by zero and starting over. Also, but multiplying Within_Tolerance by the opposite of Stable, once the motors did become stable the counter could stop thus preventing overflow.