andreahmed
Member
I'm running a PLC simulation software and I have a client Qt, I get the data which is a temperature from the PLC and it's running its own internal operating system. At Qt client I'm running a thread every 1 second and I plot the temperature and the time, but its not accurate, how would I sync the data with the plc simulation software
In PLC
timer(IN := TRUE, PT:=tAbsoluteTime);
IF(timer.Q) THEN
rT := rT + 1/TIME_TO_REAL(tAbsoluteTime);
rOut := (1 - rT) * sPoints[iStartIndex].rTemperature + rT * sPoints[iEndIndex].rTemperature;
IF(rOUT > 0) THEN
bStartCounting := TRUE;
END_IF
timer.IN := FALSE;
rTickCount := rTickCount + 1;
END_IF
In Qt, I'm just running a timer with T = 1 Second and I'm reading rOut from it.
In PLC
timer(IN := TRUE, PT:=tAbsoluteTime);
IF(timer.Q) THEN
rT := rT + 1/TIME_TO_REAL(tAbsoluteTime);
rOut := (1 - rT) * sPoints[iStartIndex].rTemperature + rT * sPoints[iEndIndex].rTemperature;
IF(rOUT > 0) THEN
bStartCounting := TRUE;
END_IF
timer.IN := FALSE;
rTickCount := rTickCount + 1;
END_IF
In Qt, I'm just running a timer with T = 1 Second and I'm reading rOut from it.