Managing data through instance parameters
When creating standard objects that have multiple methods of operation, it is worth considering which resources may be shared between the methods that an object can use. Sharing resources has a positive impact on memory allocation and simplification of an object.
Principle to this approach
Consider a standard control object that can be run in one of three modes. Only one mode can be run at any one time. You can see an example of this in the following screenshot:
The standard control object accepts a common data structure (UDT, for example) and contains logic to read the selected method. In Figure 8.7, the three methods contain different timers that are in use. All methods require at least one timer, with the largest method (Method 1) requiring three timers.
If a function block were written in this manner, it would...