9/17/2019 12:49 PM | |
Joined: 4/11/2012 Last visit: 12/4/2023 Posts: 176 Rating: (34) |
Then you have a system where non-safety program is telling safety program that "The value you are looking for is This one here". And everything the safety program does after that is based on a non-safe signal. Do NOT do this! Starting with the safety program can be frustrating at the beginning. Not being able to use EN operation is tough, even stuff that is supposed to be easy needs complex structures. Jump operation is almost the only way forward, if you want to sometimes do an operation and sometimes not, depending on conditions. Try to keep the Jump operations easy to notice and name them clearly. Also consider operations where you perform the ADD operation every cycle, but set the value to zero (with a jump) if you don't want to perform the operation. Or other similar program structures that could make your life easier. Alternatively, depending on your program structure, you can use RET operation. For example, if you create a conditional Add subprogram, if you don't want to perform the calculation, terminate the subprogram with RET before the calculation is performed. That way you don't need the jumps. Keep the programs small so that each program will only have a very limited amount of jumps. Use subprograms whenever possible. Maybe even create a subprogram for the conditional ADD operation? By the way, check the LF_Math library from Siemens. The LFMath functions will automatically check the calculation for overflow so you don't need to worry about it. (Division by zero in safety program = PLC probably goes to stop). The LFMath functions take more PLC resources though, so you might want to use the normal calculation operations in their place if you know that the calculation can never overflow. https://support.industry.siemens.com/cs/ww/en/view/109482083 (And if you take the LFMath functions to use and then find that you can't simulate your program anymore, check this topic here: Cannot simulate LGF library blocks in PLCSim Advanced) |
Last edited by: Elonen at: 09/17/2019 13:01:20Added details on why the LFMath is useful and on the possible issue with simulation. |
|
Follow us on