; 18649 Spring 2010 ; group 7 ; Justin Ray/justinr2 ; other names would go here ; coincontrol_1.mf ;unit test for coin control ;physical coinin period #DEFINE COIN_IN_PER 50ms ;definitions for inputs ;period and ID for mVend #DEFINE VEND_PER 50ms #DEFINE VEND_CAN_ID 0x08C81400 ;period and ID for mVendMotor #DEFINE VEND_MOTOR_PER 50ms #DEFINE VEND_MOTOR_CAN_ID 0x092C1E00 ;period and ID for mCoinReturn #DEFINE COIN_RETURN_PER 100ms #DEFINE COIN_RETURN_CAN_ID 0x09F43200 ;definitions for outputs (output periods are determined by the setting in the .cf file) #DEFINE COIN_COUNT_CAN_ID 0x0A583C00 ;set input initial value 0.0s I COIN_IN_PER F CoinIn = false 0.0s I VEND_PER N VEND_CAN_ID Vend = false 0.0s I VEND_MOTOR_PER N VEND_MOTOR_CAN_ID VendMotor = STOP 0.0s I COIN_RETURN_PER N COIN_RETURN_CAN_ID CoinReturn = false ;#state 'S3.1 IDLE' 0.2s A F CoinOut : value == false 0.2s A N COIN_COUNT_CAN_ID CoinCount : getCoinCount == 0 ;#transition 'T3.1' 1.0s I COIN_IN_PER F CoinIn = true ;#state 'S3.2 COIN_IN_1' ;#transition 'T3.2' ;no way to test the output of COIN_IN_1 because it is only in that state for one ;cycle and there is no different in the COIN_IN_1 and COIN_IN_2 outputs. ;so manually verify the output ;#state 'S3.3 COIN_IN_2' 1.31s A F CoinOut : value == false 1.31s A N COIN_COUNT_CAN_ID CoinCount : getCoinCount == 1 ;#transition 'T3.3' 1.3s I COIN_IN_PER F CoinIn = false ;#state 'S3.1 IDLE' 1.51s A F CoinOut : value == false 1.51s A N COIN_COUNT_CAN_ID CoinCount : getCoinCount == 1 ;pulse coinin a second time ;#transition 'T3.1' 2.0s I COIN_IN_PER F CoinIn = true ;#state 'S3.2 COIN_IN_1' ;#transition 'T3.2' ;no way to test the output of COIN_IN_1 because it is only in that state for one ;cycle and there is no different in the COIN_IN_1 and COIN_IN_2 outputs. ;so manually verify the output ;#state 'S3.3 COIN_IN_2' 2.31s A F CoinOut : value == false 2.31s A N COIN_COUNT_CAN_ID CoinCount : getCoinCount == 2 ;#transition 'T3.3' 2.5s I COIN_IN_PER F CoinIn = false ;#state 'S3.1 IDLE' 2.51s A F CoinOut : value == false 2.51s A N COIN_COUNT_CAN_ID CoinCount : getCoinCount == 2 ;#transition 'T3.1' 3.0s I COIN_IN_PER F CoinIn = true ;#state 'S3.2 COIN_IN_1' ;#transition 'T3.2' ;no way to test the output of COIN_IN_1 because it is only in that state for one ;cycle and there is no different in the COIN_IN_1 and COIN_IN_2 outputs. ;so manually verify the output ;#state 'S3.3 COIN_IN_2' 3.31s A F CoinOut : value == false 3.31s A N COIN_COUNT_CAN_ID CoinCount : getCoinCount == 3 ;#transition 'T3.3' ;because this part of the state machine is a pulse detector, no way to distinguish COIN_IN_2 from IDLE ;or pause the state machine in COIN_IN_2, so verify the COIN_IN_2 state in the controller log output. 3.5s I COIN_IN_PER F CoinIn = false ;#state 'S3.1 IDLE' 3.61s A F CoinOut : value == false 3.61s A N COIN_COUNT_CAN_ID CoinCount : getCoinCount == 3 ;#transition 'T3.4' ;no inputs changed, T3.4 depends on an internal state variable ;#state 'S3.4 OVERPAY' ;#transition 'T3.12' ;#state 'S3.8 OVERPAY_STRETCH' ;These assertions are removed because they cannot reliably detect the output in the overpay state ;these transitions and outputs have to be manually verified in the controller logs. ;3.81s A F CoinOut : value == true ;3.81s A N COIN_COUNT_CAN_ID CoinCount : getCoinCount == 2 ;this test is delayed because of the time it takes the CAN message to propagate. ;#transition 'T3.5' ;no inputs changed, T3.5 is unconditional ;#state 'S3.1 IDLE' 4.01s A F CoinOut : value == false 4.01s A N COIN_COUNT_CAN_ID CoinCount : getCoinCount == 2