ZIBO speed breaks
- Keith Baxter
- Posts: 4674
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: ZIBO speed breaks
Gilles,
I asked Corjan for a dataref throttle to restrict the amount of dataref fires and force calls. He provided this very useful bit of code which i manipulate and use in many instruments. Mostly CAS systems and instruments that need |dampening.
https://www.forums.siminnovations.com/v ... 769#p31769
So what happens is the callback fires the dataref call every 1000 ms. You can change that. Very useful bit of code for large dataref busses
Keith
I asked Corjan for a dataref throttle to restrict the amount of dataref fires and force calls. He provided this very useful bit of code which i manipulate and use in many instruments. Mostly CAS systems and instruments that need |dampening.
https://www.forums.siminnovations.com/v ... 769#p31769
So what happens is the callback fires the dataref call every 1000 ms. You can change that. Very useful bit of code for large dataref busses
Keith
Last edited by Keith Baxter on Mon Nov 21, 2022 1:04 am, edited 1 time in total.
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card
-
- Posts: 5336
- Joined: Thu Jul 27, 2017 12:22 am
Re: ZIBO speed breaks
Thanks Keith, I've missed this parts
I will try to figure out what's involved
I will try to figure out what's involved
- Keith Baxter
- Posts: 4674
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: ZIBO speed breaks
No worries Gilles,SimPassion wrote: ↑Mon Nov 21, 2022 1:04 am Thanks Keith, I've missed this parts
I will try to figure out what's involved
Just a bit of simple explanation for all on what we talk....
I know after reading you understand
https://www.mendix.com/blog/asynchronou ... ogramming/
So our standard coding is Synchronous (single threading) {blocking} . When we use "inline functions" ""as we call them"" then that is Asynchronous coding (multi threading) {non-blocking }
Do we see a difference in AM ? I think that depends on ones system and size of the instrument/panel.
Anyway, nice discussion and lots to think about when coding and creating one's dreams.
And sorry for taking this thread OT,
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card
-
- Posts: 5336
- Joined: Thu Jul 27, 2017 12:22 am
Re: ZIBO speed breaks
Just to be aware @Corjan, on AM insights, did you made it working on any platform for AM ?
Re: ZIBO speed breaks
There is no logic or reason to what you are saying. It makes no sense in an AM coding context. You appear to be taking small snippets from various places and adding 2 + 2 to become 5. Mixing and matching non related terms that are out of contextKeith Baxter wrote: ↑Mon Nov 21, 2022 1:12 am
So our standard coding is Synchronous (single threading) {blocking} . When we use "inline functions" ""as we call them"" then that is Asynchronous coding (multi threading) {non-blocking }
Keith
Definitely need more water with it
Joe. CISSP, MSc.
- Keith Baxter
- Posts: 4674
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: ZIBO speed breaks
Joe,
I can assure you what I say is fact.
Take some time to read this.
https://siminnovations.com/wiki/index.p ... _data_load
Keith
I can assure you what I say is fact.
Take some time to read this.
https://siminnovations.com/wiki/index.p ... _data_load
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card
Re: ZIBO speed breaks
Hi Keith
You have linked to a file load example that is fairly standard - yet out of context. .... what about your
in relation to"inline functions" ""as we call them"" then that is Asynchronous coding (multi threading)
Are you getting into the realms of lua coroutines being in play here.. ? - if so, where are they in play in your example above and how do you differentiate the two ?our standard coding is Synchronous (single threading)
Joe. CISSP, MSc.
- Keith Baxter
- Posts: 4674
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: ZIBO speed breaks
Joe.
Lets look at this bit of code. This is Synchronous coding, The loading of <map_boundrys_data> will not start until <map_level1_data> has finished loading.
Now lets look a a simple HW switch. This is also Synchronous coding and is the standard code method that AM uses. So while this switch code is running then all other processes will be halted
Now lets look at that same simple HW switch but this time using Asynchronous coding. While this switch code is running in the background then other processes will NOT be halted.
Keith
Lets look at this bit of code. This is Synchronous coding, The loading of <map_boundrys_data> will not start until <map_level1_data> has finished loading.
Code: Select all
map_level1_data = static_data_load("110_world.json")
if map_level1_data ~= nil then
print("The Map level 1 data has loaded")
end
map_boundrys_data = static_data_load("110_country_boundries.json")
if map_boundrys_data ~= nil then
print("The Country Boundries data has loaded")
end
water_data = static_data_load("110_lakes.json")
if water_data ~= nil then
print("The Water data has loaded")
end
Code: Select all
-- This function is called every time the switch has a new position
function switch_callback(position)
print("The switch got changed to position " .. position)
end
-- Create a new 3 position switch with Synchronous coding
hw_switch_add("Ignition", 3, switch_callback)
Now lets look at that same simple HW switch but this time using Asynchronous coding. While this switch code is running in the background then other processes will NOT be halted.
Code: Select all
-- This function is called every time the switch has a new position
-- Create a new 3 position switch with Asynchronous coding.
hw_switch_add("Ignition", 3, function(position)
print("The switch got changed to position " .. position)
end)
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card
Re: ZIBO speed breaks
Hi Keith,
Due to the action of the main AM program then I can accept that the first example of the choice of mode of background loading of data is non blocking.
As for the other examples of the switch then I do not see how they would be any different apart from a more convenient (to some people) way of writing the script.
I would imagine the operation of the two switch examples at code level is identical.
Perhaps @Corjan could comment ?
Joe
Due to the action of the main AM program then I can accept that the first example of the choice of mode of background loading of data is non blocking.
As for the other examples of the switch then I do not see how they would be any different apart from a more convenient (to some people) way of writing the script.
I would imagine the operation of the two switch examples at code level is identical.
Perhaps @Corjan could comment ?
Joe
Joe. CISSP, MSc.
- Keith Baxter
- Posts: 4674
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: ZIBO speed breaks
Joe,jph wrote: ↑Mon Nov 21, 2022 2:15 pm Hi Keith,
Due to the action of the main AM program then I can accept that the first example of the choice of mode of background loading of data is non blocking.
As for the other examples of the switch then I do not see how they would be any different apart from a more convenient (to some people) way of writing the script.
I would imagine the operation of the two switch examples at code level is identical.
Perhaps @Corjan could comment ?
Joe
For one or two switches you are correct. There would be very little or no benefit at all.
However, when we start talking of large instruments that are loading and reading sim data then Asynchronous is very much the method of choice.
If you have been privileged to have Corjan help you with some coding he has mostly used Asynchronous coding. I asked him why and he told me what I tell you.
This image enplanes how the two work. Synchronous (left side) has to step through where as Asynchronous (right side) does not wait and communication happens in the background.
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card