Results 1 to 6 of 6
Thread: SIOC expert needed
-
10-23-2009, 10:04 AM #1
SIOC expert needed
Hi all,
i tried to get the following working with SIOC:
If Aircraft on ground and Engine is running, than one LED should go on.
If the Engines are off the LED should be off.
If the Aircraft is in the Air, the LED should be off, except if the Flapstatus is >0 than the led should be again on.
I tried it with the following (without Flap Status in this example.):
Code:Var 0013, name Aircft_GND, Link FSUIPC_IN, Offset $0366, Length 2 // Ground=1 / air=0 { IF &Aircft_GND = 1 { IF &OilP1 > 2383 { &_Eng1_RAM_Door = 1 } IF &OilP1 < 2383 { &_Eng1_RAM_Door = 0 } } ELSE { &_Eng1_RAM_Door = 0 } }
Code:Var 0013, name Aircft_GND, Link FSUIPC_IN, Offset $0366, Length 2 // Ground=1 / air=0 { IF &Aircft_GND = 1 { CALL &sub1 } ELSE { &_Eng1_RAM_Door = 0 } } Var 0014, name Flapsstate, Link FSUIPC_IN, Offset $0BDC, Length 4 // Flaps state 0=up Var 0015, name sub1, Link SUBRUTINE { IF &OilP1 < 2380 { CALL &sub2 } ELSE { &_Eng1_RAM_Door = 1 } } Var 0017, name sub2, Link SUBRUTINE { &_Eng1_RAM_Door = 0 }
Any Ideas how to get this working correct??
thanks for all hints,
Markus
-
10-23-2009, 10:51 AM #2
- Join Date
- Mar 2008
- Location
- France,Nice
- Posts
- 2,652
Re: SIOC expert needed
The use of subroutine is the way to go, your second approach is almost correct.
Bear in mind that the FSUIPC In/Out code will only be executed when the corresponding variable actually changes.
So you need to declare a FSUIPC variable for each condition you need:
-Aircft_GND
-OilP1 (by the way there is an offset for engine running flag, instead of using oil pressure, see $0894)
-Flapsstate
And each condition should call the same subroutine, which could look like this
Code:IF &Aircft_GND = 1 { IF &OilP1 > 2383 { &_Eng1_RAM_Door = 1 } ELSE { &_Eng1_RAM_Door = 0 } } ELSE { IF &Flapsstate> 0 { &_Eng1_RAM_Door = 1 } ELSE { &_Eng1_RAM_Door = 0 } }
-
Post Thanks / Like - 1 Thanks, 0 Likes, 0 Dislikes
markusr thanked for this post
-
10-23-2009, 11:24 AM #3
Re: SIOC expert needed
thanks for the hint.
it worked.
So, i can only use 1 variable that i have decalred in sioc at one time.
I already had the OilP1 variable used for another thing.
Code:Var 0013, name Aircft_GND, Link FSUIPC_IN, Offset $0366, Length 2 // Ground=1 / air=0 { CALL &sub1 } Var 0014, name Flapsstate, Link FSUIPC_IN, Offset $0BDC, Length 4 // Flaps state 0=up { CALL &sub1 } Var 0017, name oilp1_2, Link FSUIPC_IN, Offset $08BA, Length 2 { CALL &sub1 } Var 0015, name sub1, Link SUBRUTINE { IF &Aircft_GND = 1 { IF &oilp1_2 > 2380 { &_Eng1_RAM_Door = 1 } ELSE { &_Eng1_RAM_Door = 0 } } ELSE { IF &Flapsstate > 0 { &_Eng1_RAM_Door = 1 } ELSE { &_Eng1_RAM_Door = 0 } } }
-
10-23-2009, 11:36 AM #4
- Join Date
- Mar 2008
- Location
- France,Nice
- Posts
- 2,652
Re: SIOC expert needed
To be more precise look at this variable declaration:
Code:Var 0013, name Aircft_GND, Link FSUIPC_IN, Offset $0366, Length 2 // Ground=1 / air=0 { " WHATEVER CODE FUNCTIONS YOU NEED" }
1) the ACFT was prior on ground then took off, thus offset $0366 changed from 1 to 0
2) the ACFT was prior in flight then touched down, thus offset $0366 changed from 0 to 1
While in flight or on ground , if any other parameter changes, this one won't change unless one of the two conditions above is met. Problem is, SIOC reacts only on "change events". Thus the code won't be executed unless 1 or 2.
Am I clear?
-
Post Thanks / Like - 1 Thanks, 0 Likes, 0 Dislikes
markusr thanked for this post
-
10-23-2009, 11:50 AM #5
Re: SIOC expert needed
That is not a problem, it is by design! That makes SIOC so powerful.
One should bear in mind that SIOC is not a procedural programming language but an event based scripting language.
The value change of a variable is such an event.
If you assign the same value a second time to a variable, nothing will happen.
-
10-23-2009, 12:11 PM #6
- Join Date
- Mar 2008
- Location
- France,Nice
- Posts
- 2,652
Re: SIOC expert needed
Don't get me wrong, I never said SIOC was flawed. I used the word "problem" here in regards of what Markus tried to achieve with the first code he wrote, which clearly meant he hadn't yet grasped the concept of events.
Similar Threads
-
Resident Opencockpits Card Expert Needed!!!
By blueskydriver in forum OpenCockpits General DiscussionReplies: 1Last Post: 03-01-2010, 09:59 AM -
SIOC help with low volts light needed
By Steve1970 in forum General Aviation (GA) Builder DisccusionReplies: 9Last Post: 02-23-2010, 09:47 PM -
qestion for expert builders????
By spiro in forum General Builder Questions All Aircraft TypesReplies: 6Last Post: 04-18-2009, 07:02 PM -
FAQ on the Windows XP Expert Zone
By MS Expert Zone RSS Feed in forum Computer Hardware SetupReplies: 0Last Post: 12-28-2006, 11:30 AM -
Katy (network expert) .. aquestion
By John White in forum PM General Q & AReplies: 0Last Post: 12-10-2004, 11:26 AM