网站建设资讯

NEWS

网站建设资讯

c语言setprop函数 Setprop

WINCC中如何按钮组态控制

用个简单点的方法 创建一个内部变量A 颜色属性连接内部变量A 1为绿色0为红色 按钮左键连接对变量A取反

成都创新互联是一家集网站建设,绥中企业网站建设,绥中品牌网站建设,网站定制,绥中网站建设报价,网络营销,网络优化,绥中网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。

高分悬赏,请知道的高手帮忙,感激不尽!如何在wincc中根据设定的几个点绘制曲线,然后plc跟随这条曲线运

一、定义一个原始数据变量;

二、用Wincc function trend control控件画线,使用SetProp...函数设置该控件的BeginX,EndX,DataX,DataY等属性,用InsertData插入点

三、必须注意PLC中浮点数的字节顺序和C语言中的不同,可以在PLC程序中使用CAD命令调换字节顺序,也可以在C语言中用循环调换字节顺序

在网上查到了一篇文章,里面的程序说的是WebNavigator下实现趋势曲线显示的问题,很有参考价值。根据这个修改一下,应该可以实现你所要实现的功能。

WinCC Trend in WebNavigator

Nov 30, 2003 1:17 pm, by R.K.

Subject : HMI

from the Automation List dept.

Text :

Hello,

I would like to plot an array in WinCC coming from a PLC. I am trying to create this graph using the Trend Control supplied by WinCC. I've got a loop that adds the points to the graph and then displays them and it works beautifully in WinCC Runtime, but does not in web Navigator. Does anyone know if there is a special initialization process needed to have it run properly on web navigator? Attached below is my code:

// WINCC:TAGNAME_SECTION_START

// syntax: #define TagNameInAction "DMTagName"

// next TagID : 1

// WINCC:TAGNAME_SECTION_END

#define TAG_M12_0312_Det2_Curve_Force_Live "M12_0312_Det2_Curve_Force_Test" // Force is an INT (2 Bytes)

#define TAG_M12_0312_Det2_Curve_Pos_Live "M12_0312_Det2_Curve_Pos_Test" // Position is an INT (2 Bytes)

//-------- Not Neccessary------------------

//#define nbByte_for_INT sizeof(int) //BYTE (default format for a raw tag ...)

#define nbByte_for_DINT sizeof(float) //BYTE (default format for a raw tag ...)

#define nbByte_for_REAL sizeof(long) //BYTE (default format for a raw tag ...)

#define nbSamples_Array 100 // Size of the arrays that contains Force and Position data curve analysis

#define szData_Force nbSamples_Array*nbByte_for_REAL // Force Values are REAL (4 Bytes)

#define szData_Position nbSamples_Array*nbByte_for_DINT // Position Values are DINT (4 Bytes)

//#define szData_Time nbSamples_Array*nbByte_for_DINT // TimeValues are DINT (4 Bytes)

//Declaration of Force and Position input arrays

float *Force_2;

long *Position_2;

double Force_Detail2[100];

double Position_Detail2[100];

unsigned int j;

unsigned int i;

unsigned int Null_Count_Force_2=0;

unsigned int Null_Count_Position_2=0;

static double ForceMax_Detail2;

static double PositionMax_Detail2;

// Creation of the BYTE array in which the values of the raw data tag are stored

BYTE byData_Force[szData_Force];

BYTE byData_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);

// Pointer to Raw Data Array

Force_2=byData_Force[0];

Position_2=byData_Position[0];

//Verification of actual values

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\n Force Values are =\r\n");

for (j=0;j100;j++)

{

printf("%e \r\n", Force_Detail2[j]);

}

printf("\r\n Position Values are =\r\n");

for (j=0;j100;j++)

{

printf("%e \r\n", Position_Detail2[j]);

}

//Plot Graph

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组态里的C语言程序如下:

void onlbuttondown(char*lpszpicturename,char*lpszpropertyname,uintnflags,intx,inty)

//lp指的是longpoint,其实就是指针,鼠标键按下,操作系统返回消息,调到这个程序来进行响应处理,从传进来的参数可以看出,一参:图片名称,二参:属性名称,三参:标志位:第4,5个参数表示键被按下时的鼠标位置,x和y坐标。

函数中有4个函数,都是以set开头的,说明是一些基本的设置,你可以右键goto definition(转到定义),看看函数声明,来确定函数具体做了哪些事,定义了哪些参数。

个人感觉是动态的改变了一些窗体的原有属性,貌似基本都是改变外观和显示状态了。

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);

}


本文名称:c语言setprop函数 Setprop
网站路径:http://cdweb.net/article/hgcjjh.html