Welcome to Cockpitbuilders.com. Please login or sign up.

May 09, 2024, 04:34:50 AM

Login with username, password and session length

PROUDLY ENDORSING


Fly Elise-ng
545 Guests, 0 Users
Members
Stats
  • Total Posts: 59,641
  • Total Topics: 7,853
  • Online today: 588
  • Online ever: 831
  • (May 03, 2024, 12:39:25 PM)
Users Online
Users: 0
Guests: 545
Total: 545

COUNTDOWN TO WF2022


WORLDFLIGHT TEAM USA

Will Depart in...

Recent

Welcome

Help with SIOC for Position/Strobe lights

Started by fsaviator, April 12, 2013, 10:49:11 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

fsaviator

Looking for some SIOC coding help.

I just discovered my coding was wrong for my POSITION/STROBE & STEADY - STEADY switch on my overhead. Does anyone have an idea on how to fix the following code:

So that POSITION LIGHTS ARE ON when both switch 19 and 20 are =1
and so that STROBE is ON when switch 19 =1
Otherwise, both Strobe and Position lights = 0

The issue is that Prosim will not let me have two variables for Position Lights ON.

Here is what I have:

Var 1135, name LIGHT_POS_1, static, Link IOCARD_SW, Device 5, Input 19 // Lights Position: Strobe & Steady
{
  IF &LIGHT_POS_1 = 1
  {
    &Position = 1   
    &Strobe = 1   
  }
  ELSE
  {
    &Position = 0   
    &Strobe = 0   
  }
}

Var 1136, name LIGHT_POS_2, static, Link IOCARD_SW, Device 5, Input 20 // Lights Position: Steady
{
  IF &LIGHT_POS_2 = 1
  {
    &Position = 1   
  }
  ELSE
  {
    &Position = 0   
  }
}



Thanks,

Warren
Warren "FSAviator"
http://www.B737NG-Sim.com  |  https://www.facebook.com/fsaviator/
P3D45/ Prosim737 2/ ACE Dual-linked Yokes/ RevSim Proline TQ and Dual-linked Rudders/ CPFlight MCP PRO3 and EFIS'; MIP737ICS_FULL and SIDE737; Forward and Aft Overheads; Pedestal/ FDS MIP

fordgt40

Hi Warren

Here you are - it follows the logic you set out. I have renumbered and included the strobe and position variables so I could test it. The argument static has been removed as I do not believe ordinary sioc scripts need it.

Regards

David

Var 1, name LIGHT_POS_1,  Link IOCARD_SW, Device 5, Input 19 // Lights Position: Strobe & Steady
{
&Strobe = &LIGHT_POS_1
IF &LIGHT_POS_1 = 0
   {
   &position = 0
   }
ELSE
   {
   IF &LIGHT_POS_1 = 1
      {
      IF &LIGHT_POS_2 = 1
         {
         &Position = 1
         }
      }
    }
}

Var 2, name LIGHT_POS_2,  Link IOCARD_SW, Device 5, Input 20 // Lights Position: Steady
{
  IF &LIGHT_POS_2 = 1
    {
   IF &LIGHT_POS_1 = 1   
      {
      &Position = 1   
      }
   }

ELSE
    {
       &Position = 0   
    }
}

var 3 name strobe
var 4 name position

fsaviator

David, unfortunately, it didn't do it.

I looked into the script (it came from OC) and there is indeed two additional variables a bit further down that do the same thing yours did.

Variable 1141 is Position
Variable 1142 is Strobe

I then dug into the Prosim script and noticed that the LIGHT_POS_2 variable refers to Strobe, not Position light in Prosim.

I have a three way switch installed, so OFF is all OFF: Position 19 should be Position lights and Strobe; Position 20 should be Position lights only (as opposed to now, where it is strobes only).

So here is what I have.  Hope it helps:



Name on Overhead   Variable Description in SIOC Script   Variable Name in SSI Configuration   Name in Prosim   Type   IOCP Variable   Device   LINK   I/O Value
POSITION - OFF   Lights Position: Strobe & Steady   LIGHT_POS_1     Lights Position Off   Switches   1135   5   IOCARD_SW   19   
STROBE - OFF   Lights Position: Strobe   LIGHT_POS_2     Lights Strobe Off   Switches   1136   5   IOCARD_SW   20   
Warren "FSAviator"
http://www.B737NG-Sim.com  |  https://www.facebook.com/fsaviator/
P3D45/ Prosim737 2/ ACE Dual-linked Yokes/ RevSim Proline TQ and Dual-linked Rudders/ CPFlight MCP PRO3 and EFIS'; MIP737ICS_FULL and SIDE737; Forward and Aft Overheads; Pedestal/ FDS MIP

fordgt40

Hi Warren

You are changing the brief  :(

Do I understand that now

If switch 19 = 1 then both position and strobe are on
If switch 20 = 1 then only position is on
If neither switch 19 or 20 are on then both strobe and position are off

Regards

David

fsaviator

I'm sorry, David.  Yes, I didn't present the original brief correctly.

I appreciate your help on this.  Normally I wouldn't worry about something like this as it is exterior, but I suspect that as the NAV lights are part of Preflight, this may be what is holding my virtual FO back from interacting with me.  As it is set now, either I have just strobes, or both strobe and NAV on, which would not satisfy my FO as strobes should be off.

Thanks again.

Warren
Warren "FSAviator"
http://www.B737NG-Sim.com  |  https://www.facebook.com/fsaviator/
P3D45/ Prosim737 2/ ACE Dual-linked Yokes/ RevSim Proline TQ and Dual-linked Rudders/ CPFlight MCP PRO3 and EFIS'; MIP737ICS_FULL and SIDE737; Forward and Aft Overheads; Pedestal/ FDS MIP

fordgt40

Hi Warren

No probs, just having a little bit of fun  :D

I am just finishing my aft overhead and will recode this latter today for you.

Regards

David

fsaviator

Did you say aft overhead?  Ohhhhhhh :cheers:

That is my next project.  Are you using SIOC?  I was going to use one of my Pokeys for that, but if you are already coding SIOC...  I have plenty of OC interface cards laying around.

Warren
Warren "FSAviator"
http://www.B737NG-Sim.com  |  https://www.facebook.com/fsaviator/
P3D45/ Prosim737 2/ ACE Dual-linked Yokes/ RevSim Proline TQ and Dual-linked Rudders/ CPFlight MCP PRO3 and EFIS'; MIP737ICS_FULL and SIDE737; Forward and Aft Overheads; Pedestal/ FDS MIP

fordgt40

Hi Warren

Would you like a copy of my sioc code  :)

I used an Opencockpits mastercard  for the annunciators, LE Devices lights and all switches, with an Opencocpits  USBLcd card for the IRS display. I use SimAvionics, though it should be easy to amend the references for Prosim

David

fordgt40

Hi Warren

Knowing that switches 19 and 20 are on a toggle with centre off simplifies the code considerably, as it is impossible for both switches to be on at the same time. Here is the code.


Var 1, name LIGHT_POS_1,  Link IOCARD_SW, Device 5, Input 19 // Lights Position: Strobe & Steady
{
&position = &LIGHT_POS_1
&strobe = &LIGHT_POS_1
}


Var 2, name LIGHT_POS_2,  Link IOCARD_SW, Device 5, Input 20 // Lights Position: Steady
{
&Position = &LIGHT_POS_2
}

var 3 name strobe
var 4 name position

fsaviator

Quote from: fordgt40 on April 13, 2013, 09:31:16 AM

Var 1, name LIGHT_POS_1,  Link IOCARD_SW, Device 5, Input 19 // Lights Position: Strobe & Steady
{
&position = &LIGHT_POS_1
&strobe = &LIGHT_POS_1
}


Var 2, name LIGHT_POS_2,  Link IOCARD_SW, Device 5, Input 20 // Lights Position: Steady
{
&Position = &LIGHT_POS_2
}

var 3 name strobe
var 4 name position

Hi David.  Finally had some free time to work this.  Good news, and bad.  The Good is that the right lights come on with the right switch setting now.

The bad:  The Position lights do not turn off at all.  They are constantly on.  The strobes do turn off though when the switch is in the center.

Any ideas?
Warren "FSAviator"
http://www.B737NG-Sim.com  |  https://www.facebook.com/fsaviator/
P3D45/ Prosim737 2/ ACE Dual-linked Yokes/ RevSim Proline TQ and Dual-linked Rudders/ CPFlight MCP PRO3 and EFIS'; MIP737ICS_FULL and SIDE737; Forward and Aft Overheads; Pedestal/ FDS MIP

fordgt40

Hi Warren

The code, when tested on my machine follows the agreed  logic set out below:-

If switch 19 = 1 then both position and strobe are on
If switch 20 = 1 then only position is on
If neither switch 19 or 20 are on then both strobe and position are off

So if the position light is not going off, then are you sure that the switch is indeed off?
Also I suggest that you use IOCPConsole to create a log of what happens when you exercise the switch positions. Perhaps you could also post your sioc script and I will look at it

I am puzzled here as I have checked my script and although I have no h/w hooked up, I can simulate switch values within IOCPConsole and the code works correctly :(

David

fsaviator

Hey David.
I think it is due to the Prosim script.  Are you using Prosim?  This original script also results in the Position lights staying on even when the switch is centered.

I'll mess with the IOCPConsole to see what I can capture.

Here are the pertinent lines from the OC - Prosim configuration XML script

<mapping connection="Lights Position On">
      <iocp serial="0" port="1135" />
    </mapping>
<mapping connection="Lights Strobe On">
      <iocp serial="0" port="1136" />
    </mapping>

This is the original SIOC script that came with the Overhead:

Var 1135, name LIGHT_POS_1, static, Link IOCARD_SW, Device 5, Input 19 // Lights Position: Strobe & Steady
{
  IF &LIGHT_POS_1 = 1
  {
    &Position = 1   
    &Strobe = 1   
  }
  ELSE
  {
    &Position = 0   
    &Strobe = 0   
  }
}

Var 1136, name LIGHT_POS_2, static, Link IOCARD_SW, Device 5, Input 20 // Lights Position: Strobe
{
  IF &LIGHT_POS_2 = 1
  {
    &Strobe = 1   
  }
  ELSE
  {
    &Strobe = 0   
  }
}

Var 1141, name Position, static // Position: On

Var 1142, name Strobe, static // Position: On

Thanks,

Warren
Warren "FSAviator"
http://www.B737NG-Sim.com  |  https://www.facebook.com/fsaviator/
P3D45/ Prosim737 2/ ACE Dual-linked Yokes/ RevSim Proline TQ and Dual-linked Rudders/ CPFlight MCP PRO3 and EFIS'; MIP737ICS_FULL and SIDE737; Forward and Aft Overheads; Pedestal/ FDS MIP

fordgt40

Hi Warren

I am not using Prosim, just sioc to test the logic flow which is correct. Your original sioc code is also correct, just a different way to code the logic. Although I have no knowledge of Prosim xml files, it seems clear that Prosim is mapping your sioc variables to the xml file ie vars 1135 and 1136. So why is the light not going out?

I suggest that either something else in the script elsewhere is screwing it or the switch is not functioning as it should. You should use an editor to see if the variables
LIGHT_POS_1 or LIGHT_POS_2 are used elsewhere in the script. Also check that the switch is making the contacts that you think it should

Regards

David

Like the Website ?
Support Cockpitbuilders.com and Click Below to Donate