/// <summary> /// Generate a line for a wind/time elated operation rule /// </summary> /// <param name="index">index number of the operation</param> /// <param name="windMinSpeed"></param> /// <param name="windLimit"></param> /// <param name="startTime"></param> /// <param name="endTime"></param> /// <returns>true if the operation needed to be split into at 0 degrees</returns> private bool GenerateOperation(int index, int windMinSpeed, WindLimits windLimit, string startTime, string endTime, string description) { if (windLimit.MaxDir < windLimit.MinDir) { _operations.Add($"{index,-7} {windMinSpeed,-17} {windLimit.MaxSpeed,-18} {windLimit.MinDir,-14} {360,-15} {startTime} {endTime} {description}"); _operations.Add($"{index+1,-7} {windMinSpeed,-17} {windLimit.MaxSpeed,-18} {0,-14} {windLimit.MaxDir,-15} {startTime} {endTime}"); return(true); } else { _operations.Add($"{index,-7} {windMinSpeed,-17} {windLimit.MaxSpeed,-18} {windLimit.MinDir,-14} {windLimit.MaxDir,-15} {startTime} {endTime} {description}"); return(false); } }
/// <summary> /// Add operations and runways for the generated operations /// </summary> /// <param name="ruleIdx"></param> /// <param name="rule"></param> /// <param name="windLimit"></param> /// <param name="currentMinWindSpeed"></param> /// <param name="currentMaxWindSpeed"></param> /// <param name="startTime"></param> /// <param name="endTime"></param> private void GenerateOperations(ref int ruleIdx, TrafficRule rule, WindLimits windLimit, int currentMinWindSpeed, int currentMaxWindSpeed, string startTime, string endTime) { // Extend the upper limit of the wind rule to make it match WT behavior if (_noOverlap) { windLimit.MaxDir++; } windLimit.MaxDir = Math.Min(360, windLimit.MaxDir); // Write the operation, and track whether it actually resulted in two operations bool splitOperation = GenerateOperation(ruleIdx, currentMinWindSpeed, windLimit, startTime, endTime, rule.Description); Logger.Log($"{currentMinWindSpeed,3}-{currentMaxWindSpeed,3} kts {windLimit.MinDir:000}-{windLimit.MaxDir:000} {startTime} {endTime}"); // Write the runways for the (or both) operation(s) GenerateRunways(rule.RunwayUses, ruleIdx++, startTime, endTime, rule.Description); if (splitOperation) { GenerateRunways(rule.RunwayUses, ruleIdx++, startTime, endTime, rule.Description); } }