Example #1
0
 public FaseDetectorTypeChangedMessage(ControllerModel controller, string detectordefine, DetectorTypeEnum oldType, DetectorTypeEnum newType)
 {
     Controller     = controller;
     NewType        = newType;
     OldType        = oldType;
     DetectorDefine = detectordefine;
 }
Example #2
0
        private string GenerateTabCControlParametersIOTypes(ControllerModel c)
        {
            var sb = new StringBuilder();

            sb.AppendLine("/* Typen ingangen */");
            sb.AppendLine("/* -------------- */");

            var ds = new List <string>();
            DetectorTypeEnum prev = DetectorTypeEnum.Kop;

            foreach (DetectorModel dm in c.GetAllDetectors())
            {
                if (c.Data.CCOLVersie >= CCOLVersieEnum.CCOL9)
                {
                    if (prev != DetectorTypeEnum.VecomDetector &&
                        (dm.Type == DetectorTypeEnum.VecomDetector || dm.Type == DetectorTypeEnum.OpticomIngang))
                    {
                        sb.AppendLine("#ifndef NO_CVN_50");
                    }
                    if ((prev == DetectorTypeEnum.VecomDetector || prev == DetectorTypeEnum.OpticomIngang) &&
                        dm.Type != DetectorTypeEnum.VecomDetector)
                    {
                        sb.AppendLine("#else");
                        foreach (var d in ds)
                        {
                            sb.AppendLine($"{ts}IS_type[{_dpf}{d}] = DS_type;");
                        }
                        ds.Clear();
                        sb.AppendLine("#endif");
                    }
                }
                sb.Append($"{ts}IS_type[{_dpf}{dm.Naam}] = ");
                switch (dm.Type)
                {
                case DetectorTypeEnum.Knop:
                case DetectorTypeEnum.KnopBinnen:
                case DetectorTypeEnum.KnopBuiten:
                    sb.AppendLine("DK_type;");
                    break;

                case DetectorTypeEnum.File:
                case DetectorTypeEnum.Verweg:
                    sb.AppendLine("DL_type | DVER_type;");
                    break;

                case DetectorTypeEnum.Kop:
                    sb.AppendLine("DL_type | DKOP_type;");
                    break;

                case DetectorTypeEnum.Lang:
                    sb.AppendLine("DL_type | DLNG_type;");
                    break;

                case DetectorTypeEnum.OpticomIngang:
                case DetectorTypeEnum.VecomDetector:
                    // TODO: it is possible to use DKOP and DVER to mark in- and uitmelding: use? how?
                    if (c.Data.CCOLVersie >= CCOLVersieEnum.CCOL9)
                    {
                        sb.AppendLine("DSI_type;");
                        ds.Add(dm.Naam);
                    }
                    else
                    {
                        sb.AppendLine("DS_type;");
                    }
                    break;

                case DetectorTypeEnum.Overig:
                    sb.AppendLine("DL_type;");
                    break;

                case DetectorTypeEnum.WisselStandDetector:
                case DetectorTypeEnum.WisselDetector:
                case DetectorTypeEnum.WisselStroomKringDetector:
                case DetectorTypeEnum.Radar:
                    sb.AppendLine("DL_type | DKOP_type;");
                    break;

                default:
                    throw new ArgumentOutOfRangeException("Unknown detector type while generating tab.c: " + dm.Type.ToString());
                }
                prev = dm.Type;
            }

            sb.AppendLine();
            sb.AppendLine("/* Typen uitgangen */");
            sb.AppendLine("/* --------------- */");

            foreach (FaseCyclusModel fc in c.Fasen)
            {
                sb.Append($"{ts}US_type[{_fcpf}{fc.Naam}] = ");
                switch (fc.Type)
                {
                case Models.Enumerations.FaseTypeEnum.Auto:
                    sb.AppendLine("MVT_type;");
                    break;

                case Models.Enumerations.FaseTypeEnum.OV:
                    sb.AppendLine("OV_type;");
                    break;

                case Models.Enumerations.FaseTypeEnum.Fiets:
                    sb.AppendLine("FTS_type;");
                    break;

                case Models.Enumerations.FaseTypeEnum.Voetganger:
                    sb.AppendLine("VTG_type;");
                    break;

                default:
                    throw new ArgumentOutOfRangeException("Unknown vehicle type while generating tab.c: " + fc.Type.ToString());
                }
            }

            if (c.Data.CCOLVersie > CCOLVersieEnum.CCOL8 &&
                AllCCOLInputElements.Any(x => x.Multivalent))
            {
                sb.AppendLine();
                sb.AppendLine($"{ts}/* Multivalente ingangen */");
                sb.AppendLine($"#if !defined NO_VLOG_300");
                foreach (var i in AllCCOLInputElements.Where(x => x.Multivalent))
                {
                    sb.AppendLine($"{ts}IS_type[{i.Naam}] = ISM_type;");
                }
                sb.AppendLine("#endif /* NO_VLOG_300 */");
            }
            if (c.Data.CCOLVersie > CCOLVersieEnum.CCOL8 &&
                AllCCOLOutputElements.Any(x => x.Multivalent))
            {
                sb.AppendLine();
                sb.AppendLine($"{ts}/* Multivalente ingangen */");
                sb.AppendLine($"#if !defined NO_VLOG_300");
                foreach (var i in AllCCOLOutputElements.Where(x => x.Multivalent))
                {
                    sb.AppendLine($"{ts}US_type[{i.Naam}] = USM_type;");
                }
                sb.AppendLine("#endif /* NO_VLOG_300 */");
            }

            return(sb.ToString());
        }
 public FaseDetectorTypeChangedMessage(string detectordefine, DetectorTypeEnum type)
 {
     Type           = type;
     DetectorDefine = detectordefine;
 }