⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gomapot.cpp

📁 很好c语言编写的pid算法,具有很好的参考价值
💻 CPP
字号:
////////////////////////////////////////////////////////
//	僼傽僀儖偺愢柧丗GOMA 億僢僩偺僔僗僥儉僋儔僗娭悢
////////////////////////////////////////////////////////
#include "Rtos.h"
#include "GomaPot.h"


////////////////////////////////////////////////////////
//	僋儔僗丗GOMA 億僢僩僔僗僥儉
//	婡  擻丗GOMA 億僢僩僔僗僥儉偺惗惉
//			巊梡偡傞僋儔僗偺弶婜壔傪偍偙側偆
//	堷  悢丗側偟
//	栠傝抣丗側偟
////////////////////////////////////////////////////////
VOID GomaPot::create()
{

	// ControlTemperature乮搾暒偐偟乯僋儔僗偺弶婜壔
	this->PIDControlObj.setControlPeriod( CONTROL_PERIOD );			// 惂屼廃婜愝掕
	this->PIDControlObj.setSensorInfo( &(this->sensorInfoObj) );
	this->PIDControlObj.setHeater( &(this->heaterObj) );
	this->onOffControlObj.setControlPeriod( CONTROL_PERIOD );		// 惂屼廃婜愝掕
	this->onOffControlObj.setSensorInfo( &(this->sensorInfoObj) );
	this->onOffControlObj.setHeater( &(this->heaterObj) );

	//TemperatureMonitor乮壏搙娔帇乯偺弶婜壔
//	this->monitorTemperatureObj.setBoilControl( &(this->PIDControlObj) );		// 搾暒偐偟曽幃愝掕
	this->monitorTemperatureObj.setBoilControl( &(this->onOffControlObj) );		// 搾暒偐偟曽幃愝掕
	this->monitorTemperatureObj.setSterilizeControl( &(this->onOffControlObj) );// 嶦嬠曽幃偺愝掕
	this->monitorTemperatureObj.setKeepControl( &(this->PIDControlObj) );		// 曐壏曽幃偺愝掕
	this->monitorTemperatureObj.setTemperatureSelector( &tempSelect );			// 壏搙慖戰僋儔僗
	this->monitorTemperatureObj.setPowerSaver( &(this->powerSaverObj) );		// 愡揹僆僽僕僃僋僩偺愝掕
	this->monitorTemperatureObj.setHeaterController( &(this->heaterObj) );		// 僸乕僞乕惂屼僆僽僕僃僋僩偺愝掕

	// pouringController乮拲偓惂屼乯偺弶婜壔
	this->pourForCoffeeObj.setMotorControllerObj( &(this->motorControllerObj) );// 儌乕僞乕惂屼偺巜掕
	this->pourForTeaObj.setMotorControllerObj( &(this->motorControllerObj) );	// 儌乕僞乕惂屼偺巜掕
	this->pouringControllerObj.setMasterOfCoffee( &(this->pourForCoffeeObj) );	// 僐乕僸乕僆僽僕僃僋僩愝掕
	this->pouringControllerObj.setMasterOfTea( &(this->pourForTeaObj) );		// 偍拑僆僽僕僃僋僩愝掕
	this->pouringControllerObj.setPouringSelector( &(this->pouringSelectorObj) );// 拲偓偐偨慖戰僆僽僕僃僋僩愝掕
	this->pouringControllerObj.setPourButton( &(this->pourButtonObj) );			// 拲偓儃僞儞僆僽僕僃僋僩愝掕

	//愡揹傾僾儕働乕僔儑儞偺弶婜壔
	this->powerSaverObj.setRealTimeClockObj( &(this->realTimeClockObj) ); //儕傾儖僞僀儉僋儘僢僋愝掕

}

////////////////////////////////////////////////////////
//	僌儘乕僶儖娭悢
////////////////////////////////////////////////////////
////////////////////////////////////////////////////////
//	婡  擻丗壏搙娔帇僞僗僋
//	堷  悢丗枹巊梡
//	栠傝抣丗側偟
////////////////////////////////////////////////////////
VOID monitorTempMain( INT StaCd )
{
	GomaPot * gomaObject = ::getGomaObj(  );
	gomaObject->controlTempTask( StaCd );
}

////////////////////////////////////////////////////////
//	婡  擻丗偍搾拲偓僞僗僋
//	堷  悢丗枹巊梡
//	栠傝抣丗側偟
////////////////////////////////////////////////////////
VOID poureMain( INT StaCd )
{
	GomaPot * gomaObject = ::getGomaObj(  );
	gomaObject->pouringTask( StaCd );
}

////////////////////////////////////////////////////////
//	婡  擻丗僔僗僥儉僆僽僕僃僋僩庢摼
//	堷  悢丗側偟
//	栠傝抣丗僔僗僥儉僆僽僕僃僋僩偺億僀儞僞
////////////////////////////////////////////////////////
GomaPot * getGomaObj(  )
{
	static GomaPot gomaPotObject;
	return &gomaPotObject;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -