用C脚本实现数据堆栈 最近公司搞了个手机网页看WINCC,让客户实现随时随地的查看现场数据,之前只是看实时的数据和趋势图,前不久一个客户提出要看在线报表,现场上位机上做了半小时一归档的数据报表,可是这个报表控件网页显示不了,问了西门子的技术支持,说是目前WINCC 7.3的该控件不能支持发布在网页上,郁闷啊!!!于是乎就用脚本做了个数据堆栈,半小时触发一次,模拟了在线报表。 采用的是WINCC内部变量,脚本如下: float a,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10; float a11,a12,a13,a14,a15,a16,a17,a18,a19,a20; float a21,a22,a23,a24,a25,a26,a27,a28,a29,a30; float a31,a32,a33,a34,a35,a36,a37,a38,a39,a40; float a41,a42,a43,a44,a45,a46,a47,a48;
a=GetTagFloat("lzwendu1"); //Return-Type: float
SetTagFloat("a1",a); //Return-Type: BOOL
a1=GetTagFloat("a1"); //Return-Type: float
SetTagFloat("a2",a1); //Return-Type: BOOL a2=GetTagFloat("a2"); //Return-Type: float
SetTagFloat("a3",a2); //Return-Type: BOOL a3=GetTagFloat("a3"); //Return-Type: float
SetTagFloat("a4",a3); //Return-Type: BOOL a4=GetTagFloat("a4"); //Return-Type: float
SetTagFloat("a5",a4); //Return-Type: BOOL a5=GetTagFloat("a5"); //Return-Type: float
SetTagFloat("a6",a5); //Return-Type: BOOL a6=GetTagFloat("a6"); //Return-Type: float
SetTagFloat("a7",a6); //Return-Type: BOOL a7=GetTagFloat("a7"); //Return-Type: float
SetTagFloat("a8",a7); //Return-Type: BOOL a8=GetTagFloat("a8"); //Return-Type: float
SetTagFloat("a9",a8); //Return-Type: BOOL a9=GetTagFloat("a9"); //Return-Type: float
SetTagFloat("a10",a9); //Return-Type: BOOL a10=GetTagFloat("a10"); //Return-Type: float
SetTagFloat("a11",a10); //Return-Type: BOOL a11=GetTagFloat("a11"); //Return-Type: float
SetTagFloat("a12",a11); //Return-Type: BOOL a12=GetTagFloat("a12"); //Return-Type: float
SetTagFloat("a13",a12); //Return-Type: BOOL a13=GetTagFloat("a13"); //Return-Type: float
SetTagFloat("a14",a13); //Return-Type: BOOL a14=GetTagFloat("a14"); //Return-Type: float
SetTagFloat("a15",a14); //Return-Type: BOOL a15=GetTagFloat("a15"); //Return-Type: float
SetTagFloat("a16",a15); //Return-Type: BOOL a16=GetTagFloat("a16"); //Return-Type: float
SetTagFloat("a17",a16); //Return-Type: BOOL a17=GetTagFloat("a17"); //Return-Type: float
SetTagFloat("a18",a17); //Return-Type: BOOL a18=GetTagFloat("a18"); //Return-Type: float
SetTagFloat("a19",a18); //Return-Type: BOOL a19=GetTagFloat("a19"); //Return-Type: float
SetTagFloat("a20",a19); //Return-Type: BOOL a20=GetTagFloat("a20"); //Return-Type: float
SetTagFloat("a21",a20); //Return-Type: BOOL a21=GetTagFloat("a21"); //Return-Type: float
SetTagFloat("a22",a21); //Return-Type: BOOL a22=GetTagFloat("a22"); //Return-Type: float
SetTagFloat("a23",a22); //Return-Type: BOOL a23=GetTagFloat("a23"); //Return-Type: float
SetTagFloat("a24",a23); //Return-Type: BOOL a24=GetTagFloat("a24"); //Return-Type: float
SetTagFloat("a25",a24); //Return-Type: BOOL a25=GetTagFloat("a25"); //Return-Type: float
SetTagFloat("a26",a25); //Return-Type: BOOL a26=GetTagFloat("a26"); //Return-Type: float
SetTagFloat("a27",a26); //Return-Type: BOOL a27=GetTagFloat("a27"); //Return-Type: float
SetTagFloat("a28",a27); //Return-Type: BOOL a28=GetTagFloat("a28"); //Return-Type: float
SetTagFloat("a29",a28); //Return-Type: BOOL a29=GetTagFloat("a29"); //Return-Type: float
SetTagFloat("a30",a29); //Return-Type: BOOL a30=GetTagFloat("a30"); //Return-Type: float
SetTagFloat("a31",a30); //Return-Type: BOOL a31=GetTagFloat("a31"); //Return-Type: float
SetTagFloat("a32",a31); //Return-Type: BOOL a32=GetTagFloat("a32"); //Return-Type: float
SetTagFloat("a33",a32); //Return-Type: BOOL a33=GetTagFloat("a33"); //Return-Type: float
SetTagFloat("a34",a33); //Return-Type: BOOL a34=GetTagFloat("a34"); //Return-Type: float
SetTagFloat("a35",a34); //Return-Type: BOOL a35=GetTagFloat("a35"); //Return-Type: float
SetTagFloat("a36",a35); //Return-Type: BOOL a36=GetTagFloat("a36"); //Return-Type: float
SetTagFloat("a37",a36); //Return-Type: BOOL a37=GetTagFloat("a37"); //Return-Type: float
SetTagFloat("a38",a37); //Return-Type: BOOL a38=GetTagFloat("a38"); //Return-Type: float
SetTagFloat("a39",a38); //Return-Type: BOOL a39=GetTagFloat("a39"); //Return-Type: float
SetTagFloat("a40",a39); //Return-Type: BOOL a40=GetTagFloat("a40"); //Return-Type: float
SetTagFloat("a41",a40); //Return-Type: BOOL a41=GetTagFloat("a41"); //Return-Type: float
SetTagFloat("a42",a41); //Return-Type: BOOL a42=GetTagFloat("a42"); //Return-Type: float
SetTagFloat("a43",a42); //Return-Type: BOOL a43=GetTagFloat("a43"); //Return-Type: float
SetTagFloat("a44",a43); //Return-Type: BOOL a44=GetTagFloat("a44"); //Return-Type: float
SetTagFloat("a45",a44); //Return-Type: BOOL a45=GetTagFloat("a45"); //Return-Type: float
SetTagFloat("a46",a45); //Return-Type: BOOL a46=GetTagFloat("a46"); //Return-Type: float
SetTagFloat("a47",a46); //Return-Type: BOOL a47=GetTagFloat("a47"); //Return-Type: float
SetTagFloat("a48",a47); //Return-Type: BOOL
用C脚本实现数据堆栈
以上就是最终效果,做的比较粗糙,不知道各位大侠有没有其他的方法能实现该功能,如果有简单的方法望赐教!!! 另外小弟还有一个问题,这个脚本用周期性触发,比如半小时、一小时什么的就可以按照这个时间周期每次自动实现数据记录一行,同时将上次保存数据依次下移一行。 但如果用变量触发就会记录两行,变量有0变1的时候记录一次,有1变0的时候又记录一次(该变量1的状态会持续一段时间,时间从几十秒到一两分钟每次不同),不知道为什么???变量触发的话要怎么设置才能实现只是变量0变1的时候记录一次呢???望赐教!!!
|