Search documentation of snmpkit

# SnmpKit.SnmpSim.TimePatterns (snmpkit v1.2.0)

Realistic time-based variations for network metrics. Implements daily, weekly, and seasonal patterns for authentic simulation.

# Summary

## Functions

apply_seasonal_variation(datetime, pattern_type \\ :generic)

Apply seasonal variations to any metric.

apply_weather_variation(datetime)

Apply weather-related variations to signal quality metrics.

get_burst_pattern(device_type, datetime)

Get burst patterns for specific device types and times.

get_correlation_pattern(primary_metric, secondary_metric, primary_value, datetime)

Get correlation patterns for linked metrics.

get_daily_temperature_pattern(datetime)

Get daily temperature variation pattern.

get_daily_utilization_pattern(datetime)

Get daily utilization pattern factor (0.0 to 1.5).

get_interface_traffic_rate(interface_type, datetime)

Get interface traffic rate based on interface type and time patterns.

get_maintenance_window_factor(datetime)

Get maintenance window patterns.

get_monthly_pattern(datetime)

Get monthly pattern for maintenance windows and operational changes.

get_seasonal_temperature_pattern(datetime)

Get seasonal temperature variation.

get_weekly_pattern(datetime)

Get weekly pattern factor based on day of week.

# Functions

# apply_seasonal_variation(datetime, pattern_type \\ :generic)

Apply seasonal variations to any metric.

Generic seasonal pattern that can be applied to various metrics. Useful for metrics that have yearly cycles.

## Examples

    # Apply to equipment failure rates (higher in summer heat)
    factor = SnmpKit.SnmpSim.TimePatterns.apply_seasonal_variation(datetime, :equipment_stress)

    # Apply to power consumption (higher in winter/summer for heating/cooling)
    factor = SnmpKit.SnmpSim.TimePatterns.apply_seasonal_variation(datetime, :power_consumption)

# apply_weather_variation(datetime)

Apply weather-related variations to signal quality metrics.

Simulates weather patterns that affect signal strength:

- Rain/snow: Reduces signal quality
- Clear weather: Optimal signal quality
- Seasonal patterns for different weather probabilities

## Examples

    factor = SnmpKit.SnmpSim.TimePatterns.apply_weather_variation(~U[2024-01-15 14:00:00Z])
    # Returns: 0.85 (some weather impact)

# get_burst_pattern(device_type, datetime)

Get burst patterns for specific device types and times.

Different devices have different burst characteristics:

- Servers: Application-driven bursts
- Routers: Protocol-driven bursts
- Cable modems: User-activity bursts

# get_correlation_pattern(primary_metric, secondary_metric, primary_value, datetime)

Get correlation patterns for linked metrics.

Many network metrics are correlated and should move together:

- Traffic volume vs packet count
- Utilization vs error rates
- Signal quality vs throughput

# get_daily_temperature_pattern(datetime)

Get daily temperature variation pattern.

Returns temperature offset based on time of day:

- Coldest: ~6 AM
- Warmest: ~3 PM
- Smooth sinusoidal pattern

## Examples

    # 6 AM (coldest)
    offset = SnmpKit.SnmpSim.TimePatterns.get_daily_temperature_pattern(~U[2024-01-15 06:00:00Z])
    # Returns: -3.2

    # 3 PM (warmest)
    offset = SnmpKit.SnmpSim.TimePatterns.get_daily_temperature_pattern(~U[2024-01-15 15:00:00Z])
    # Returns: 4.1

# get_daily_utilization_pattern(datetime)

Get daily utilization pattern factor (0.0 to 1.5).

Returns a multiplier based on time of day:

- 0-5 AM: Low usage (0.3)
- 6-8 AM: Morning ramp (0.7)
- 9-17 PM: Business hours (0.9-1.2)
- 18-20 PM: Evening peak (1.5)
- 21-23 PM: Late evening (0.8)

## Examples

    # 2 PM business hours
    factor = SnmpKit.SnmpSim.TimePatterns.get_daily_utilization_pattern(~U[2024-01-15 14:00:00Z])
    # Returns: ~1.1

    # 7 PM evening peak
    factor = SnmpKit.SnmpSim.TimePatterns.get_daily_utilization_pattern(~U[2024-01-15 19:00:00Z])
    # Returns: ~1.5

# get_interface_traffic_rate(interface_type, datetime)

Get interface traffic rate based on interface type and time patterns.

Returns expected traffic rate ranges for different interface types with time-based adjustments.

## Examples

    rate = SnmpKit.SnmpSim.TimePatterns.get_interface_traffic_rate(:ethernet_gigabit, datetime)
    # Returns: {min_rate, max_rate, current_factor}

# get_maintenance_window_factor(datetime)

Get maintenance window patterns.

Network maintenance typically happens during low-usage periods:

- 2-6 AM local time
- Weekend mornings
- Holiday periods

# get_monthly_pattern(datetime)

Get monthly pattern for maintenance windows and operational changes.

Some months have different operational characteristics:

- End of quarters: Higher activity
- Summer months: Maintenance windows
- Holiday months: Lower activity

# get_seasonal_temperature_pattern(datetime)

Get seasonal temperature variation.

Returns temperature offset in Celsius based on month and location patterns. Simulates realistic seasonal temperature changes.

## Examples

    # January (winter)
    offset = SnmpKit.SnmpSim.TimePatterns.get_seasonal_temperature_pattern(~U[2024-01-15 14:00:00Z])
    # Returns: -8.5

    # July (summer)
    offset = SnmpKit.SnmpSim.TimePatterns.get_seasonal_temperature_pattern(~U[2024-07-15 14:00:00Z])
    # Returns: 12.3

# get_weekly_pattern(datetime)

Get weekly pattern factor based on day of week.

Returns multiplier for weekday vs weekend patterns:

- Monday-Friday: 1.0 (full pattern)
- Saturday: 0.7 (reduced business, increased residential)
- Sunday: 0.5 (lowest overall usage)

## Examples

    # Tuesday
    factor = SnmpKit.SnmpSim.TimePatterns.get_weekly_pattern(~U[2024-01-16 14:00:00Z])
    # Returns: 1.0

    # Saturday
    factor = SnmpKit.SnmpSim.TimePatterns.get_weekly_pattern(~U[2024-01-20 14:00:00Z])
    # Returns: 0.7