c语言setprop函数 c语言setup函数

高分悬赏,请知道的高手帮忙,感激不?。∪绾卧趙incc中根据设定的几个点绘制曲线,然后plc跟随这条曲线运一、定义一个原始数据变量;
二、用Winccfunctiontrendcontrol控件画线,使用SetProp...函数设置该控件的BeginX,EndX,DataX,DataY等属性,用InsertData插入点
三、必须注意PLC中浮点数的字节顺序和C语言中的不同,可以在PLC程序中使用CAD命令调换字节顺序,也可以在C语言中用循环调换字节顺序
在网上查到了一篇文章,里面的程序说的是WebNavigator下实现趋势曲线显示的问题,很有参考价值 。根据这个修改一下,应该可以实现你所要实现的功能 。
WinCCTrendinWebNavigator
Nov30,20031:17pm,byR.K.
Subject:HMI
fromtheAutomationListdept.
Text:
Hello,
IwouldliketoplotanarrayinWinCCcomingfromaPLC.IamtryingtocreatethisgraphusingtheTrendControlsuppliedbyWinCC.I'vegotaloopthataddsthepointstothegraphandthendisplaysthemanditworksbeautifullyinWinCCRuntime,butdoesnotinwebNavigator.Doesanyoneknowifthereisaspecialinitializationprocessneededtohaveitrunproperlyonwebnavigator?Attachedbelowismycode:
//WINCC:TAGNAME_SECTION_START
//syntax:#defineTagNameInAction"DMTagName"
//nextTagID:1
//WINCC:TAGNAME_SECTION_END
#defineTAG_M12_0312_Det2_Curve_Force_Live"M12_0312_Det2_Curve_Force_Test"//ForceisanINT(2Bytes)
#defineTAG_M12_0312_Det2_Curve_Pos_Live"M12_0312_Det2_Curve_Pos_Test"//PositionisanINT(2Bytes)
//--------NotNeccessary------------------
//#definenbByte_for_INTsizeof(int)//BYTE(defaultformatforarawtag...)
#definenbByte_for_DINTsizeof(float)//BYTE(defaultformatforarawtag...)
#definenbByte_for_REALsizeof(long)//BYTE(defaultformatforarawtag...)
#definenbSamples_Array100//SizeofthearraysthatcontainsForceandPositiondatacurveanalysis
#defineszData_ForcenbSamples_Array*nbByte_for_REAL//ForceValuesareREAL(4Bytes)
#defineszData_PositionnbSamples_Array*nbByte_for_DINT//PositionValuesareDINT(4Bytes)
//#defineszData_TimenbSamples_Array*nbByte_for_DINT//TimeValuesareDINT(4Bytes)
//DeclarationofForceandPositioninputarrays
float*Force_2;
long*Position_2;
doubleForce_Detail2[100];
doublePosition_Detail2[100];
unsignedintj;
unsignedinti;
unsignedintNull_Count_Force_2=0;
unsignedintNull_Count_Position_2=0;
staticdoubleForceMax_Detail2;
staticdoublePositionMax_Detail2;
//CreationoftheBYTEarrayinwhichthevaluesoftherawdatatagarestored
BYTEbyData_Force[szData_Force];
BYTEbyData_Position[szData_Position];
GetTagRaw(TAG_M12_0312_Det2_Curve_Force_Live,byData_Force,szData_Force);
GetTagRaw(TAG_M12_0312_Det2_Curve_Pos_Live,byData_Position,szData_Position);
//PointertoRawDataArray
Force_2=byData_Force[0];
Position_2=byData_Position[0];
//Verificationofactualvalues
ForceMax_Detail2==0;
for(i=0;i100;i)
{
Force_Detail2[i]=Force_2[i];
Position_Detail2[i]=Position_2[i];
//printf("%e,%e\r\n",Position_2[i],Force_Detail2[i]);
/*if(Force_Detail2[i]ForceMax_Detail2)
{
ForceMax_Detail2=Force_Detail2[i];
}
else
{
ForceMax_Detail2=ForceMax_Detail2;
}
if(Position_Detail2[i]PositionMax_Detail2)
{
PositionMax_Detail2=Position_Detail2[i];
}
else
{
PositionMax_Detail2=PositionMax_Detail2;
}
if(Force_Detail2[i]==0)
{
Null_Count_Force_2;
}
if(Position_Detail2[i]==0)
{
Null_Count_Position_2;
}
}
printf("\r\nForceValuesare=\r\n");
for(j=0;j100;j)
{
printf("%e\r\n",Force_Detail2[j]);
}
printf("\r\nPositionValuesare=\r\n");
for(j=0;j100;j)
{
printf("%e\r\n",Position_Detail2[j]);
}
//PlotGraph
SetPropBOOL(lpszPictureName,"BushingDet2CurveGraph","DeleteData",1);
SetPropWord(lpszPictureName,"BushingDet2CurveGraph","Index",0);
SetPropBOOL(lpszPictureName,"BushingDet2CurveGraph","Online",FALSE);//
SetPropBOOL(lpszPictureName,"BushingDet2CurveGraph","Activate",FALSE);//
SetPropBOOL(lpszPictureName,"BushingDet2CurveGraph","ItemVisible",1);
SetPropBOOL(lpszPictureName,"BushingDet2CurveGraph","AutoRangeX",0);
SetPropBOOL(lpszPictureName,"BushingDet2CurveGraph","AutoRangeY",1);
SetPropDouble(lpszPictureName,"BushingDet2CurveGraph","BeginX",(Position_Detail2[0]/10000));//10000);
SetPropDouble(lpszPictureName,"BushingDet2CurveGraph","EndX",(PositionMax_Detail2/10000));//10000);
i=0;
for(i=0;i100;i)
{
if(Force_Detail2[i]!=ForceMax_Detail2)
{
SetPropDouble(lpszPictureName,"BushingDet2CurveGraph","DataX",Position_Detail2[i]/10000);
SetPropDouble(lpszPictureName,"BushingDet2CurveGraph","DataY",Force_Detail2[i]);
//Return-Type:BOOL
SetPropBOOL(lpszPictureName,"BushingDet2CurveGraph","InsertData",1);
}
else
{
break;
}
}
SetPropBOOL(lpszPictureName,"BushingDet2CurveGraph","Online",TRUE);
SetPropBOOL(lpszPictureName,"BushingDet2CurveGraph","Activate",TRUE);//
}
}
WINCC中如何按钮组态控制用个简单点的方法 创建一个内部变量A 颜色属性连接内部变量A 1为绿色0为红色 按钮左键连接对变量A取反
Wincc问题,鼠标移至(不是点击)控件处,弹出一个显示信息的窗口!#include "apdefap.h"
void MouseMove(char* lpszPictureName, char* lpszObjectName ,short Button,short Shift,long x,long y)
{
long left,top,width,height;
left=GetPropWord(lpszPictureName,lpszObjectName,"Left");
top=GetPropWord(lpszPictureName,lpszObjectName,"Top");
width=GetPropWord(lpszPictureName,lpszObjectName,"Width");
height=GetPropWord(lpszPictureName,lpszObjectName,"Height");
//SetTagDWord("left",left);
//SetTagDWord("top",top);
//SetTagDWord("width",width);
//SetTagDWord("height",height);
//SetTagDWord("x_1",x);
//SetTagDWord("y_1",y);
if((x0)(xwidth)(y0)(xheight))
{
SetTagPrefix(lpszPictureName,"YB",lpszObjectName);
SetPictureName(lpszPictureName,"YB","Meter_Set");
SetPropWord(lpszPictureName,"YB","Left",left width);
SetPropWord(lpszPictureName,"YB","Top",top height);
SetVisible(lpszPictureName,"YB",1);}
else SetVisible(lpszPictureName,"YB",0);
}
谁能给我讲讲下段程序的意思啊 WINCC组态里的C语言程序如下:void onlbuttondown(char*lpszpicturename,char*lpszpropertyname,uintnflags,intx,inty)
//lp指的是longpoint,其实就是指针 , 鼠标键按下,操作系统返回消息,调到这个程序来进行响应处理,从传进来的参数可以看出,一参:图片名称,二参:属性名称 , 三参:标志位:第4,5个参数表示键被按下时的鼠标位置,x和y坐标 。
函数中有4个函数,都是以set开头的 , 说明是一些基本的设置,你可以右键goto definition(转到定义),看看函数声明,来确定函数具体做了哪些事,定义了哪些参数 。
个人感觉是动态的改变了一些窗体的原有属性 , 貌似基本都是改变外观和显示状态了 。
【c语言setprop函数 c语言setup函数】c语言setprop函数的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于c语言setup函数、c语言setprop函数的信息别忘了在本站进行查找喔 。

    推荐阅读