public SignalCycleData(SigControlType controlType, int cycleLengthSec)
 {
     _controlType      = controlType;
     _cycleLengthSec   = cycleLengthSec;
     _referencePhaseID = 1;
     _offsetSec        = 0;
 }
 public SignalCycleData(SigControlType controlType, int cycleLengthSec, List <SignalPhaseData> Phases)
 {
     _controlType      = controlType;
     _cycleLengthSec   = cycleLengthSec;
     _referencePhaseID = 1;
     _offsetSec        = 0;
     _phases           = Phases;
 }
 public void SetDefaultValues(AreaType area, int artClass, SigControlType sigControl) // Intersection
 {
     /*
      * _cycleLen = ParmRanges.CycleLengthDefault[(int)area, artClass];
      * //_gCthru = ParmRanges.gCThruDefault[(int)area];
      * _gCthru = SignalCalcs.CalcGreenToCycleLengthRatio(_cycleLen);
      * _arvType = ParmRanges.ArrTypeDefault[(int)sigControl];
      * _numThLanes = ParmRanges.NumThruLanesDefault[(int)area];
      * _pctLT = ParmRanges.PctLTDefault[(int)area];
      * _pctRT = ParmRanges.PctRTDefault[(int)area];
      * _excLTlane = ParmRanges.ExclLTlaneDefault[(int)area];
      * _phasing = ParmRanges.LTphasing;
      * _numLTlanes = ParmRanges.NumLTLanesDefault[(int)area];
      * _LTlen = ParmRanges.LTbayLenDefault[(int)area];
      * _gCleft = ParmRanges.gCLeftDefault[(int)area];
      * _excRTlane = ParmRanges.ExclRTlaneDefault[(int)area];
      * _width = ParmRanges.IntWidthDefault[(int)area];
      * _overCap = false;
      */
 }
 public SignalCycleData()
 {
     _controlType = SigControlType.Pretimed;
     //_sigControl = ParmRanges.SigControlDefault[Convert.ToInt32(_area), Convert.ToInt32(_class)];
     //_sigControl = ParmRanges.SigControlDefault[Convert.ToInt32(_class)];
 }
        public static float QSratio(float AdjSatFlowThru, float SegDDHV, float PHF, int PctLT, SigControlType SigControl, int CycleLen, float gClt, float PreviousVC, int NumLTlanes, int LTbayLen, PhasingType LTphasing)
        {
            //Based on Appendix G of HCM 2000
            float QSR = 0;     //queue storage ratio
            float VolLT;
            float AdjSatFlowLT;
            float CapacityLT;
            float FlowRatioLT;
            float vcLT;
            float Rp = 1.0f;    //assumed arrival type of 3
            float PF2;
            float Q1;
            float Q2;
            float Ivalue;
            float kb;

            //QbL = 0    //assumed that there is no initial queue at start of analysis period--this also simplifies some equations
            //T = 0.25   //15-min analysis period, used in equation for Q2
            //Lh = 25 ft (default vehicle spacing in queue)

            //Note: do calculations in terms of one LT lane
            AdjSatFlowLT = AdjSatFlowThru * 0.95f;  //5% reduction from adjacent through lanes
            VolLT        = (SegDDHV / PHF) * (float)(PctLT) / 100 / NumLTlanes;

            if (LTphasing == PhasingType.Protected)
            {
                CapacityLT = AdjSatFlowLT * gClt;
            }
            else  //protected + permitted phasing
            {
                float NumPhasesPerHour = 3600 / CycleLen;
                CapacityLT = AdjSatFlowLT * gClt + (NumPhasesPerHour * 2.5f);  //increase capacity by 2.5 vehicles per phase
            }
            FlowRatioLT = VolLT / AdjSatFlowLT;
            vcLT        = VolLT / CapacityLT;

            PF2 = ((1 - Rp * gClt) * (1 - FlowRatioLT)) / ((1 - gClt) * (1 - Rp * FlowRatioLT));
            Q1  = PF2 * (((VolLT * CycleLen) / 3600) * (1 - gClt) / (1 - vcLT * gClt));

            if (PreviousVC >= 1)
            {
                Ivalue = 0.09f;
            }
            else
            {
                Ivalue = (float)(1 - 0.91 * Math.Pow(PreviousVC, 2.68));
            }

            if (SigControl == SigControlType.Pretimed)
            {
                kb = (float)(0.12 * Ivalue * Math.Pow((AdjSatFlowLT * gClt * CycleLen) / 3600, 0.7));
            }
            else    //Semiactuated or Fully Actuated
            {
                kb = (float)(0.1 * Ivalue * Math.Pow((AdjSatFlowLT * gClt * CycleLen) / 3600, 0.6));
            }

            Q2 = (float)(0.25 * CapacityLT * 0.25 * ((vcLT - 1) + Math.Pow(Math.Pow((vcLT - 1), 2) + (8 * kb * vcLT) / (CapacityLT * 0.25), 0.5)));

            QSR = 25 * (Q1 + Q2) / LTbayLen;  //(LTbayLen / NumLTlanes);  LTbayLen is now total storage length, not per lane length

            //if (QSR > 1)
            //CalcsArterial.LTMessage = true;   //turn on warning message for LT lane spillover

            return(QSR);
        }