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

📄 makesure_in_out_point.cpp

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

#include "PLC_DEMODoc.h"
#include "PLC_DEMOView.h"
#include "choosepoint.h"
#include "Write_inandout_point.h"

int forautotruckinput[2];
int forautotruckoutput[7];
int fortrafficlumpinput[5];
int fortrafficlumpoutput[6];
int forobjectcheckinput[5];
int forobjectcheckoutput[2];

extern Cchoosepoint *forchoose;
extern CString strinput[8];
extern CString stroutput[10];

void makesure_autotruck()
{
	CString str1="S1";	CString str2="S2"; CString str3="K1";
	CString str4="K2";	CString str5="L1"; CString str6="L2";
    CString str7="M1";  CString str8="M2"; CString str9="M3";
	for(int i=1;i<8;i++)
	{
		if(strinput[i].IsEmpty()==false)
		{
			if(strinput[i].Compare(str1)==0)
				forautotruckinput[0]=i;
			else if(strinput[i].Compare(str2)==0)
				forautotruckinput[1]=i;
		}
	}
	for(i=1;i<10;i++)
	{
		if(stroutput[i].IsEmpty()==false)
		{
			if(stroutput[i].Compare(str3)==0)
				forautotruckoutput[0]=i;
			else if(stroutput[i].Compare(str4)==0)
				forautotruckoutput[1]=i;
			else if(stroutput[i].Compare(str5)==0)
				forautotruckoutput[2]=i;
			else if(stroutput[i].Compare(str6)==0)
				forautotruckoutput[3]=i;
			else if(stroutput[i].Compare(str7)==0)
				forautotruckoutput[4]=i;
       	    else if(stroutput[i].Compare(str8)==0)
				forautotruckoutput[5]=i;
			else if(stroutput[i].Compare(str9)==0)
				forautotruckoutput[6]=i;
		}
	}		
}

void makesure_trafficlumpcontrol()
{
	CString str1="SBP";
	CString str2="K1";
	CString str3="K2";
	CString str4="K3";
	CString str5="K4";
	CString str6="L1";
	CString str7="L2";
	CString str8="L3";
	CString str9="L4";
	CString str10="L5";
	CString str11="L6";
	for(int i=1;i<8;i++)
	{
		if(strinput[i].IsEmpty()==false)
		{
			if(strinput[i].Compare(str1)==0)
				fortrafficlumpinput[0]=i;
			else if(strinput[i].Compare(str2)==0)
				fortrafficlumpinput[1]=i;
			else if(strinput[i].Compare(str3)==0)
				fortrafficlumpinput[2]=i;
			else if(strinput[i].Compare(str4)==0)
				fortrafficlumpinput[3]=i;
			else if(strinput[i].Compare(str5)==0)
				fortrafficlumpinput[4]=i;
		}
	}
	
	for(i=1;i<10;i++)
	{
		if(stroutput[i].IsEmpty()==false)
		{
			if(stroutput[i].Compare(str6)==0)
				fortrafficlumpoutput[0]=i;
			else if(stroutput[i].Compare(str7)==0)
				fortrafficlumpoutput[1]=i;
			else if(stroutput[i].Compare(str8)==0)
				fortrafficlumpoutput[2]=i;
			else if(stroutput[i].Compare(str9)==0)
				fortrafficlumpoutput[3]=i;
			else if(stroutput[i].Compare(str10)==0)
				fortrafficlumpoutput[4]=i;
			else if(stroutput[i].Compare(str11)==0)
				fortrafficlumpoutput[5]=i;
		}
	}		

}

void makesure_objectcheck()
{	
	CString str1="BL1";
	CString str2="BL2";
	CString str3="BL3";
	CString str4="SB";
	CString str5="K1";
	CString str6="YV";
	CString str7="M1";
	for(int i=1;i<8;i++)
	{
		if(strinput[i].IsEmpty()==false)
		{
			if(strinput[i].Compare(str1)==0)
				forobjectcheckinput[0]=i;
			else if(strinput[i].Compare(str2)==0)
				forobjectcheckinput[1]=i;
			else if(strinput[i].Compare(str3)==0)
				forobjectcheckinput[2]=i;
			else if(strinput[i].Compare(str4)==0)
				forobjectcheckinput[3]=i;
			else if(strinput[i].Compare(str5)==0)
				forobjectcheckinput[4]=i;
		}
	}
	for(i=1;i<10;i++)
	{
		if(stroutput[i].IsEmpty()==false)
		{
			if(stroutput[i].Compare(str6)==0)
				forobjectcheckoutput[0]=i;
			else if(stroutput[i].Compare(str7)==0)
				forobjectcheckoutput[1]=i;
		}
	}
}

⌨️ 快捷键说明

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