Exemple #1
0
 public void Disconnect()
 {
     isConnected = false;
     assigned_powersource.Unavailable();
 }
Exemple #2
0
        private void fsiOnVarReceive(FSIID id)
        {
            //GROUND POWER
            if (id == FSIID.IOS_GRD_PWR_CONNECTED)
            {
                if (FSIcm.inst.IOS_GRD_PWR_CONNECTED)
                {
                    debug("ELEC GND PWR Connected");
                    ext_pwr_l.Available();
                    ext_pwr_r.Available();
                }
                else
                {
                    debug("ELEC GND PWR Disconnected");
                    ext_pwr_l.Unavailable();
                    ext_pwr_r.Available();
                }

                //GND PWR available
                LightController.set(FSIID.MBI_ELEC_BUS_GRD_PWR_AVAILABLE_LIGHT, FSIcm.inst.IOS_GRD_PWR_CONNECTED);
                simElectrics();
            }

            //GROUND POWER SWITCH
            if (id == FSIID.MBI_ELEC_BUS_GRD_PWR_SWITCH)
            {
                if (FSIcm.inst.MBI_ELEC_BUS_GRD_PWR_SWITCH)
                {
                    debug("ELEC GND PWR SWITCH On");
                    if (ext_pwr_l.SwitchOn())
                    {
                        ac_bus1.select(ext_pwr_l);
                    }
                    if (ext_pwr_r.SwitchOn())
                    {
                        ac_bus2.select(ext_pwr_r);
                    }
                }
                else
                {
                    debug("ELEC GND PWR SWITCH Off");
                    ext_pwr_l.SwitchOff();
                    ext_pwr_r.SwitchOff();
                }
                simElectrics();
            }

            //battery
            if (id == FSIID.MBI_ELEC_IND_BATTERY_SWITCH)
            {
                if (!FSIcm.inst.MBI_ELEC_IND_BATTERY_SWITCH)
                {
                    debug("ELEC DC Bat On");
                    battery_online = true;
                    simElectrics();
                }
                else
                {
                    debug("ELEC DC Bat Off");
                    battery_online = false;
                    simElectrics();
                }
            }

            //STBY Power
            if (id == FSIID.MBI_ELEC_STBY_STANDBY_POWER_SWITCH_AUTO_POS || id == FSIID.MBI_ELEC_STBY_STANDBY_POWER_SWITCH_BAT_POS)
            {
                if (FSIcm.inst.MBI_ELEC_STBY_STANDBY_POWER_SWITCH_AUTO_POS)
                {
                    debug("ELEC STBY PWR AUTO");
                    sby_pwr_auto = true;
                    sby_pwr_bat  = false;
                }
                else if (FSIcm.inst.MBI_ELEC_STBY_STANDBY_POWER_SWITCH_BAT_POS)
                {
                    debug("ELEC STBY PWR BAT");
                    sby_pwr_auto = false;
                    sby_pwr_bat  = true;
                }
                else
                {
                    debug("ELEC STBY PWR OFF");
                    sby_pwr_bat  = false;
                    sby_pwr_auto = false;
                }
                simElectrics();
            }

            //IDG_1
            if (id == FSIID.MBI_ELEC_STBY_GEN_1_DISCONNECT_SWITCH)
            {
                if (!FSIcm.inst.MBI_ELEC_STBY_GEN_1_DISCONNECT_SWITCH)
                {
                    debug("ELEC STBY Gen 1 Connected");
                }
                else
                {
                    debug("ELEC STBY Gen 1 Disconnected");
                    idg1.Disconnect();
                }
                simElectrics();
            }

            //IDG_2
            if (id == FSIID.MBI_ELEC_STBY_GEN_2_DISCONNECT_SWITCH)
            {
                if (!FSIcm.inst.MBI_ELEC_STBY_GEN_2_DISCONNECT_SWITCH)
                {
                    debug("ELEC STBY Gen 2 Connected");
                }
                else
                {
                    debug("ELEC STBY Gen 2 Disconnected");
                    idg2.Disconnect();
                }
                simElectrics();
            }

            //APU GEN 1
            if (id == FSIID.MBI_ELEC_BUS_APU_GEN_1_SWITCH_OFF_POS || id == FSIID.MBI_ELEC_BUS_APU_GEN_1_SWITCH_ON_POS)
            {
                if (FSIcm.inst.MBI_ELEC_BUS_APU_GEN_1_SWITCH_OFF_POS)
                {
                    debug("ELEC APU GEN 1 Off");
                    apu_gen1.SwitchOff();
                }
                if (FSIcm.inst.MBI_ELEC_BUS_APU_GEN_1_SWITCH_ON_POS)
                {
                    debug("ELEC APU GEN 1 On");
                    if (apu_gen1.SwitchOn())
                    {
                        ac_bus1.select(apu_gen1);
                        ext_pwr_l.SwitchOff();
                        ext_pwr_r.SwitchOff();
                    }
                }
                simElectrics();
            }

            //APU GEN 2
            if (id == FSIID.MBI_ELEC_BUS_APU_GEN_2_SWITCH_OFF_POS || id == FSIID.MBI_ELEC_BUS_APU_GEN_2_SWITCH_ON_POS)
            {
                if (FSIcm.inst.MBI_ELEC_BUS_APU_GEN_2_SWITCH_OFF_POS)
                {
                    debug("ELEC APU GEN 2 Off");
                    apu_gen2.SwitchOff();
                }
                if (FSIcm.inst.MBI_ELEC_BUS_APU_GEN_2_SWITCH_ON_POS)
                {
                    debug("ELEC APU GEN 2 On");
                    if (apu_gen2.SwitchOn())
                    {
                        ac_bus2.select(apu_gen2);
                        ext_pwr_l.SwitchOff();
                        ext_pwr_r.SwitchOff();
                    }
                }

                simElectrics();
            }

            //ENG 1 GEN
            if (id == FSIID.MBI_ELEC_BUS_GEN_1_SWITCH_OFF_POS || id == FSIID.MBI_ELEC_BUS_GEN_1_SWITCH_ON_POS)
            {
                if (FSIcm.inst.MBI_ELEC_BUS_GEN_1_SWITCH_OFF_POS)
                {
                    debug("ELEC ENG GEN 1 Off");
                    eng1_gen.SwitchOff();
                }
                if (FSIcm.inst.MBI_ELEC_BUS_GEN_1_SWITCH_ON_POS)
                {
                    debug("ELEC ENG GEN 1 On");
                    if (eng1_gen.SwitchOn())
                    {
                        ac_bus1.select(eng1_gen);
                    }
                }
                simElectrics();
            }

            //ENG 2 GEN
            if (id == FSIID.MBI_ELEC_BUS_GEN_2_SWITCH_OFF_POS || id == FSIID.MBI_ELEC_BUS_GEN_2_SWITCH_ON_POS)
            {
                if (FSIcm.inst.MBI_ELEC_BUS_GEN_2_SWITCH_OFF_POS)
                {
                    debug("ELEC ENG GEN 2 Off");
                    eng2_gen.SwitchOff();
                }
                if (FSIcm.inst.MBI_ELEC_BUS_GEN_2_SWITCH_ON_POS)
                {
                    debug("ELEC ENG GEN 2 On");
                    if (eng2_gen.SwitchOn())
                    {
                        ac_bus2.select(eng2_gen);
                    }
                }
                simElectrics();
            }

            //BUS TRANSFER
            if (id == FSIID.MBI_ELEC_BUS_BUS_TRANSFER_SWITCH)
            {
                if (FSIcm.inst.MBI_ELEC_BUS_BUS_TRANSFER_SWITCH)
                {
                    debug("ELEC BUS TRANSFER AUTO");
                    bustransfer_auto = true;
                }
                else
                {
                    debug("ELEC BUS TRANSFER OFF");
                    bustransfer_auto = false;
                }
                simElectrics();
            }


            //some changes in generator availability
            if (id == FSIID.SLI_APU_GEN_RTL)
            {
                if (FSIcm.inst.SLI_APU_GEN_RTL)
                {
                    debug("ELEC APU ready to load");
                    apu_gen1.Available();
                    apu_gen2.Available();
                }
                else
                {
                    debug("ELEC APU not ready to load");
                    apu_gen1.Unavailable();
                    apu_gen2.Unavailable();
                }
                simElectrics();
            }

            if (id == FSIID.SLI_GEN_1_RTL)
            {
                if (FSIcm.inst.SLI_GEN_1_RTL && idg1.isConnected)
                {
                    eng1_gen.Available();
                    debug("ELEC GEN 1 ready to load");
                }
                else
                {
                    eng1_gen.Unavailable();
                    debug("ELEC GEN 1 not ready to load");
                }
                simElectrics();
            }

            if (id == FSIID.SLI_GEN_2_RTL)
            {
                if (FSIcm.inst.SLI_GEN_2_RTL && idg2.isConnected)
                {
                    eng2_gen.Available();
                    debug("ELEC GEN 2 ready to load");
                }
                else
                {
                    eng2_gen.Unavailable();
                    debug("ELEC GEN 2 not ready to load");
                }
                simElectrics();
            }
        }