Download Application Software Development via Model Based Design
Transcript
62 of small changes is not always this radical, but this example shows how hard it can be to predict the generated code. With small and simple tasks, the MATLAB function block generation works very well, but it requires always a very careful examination of the generated code to make sure that the code is somewhat reasonable. One good example of the MATLAB function block is presented in figure 44. With a simple if structure we can easily replace the Merge block which is not allowed in the current version of PLC Coder. Without the Merge block the Simulink’s if-structure is somewhat impossible to use. Figure 44. With a simple MATLAB function block we can easily replace the unsupported Merge block. 8.1.3 Multiple task execution time levels Handling the different time levels is crucial in any software development work. The logic controllers have quite often multiple execution time levels, which are usually structured with either timer variables or with IEC-61131 tasks. PLC Coder has a full support for multiple time levels, which are carried out by using IF-statements and additional timer variables called ‘plc_ts_counter’.