private string GeneratePraticeCcolReg2(ControllerModel controller)
        {
            var sb = new StringBuilder();

            if (controller.ModuleMolen.LangstWachtendeAlternatief)
            {
                sb.AppendLine("#include \"lwmlfunc.c\"");
            }
            sb.AppendLine("#include \"fbericht.c\"");
            sb.AppendLine();
            sb.AppendLine($"#include \"{controller.Data.Naam}reg.c\"");
            sb.AppendLine($"#include \"{controller.Data.Naam}tab.c\"");
            sb.AppendLine($"#include \"{controller.Data.Naam}ov.c\"");
            if (controller.Data.VLOGInTestOmgeving)
            {
                sb.AppendLine();
                sb.AppendLine($"#include \"ccol_mon.c\"");
            }
            sb.AppendLine();
            if (controller.InterSignaalGroep.Gelijkstarten.Any() ||
                controller.InterSignaalGroep.Voorstarten.Any())
            {
                sb.AppendLine($"#include \"syncfunc.c\"");
            }
            if (controller.HasDSI())
            {
                sb.AppendLine($"#include \"dsifunc.c\"");
            }
            sb.AppendLine($"#include \"xtnd_dic.c\"");
            return(sb.ToString());
        }
Esempio n. 2
0
        private string GenerateSysH(ControllerModel c)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("/* ALGEMENE APPLICATIEFILE */");
            sb.AppendLine("/* ----------------------- */");
            sb.AppendLine();
            sb.Append(GenerateFileHeader(c.Data, "sys.h"));
            sb.AppendLine();
            sb.Append(GenerateVersionHeader(c.Data));
            sb.AppendLine();
            sb.AppendLine($"#define SYSTEM \"{c.Data.Naam}\"");
            sb.AppendLine();
            sb.Append(GenerateSysHFasen(c));
            sb.AppendLine();
            sb.Append(GenerateSysHUitgangen(c));
            sb.AppendLine();
            sb.Append(GenerateSysHDetectors(c));
            sb.AppendLine();
            sb.Append(GenerateSysHIngangen(c));
            sb.AppendLine();
            sb.Append(GenerateSysHHulpElementen(c));
            sb.AppendLine();
            sb.Append(GenerateSysHGeheugenElementen(c));
            sb.AppendLine();
            sb.Append(GenerateSysHTijdElementen(c));
            sb.AppendLine();
            sb.Append(GenerateSysHCounters(c));
            sb.AppendLine();
            sb.Append(GenerateSysHSchakelaars(c));
            sb.AppendLine();
            sb.Append(GenerateSysHParameters(c));
            sb.AppendLine();
            if (c.HasDSI())
            {
                sb.Append(GenerateSysHDS(c));
                sb.AppendLine();
            }
            if (c.OVData.OVIngreepType == OVIngreepTypeEnum.Uitgebreid)
            {
                var ov = 0;
                foreach (var ovFC in c.OVData.OVIngrepen)
                {
                    sb.AppendLine($"{ts}#define ovFC{ovFC.FaseCyclus} {ov.ToString()}");
                    ++ov;
                }
                foreach (var hdFC in c.OVData.HDIngrepen)
                {
                    sb.AppendLine($"{ts}#define hdFC{hdFC.FaseCyclus} {ov.ToString()}");
                    ++ov;
                }
                sb.AppendLine($"{ts}#define ovOVMAX {ov.ToString()}");
                sb.AppendLine();
            }

            sb.AppendLine("/* modulen */");
            sb.AppendLine("/* ------- */");
            if (!c.Data.MultiModuleReeksen)
            {
                sb.AppendLine($"{ts}#define MLMAX1 {c.ModuleMolen.Modules.Count} /* aantal modulen */");
            }
            else
            {
                foreach (var r in c.MultiModuleMolens)
                {
                    sb.AppendLine($"{ts}#define {r.Reeks}MAX1 {r.Modules.Count} /* aantal modulen reeks {r.Reeks} */");
                }
            }
            sb.AppendLine();
            if (c.HalfstarData.IsHalfstar)
            {
                sb.AppendLine("/* signaalplannen*/");
                sb.AppendLine("/* -------------- */");
                sb.AppendLine($"{ts}#define PLMAX1 {c.HalfstarData.SignaalPlannen.Count} /* aantal signaalplannen */");
                sb.AppendLine();
            }
            sb.AppendLine("/* Aantal perioden voor max groen */");
            sb.AppendLine("/* ------- */");
            // Here: +1 to allow room for default period in arrays made with this value
            sb.AppendLine($"{ts}#define MPERIODMAX {c.PeriodenData.Perioden.Count(x => x.Type == PeriodeTypeEnum.Groentijden) + 1} /* aantal groenperioden */");
            sb.AppendLine();

            foreach (var gen in OrderedPieceGenerators[CCOLCodeTypeEnum.SysHBeforeUserDefines])
            {
                sb.Append(gen.Value.GetCode(c, CCOLCodeTypeEnum.SysHBeforeUserDefines, ts));
            }

            sb.AppendLine("/* Gebruikers toevoegingen file includen */");
            sb.AppendLine("/* ------------------------------------- */");
            sb.AppendLine($"{ts}#include \"{c.Data.Naam}sys.add\"");
            sb.AppendLine();

            return(sb.ToString());
        }
        private string GenerateRegCIncludes(ControllerModel controller)
        {
            var sb = new StringBuilder();

            sb.AppendLine("/* include files */");
            sb.AppendLine("/* ------------- */");
            sb.AppendLine($"{ts}#include \"{controller.Data.Naam}sys.h\"");
            sb.AppendLine($"{ts}#include \"stdfunc.h\"  /* standaard functies                */");
            sb.AppendLine($"{ts}#include \"fcvar.c\"    /* fasecycli                         */");
            sb.AppendLine($"{ts}#include \"kfvar.c\"    /* conflicten                        */");
            sb.AppendLine($"{ts}#include \"usvar.c\"    /* uitgangs elementen                */");
            sb.AppendLine($"{ts}#include \"dpvar.c\"    /* detectie elementen                */");
            if (controller.Data.GarantieOntruimingsTijden)
            {
                if (controller.Data.CCOLVersie >= CCOLVersieEnum.CCOL95 && controller.Data.Intergroen)
                {
                    sb.AppendLine($"{ts}#include \"tig_min.c\"   /* garantie-ontruimingstijden        */");
                }
                else
                {
                    sb.AppendLine($"{ts}#include \"to_min.c\"   /* garantie-ontruimingstijden        */");
                }
            }
            sb.AppendLine($"{ts}#include \"trg_min.c\"  /* garantie-roodtijden               */");
            sb.AppendLine($"{ts}#include \"tgg_min.c\"  /* garantie-groentijden              */");
            sb.AppendLine($"{ts}#include \"tgl_min.c\"  /* garantie-geeltijden               */");
            sb.AppendLine($"{ts}#include \"isvar.c\"    /* ingangs elementen                 */");
            if (controller.HasDSI())
            {
                sb.AppendLine($"{ts}#include \"dsivar.c\"   /* selectieve detectie               */");
            }
            sb.AppendLine($"{ts}#include \"hevar.c\"    /* hulp elementen                    */");
            sb.AppendLine($"{ts}#include \"mevar.c\"    /* geheugen elementen                */");
            sb.AppendLine($"{ts}#include \"tmvar.c\"    /* tijd elementen                    */");
            sb.AppendLine($"{ts}#include \"ctvar.c\"    /* teller elementen                  */");
            sb.AppendLine($"{ts}#include \"schvar.c\"   /* software schakelaars              */");
            if (controller.HalfstarData.IsHalfstar)
            {
                if (controller.Data.CCOLVersie >= CCOLVersieEnum.CCOL95)
                {
                    sb.AppendLine($"{ts}#include \"trigvar.c\"   /* uitgebreide signaalplan structuur */");
                }
                else
                {
                    sb.AppendLine($"{ts}#include \"tigvar.c\"   /* uitgebreide signaalplan structuur */");
                }
                sb.AppendLine($"{ts}#include \"plevar.c\"   /* uitgebreide signaalplan structuur */");
            }
            sb.AppendLine($"{ts}#include \"prmvar.c\"   /* parameters                        */");
            sb.AppendLine($"{ts}#include \"lwmlvar.c\"  /* langstwachtende modulen structuur */");
            if (controller.Data.VLOGType != VLOGTypeEnum.Geen)
            {
                sb.AppendLine($"{ts}#ifndef NO_VLOG");
                sb.AppendLine($"{ts}{ts}#include \"vlogvar.c\"  /* variabelen t.b.v. vlogfuncties                */");
                sb.AppendLine($"{ts}{ts}#include \"logvar.c\"   /* variabelen t.b.v. logging                     */");
                sb.AppendLine($"{ts}{ts}#include \"monvar.c\"   /* variabelen t.b.v. realtime monitoring         */");
                sb.AppendLine($"{ts}{ts}#include \"fbericht.h\"");
                sb.AppendLine($"{ts}#endif");
            }
            if (controller.PrioData.PrioIngrepen.Count > 0 || controller.PrioData.HDIngrepen.Count > 0)
            {
                sb.AppendLine($"{ts}#include \"prio.h\"       /* prio-afhandeling                  */");
            }
            if (controller.RISData.RISToepassen)
            {
                sb.AppendLine($"{ts}#ifndef NO_RIS");
                sb.AppendLine($"{ts}{ts}#include \"risvar.c\" /* ccol ris controller */");
                sb.AppendLine($"{ts}{ts}#include \"risappl.c\" /* RIS applicatiefuncties */");
                if (controller.PrioData.PrioIngrepen.Any(x => x.MeldingenData.Inmeldingen.Any(x2 => x2.Type == PrioIngreepInUitMeldingVoorwaardeTypeEnum.RISVoorwaarde)) ||
                    controller.PrioData.PrioIngrepen.Any(x => x.MeldingenData.Uitmeldingen.Any(x2 => x2.Type == PrioIngreepInUitMeldingVoorwaardeTypeEnum.RISVoorwaarde)))
                {
                    sb.AppendLine($"{ts}{ts}#if (CCOL_V > 100)");
                    sb.AppendLine($"{ts}{ts}#define RIS_SSM  /* Gebruik in/uitmelden via RIS SSM */");
                    sb.AppendLine($"{ts}{ts}#endif");
                }
                sb.AppendLine($"{ts}{ts}#include \"extra_func_ris.c\" /* RIS extra functies */");
                sb.AppendLine($"{ts}{ts}#if (!defined AUTOMAAT && !defined AUTOMAAT_TEST)");
                sb.AppendLine($"{ts}{ts}{ts}#include \"rissimvar.h\" /* ccol ris simulatie functie */");
                sb.AppendLine($"{ts}{ts}#endif");
                sb.AppendLine($"{ts}#endif");
            }
            sb.AppendLine($"{ts}#include \"prsvar.c\"   /* parameters parser                 */");
            sb.AppendLine($"{ts}#include \"control.c\"  /* controller interface              */");
            sb.AppendLine($"{ts}#include \"rtappl.h\"   /* applicatie routines               */");
            if (controller.PrioData.PrioIngrepen.Count > 0 || controller.PrioData.HDIngrepen.Count > 0)
            {
                if (controller.PrioData.PrioIngrepen.Any(x => x.CheckWagenNummer))
                {
                    sb.AppendLine($"{ts}#define PRIO_CHECK_WAGENNMR /* check op wagendienstnummer          */");
                }
                sb.AppendLine($"{ts}#include \"extra_func_prio.c\" /* extra standaard functies OV     */");
            }
            sb.AppendLine($"{ts}#include \"extra_func.c\" /* extra standaard functies        */");
            sb.AppendLine();
            sb.AppendLine("#if (!defined AUTOMAAT && !defined AUTOMAAT_TEST)");
            sb.AppendLine("/*    #include \"ccdump.inc\" */");
            sb.AppendLine($"{ts}#include \"keysdef.c\"     /* Definitie toetsenbord t.b.v. stuffkey  */");
            sb.AppendLine($"{ts}#if !defined (_DEBUG)");
            sb.AppendLine($"{ts}{ts}#include \"xyprintf.h\" /* Printen debuginfo                      */");
            sb.AppendLine($"{ts}#endif");
            sb.AppendLine("#endif");
            sb.AppendLine();
            sb.AppendLine($"{ts}#include \"detectie.c\"");
            sb.AppendLine($"{ts}#include \"ccolfunc.c\"");
            if (controller.Data.FixatieMogelijk)
            {
                sb.AppendLine($"{ts}#include \"fixatie.c\"");
            }
            if (controller.Data.SynchronisatiesType == SynchronisatiesTypeEnum.SyncFunc &&
                (controller.InterSignaalGroep.Voorstarten.Any() || controller.InterSignaalGroep.Gelijkstarten.Any()))
            {
                sb.AppendLine($"{ts}#include \"syncvar.c\"  /* synchronisatie functies           */");
            }

            if (controller.HalfstarData.IsHalfstar)
            {
                sb.AppendLine($"{ts}#include \"{controller.Data.Naam}hst.c\"");
            }
            foreach (var gen in OrderedPieceGenerators[CCOLCodeTypeEnum.RegCIncludes])
            {
                sb.Append(gen.Value.GetCode(controller, CCOLCodeTypeEnum.RegCIncludes, ts));
            }
            sb.AppendLine($"{ts}#include \"{controller.Data.Naam}reg.add\"");
            sb.AppendLine();

            return(sb.ToString());
        }
Esempio n. 4
0
        public static List <string> GetNeededCCOLLibraries(ControllerModel c, bool automaat, int visualVer)
        {
            // Collect needed libraries
            var neededlibs = new List <string> {
                "ccolreg.lib", "lwmlfunc.lib", "stdfunc.lib"
            };

            if (!automaat)
            {
                neededlibs.Add("comctl32.lib");
                neededlibs.Add("ccolsim.lib");
                neededlibs.Add(c.Data.CCOLMulti ? "ccolmainms.lib" : "ccolmain.lib");
                if (c.PTPData.PTPKoppelingen != null &&
                    c.PTPData.PTPKoppelingen.Any())
                {
                    neededlibs.Add("ccolks.lib");
                }
                switch (c.Data.CCOLVersie)
                {
                case CCOLVersieEnum.CCOL8:
                    break;

                case CCOLVersieEnum.CCOL9:
                case CCOLVersieEnum.CCOL95:
                case CCOLVersieEnum.CCOL100:
                case CCOLVersieEnum.CCOL110:
                    neededlibs.Add("htmlhelp.lib");
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
            if (c.Data.VLOGType != VLOGTypeEnum.Geen)
            {
                neededlibs.Add("ccolvlog.lib");
            }
            if (c.HalfstarData.IsHalfstar)
            {
                neededlibs.Add("plfunc.lib");
                neededlibs.Add("plefunc.lib");
                neededlibs.Add("tx_synch.lib");
                neededlibs.Add(c.Data.CCOLVersie >= CCOLVersieEnum.CCOL95 && c.Data.Intergroen ? "trigfunc.lib" : "tigfunc.lib");
            }
            if (c.HasDSI())
            {
                neededlibs.Add("dsifunc.lib");
            }
            if (c.RISData.RISToepassen)
            {
                if (c.RISData.RISFasen.Any(x => x.LaneData.Any()))
                {
                    neededlibs.Add("risfunc.lib");
                }
                if (c.RISData.RISFasen.Any(x => x.LaneData.Any(x2 => x2.SimulatedStations.Any())))
                {
                    neededlibs.Add("rissimfunc.lib");
                }
            }

            switch (visualVer)
            {
            case 0:
                break;

            case 2010:
                break;

            case 2013:
                break;

            case 2017:
            case 2019:
                neededlibs.Add("legacy_stdio_definitions.lib");
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(neededlibs);
        }
Esempio n. 5
0
        private string GenerateRegelingC(ControllerModel c)
        {
            var sb = new StringBuilder();

            sb.AppendLine("/* Compileerbestand */");
            sb.AppendLine("/* ---------------- */");
            sb.AppendLine();
            sb.Append(GenerateFileHeader(c.Data, "regeling.c"));
            sb.AppendLine();
            sb.Append(GenerateVersionHeader(c.Data));
            sb.AppendLine();
            sb.AppendLine("/* Functionaliteiten regeling:");
            sb.AppendLine($"{ts}RIS: {(c.RISData.RISToepassen ? "ja" : "nee")}");
            sb.AppendLine($"{ts}PTP: {(c.PTPData.PTPKoppelingen.Any() ? "ja" : "nee")}");
            sb.AppendLine($"{ts}Intergroen: {(c.Data.Intergroen ? "ja" : "nee")}");
            sb.AppendLine("*/");
            sb.AppendLine();
            sb.AppendLine("#ifndef AUTOMAAT");
            sb.AppendLine($"{ts}#pragma region CCOL library dependencies");
            sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"ccolreg.lib\")");
            sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"ccolsim.lib\")");
            sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"lwmlfunc.lib\")");
            sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"stdfunc.lib\")");
            if (c.Data.CCOLVersie <= CCOLVersieEnum.CCOL8 && c.Data.VLOGType != VLOGTypeEnum.Geen ||
                c.Data.CCOLVersie >= CCOLVersieEnum.CCOL9 && c.Data.VLOGSettings.VLOGToepassen)
            {
                sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"ccolvlog.lib\")");
            }
            if (c.HasDSI())
            {
                sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"dsifunc.lib\")");
            }
            if (c.PTPData.PTPKoppelingen.Any())
            {
                sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"ccolks.lib\")");
            }
            sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"ccolmain.lib\")");
            if (c.HalfstarData.IsHalfstar)
            {
                sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"plfunc.lib\")");
                sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"plefunc.lib\")");
                sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"tx_synch.lib\")");
                sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"{(c.Data.CCOLVersie >= CCOLVersieEnum.CCOL95 && c.Data.Intergroen ? "trigfunc.lib" : "tigfunc.lib")}\")");
            }
            if (c.RISData.RISToepassen)
            {
                sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"risfunc.lib\")");
                sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"rissimfunc.lib\")");
                sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"comctl32.lib\")");
                if (c.Data.CCOLVersie > CCOLVersieEnum.CCOL8)
                {
                    sb.AppendLine($"{ts}{ts}#pragma comment(lib, \"htmlhelp.lib\")");
                }
                sb.AppendLine($"{ts}{ts}/* Voor Visual 2017 en hoger: haal onderstaande regel uit het commentaar */");
                sb.AppendLine($"{ts}{ts}/* #pragma comment(lib, \"legacy_stdio_definitions.lib\") */");
            }
            sb.AppendLine($"{ts}#pragma endregion");
            sb.AppendLine("#endif");
            sb.AppendLine();
            sb.AppendLine("#ifndef CCOLTIG     /* Intergroentijden worden toegepast */");
            sb.AppendLine($"{ts}#define CCOLTIG");
            sb.AppendLine("#endif");
            sb.AppendLine();
            if (c.PTPData.PTPKoppelingen.Any())
            {
                sb.AppendLine($"#include \"PTPWIN.C\"");
            }
            sb.AppendLine($"#include \"{c.Data.Naam}sys.h\"");
            sb.AppendLine($"#include \"{c.Data.Naam}reg.c\"");
            if (c.HasPTorHD())
            {
                sb.AppendLine($"#include \"{c.Data.Naam}prio.c\"");
            }
            sb.AppendLine($"#include \"{c.Data.Naam}tab.c\"");
            if (c.Data.SynchronisatiesType == SynchronisatiesTypeEnum.SyncFunc &&
                (c.InterSignaalGroep.Gelijkstarten.Any() || c.InterSignaalGroep.Voorstarten.Any()))
            {
                sb.AppendLine("#include \"syncfunc.c\"");
            }
            sb.AppendLine("#ifndef AUTOMAAT");
            if (!c.Data.NietGebruikenBitmap)
            {
                sb.AppendLine($"{ts}#include \"{c.Data.Naam}dpl.c\"");
            }
            sb.AppendLine($"{ts}#include \"{c.Data.Naam}sim.c\"");
            if (c.RISData.RISToepassen)
            {
                sb.AppendLine($"{ts}#include \"{c.Data.Naam}rissim.c\"");
            }

            sb.AppendLine("#endif");

            return(sb.ToString());
        }
        private string GenerateRegCIncludes(ControllerModel controller)
        {
            var sb = new StringBuilder();

            sb.AppendLine("/* include files */");
            sb.AppendLine("/* ------------- */");
            sb.AppendLine($"{ts}#include \"{controller.Data.Naam}sys.h\"");
            sb.AppendLine($"{ts}#include \"fcvar.c\"    /* fasecycli                         */");
            sb.AppendLine($"{ts}#include \"kfvar.c\"    /* conflicten                        */");
            sb.AppendLine($"{ts}#include \"usvar.c\"    /* uitgangs elementen                */");
            sb.AppendLine($"{ts}#include \"dpvar.c\"    /* detectie elementen                */");
            if (controller.Data.GarantieOntruimingsTijden)
            {
                if (controller.Data.CCOLVersie >= CCOLVersieEnum.CCOL95 && controller.Data.Intergroen)
                {
                    sb.AppendLine($"{ts}#include \"tig_min.c\"   /* garantie-ontruimingstijden        */");
                }
                else
                {
                    sb.AppendLine($"{ts}#include \"to_min.c\"   /* garantie-ontruimingstijden        */");
                }
            }
            sb.AppendLine($"{ts}#include \"trg_min.c\"  /* garantie-roodtijden               */");
            sb.AppendLine($"{ts}#include \"tgg_min.c\"  /* garantie-groentijden              */");
            sb.AppendLine($"{ts}#include \"tgl_min.c\"  /* garantie-geeltijden               */");
            sb.AppendLine($"{ts}#include \"isvar.c\"    /* ingangs elementen                 */");
            if (controller.HasDSI())
            {
                sb.AppendLine($"{ts}#include \"dsivar.c\"   /* selectieve detectie               */");
            }
            sb.AppendLine($"{ts}#include \"hevar.c\"    /* hulp elementen                    */");
            sb.AppendLine($"{ts}#include \"mevar.c\"    /* geheugen elementen                */");
            sb.AppendLine($"{ts}#include \"tmvar.c\"    /* tijd elementen                    */");
            sb.AppendLine($"{ts}#include \"ctvar.c\"    /* teller elementen                  */");
            sb.AppendLine($"{ts}#include \"schvar.c\"   /* software schakelaars              */");
            if (controller.HalfstarData.IsHalfstar)
            {
                if (controller.Data.CCOLVersie >= CCOLVersieEnum.CCOL95)
                {
                    sb.AppendLine($"{ts}#include \"trigvar.c\"   /* uitgebreide signaalplan structuur */");
                }
                else
                {
                    sb.AppendLine($"{ts}#include \"tigvar.c\"   /* uitgebreide signaalplan structuur */");
                }
                sb.AppendLine($"{ts}#include \"plevar.c\"   /* uitgebreide signaalplan structuur */");
            }
            sb.AppendLine($"{ts}#include \"prmvar.c\"   /* parameters                        */");
            sb.AppendLine($"{ts}#include \"lwmlvar.c\"  /* langstwachtende modulen structuur */");
            if (controller.Data.VLOGType != VLOGTypeEnum.Geen)
            {
                sb.AppendLine($"{ts}#ifndef NO_VLOG");
                sb.AppendLine($"{ts}{ts}#include \"vlogvar.c\"  /* variabelen t.b.v. vlogfuncties                */");
                sb.AppendLine($"{ts}{ts}#include \"logvar.c\"   /* variabelen t.b.v. logging                     */");
                sb.AppendLine($"{ts}{ts}#include \"monvar.c\"   /* variabelen t.b.v. realtime monitoring         */");
                sb.AppendLine($"{ts}{ts}#include \"fbericht.h\"");
                sb.AppendLine($"{ts}#endif");
            }
            sb.AppendLine($"{ts}#include \"prsvar.c\"   /* parameters parser                 */");
            sb.AppendLine($"{ts}#include \"control.c\"  /* controller interface              */");
            sb.AppendLine($"{ts}#include \"rtappl.h\"   /* applicatie routines               */");
            sb.AppendLine($"{ts}#include \"stdfunc.h\"  /* standaard functies                */");
            sb.AppendLine($"{ts}#include \"extra_func.c\" /* extra standaard functies        */");
            if (controller.OVData.OVIngrepen.Count > 0 || controller.OVData.HDIngrepen.Count > 0)
            {
                sb.AppendLine($"{ts}#include \"ov.h\"       /* ov-afhandeling                    */");
                sb.AppendLine($"{ts}#include \"extra_func_ov.c\" /* extra standaard functies OV     */");
            }
            sb.AppendLine();
            sb.AppendLine("#if (!defined AUTOMAAT && !defined AUTOMAAT_TEST)");
            sb.AppendLine("/*    #include \"ccdump.inc\" */");
            sb.AppendLine($"{ts}#include \"keysdef.c\"     /* Definitie toetsenbord t.b.v. stuffkey  */");
            sb.AppendLine($"{ts}#if !defined (_DEBUG)");
            sb.AppendLine($"{ts}{ts}#include \"xyprintf.h\" /* Printen debuginfo                      */");
            sb.AppendLine($"{ts}#endif");
            sb.AppendLine("#endif");
            sb.AppendLine();
            sb.AppendLine($"{ts}#include \"detectie.c\"");
            sb.AppendLine($"{ts}#include \"ccolfunc.c\"");
            if (controller.InterSignaalGroep.Voorstarten.Any() || controller.InterSignaalGroep.Gelijkstarten.Any())
            {
                sb.AppendLine($"{ts}#include \"syncvar.c\"  /* synchronisatie functies           */");
            }

            if (controller.HalfstarData.IsHalfstar)
            {
                sb.AppendLine($"{ts}#include \"{controller.Data.Naam}hst.c\"");
            }
            foreach (var gen in OrderedPieceGenerators[CCOLCodeTypeEnum.RegCIncludes])
            {
                sb.Append(gen.Value.GetCode(controller, CCOLCodeTypeEnum.RegCIncludes, ts));
            }
            sb.AppendLine($"{ts}#include \"{controller.Data.Naam}reg.add\"");
            sb.AppendLine();

            return(sb.ToString());
        }
Esempio n. 7
0
        private string GenerateTabCIncludes(ControllerModel c)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine($"/* include files */");
            sb.AppendLine($"/* ------------- */");
            if (c.Data.PracticeOmgeving)
            {
                sb.AppendLine("#ifndef PRACTICE_TEST");
            }
            sb.AppendLine($"{ts}#include \"{c.Data.Naam}sys.h\"");
            sb.AppendLine($"{ts}#include \"fcvar.h\"    /* fasecycli                         */");
            sb.AppendLine($"{ts}#include \"kfvar.h\"    /* conflicten                        */");
            sb.AppendLine($"{ts}#include \"usvar.h\"    /* uitgangs elementen                */");
            sb.AppendLine($"{ts}#include \"dpvar.h\"    /* detectie elementen                */");
            if (c.Data.GarantieOntruimingsTijden)
            {
                if (c.Data.CCOLVersie >= CCOLVersieEnum.CCOL95 && c.Data.Intergroen)
                {
                    sb.AppendLine($"{ts}#include \"tig_min.h\"   /* garantie-ontruimingstijden        */");
                }
                else
                {
                    sb.AppendLine($"{ts}#include \"to_min.h\"   /* garantie-ontruimingstijden        */");
                }
            }
            sb.AppendLine($"{ts}#include \"trg_min.h\"  /* garantie-roodtijden               */");
            sb.AppendLine($"{ts}#include \"tgg_min.h\"  /* garantie-groentijden              */");
            sb.AppendLine($"{ts}#include \"tgl_min.h\"  /* garantie-geeltijden               */");
            sb.AppendLine($"{ts}#include \"isvar.h\"    /* ingangs elementen                 */");
            if (c.HasDSI())
            {
                sb.AppendLine($"{ts}#include \"dsivar.h\"   /* selectieve detectie               */");
            }
            sb.AppendLine($"{ts}#include \"hevar.h\"    /* hulp elementen                    */");
            sb.AppendLine($"{ts}#include \"mevar.h\"    /* geheugen elementen                */");
            sb.AppendLine($"{ts}#include \"tmvar.h\"    /* tijd elementen                    */");
            sb.AppendLine($"{ts}#include \"ctvar.h\"    /* teller elementen                  */");
            sb.AppendLine($"{ts}#include \"schvar.h\"   /* software schakelaars              */");
            sb.AppendLine($"{ts}#include \"prmvar.h\"   /* parameters                        */");
            sb.AppendLine($"{ts}#include \"lwmlvar.h\"  /* langstwachtende modulen structuur */");
            sb.AppendLine($"{ts}#include \"control.h\"  /* controller interface              */");
            if (c.Data.VLOGType != Models.Enumerations.VLOGTypeEnum.Geen)
            {
                sb.AppendLine($"{ts}#ifndef NO_VLOG");
                sb.AppendLine($"{ts}{ts}#include \"vlogvar.h\"  /* variabelen t.b.v. vlogfuncties                */");
                sb.AppendLine($"{ts}{ts}#include \"logvar.h\"   /* variabelen t.b.v. logging                     */");
                sb.AppendLine($"{ts}{ts}#include \"monvar.h\"   /* variabelen t.b.v. realtime monitoring         */");
                sb.AppendLine($"{ts}#endif");
            }

            if (c.HalfstarData.IsHalfstar)
            {
                sb.AppendLine($"{ts}#include \"tx_synch.h\"");
                sb.AppendLine($"{ts}#include \"plevar.h\"");
                sb.AppendLine($"{ts}#include \"halfstar.h\"");
            }
            if (c.Data.PracticeOmgeving)
            {
                sb.AppendLine("#endif // PRACTICE_TEST");
            }

            sb.AppendLine();
            sb.AppendLine($"{ts}mulv FC_type[FCMAX];");

            AddCodeTypeToStringBuilder(c, sb, CCOLCodeTypeEnum.TabCControlIncludes, true, true, true, true);

            return(sb.ToString());
        }
Esempio n. 8
0
        private string GenerateTabCControlParameters(ControllerModel controller)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("void control_parameters(void)");
            sb.AppendLine("{");

            if (controller.Data.CCOLVersie < CCOLVersieEnum.CCOL9)
            {
                sb.AppendLine($"{ts}#ifndef NO_VLOG");
                sb.AppendLine($"{ts}{ts}int i;");
                sb.AppendLine($"{ts}#endif");
                sb.AppendLine();
            }

            AddCodeTypeToStringBuilder(controller, sb, CCOLCodeTypeEnum.TabCControlParameters, true, false, false, true);

            sb.Append(GenerateTabCControlParametersFasen(controller));
            sb.AppendLine();
            sb.Append(GenerateTabCControlParametersConflicten(controller));
            sb.AppendLine();
            sb.Append(GenerateTabCControlParametersUitgangen(controller));
            sb.AppendLine();
            sb.Append(GenerateTabCControlParametersDetectors(controller));
            sb.AppendLine();
            sb.Append(GenerateTabCControlParametersIngangen(controller));
            sb.AppendLine();
            sb.Append(GenerateTabCControlParametersHulpElementen(controller));
            sb.AppendLine();
            sb.Append(GenerateTabCControlParametersGeheugenElementen(controller));
            sb.AppendLine();
            sb.Append(GenerateTabCControlParametersTijdElementen(controller));
            sb.AppendLine();
            sb.Append(GenerateTabCControlParametersCounters(controller));
            sb.AppendLine();
            sb.Append(GenerateTabCControlParametersSchakelaars(controller));
            sb.AppendLine();
            sb.Append(GenerateTabCControlParametersParameters(controller));
            sb.AppendLine();
            sb.Append(GenerateTabCControlParametersExtraData(controller));
            sb.AppendLine();
            if (controller.HasDSI())
            {
                sb.Append(GenerateTabCControlParametersDS(controller));
                sb.AppendLine();
            }
            sb.Append(GenerateTabCControlParametersModulen(controller));
            sb.AppendLine();
            if (controller.Data.VLOGType != Models.Enumerations.VLOGTypeEnum.Geen)
            {
                sb.Append(GenerateTabCControlParametersVLOG(controller));
                sb.AppendLine();
            }
            sb.Append(GenerateTabCControlParametersIOTypes(controller));
            sb.AppendLine();

            AddCodeTypeToStringBuilder(controller, sb, CCOLCodeTypeEnum.TabCControlParameters, false, true, false, true);

            if (controller.HalfstarData.IsHalfstar)
            {
                sb.AppendLine($"{ts}signaalplan_instellingen();");
                sb.AppendLine();
            }

            sb.AppendLine($"{ts}#include \"{controller.Data.Naam}tab.add\"");

            sb.AppendLine("}");

            return(sb.ToString());
        }
        private string GenerateSysH(ControllerModel c)
        {
            var sb = new StringBuilder();

            sb.AppendLine("/* ALGEMENE APPLICATIEFILE */");
            sb.AppendLine("/* ----------------------- */");
            sb.AppendLine();
            sb.Append(GenerateFileHeader(c.Data, "sys.h"));
            sb.AppendLine();
            sb.Append(GenerateVersionHeader(c.Data));
            sb.AppendLine();
            sb.AppendLine($"#define SYSTEM \"{c.Data.Naam}\"");
            if (c.Data.AanmakenVerionSysh)
            {
                var ver = c.Data.Versies.LastOrDefault();
                if (ver != null)
                {
                    sb.AppendLine($"#define VERSION \"{ver.Versie} {ver.Datum:yyyyMMdd}\"");
                }
            }
            sb.AppendLine();
            sb.Append(GenerateSysHFasen(c));
            sb.AppendLine();
            sb.Append(GenerateSysHUitgangen(c));
            sb.AppendLine();
            sb.Append(GenerateSysHDetectors(c));
            sb.AppendLine();
            sb.Append(GenerateSysHIngangen(c));
            sb.AppendLine();
            sb.Append(GenerateSysHHulpElementen(c));
            sb.AppendLine();
            sb.Append(GenerateSysHGeheugenElementen(c));
            sb.AppendLine();
            sb.Append(GenerateSysHTijdElementen(c));
            sb.AppendLine();
            sb.Append(GenerateSysHCounters(c));
            sb.AppendLine();
            sb.Append(GenerateSysHSchakelaars(c));
            sb.AppendLine();
            sb.Append(GenerateSysHParameters(c));
            sb.AppendLine();
            if (c.HasDSI())
            {
                sb.Append(GenerateSysHDS(c));
                sb.AppendLine();
            }
            var ov = 0;

            if (c.PrioData.PrioIngreepType == PrioIngreepTypeEnum.GeneriekePrioriteit)
            {
                foreach (var ovFC in c.PrioData.PrioIngrepen)
                {
                    sb.AppendLine($"{ts}#define prioFC{ovFC.FaseCyclus}{ovFC.Naam} {ov.ToString()}");
                    ++ov;
                }
                foreach (var hdFC in c.PrioData.HDIngrepen)
                {
                    sb.AppendLine($"{ts}#define hdFC{hdFC.FaseCyclus} {ov.ToString()}");
                    ++ov;
                }
                sb.AppendLine($"{ts}#define prioFCMAX {ov.ToString()}");
                sb.AppendLine();
            }

            sb.AppendLine("/* modulen */");
            sb.AppendLine("/* ------- */");
            if (!c.Data.MultiModuleReeksen)
            {
                sb.AppendLine($"{ts}#define MLMAX1 {c.ModuleMolen.Modules.Count} /* aantal modulen */");
            }
            else
            {
                foreach (var r in c.MultiModuleMolens)
                {
                    sb.AppendLine($"{ts}#define {r.Reeks}MAX1 {r.Modules.Count} /* aantal modulen reeks {r.Reeks} */");
                }
            }
            sb.AppendLine();
            if (c.HalfstarData.IsHalfstar)
            {
                sb.AppendLine("/* signaalplannen */");
                sb.AppendLine("/* -------------- */");
                sb.AppendLine($"{ts}#define PLMAX1 {c.HalfstarData.SignaalPlannen.Count} /* aantal signaalplannen */");
                sb.AppendLine();
            }
            if (c.StarData.ToepassenStar)
            {
                sb.AppendLine("/* starre programma's */");
                sb.AppendLine("/* ------------------ */");
                var pr = 0;
                foreach (var programma in c.StarData.Programmas)
                {
                    sb.AppendLine($"{ts}#define STAR{pr + 1} {pr} /* programma {programma.Naam} */");
                    ++pr;
                }
                sb.AppendLine($"{ts}#define STARMAX {c.StarData.Programmas.Count} /* aantal starre programmas */");
                sb.AppendLine();
            }
            sb.AppendLine("/* Aantal perioden voor max groen */");
            sb.AppendLine("/* ------- */");
            // Here: +1 to allow room for default period in arrays made with this value
            sb.AppendLine($"{ts}#define MPERIODMAX {c.PeriodenData.Perioden.Count(x => x.Type == PeriodeTypeEnum.Groentijden) + 1} /* aantal groenperioden */");
            sb.AppendLine();

            foreach (var gen in OrderedPieceGenerators[CCOLCodeTypeEnum.SysHBeforeUserDefines])
            {
                sb.Append(gen.Value.GetCode(c, CCOLCodeTypeEnum.SysHBeforeUserDefines, ts));
            }

            sb.AppendLine("/* Gebruikers toevoegingen file includen */");
            sb.AppendLine("/* ------------------------------------- */");
            sb.AppendLine($"{ts}#include \"{c.Data.Naam}sys.add\"");
            sb.AppendLine();

            return(sb.ToString());
        }