0

Creating an initialization function group in v4

Derek M 2 years ago in IQANdesign updated by Gustav Widén (System support) 2 years ago 3

I have a program in v4 that can't currently be upgraded, yet I need the initialization functionality like in v6. Cycle utilization is an issue so I'm looking to find out what the most efficient way to keep the controller from processing a lot of math every loop and just keeping the resulting parameters after the initial calculation.

Will an if/else statement with a static init variable accomplish this or does the controller still process all of the Qcode even if it is not executed? Is there a better way?

You can disable a function group and that will prevent the channels from being calculated, thus reducing the impact on cycle utilization. But disabling the function group sets all calculated channel values to zero. 


This is the difference with the Initialization group introduced in IQANdesign 5. This group is calculated once at startup, and after that the channel values are constant, until the application is restarted. 



On a side not, it is worth knowing that memory utilization is unaffected by disabling function groups, the whole application is always loaded into memory. 

Gustav, since disabling a function group sets channels to zero I would need to add a math channel for each parameter to store the calculation result from the function group but retain it when the function group is disabled. Is this functionally any different from having the calculations in the math channel and executing it once at startup to save to a static variable? Just the nuance here of how if/else statements are executed by the controller.

I understand this does not affect the program memory but hoping to make a dent in cycle utilization. Thanks.

When you have Qcode with an if/else statement, you can observe how each line in the branch that gets evaluated has a green indicator, and each line in the branch that is not evaluated has a gray status indicator. 

Green indicate it is calculated and ok, gray means it is not calculated.