A #TMP_BOOL_1
L #RHO_CAL
CLR
A #TMP_BOOL_2
CLR
A #TMP_BOOL_2
A #TMP_BOOL_1
L #RHO_ACT
TAK
/R
L 0.000000e+000
= L 8.4
>R
A L 8.4
JCN A7d0
SET
= #VALID
L #RHO_ACT
L #RHO_CAL
/R
SQRT
L #FLOW_TRANS
*R
T #FLOW_CORR
这个代码是怎么个逻辑啊??求解!!
问题补充:
能将这段STL代码翻译成scl代码吗?
最佳答案
此回答已完善
A #TMP_BOOL_1//判断变量TMP_BOOL_1的值,为1则rlo为1,否则rlo为0
L #RHO_CAL//读取变量值到累加器1
CLR //清除rlo状态
A #TMP_BOOL_2//判断TMP_BOOL_2的值,为1,则rlo为1,否则rlo位0
CLR //清除rlo状态
A #TMP_BOOL_2
A #TMP_BOOL_1//判断这两个bool量的值,为1则rlo为1,否则rlo为0
L #RHO_ACT//累加器1中原来的值保存到累加器2中,当前值保存到累加器1
TAK //交换累加器1和累加器2中的值
/R //累加器2除以累加器1中的值。RHO_ACT/RHO_CAL
L 0.000000e+000
= L 8.4//保存rlo状态到变量L8.4
>R
A L 8.4//如果累加器1中的计算结果大于0且L8.4为1则执行后面程序,佛祖儿跳转
JCN A7d0
SET
= #VALID//valid=1
L #RHO_ACT
L #RHO_CAL
/R
SQRT
L #FLOW_TRANS
*R
T #FLOW_CORR//FLOW_CORR=(RHO_ACT/RHO_CAL)^1/2*FLOW_TRANS
补充:
if tmp_bool_1 and tmp_bool_1 and (rho_act/rho_cal>0.0) then
valid:=1;
flow_corr:=(rho_act/rho_cal)^0.5*flow_tans;
end_if;
提问者对于答案的评价:
谢谢
原创文章,作者:more0621,如若转载,请注明出处:https://www.zhaoplc.com/plc291189.html