CS3000中SFC用SEBOL编写的技巧? 还有就是assign,与alias的区别,不明白,望指较 下面的手册原句能解答你关于声明功能块类型错误的问题: during compilation, the following checks are performed with respect to the data item name: • whether a data item exists in the function block • whether it is possible to write to the data item with an assignment statement or group assignment statement • whether calculations appropriate to the data type of the data item are being performed for example, it is checked if data in the character-string format is being designated for the operand of the arithmetic operator, or if numeric data is being assigned to the character-string variable if an error is detected, a compile error will occur. during compilation, it is not checked whether the tag names declared in “block” statements have been defined using the function block detail builder. if a tag name that has not been defined using the function block detail builder is used, a run-time error occurs. 也就是说如果你功能块类型声明错了系统就当你还没定义这个功能块,因此编译时不报错。 另外,关于alias和assign, alias是常规意义的变量声明,在一个程序中如果需要用到的某个tag是以数字开头为了不让程序误解为数字+tag或者把含有横线的tag名的横线当成减号;所以我们需要声明。如下面的句子,将pid-001声明为pid_001,并执行动作。 block pid pid_001 alias pid-001 ...... pid_001.sv = 100.0 !use the alias in the program. ...... assign实际上只是开辟一个内存单元,它不能单独用,要结合local genname或unit genname来用。比如说下面的语句: genname pid tag001 integer a ...... switch (a) case 0: assign "pic001" to tag001 case 1: assign "pic002" to tag001 otherwise: assign "pic003" to tag001 end switch tag001.sv = 100.0 !set 100.0 to pic001.sv ...... tag001是genname(变量),对应的实际仪表并没有被分配,而是利用后续的语句assign "pic00?" to tag001来把实际的pic00?分配给tag001。 横河手册很详细的,所有工程问题你都能在手册上找到答案。 查看更多