songyanghua
Hello, when I referenced the official document ADDING NEW BLOCKS TO OPENPLC EDITOR'S LIBRARY to create a custom block, I found an error during compilation and found that TEST was not found. After checking, I followed the requirements of each step to set it. On the Win11 system, I hope you can help me. I haven't found the reason for several days!
0e3299f2fb9758a349c83a334cb4c0dd.png17c9f4a5a9e78bda26026cd8e97fa14d.png49e31f5864b567d4db9f47ca35ae5488.png

Delete that module to pass

Reply 0 0
thiagoralves
You can use INT_TO_REAL() and REAL_TO_TIME() for conversions.
Reply 0 0
songyanghua
您可以使用 INT_TO_REAL() 和 REAL_TO_TIME() 进行转换。
Ok, I see. Thanks. I saw that piece and had another question. What if I want the minimum increase of 1ms to be 10ms? How should I judge? For example, the current PT parameter is 150ms. When I modify the PT parameters I can change them to 160ms or 190ms etc. However, I cannot configure the parameter to 150.5ms or 155ms because I only want to configure the minimum parameter to 10ms, not 0.5ms and 1ms.
Reply 0 0
thiagoralves
It looks like you're overcomplicating your project, but anyway, you can for example say in your block description that your input is in the order of tens of milliseconds (which is weird, but, ok). So whatever the user inputs will be multiplied by 10 resulting the final value. So an input of 3 will become 30ms. An input of 15 will become 150ms, and so on...
Reply 0 0
songyanghua
看起来你把你的项目过于复杂了,但无论如何,你可以在你的块描述中说你的输入是几十毫秒的数量级(这很奇怪,但是,没关系)。因此,无论用户输入什么,都将乘以 10,从而得到最终值。因此,输入 3 将变为 30ms。15 的输入将变为 150ms,依此类推...
好的,非常感谢您的回复。我会尝试实现它
Reply 0 0
songyanghua
看起来你把你的项目过于复杂了,但无论如何,你可以在你的块描述中说你的输入是几十毫秒的数量级(这很奇怪,但是,没关系)。因此,无论用户输入什么,都将乘以 10,从而得到最终值。因此,输入 3 将变为 30ms。15 的输入将变为 150ms,依此类推...
33.png为什么 in1 在这里编译时需要连接?34.png已连接或报告错误?
Reply 0 0
songyanghua
35.png36.pngWhy does this error appear when clicking on simulation again? I haven't made any changes to the code, so I can use it in the first few minutes, but I can't use it in the next few minutes? Looking forward to your reply. Thank you
Reply 0 0
songyanghua
37.png38.png39.png40.png
When I conduct simulation tests on custom blocks and find that they meet my requirements, and then use the tool to add them to the editor, I will find that the PT value at this time has not been transmitted. Is it a code issue generated by the tool? I also found that the XML file at this time will display this PT error. I don't know why?
Reply 0 0
songyanghua
41.png42.png
The above is the logic code generated automatically through tools. Is it a logical issue with automatically generating code? Please correct my mistake, thank you
Reply 0 0
songyanghua
Is it LINT_ REAL and REAL_ Is there a problem with the TIME control when using the tool? Do I think the values in them are all empty? Thank you very much for your answer. Thank you!
Reply 0 0
thiagoralves
What makes you think that the values are empty? Is the imported block behavior any different from when you tested it before importing?
Reply 0 0
songyanghua
是什么让你认为这些值是空的?导入的块行为与导入前测试时的行为有什么不同吗?
I've found the reason. When the tool is generated, it changes max and min to 0, so it cannot be passed in
Reply 0 0
songyanghua
松阳华 wrote:
我已经找到了原因。生成工具时,它将 max 和 min 更改为 0,因此无法传入
 
是什么让你认为这些值是空的?导入的块行为与导入前测试时的行为有什么不同吗?
What should I do if I want the user to be prompted when configuring a pulse width input outside of the 0-300000 ms range and need to re-enter it without letting it compile? I currently only use LIMITED to limit this scope, but how should I prompt the user? Or how to report a bug?
Reply 0 0
songyanghua
That is to say, when the program is not running and the pulse width is being configured, an error will be reported if the configuration is not within the range. Which block should be used?
Reply 0 0
thiagoralves
Such thing does not exist. You would have to refactor and add a lot of code on the editor. 
Reply 0 0
songyanghua
这样的事情是不存在的。您必须在编辑器上重构并添加大量代码。
Is there an easy way, like dragging and dropping a control with a comment box, to tell the user that I need to enter a range of 0-300000 milliseconds?
Reply 0 0
Reply