I need create certain amount of struct type pairs which will be further used as const parameters and has essentially the same set of values, but scaled in half, something like this (given a n constant):
TYPE ADDR_1 :
STRUCT
PARAMETER_A: INT :=0;
PARAMETER_B: INT :=2;
PARAMETER_C: INT :=4;
- - -
PARAMETER_n: INT :=n; (* being n any number *)
END_STRUCT
END_TYPE
And the correlate pair:
TYPE ADDR_2 :
STRUCT
PARAMETER_X: INT :=0/2;
PARAMETER_Y: INT :=2/2;
PARAMETER_Z: INT :=4/2;
- - -
PARAMETER_n/2: INT :=n/2; (* being n any number *)
END_STRUCT
END_TYPE
By creating both structs sepparately it works pretty well, I use them to create a CONST array to be used at the SWITCH...CASE statement - which as we know well, only accepts constants at their indexes, not variables.
However every change made in one structure has to be refactored in another structure, indeed not a safe approach in therms of 'best practices' designing.
The problem which I'm facing now, is that if I create CONST values at the Global Variable List (GVL), it has not precedence in compilation timeline, I mean, structs are evaluated first.
Another option were by using Pragmas, but it works only within a specific scope, which mean it would not act as 'global parameters'.
I just wanted define each above parameter before compilation in such a way I could define just once, by dividing one by other by 2.