#include"TcPch.h"
#pragma hdrstop
#include"Simulator.h"

#if defined( _DEBUG ) && defined(_WITH_SIMULATOR)
#include"CRemoteLog.h"
Simulator sm;
#include"IoSensor.h"
#include"BoatModule.h"
void simulatorBoat() {
	//准备boat move的ilk
	sm.set(&IoSensor::poSensorVAC1->di, true);
	sm.set(&IoSensor::poSensorVAC2->di, true);
	sm.set(&IoSensor::poSensorVAC3->di, true);
	sm.set(&IoSensor::poSensorRaxisaircylinderretractposition->di, true);
	sm.set(&IoSensor::poSensorBoatUnloadInterlock->di, true);

	//收到shutter打开命令后3秒应答打开
	sm.when(&boatModule->shutter->doClose, SMOP::EQ, false)->
		when(&boatModule->shutter->doOpen, SMOP::EQ, true)->
		wait(3000)->
		set(&boatModule->shutter->diClose, false)->
		set(&boatModule->shutter->diOpen, true)->
		set(&IoSensor::poSensorVAC1->di, false)->
		wait(1000)->
		set(&IoSensor::poSensorVAC1->di, true);

	sm.when(&boatModule->boatElevator->aoTargetPosition, SMOP::EQ, 1.0)->
		wait(2000)->
		set(&boatModule->boatElevator->diPosition1, true);	 
}

void simulatorSet() {
#if defined( _DEBUG ) && defined(_WITH_SIMULATOR)
	simulatorBoat();

#endif
}
void simulatorMonitor() {
#if defined( _DEBUG ) && defined(_WITH_SIMULATOR)
	sm.monitor();
#endif
}
#endif