Hi PLCnext Team, the README for EN/ENO is not so clearly, It only mentions three points.
- EN has to be the first defined input and be in capital letters
- ENO has to be the first defined output and be in capital letters
- On error return (ENO == false) , the outputs must be well defined
For the reader we just know these for sure.
- EN needs to be defined and to be the first in the input.
- ENO needs to be defined to be the first in the output.
- Need to handle the case when ENO == false.
This might lead readers to think that PLCnext has some kind of 'magic' that can automatically handle error situations and jump to (ENO==false). But in reality, that's not the case; users need to explicitly handle error logic themselves. So I think this part should also be included in the README, so that readers can understand it more clearly.
Besides above, i also have a question about the Demo Code
public void __Process()
{
// EN/ENO handling must be implemented by the developer
ENO = EN;
if (ENO == false)
{
SetOutputValuesToDefault();
return;
}
if (xDOWN)
{
iOUT--;
}
else
{
iOUT++;
}
// going into error state can be defined by the developer by setting ENO to false
if (iOUT < 0 || iOUT > 1000)
{
ENO = false;
}
}
// Outputs must be well defined on error return
private void SetOutputValuesToDefault()
{
iOUT = 0;
}
}
In fact, the code will never trigger SetOutputValuesToDefault() if EN is always TRUE
if EN alwayss TRUE and iOUT exceed the range (<0 or > 1000) lead to ENO = false, at the beginning the ENO=EN will override ENO=false so the iOUT will increase (or decrease) indefinitely and will never be reset to zero.
Describe the solution you'd like
A clearer README document, and whether to improve the code in the demo?
Hi PLCnext Team, the README for EN/ENO is not so clearly, It only mentions three points.
For the reader we just know these for sure.
This might lead readers to think that PLCnext has some kind of 'magic' that can automatically handle error situations and jump to (ENO==false). But in reality, that's not the case; users need to explicitly handle error logic themselves. So I think this part should also be included in the README, so that readers can understand it more clearly.
Besides above, i also have a question about the Demo Code
In fact, the code will never trigger SetOutputValuesToDefault() if EN is always TRUE
if EN alwayss TRUE and iOUT exceed the range (<0 or > 1000) lead to ENO = false, at the beginning the ENO=EN will override ENO=false so the iOUT will increase (or decrease) indefinitely and will never be reset to zero.
Describe the solution you'd like
A clearer README document, and whether to improve the code in the demo?