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
That’s not OpenPLC Editor. That’s why the tool didn’t work. It expects the original OpenPLC Editor installed at its default path.
Reply 0 0
songyanghua
那不是OpenPLC编辑器。这就是该工具不起作用的原因。它期望在其默认路径上安装原始 OpenPLC 编辑器。
Oh my gosh, does this tool only work on the default path? Can I move the original editor to another location?
Reply 0 0
songyanghua
That’s not OpenPLC Editor. That’s why the tool didn’t work. It expects the original OpenPLC Editor installed at its default path.
31.pngHello, may I ask why there are so many errors when I customize an XNOR operator like this? What should I do?
Reply 0 0
songyanghua
That’s not OpenPLC Editor. That’s why the tool didn’t work. It expects the original OpenPLC Editor installed at its default path.
What type of variable is PT here? If I want to determine if the input I input is a decimal, and if so, I will output my ERROR pin as TRUE, how should I write the judgment condition for if? Can you give me an example to take a look at? Thank you very much for answering my question32.png
Reply 0 0
thiagoralves
This is something the compiler checks, not you. If you define your input to be of type TIME, than any variable connected to that pin with type different than TIME will cause a compilation error.
Reply 0 0
thiagoralves
songyanghua wrote:
Oh my gosh, does this tool only work on the default path? Can I move the original editor to another location?
If you move the Editor to another path you will have to modify the code of the import tool to look at a different path.
Reply 0 0
songyanghua
This is something the compiler checks, not you. If you define your input to be of type TIME, that any variable connected to that pin with type different than TIME will cause a compilation error.
Oh no, I just want the PT value I input to be an integer. If I input a decimal, I will make my error pin true. I just don't know how to make this judgment?
Reply 0 0
thiagoralves
What is the difference between integer and decimal?
Reply 0 0
songyanghua
整数和十进制有什么区别?
Maybe you don't understand what I mean. For example, the current PT parameter is 150ms. When I modify the PT parameters I can change it to 151ms or 160ms etc. However, I cannot configure the parameter to 150.5ms because I only want the minimum parameter configured to be 1ms and not 0.5ms. So what I mean is, if you want to configure it to 150.5ms, then I would make my ERROR pin output TRUE and reset the PT value. Can you understand?
Reply 0 0
thiagoralves
In that case you can change your input pin to be an INT (or UINT, DINT, LINT or any other integer variations depending on your size requirements). Inside the block you convert that number to TIME in ms. This will prevent the user to input any millisecond fraction.
Reply 0 0
songyanghua
In that case you can change your input pin to be an INT (or UINT, DINT, LINT or any other integer variations depending on your size requirements). Inside the block you convert that number to TIME in ms. This will prevent the user to input any millisecond fraction.
I understand what you mean, but there is a question. How can I convert this number into a TIME in milliseconds within a block? Which control is used? Can you give an example and take a screenshot? Thank you.
Reply 0 0
thiagoralves
Screenshot 2023-10-23 at 11.10.21 AM.png
Reply 0 0
thiagoralves
The only catch is that this block converts INT to TIME in seconds. So, if you input INT 2, it will convert to T#2s. If you want the time in the millisecond range, then you will have to convert your INT to REAL first, then divide the value by 1000.0 (to get a fraction) and then use the REAL_TO_TIME block to convert to TIME. This essentially means that if the user inputs 2, it will be converted to 2.0, then divided by 1000.0 will become 0.002, and then when converted to TIME will finally become T#2ms.
Reply 0 0
songyanghua
I think this method is suitable for us: convert INT to REAL, then divide the value by 1000.0, and then use REAL_ TO_ The TIME block converts it to TIME. There are two questions: 1. Is there a block that can be directly used to convert int to REAL? I don't seem to have found it in the library. 2. REAL_ TO_ Is the TIME block also ready-made?
Reply 0 0
songyanghua
唯一的问题是该块将INT转换为TIME(以秒为单位)。所以,如果你输入INT 2,它将转换为T#2s。如果您希望时间在毫秒范围内,那么您必须首先将INT转换为REAL,然后将值除以1000.0(得到一个分数),然后使用REAL_TO_TIME块将其转换为TIME。这基本上意味着如果用户输入2,它将被转换为2.0,然后除以1000.0将成为0.002,然后当转换为时间将最终成为T#2ms。
Received your reply and sent my question. Thank you for your answer
Reply 0 0
Reply