组态软件实验报告(7)
时间:2025-07-14
时间:2025-07-14
endif
//桶向前移动
if nStep = =5 then
bottlemovevh= bottlemovevh—1 * mover/35;
endif
//如果到达终点,则信号灯2变红,容积清0
if nStep = =5&& bottlemovevh > =0 then
flag2=1;
depth=0;
number=number + 1;
//如果满5个,就进入运输阶段
If number= =5 then
nStep=6;
bottlemoveh=100;
//否则重新开始
else
nStep=1;
bottlemoveh=0;
endif
endif
//小车向前移动
if nStep = =6 then
carmoveh= carmoveh + 1 * mover/15;
endif
//重新开始
if nStep = =6&&carmovevh > =100 then
carmoverh=0;
nStep=1;
number=0;
bottlemoveh=0;
endif
(3)图形对象1的组态
双击图形对象(装制剂的空桶),出现“动画连接”对话框,选择“杂项/一般性动作”按钮,在“运行中周期执行”编辑区域输入脚本:
if bottlemoveh= =0||nStp= =1 then
Show( );
endif
if bottlemoveh= =100 then
hide( );
endif
然后单击“返回”按钮回到“动画连接”对话框;
单击“目标移动/垂直”按钮,弹出“水平/垂直移动”对话框,填写内容见图12.16;