Beispiel #1
0
        public override string GetCode(ControllerModel c, CCOLCodeTypeEnum type, string ts)
        {
            StringBuilder sb = new StringBuilder();

            switch (type)
            {
            case CCOLCodeTypeEnum.RegCSystemApplication:
                sb.AppendLine($"{ts}/* OV/HD verklikking */");
                sb.AppendLine($"{ts}/* ----------------- */");
                foreach (var ov in c.OVData.OVIngrepen)
                {
                    sb.AppendLine($"{ts}CIF_GUS[{_uspf}{_usovinm}{ov.FaseCyclus}] = C[{_ctpf}{_cvc}{ov.FaseCyclus}];");
                }
                foreach (var hd in c.OVData.HDIngrepen)
                {
                    sb.AppendLine($"{ts}CIF_GUS[{_uspf}{_ushdinm}{hd.FaseCyclus}] = C[{_ctpf}{_cvchd}{hd.FaseCyclus}];");
                }
                sb.AppendLine();
                if (c.OVData.OVIngrepen.Count > 0 && c.OVData.OVIngrepen.Any(x => x.KAR) ||
                    c.OVData.HDIngrepen.Count > 0 && c.OVData.HDIngrepen.Any(x => x.KAR))
                {
                    sb.AppendLine($"{ts}/* Verklikken melding en ondergedrag KAR */");
                    sb.AppendLine($"{ts}CIF_GUS[{_uspf}{_uskarmelding}] = T[{_tpf}{_tkarmelding}];");
                    sb.AppendLine($"{ts}CIF_GUS[{_uspf}{_uskarog}] = !T[{_tpf}{_tkarog}];");
                }
                return(sb.ToString());

            default:
                return(null);
            }
        }
Beispiel #2
0
        public override int HasCode(CCOLCodeTypeEnum type)
        {
            switch (type)
            {
            case CCOLCodeTypeEnum.TabCControlIncludes:
                return(201);

            case CCOLCodeTypeEnum.TabCControlParameters:
                return(201);

            case CCOLCodeTypeEnum.RegCIncludes:
                return(201);

            case CCOLCodeTypeEnum.RegCTop:
                return(201);

            case CCOLCodeTypeEnum.RegCPreApplication:
                return(201);

            case CCOLCodeTypeEnum.RegCPostApplication:
                return(201);

            case CCOLCodeTypeEnum.RegCSpecialSignals:
                return(201);

            default:
                return(0);
            }
        }
Beispiel #3
0
 public override int HasCode(CCOLCodeTypeEnum type)
 {
     return(type switch
     {
         CCOLCodeTypeEnum.RegCDetectieStoring => 10,
         _ => 0
     });
        public override int HasCode(CCOLCodeTypeEnum type)
        {
            switch (type)
            {
            case CCOLCodeTypeEnum.RegCTop:
                return(100);

            case CCOLCodeTypeEnum.RegCInitApplication:
                return(100);

            case CCOLCodeTypeEnum.RegCPreApplication:
                return(100);

            case CCOLCodeTypeEnum.RegCAlternatieven:
                return(100);

            case CCOLCodeTypeEnum.RegCPostApplication:
                return(100);

            case CCOLCodeTypeEnum.RegCPostSystemApplication:
                return(100);

            default:
                return(0);
            }
        }
        public override string GetCode(ControllerModel c, CCOLCodeTypeEnum type, string ts)
        {
            StringBuilder sb = new StringBuilder();

            switch (type)
            {
            case CCOLCodeTypeEnum.RegCAanvragen:
                int i = 0;
                foreach (var fc in c.Fasen)
                {
                    foreach (var d in fc.Detectoren)
                    {
                        if (d.AanvraagDirect)
                        {
                            if (i == 0)
                            {
                                sb.AppendLine($"{ts}/* Direct groen in geval van !K voor een richting */");
                                ++i;
                            }
                            sb.AppendLine($"{ts}AanvraagSnelV2({_fcpf}{fc.Naam}, {_dpf}{d.Naam});");
                        }
                    }
                }
                return(sb.ToString());

            default:
                return(null);
            }
        }
        public override int HasCode(CCOLCodeTypeEnum type)
        {
            switch (type)
            {
            case CCOLCodeTypeEnum.RegCInitApplication:
                return(30);

            case CCOLCodeTypeEnum.RegCPreApplication:
                return(30);

            case CCOLCodeTypeEnum.RegCSynchronisaties:
                return(20);

            case CCOLCodeTypeEnum.RegCMaxgroenNaAdd:
                return(10);

            case CCOLCodeTypeEnum.RegCMaxgroen:
                return(20);

            case CCOLCodeTypeEnum.RegCVerlenggroen:
                return(10);

            case CCOLCodeTypeEnum.RegCAlternatieven:
                return(20);

            case CCOLCodeTypeEnum.OvCPrioriteitsNiveau:
                return(20);

            default:
                return(0);
            }
        }
Beispiel #7
0
 public override int HasCode(CCOLCodeTypeEnum type)
 {
     return(type switch
     {
         CCOLCodeTypeEnum.RegCSystemApplication => 60,
         _ => 0
     });
        public override string GetCode(ControllerModel c, CCOLCodeTypeEnum type, string ts)
        {
            StringBuilder sb = new StringBuilder();

            switch (type)
            {
            case CCOLCodeTypeEnum.RegCIncludes:
                if (c.PTPData.PTPKoppelingen.Count > 0)
                {
                    sb.AppendLine($"{ts}#include \"{c.Data.Naam}ptp.c\" /* PTP seriele koppeling */");
                }
                return(sb.ToString());

            case CCOLCodeTypeEnum.RegCPreSystemApplication:
                if (c.PTPData.PTPKoppelingen.Count > 0)
                {
                    sb.AppendLine($"{ts}/* aanroepen PTP loop tbv seriele koppeling */");
                    sb.AppendLine($"{ts}ptp_pre_system_app();");
                }
                return(sb.ToString());

            case CCOLCodeTypeEnum.RegCPostSystemApplication:
                if (c.PTPData.PTPKoppelingen.Count > 0)
                {
                    sb.AppendLine($"{ts}/* aanroepen PTP loop tbv seriele koppeling */");
                    sb.AppendLine($"{ts}ptp_post_system_app();");
                }
                return(sb.ToString());

            default:
                return(null);
            }
        }
Beispiel #9
0
        public override string GetCode(ControllerModel c, CCOLCodeTypeEnum type, string ts)
        {
            StringBuilder sb = new StringBuilder();

            switch (type)
            {
            case CCOLCodeTypeEnum.RegCAlternatieven:
                if (!_MyModel.ToepassenAlternatievenPerBlok)
                {
                    return("");
                }
                sb.AppendLine($"{ts}/* BLOKGEBONDEN ALTERNATIEF */");
                sb.AppendLine($"{ts}/* ======================== */");
                sb.AppendLine($"{ts}/* Defaultinstelling is prmaltb$$ = 15 (BK1, BK2, BK3, BK4)");
                sb.AppendLine($"{ts} * Voor instellingen de volgende waarden voor het blok waarin het alternatief mag plaatsvinden optellen:");
                sb.AppendLine($"{ts} * 1  alternatief mogelijk in blok 1");
                sb.AppendLine($"{ts} * 2  alternatief mogelijk in blok 2");
                sb.AppendLine($"{ts} * 4  alternatief mogelijk in blok 3");
                sb.AppendLine($"{ts} * 8  alternatief mogelijk in blok 4");
                sb.AppendLine($"{ts} */");
                foreach (var fc in Controller.Fasen)
                {
                    sb.AppendLine($"{ts}if(!(PRM[{_prmpf}altb{fc.Naam}] & (1 << ML))) PAR[{_fcpf}{fc.Naam}] = FALSE;");
                }
                return(sb.ToString());

            default:
                return(null);
            }
        }
 public override int HasCode(CCOLCodeTypeEnum type)
 {
     return(type switch
     {
         CCOLCodeTypeEnum.RegCRealisatieAfhandeling => 10,
         _ => 0
     });
Beispiel #11
0
 public override int HasCode(CCOLCodeTypeEnum type)
 {
     return(type switch
     {
         CCOLCodeTypeEnum.RegCAanvragen => 50,
         _ => 0
     });
Beispiel #12
0
        public override bool HasCodeForController(ControllerModel c, CCOLCodeTypeEnum type)
        {
            switch (type)
            {
            case CCOLCodeTypeEnum.RegCTop:
                return(c.PelotonKoppelingenData.PelotonKoppelingen.Any(x => x.IsInkomend && x.Type == PelotonKoppelingType.RHDHV));

            case CCOLCodeTypeEnum.RegCPreApplication:
                return(c.PelotonKoppelingenData.PelotonKoppelingen.Any());

            case CCOLCodeTypeEnum.RegCAanvragen:
                return(c.PelotonKoppelingenData.PelotonKoppelingen.Any(x => x.IsInkomend && x.Type == PelotonKoppelingType.RHDHV));

            case CCOLCodeTypeEnum.RegCMeetkriterium:
                return(c.PelotonKoppelingenData.PelotonKoppelingen.Any(x => x.IsInkomend));

            case CCOLCodeTypeEnum.RegCWachtgroen:
                return(c.PelotonKoppelingenData.PelotonKoppelingen.Any(x => x.IsInkomend && x.Type == PelotonKoppelingType.RHDHV));

            case CCOLCodeTypeEnum.RegCPostApplication:
                return(c.PelotonKoppelingenData.PelotonKoppelingen.Any(x => x.IsInkomend && (x.Detectoren.Any() || x.Type == PelotonKoppelingType.RHDHV)));

            default:
                return(false);
            }
        }
Beispiel #13
0
 private void AddCodeTypeToStringBuilder(ControllerModel c, StringBuilder sb, CCOLCodeTypeEnum type, bool includevars, bool includecode, bool addnewlinebefore, bool addnewlineatend)
 {
     if (OrderedPieceGenerators[type].Any())
     {
         if ((includevars || includecode) && addnewlinebefore)
         {
             sb.AppendLine();
         }
         if (includevars)
         {
             var vars = new List <string>();
             foreach (var gen in OrderedPieceGenerators[type])
             {
                 var lv = gen.Value.GetFunctionLocalVariables(c, type);
                 if (lv.Any())
                 {
                     foreach (var i in lv)
                     {
                         if (!vars.Contains(i.Item2))
                         {
                             vars.Add(i.Item2);
                             if (!string.IsNullOrWhiteSpace(i.Item3))
                             {
                                 sb.AppendLine($"{ts}{i.Item1} {i.Item2} = {i.Item3};");
                             }
                             else
                             {
                                 sb.AppendLine($"{ts}{i.Item1} {i.Item2};");
                             }
                         }
                         else
                         {
                             // ignore: local variable already exists
                             //MessageBox.Show($"Function local variable with name {i.Item2} (now from {gen.Value.GetType().Name}) already exists!", "Error while generating function local variables");
                         }
                     }
                     if (addnewlineatend)
                     {
                         sb.AppendLine();
                     }
                 }
             }
         }
         if (includecode)
         {
             foreach (var gen in OrderedPieceGenerators[type].Where(x => x.Value.HasCodeForController(c, type)))
             {
                 var code = gen.Value.GetCode(c, type, ts);
                 if (!string.IsNullOrWhiteSpace(code))
                 {
                     sb.Append(code);
                     if (addnewlineatend)
                     {
                         sb.AppendLine();
                     }
                 }
             }
         }
     }
 }
Beispiel #14
0
 public override int HasCode(CCOLCodeTypeEnum type)
 {
     return(type switch
     {
         CCOLCodeTypeEnum.RegCMeeverlengen => 20,
         _ => 0
     });
Beispiel #15
0
        public override int HasCode(CCOLCodeTypeEnum type)
        {
            switch (type)
            {
            case CCOLCodeTypeEnum.RegCTop:
                return(10);

            case CCOLCodeTypeEnum.RegCInitApplication:
                return(10);

            case CCOLCodeTypeEnum.RegCSystemApplication:
                return(10);

            case CCOLCodeTypeEnum.RegCWachtgroen:
                return(20);

            case CCOLCodeTypeEnum.RegCFileVerwerking:
                return(10);

            case CCOLCodeTypeEnum.OvCPARCorrecties:
                return(10);

            default:
                return(0);
            }
        }
Beispiel #16
0
        public override string GetCode(ControllerModel c, CCOLCodeTypeEnum type, string ts)
        {
            var sb = new StringBuilder();

            switch (type)
            {
            case CCOLCodeTypeEnum.RegCMeeverlengen:
                sb.AppendLine($"{ts}/* Veiligheidsgroen */");
                sb.AppendLine($"{ts}/* ---------------- */");
                foreach (var fcm in c.Fasen.Where(x => x.Detectoren.Any(x2 => x2.VeiligheidsGroen != NooitAltijdAanUitEnum.Nooit)))
                {
                    sb.Append($"{ts}veiligheidsgroen_V1({_fcpf}{fcm.Naam}, {_tpf}{_tvgmax}{fcm.Naam}, ");
                    foreach (var dm in fcm.Detectoren.Where(x => x.VeiligheidsGroen != NooitAltijdAanUitEnum.Nooit))
                    {
                        if (dm.VeiligheidsGroen == NooitAltijdAanUitEnum.Altijd)
                        {
                            sb.Append($"{_dpf}{dm.Naam}, {_tpf}{_tvgvolg}{dm.Naam}, NG, {_tpf}{_tvghiaat}{dm.Naam}, ");
                        }
                        else
                        {
                            sb.Append($"{_dpf}{dm.Naam}, {_tpf}{_tvgvolg}{dm.Naam}, {_schpf}{_schvg}{dm.Naam}, {_tpf}{_tvghiaat}{dm.Naam}, ");
                        }
                    }
                    sb.AppendLine("END);");
                }
                return(sb.ToString());

            default:
                return(null);
            }
        }
 public override int HasCode(CCOLCodeTypeEnum type)
 {
     return(type switch
     {
         CCOLCodeTypeEnum.RegCMeetkriterium => 20,
         CCOLCodeTypeEnum.RegCAanvragen => 40,
         _ => 0
     });
 public override int HasCode(CCOLCodeTypeEnum type)
 {
     return(type switch
     {
         CCOLCodeTypeEnum.PrioCInUitMelden => 30,
         CCOLCodeTypeEnum.RegCAanvragen => 90,
         _ => 0
     });
Beispiel #19
0
 public override int HasCode(CCOLCodeTypeEnum type)
 {
     return(type switch
     {
         CCOLCodeTypeEnum.RegCAlternatieven => 101,
         CCOLCodeTypeEnum.PrioCPARCorrecties => 101,
         _ => 0
     });
 public override int HasCode(CCOLCodeTypeEnum type)
 {
     return(type switch
     {
         CCOLCodeTypeEnum.RegCTop => 40,
         CCOLCodeTypeEnum.TabCControlParameters => 10,
         _ => 0
     });
Beispiel #21
0
 public override int HasCode(CCOLCodeTypeEnum type)
 {
     switch (type)
     {
     case CCOLCodeTypeEnum.RegCInitApplication:
         return(90);
     }
     return(0);
 }
Beispiel #22
0
 public override int HasCode(CCOLCodeTypeEnum type)
 {
     return(type switch
     {
         CCOLCodeTypeEnum.RegCIncludes => 10,
         CCOLCodeTypeEnum.RegCKwcApplication => 10,
         CCOLCodeTypeEnum.RegCSystemApplication => 20,
         _ => 0
     });
Beispiel #23
0
        public override string GetCode(ControllerModel c, CCOLCodeTypeEnum type, string ts)
        {
            StringBuilder sb = new StringBuilder();

            switch (type)
            {
            case CCOLCodeTypeEnum.RegCAanvragen:
                if (!c.RichtingGevoeligeAanvragen.Any())
                {
                    return("");
                }

                sb.AppendLine($"{ts}/* Richtinggevoelige aanvragen */");
                sb.AppendLine($"{ts}/* --------------------------= */");

                if (c.RichtingGevoeligeAanvragen.Any(x => x.ResetAanvraag))
                {
                    sb.AppendLine();
                    sb.AppendLine($"{ts}for (fc = 0; fc < FCMAX; ++fc) RR[fc] &= ~BIT8;  /* reset BIT-sturing t.b.v. reset A */");
                    sb.AppendLine();
                }

                foreach (RichtingGevoeligeAanvraagModel rga in c.RichtingGevoeligeAanvragen)
                {
                    if (!rga.ResetAanvraag)
                    {
                        sb.AppendLine($"{ts}aanvraag_richtinggevoelig({_fcpf}{rga.FaseCyclus}, {_dpf}{rga.NaarDetector}, {_dpf}{rga.VanDetector}, {_tpf}{_trga}{_dpf}{rga.VanDetector}, SCH[{_schpf}{_schrgad}{_dpf}{rga.VanDetector}]);");
                    }
                    else
                    {
                        sb.AppendLine($"{ts}aanvraag_richtinggevoelig_reset({_fcpf}{rga.FaseCyclus}, {_dpf}{rga.NaarDetector}, {_dpf}{rga.VanDetector}, {_tpf}{_trga}{_dpf}{rga.VanDetector}, {_tpf}{_trgav}{_dpf}{rga.VanDetector}, SCH[{_schpf}{_schrgad}{_dpf}{rga.VanDetector}]);");
                    }
                }
                return(sb.ToString());

            case CCOLCodeTypeEnum.RegCMeetkriterium:
                if (!c.RichtingGevoeligVerlengen.Any())
                {
                    return("");
                }

                sb.AppendLine($"{ts}/* Richtinggevoelig verlengen */");
                sb.AppendLine($"{ts}/* -------------------------- */");
                foreach (RichtingGevoeligVerlengModel rgv in c.RichtingGevoeligVerlengen)
                {
                    sb.AppendLine($"{ts}MeetKriteriumRGprm((count) {_fcpf}{rgv.FaseCyclus}, (count) {_tpf}{_tkm}{rgv.FaseCyclus},");
                    sb.AppendLine($"{ts}{ts}(bool) RichtingVerlengen({_fcpf}{rgv.FaseCyclus}, {_dpf}{rgv.VanDetector}, {_dpf}{rgv.NaarDetector},");
                    sb.AppendLine($"{ts}{ts}                         {_tpf}{_trgr}{_dpf}{rgv.VanDetector}_{_dpf}{rgv.NaarDetector}, {_tpf}{_trgv}{_dpf}{rgv.VanDetector}_{_dpf}{rgv.NaarDetector},");
                    sb.AppendLine($"{ts}{ts}                         {_hpf}{_hrgv}{_dpf}{rgv.VanDetector}_{_dpf}{rgv.NaarDetector}), (mulv)PRM[{_prmpf}{_prmmkrg}{_dpf}{rgv.VanDetector}],");
                    sb.AppendLine($"{ts}{ts}                         (count)END);");
                }
                return(sb.ToString());

            default:
                return(null);
            }
        }
 public override int HasCode(CCOLCodeTypeEnum type)
 {
     return(type switch
     {
         CCOLCodeTypeEnum.RegCSynchronisaties => 10,
         CCOLCodeTypeEnum.RegCAlternatieven => 30,
         CCOLCodeTypeEnum.PrioCIncludes => 10,
         _ => 0
     });
 public override int HasCode(CCOLCodeTypeEnum type)
 {
     return(type switch
     {
         CCOLCodeTypeEnum.RegCPreApplication => 80,
         CCOLCodeTypeEnum.RegCVerlenggroen => 50,
         CCOLCodeTypeEnum.RegCMaxgroen => 50,
         _ => 0
     });
Beispiel #26
0
 public override int HasCode(CCOLCodeTypeEnum type)
 {
     return(type switch
     {
         CCOLCodeTypeEnum.RegCKlokPerioden => 10,
         CCOLCodeTypeEnum.RegCMaxgroen => 10,
         CCOLCodeTypeEnum.RegCVerlenggroen => 20,
         CCOLCodeTypeEnum.RegCSystemApplication => 50,
         _ => 0
     });
 public override int HasCode(CCOLCodeTypeEnum type)
 {
     return(type switch
     {
         CCOLCodeTypeEnum.PrioCTop => 50,
         CCOLCodeTypeEnum.PrioCInUitMelden => 20,
         CCOLCodeTypeEnum.PrioCPrioriteitsOpties => 10,
         CCOLCodeTypeEnum.RegCPostApplication => 10,
         _ => 0
     });
Beispiel #28
0
        //public override bool HasCCOLBitmapInputs() => true;

        public override int HasCode(CCOLCodeTypeEnum type)
        {
            return(type switch
            {
                CCOLCodeTypeEnum.RegCPreApplication => 70,
                CCOLCodeTypeEnum.RegCMeetkriterium => 40,
                CCOLCodeTypeEnum.RegCRealisatieAfhandeling => 20,
                CCOLCodeTypeEnum.RegCPostSystemApplication => 90,
                _ => 0
            });
Beispiel #29
0
        public override int HasCode(CCOLCodeTypeEnum type)
        {
            switch (type)
            {
            case CCOLCodeTypeEnum.RegCMeeverlengen:
                return(10);

            default:
                return(0);
            }
        }
        public override int HasCode(CCOLCodeTypeEnum type)
        {
            switch (type)
            {
            case CCOLCodeTypeEnum.RegCAanvragen:
                return(30);

            default:
                return(0);
            }
        }