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

📄 explain_experiment.cpp

📁 开发虚拟的被控对象及虚拟的PLC,模似PLC的工作过程进行实验。用户可根据具体的实验,确定其输入和输出的控制条件,用虚拟的连线和虚拟的PLC连接,用户利用梯形图的编程方式编写PLC程序控制被控对象的动
💻 CPP
字号:
#include "stdafx.h"
#include "PLC_DEMO.h"
#include "MainFrm.h"
#include "Auto_truck_load.h"
#include "Traffic_lump_control.h"
#include "Makesure_in_out_point.h"
#include "Write_inandout_point.h"
#include "Explain.h"

int oldexplain=0;
int new_explain;
bool canexplain;
extern bool autotruckenable;
extern bool trafficlumpenable;
extern CExplain *newexplain;
extern int forautotruckinput[2];
extern int forautotruckoutput[7];
extern int fortrafficlumpinput[5];
extern int signinput[8];
extern int signoutput[10];

void explain_experiment()
{
	CString s1("实验说明: L2亮,L1灭,车许进出");
	CString s2("实验说明: L2灭,L1辆,车不许进出,电动机三启动");
	CString s3("实验说明: 电动机二启动");
	CString s4("实验说明: 电动机一启动");
	CString s5("实验说明: 开关二开,装车");
	CString s6("实验说明: 装车完毕");
	CString s7("实验说明: 电动机一停转");
	CString s8("实验说明: 电动机二停转");//自动送料
	
    CString s9("白天,正常情况");
	CString s10("东西方向出现紧急情况");
	CString s11("南北方向出现紧急情况");
	CString s12("晚上");
	CString s13("总开关开");

	if(canexplain)
	{
		if(autotruckenable)
		{
		 if((!signinput[forautotruckinput[1]])&&
			 (signoutput[forautotruckoutput[3]]))
			 new_explain=1;
		 if ((signinput[forautotruckinput[1]])&&
			 (!signoutput[forautotruckoutput[3]]))
			 new_explain=2;
		 if ((signinput[forautotruckinput[1]])&&
			 (signoutput[forautotruckoutput[5]]))
			 new_explain=3;
		 if((signinput[forautotruckinput[1]])&&
			 (signoutput[forautotruckoutput[4]]))
			 new_explain=4;
		 if((!signinput[forautotruckinput[1]])&&
			 (signoutput[forautotruckoutput[4]]))
			 new_explain=6;
		 if(((!signinput[forautotruckinput[1]])&&
			 (!signoutput[forautotruckoutput[4]]))
			 &&(signoutput[forautotruckoutput[5]]))
			 new_explain=7;
		 if (((!signinput[forautotruckinput[1]])&&
			 (!signoutput[forautotruckoutput[5]]))
			 &&(signoutput[forautotruckoutput[6]]))
			 new_explain=8;
		 if(signoutput[forautotruckoutput[1]])
			 new_explain=5;
		 if(new_explain!=oldexplain)
		 {
			 oldexplain=new_explain;
			 if(oldexplain==1)
				 newexplain->SetWindowText(s1);
			 else  if(oldexplain==2)
				 newexplain->SetWindowText(s2);
			 else  if(oldexplain==3)
				 newexplain->SetWindowText(s3);
		     else  if(oldexplain==4)
				 newexplain->SetWindowText(s4);
	    	 else  if(oldexplain==5)
				 newexplain->SetWindowText(s5);
			 else  if(oldexplain==6)
				 newexplain->SetWindowText(s6);
		     else  if(oldexplain==7)
				 newexplain->SetWindowText(s7);
		     else  if(oldexplain==8)
				 newexplain->SetWindowText(s8);
			 else newexplain->SetWindowText("实验说明:就绪");
		 }			
		}
	else if(trafficlumpenable)
	{
		if(signinput[fortrafficlumpinput[0]])
            new_explain=13;
		if(signinput[fortrafficlumpinput[1]])
			new_explain=9;
	    if(signinput[fortrafficlumpinput[2]])
			new_explain=11;
		if(signinput[fortrafficlumpinput[3]])
			new_explain=10;
		if(signinput[fortrafficlumpinput[4]])
			new_explain=12;
		if(new_explain!=oldexplain)
		{
			oldexplain=new_explain;
		    if(	oldexplain==13)
				newexplain->SetWindowText(s13);
			else if(oldexplain==9)
				newexplain->SetWindowText(s9);
		    else if(oldexplain==10)
				newexplain->SetWindowText(s10);
			else if(oldexplain==11)
				newexplain->SetWindowText(s11);
		     else  if(oldexplain==12)
				newexplain->SetWindowText(s12);
			else newexplain->SetWindowText("实验说明:就绪");
		}
	}
	}
}

⌨️ 快捷键说明

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