Page 1 of 1

Weird timing difference between Script Editor and Sequence

Posted: Mon Aug 22, 2022 4:01 pm
by brad992
EDIT:Ok so it turns out my original explanation for the issue is wrong. Meaning that simply subtracting 15ms does not work. It seemed to work in many of my cases but completely wrong in other cases. I’ve done a fair bit more messing around and I think I understand the issue better now.

It seems to me what is happening when I type “wait:120ms” is that it is actually waiting for 139ms. However, when I type “wait:105ms” it seems to be waiting for 119ms. So I experimented more and typed things like “wait:110ms” and “wait:115ms” and in both of these cases seems to be waiting for 119ms.

This explains why subtracting 15ms worked in my first scenario. However in a different scenario where I want to have “wait:135ms”, this appears to be rounding to 139ms. Subtracting 15ms changes it to “wait:120ms” but again is still waiting for 139ms. The only solution I can come up with for this case is to alternate having “wait:119ms” and “wait:139ms” in a way that makes the average time to be 135ms. Not something which is at all easy for me to do.

Long story short, the way I understand it now is that whatever time you put in, it rounds it up to the nearest 20ms. Maybe the take home message is to avoid using the Script Editor?



I think I've finally figured out this timing issue I've been having using the Script Editor vs using a Sequence.

I've created a Sequence which has 128 steps, and each step is 120ms. This Sequence takes 15,360ms. This is exactly what I expect, perfect.

However, if I instead create the exact same thing but this time in the Script Editor, ie., the same 128 steps with a "wait:120ms" between each of the steps, it takes a total of 17,280ms. That is weird... Why do they not take the exact same time to run? Well I think I figured it out. It seems to me that typing "wait:120ms" is actually waiting for 135ms. It seems to add approximately another 15ms.

How did I figure this out? Well I experimented by changing each wait to "wait:105ms" and this time the total time to run was 15,360ms, just as I would expect if the wait time was in face 120ms. Next, I tried two waits between each step, ie., "wait:45ms" twice in a row. This gave me the same total time of 15,360ms. Now I am convinced that every time you use the wait command, it adds 15ms on top.

The take home message here is if you are using the Script Editor then you may need to subtract 15ms from each time you use the wait command. I will need to test this more but this has solved all my timing issues in the Script Editor instantly so far. This really has been bugging me for days. Hopefully this helps someone else out there experiencing the same issue.


version 4.12.5, windows 10

Re: Weird timing difference between Script Editor and Sequence

Posted: Tue Aug 23, 2022 11:31 am
by GGGss
brad992 wrote: Mon Aug 22, 2022 4:01 pm typing "wait:120ms" is actually waiting for 135ms. It seems to add approximately another 15ms.
As far as I am aware, the script engine does 1 step per internal QLC+ cyclus; thus explaining the 15ms latency.

Re: Weird timing difference between Script Editor and Sequence

Posted: Wed Aug 24, 2022 4:17 am
by brad992
Ok so it turns out my original explanation for the issue is wrong. Meaning that simply subtracting 15ms does not work. It seemed to work in many of my cases but completely wrong in other cases. I’ve done a fair bit more messing around and I think I understand the issue better now.

It seems to me what is happening when I type “wait:120ms” is that it is actually waiting for 139ms. However, when I type “wait:105ms” it seems to be waiting for 119ms. So I experimented more and typed things like “wait:110ms” and “wait:115ms” and in both of these cases seems to be waiting for 119ms.

This explains why subtracting 15ms worked in my first scenario. However in a different scenario where I want to have “wait:135ms”, this appears to be rounding to 139ms. Subtracting 15ms changes it to “wait:120ms” but again is still waiting for 139ms. The only solution I can come up with for this case is to alternate having “wait:119ms” and “wait:139ms” in a way that makes the average time to be 135ms. Not something which is at all easy for me to do.

Long story short, the way I understand it now is that whatever time you put in, it rounds it up to the nearest 20ms. Maybe the take home message is to avoid using the Script Editor?

Re: Weird timing difference between Script Editor and Sequence

Posted: Wed Aug 24, 2022 4:19 am
by brad992
GGGss wrote: Tue Aug 23, 2022 11:31 am
brad992 wrote: Mon Aug 22, 2022 4:01 pm typing "wait:120ms" is actually waiting for 135ms. It seems to add approximately another 15ms.
As far as I am aware, the script engine does 1 step per internal QLC+ cyclus; thus explaining the 15ms latency.
Thank you for your response. But I don't understand the technical details enough to understand your comment, is it possible to explain in layman's terms?

Re: Weird timing difference between Script Editor and Sequence

Posted: Wed Aug 24, 2022 6:30 am
by janosvitok
QLC+ computes a frame every 1/50 second = 20 ms. You can adjust the master timer as you wish: https://www.qlcplus.org/docs/html_en_EN ... asterTimer (Section 4.5).
Ideally, you match this to your DMX/artnet frequency somehow (that is normally 1/44 s =~ 23ms).

Re: Weird timing difference between Script Editor and Sequence

Posted: Wed Aug 24, 2022 9:24 am
by brad992
janosvitok wrote: Wed Aug 24, 2022 6:30 am QLC+ computes a frame every 1/50 second = 20 ms. You can adjust the master timer as you wish: https://www.qlcplus.org/docs/html_en_EN ... asterTimer (Section 4.5).
Ideally, you match this to your DMX/artnet frequency somehow (that is normally 1/44 s =~ 23ms).
Thank you very much for this information! I think this is exactly the information I was looking for. I'm really glad to know this now. I really never considered this to be a thing. I will experiment with changing the master timer, but I imagine it is set to the default value for a good reason

Re: Weird timing difference between Script Editor and Sequence

Posted: Wed Aug 24, 2022 10:15 am
by GGGss
brad992 wrote: Wed Aug 24, 2022 9:24 am I really never considered this to be a thing.
Off topic: During high school, defending my master paper, one specialist came up with exact this question ... one to never forget: "What does influence the internal timing of this type of PLC controller?" Seemed, afterwards, the time the PLC needed to read all inputs, which took quite some time compared to the whole processing and equation time needed. I passed without problem, it was a sleeky question to get me blocked into the corner.