PLC SCL保持变量为真

发布于 2025-01-30 07:24:01 字数 320 浏览 1 评论 0原文

因此,我正在用SCL语言编写PLC代码,我想知道这件事:

我有一个带有入口的坦克和一个用于流出的泵。可以说,泵只能在储罐中的水平超出水平之后运行,可以说10米。它应该继续前进,直到坦克水平下降到4米为止。

不确定我是否应该使用更多if语句或可能使用的语句?问题是,如何在之后保持泵的运转 水平已经低于10米但尚未达到4米?

该代码可能没有用:

IF (TankLevel > 10) THEN
      StartPump := TRUE;
END_IF;

对任何帮助表示赞赏。

So I am writing a PLC code in SCL language and I am wondering about this thing:

I have a tank with an inlet and a pump for flow out. The pump should only run after the level in the tank goes beyond a level, lets say 10 meters. And it should keep going until the tank level goes down to 4 meters.

Not sure if I should use more IF statements or maybe a WHILE statement?. Problem is, how to keep the pump going after the level has gone under 10 meters but not yet reached 4 meters?

This code would probably not be useful:

IF (TankLevel > 10) THEN
      StartPump := TRUE;
END_IF;

Any help is appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

幸福%小乖 2025-02-06 07:24:01

添加elsif

IF (TankLevel > 10) THEN
    StartPump := TRUE;
ELSIF (TankLevel < 4) THEN
    StartPump := FALSE;
END_IF;

PLC程序基本上是一个大,而循环,因此可以每隔几毫秒对此进行检查。

Add an elsif

IF (TankLevel > 10) THEN
    StartPump := TRUE;
ELSIF (TankLevel < 4) THEN
    StartPump := FALSE;
END_IF;

A PLC program is basically one big while loop, so this can be checked every few milliseconds.

流云如水 2025-02-06 07:24:01

只需添加以下内容:

IF (TankLevel < 4) THEN
      StartPump := FALSE;
END_IF;

Just add the following:

IF (TankLevel < 4) THEN
      StartPump := FALSE;
END_IF;
乖不如嘢 2025-02-06 07:24:01

另一个选项,尽管这更适合梯子逻辑:

StartPump := ( (TankLevel > 10) OR StartPump ) AND NOT (TankLevel < 4);

启动泵位将以10m的形式“锁定”,直到4m发行。

Another option, although this is more suited to ladder logic:

StartPump := ( (TankLevel > 10) OR StartPump ) AND NOT (TankLevel < 4);

The StartPump bit will be "latched" at 10m until it is released at 4m.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文