你现在位置:首页>技术论文>软件知识>正文
基于SCL语言的矩阵计算
日期:2009-12-2 8:21:56 点击:
来源:本站整理
作者:
点击【】放大字体.

Many different high-performance functions for process control process multiple input and output sizes and therefore in the relevant specialist literature they are formulated mathematically using matrices and matrix operations. Examples include state regulators, monitors, Kalman filters, predictive regulators and process simulators.

W1WW_P4LCJS_COM-PLC-技.术_网

Such functions are relatively easy to implement on a PC by incorporating prepared numerical libraries, but are very complicated to realize on the SIMATIC systems (S7 or PCS 7), because all matrix operations must be programmed manually through nested loops in the high-level language SIMATIC S7-SCL.
WWcW_PLCJS_COM-PLC-技.术_网

Solution:
WWW.PLCJS.COM——可编程控制器技术门户

As a solution we are offering you a small library of prepared functions for processing matrices in S7-SCL. A matrix is declared as a UDT (User-Defined Data Type), that contains header information about the number of rows and columns and the matrix elements in the form of a two-dimensional array. Vectors are handled as special cases of matrices with a column number of 1. At least the following prepared functions are provided as FCs for all variables of this data type:
WWW_P※LCJS_COM-PLC-)技.术_网

Matrix Addition and Subtraction
WWW_PL※CJS_COM-PLC-技.术_网

Matrix Multiplication
WW.W_PLCJS_COM-PLC-技.术_网

Transposition
W1WW_P4LCJS_COM-PLC-技.术_网

Inversion
WWW_PLCJ-S_COM-PLC-技.术_网(可-编程控-制器技术-门户)

Functions are also provided to generate a zero matrix or a unit matrix of preset dimensions
WWW_PLC※JS_COM-PmLC-技.术_网

User-defined data type (UDT): "Matrix"
WWW_PLC※JS_COM-PmLC-技.术_网

The user-defined data type "MATRIX" is a data structure (STRUCT), which consists of two integer variables and a two-dimensional array of the Real type. The integer variables specify the number of rows and columns of the matrix concerned and the array contains the matrix elements. Since it is not possible to change the dimensions of the array dynamically, the size of the field must be defined beforehand in the variable declaration. Here you must make sure that the dimensions selected match at least the largest matrix occurring in the S7 program. An array size of 4 x 4 has been chosen as the presetting. To simplify matters no separate data type has been defined for the vectors, but the data type "MATRIX" has been used as well.
plcjs.技.术_网

Function for matrix addition: FC "MxAdd"
WWW※PLCJS_COM-PL#C-技.术_网(可编※程控※制器技术门户)

The function "MxAdd" is for adding two matrices of the data type MATRIX. Before calculation a check is made as to whether both matrices have the same dimensions. In case of error, a matrix with the dimensions 0x0 is returned as a result.
WWW_PL※CJS_COM-PLC-技.术_网

Example for calculating AplusB = Am + Bm in the S7-SCL source text (sh.TestMatrixOperationen.SCL) with the function call:
WWW_P※LCJS_CO※M-PLC-技-.术_网

MxAdd( MxA:= Am, MxB:= Bm, MxC:= AplusB);
P_L_C_技_术_网——可——编——程——控-制-器-技——术——门——户

Function for matrix subtraction: "FC MxSub"
WWW_PLC※JS_COM-PmLC-技.术_网

The function "MxSub" subtracts two matrices of the data type MATRIX from each other. Here, too, before calculation a check is made as to whether both matrices have the same dimensions and in case of error a 0x0 matrix is returned as a result.
WWW_PLCJS※COM-PLC-技×术_网(可编程控※制器技术门户)

Function for matrix multiplication: FC "MxMul"
WW.W_PLC※JS_C,OM-PL,C-技.术_网

The function "MxMul" is for multiplying two matrices. The calculation is executed only if the number of columns of the first matrix matches the number of rows of the second matrix. Otherwise the return value of the function is once again a matrix with the dimensions 0x0.

本新闻共2页,当前在第11 2  
P_L_C_技_术_网——可——编——程——控-制-器-技——术——门——户

评论内容
载入中...
相关文章
商城相关
相关下载
博客相关
论坛相关
P
L
C



|










|


P
L
C









·最新招聘信息
·最新求职信息
·推荐产品
·推荐厂商
深圳秦合源科技有限公司 
   深圳市秦合源科技有限公司是国内领先的规模较大品种齐全的称重传感器(Loadce......
广州汇巨自动化设备有限公司 
   广州汇巨自动化设备有限公司是一家专业工业自动化产品和自动化设备开发、维修改造、电......
深圳联脉电子有限公司 
   公司自1998年创立以来,一直致力于工业控制产品的研发、制造、销售,目前有机房监......
北京力天昭阳科技发展有限公司 
   北京力天昭阳科技发展有限公司(PekingPowerSkyScience&......
东莞市友诚自动化 
   本公司专业代理台湾永宏、台达PLC、HITECH人机、特价供应文本显示器MD20......
深圳市爱威轮实业有限公司 
   爱威轮实业对广大用户的技术支持与服务,贯穿于与客户接触的每一个环节中,渗透在每一......
·栏目热门排行
·站内热门排行
载入中。。
报告错误·关于我们· 用户帮助· 联系我们 · 友情链接· 本站服务 · 合作伙伴 · 版权声明· 招聘信息 · 投搞指南

迅闻自动化工程部声明如下:
旗下网站:PLC技术网(www.plcjs.com)-可编程控制器技术门户
网站备案号:粤ICP备17165530号
网站法律顾问:ITLAW-庄毅雄律师
法律保护:PLC技术网,迅闻电子,plcjs.com,plcjs.net,plcjs.cn等字样

Copyright 2010-2015. All rights reserved. 

51La