Hi @d.perla ,
Iβm sure there is a point that I donβt get it so I need your help to reproduce your sequence.
In my test I have declared 5 MpDataRegPar FUBs and one MpDataRecorder, where only one MpDataRegPar FUB is enabled in the _INIT:
//5 global variables
VAR
gTemperature1 : REAL;
gTemperature2 : REAL;
gTemperature3 : REAL;
gTemperature4 : REAL;
gTemperature5 : REAL;
END_VAR
VAR
MpDataRegPar_0 : MpDataRegPar;
MpDataRegPar_1 : MpDataRegPar;
MpDataRegPar_2 : MpDataRegPar;
MpDataRegPar_3 : MpDataRegPar;
MpDataRegPar_4 : MpDataRegPar;
MpDataRecorder_0 : MpDataRecorder;
END_VAR
PROGRAM _INIT
MpDataRecorder_0.Enable := TRUE;
END_PROGRAM
PROGRAM _CYCLIC
gTemperature1 := gTemperature1 +1;
gTemperature2 := gTemperature2 +1;
gTemperature3 := gTemperature3 +1;
gTemperature4 := gTemperature4 +1;
gTemperature5 := gTemperature5 +1;
MpDataRecorder_0.MpLink := ADR(gDataRecorder);
MpDataRecorder_0.DeviceName := ADR('USER');
MpDataRecorder_0.SamplingTime := T#1s;
MpDataRecorder_0.RecordMode := mpDATA_RECORD_MODE_TIME;
MpDataRegPar_0.MpLink := ADR(gDataRecorder);
MpDataRegPar_0.PVName := ADR('gTemperature1');
MpDataRegPar_1.MpLink := ADR(gDataRecorder);
MpDataRegPar_1.PVName := ADR('gTemperature2');
MpDataRegPar_2.MpLink := ADR(gDataRecorder);
MpDataRegPar_2.PVName := ADR('gTemperature3');
MpDataRegPar_3.MpLink := ADR(gDataRecorder);
MpDataRegPar_3.PVName := ADR('gTemperature4');
MpDataRegPar_4.MpLink := ADR(gDataRecorder);
MpDataRegPar_4.PVName := ADR('gTemperature5');
MpDataRecorder_0();
MpDataRegPar_0();
MpDataRegPar_1();
MpDataRegPar_2();
MpDataRegPar_3();
MpDataRegPar_4();
END_PROGRAM
Then I command (in watch) MpDataRecorder_0.Record = True and I see TotalSamples increases
now I stop recording: MpDataRecorder_0.Record = False
In the next step I enable all MpDataRegPar FUBs:
then I command again Record=True and no issue:
then I stop recording: MpDataRecorder_0.Record = False
In the next step I disable the last 3 MpDataRegPar FUBs:
As you see below MpDataRecorder_0.Info.RegisteredPVCount = 2 (it was 5 in the previous step)
then I command again Record=True and no issue:
When I tried to enable MpDataRegPar_1 during recording I got the error (expected behavior):
so even if you change the PVName onfly on MpDataRegPar you need to disable MpDataRecorder_0.Record first.
ββββββ-
I see same behavior with AS 4.12.8:
All MpDataRegPar Fubs disabled β MpDataRecorder_0.Info.RegisteredPVCount = 0
I Enable MpDataRegPar_0 and MpDataRegPar_1 β MpDataRecorder_0.Info.RegisteredPVCount = 2
Start Recording no issue
Stop recoding: I still see MpDataRecorder_0.Info.RegisteredPVCount = 2
I Enable all MpDataRegPar Fubs β MpDataRecorder_0.Info.RegisteredPVCount = 5
Start recording β no issue
Stop recoding: I still see MpDataRecorder_0.Info.RegisteredPVCount = 5
I Enable only MpDataRegPar_0 and MpDataRegPar_1 β MpDataRecorder_0.Info.RegisteredPVCount = 2
Start recording no issue
Thanks
Ciao
Valerio