Example #1
0
            public void ComputeLoadNoCable(Substation substation)
            {
                Variable <bool> noCableConn = Variable.Bernoulli(1);

                if (substation.Fuses.Count > 0)
                {
                    noCableConn = substation.Fuses[0].IsClosed;
                }
                else
                {
                    substation.Load = Variable.GaussianFromMeanAndVariance(0, 0.001);
                    return;
                }

                for (int i = 1; i < substation.Fuses.Count; i++)
                {
                    noCableConn = noCableConn & substation.Fuses[i].IsClosed;
                }

                Bernoulli bernoulli = (Bernoulli)InferenceEngine.Infer(noCableConn);

                substation.Load = Variable.GaussianFromMeanAndVariance(0, bernoulli.GetVariance());
            }