Search documentation of snmpkit

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

Implement realistic correlations between different metrics.

Network metrics don't exist in isolation - they influence each other in predictable ways:

- Signal quality degrades with higher utilization
- Error rates increase with poor signal quality
- Temperature affects equipment performance
- Power consumption correlates with activity levels

This module provides sophisticated correlation modeling for authentic network simulation.

# Summary

## Types

correlation_config()
correlation_type()

## Functions

apply_correlations(primary_oid, primary_value, device_state, correlations, current_time)

Apply correlations to a device's metrics based on primary metric changes.

calculate_power_consumption_correlation(device_metrics, device_type)

Model power consumption correlations with activity and temperature.

calculate_signal_throughput_correlation(snr_db, power_level_dbmv, max_throughput)

Calculate signal quality impact on throughput for DOCSIS devices.

calculate_temperature_performance_correlation(temperature_celsius, equipment_type)

Calculate temperature impact on equipment performance.

calculate_utilization_error_correlation(utilization_percent, interface_type)

Calculate utilization impact on error rates.

get_device_correlations(device_type)

Get standard correlation configurations for common device types.

# Types

# correlation_config()

    @type correlation_config() :: %{
      type: correlation_type(),
      strength: float(),
      delay_seconds: integer(),
      threshold: float(),
      noise_factor: float()
    }

# correlation_type()

    @type correlation_type() ::
      :positive | :negative | :threshold | :exponential | :logarithmic

# Functions

# apply_correlations(primary_oid, primary_value, device_state, correlations, current_time)

    @spec apply_correlations(atom(), number(), map(), list(), DateTime.t()) :: map()

Apply correlations to a device's metrics based on primary metric changes.

## Examples

    device_state = %{
      interface_utilization: 0.8,
      signal_quality: 85.0,
      temperature: 45.0
    }

    correlations = [
      {:interface_utilization, :error_rate, :positive, 0.7},
      {:signal_quality, :throughput, :positive, 0.9},
      {:temperature, :cpu_usage, :positive, 0.6}
    ]

    updated_state = SnmpKit.SnmpSim.CorrelationEngine.apply_correlations(
      :interface_utilization, 0.8, device_state, correlations, DateTime.utc_now()
    )

# calculate_power_consumption_correlation(device_metrics, device_type)

    @spec calculate_power_consumption_correlation(map(), atom()) :: float()

Model power consumption correlations with activity and temperature.

Power consumption correlates with:

- CPU utilization
- Network activity
- Temperature (cooling requirements)

# calculate_signal_throughput_correlation(snr_db, power_level_dbmv, max_throughput)

    @spec calculate_signal_throughput_correlation(float(), float(), float()) :: float()

Calculate signal quality impact on throughput for DOCSIS devices.

Signal quality (SNR, power levels) directly affects achievable throughput in cable modem systems.

# calculate_temperature_performance_correlation(temperature_celsius, equipment_type)

    @spec calculate_temperature_performance_correlation(float(), atom()) :: %{
      cpu_impact: float(),
      signal_impact: float(),
      error_impact: float()
    }

Calculate temperature impact on equipment performance.

Higher temperatures affect:

- CPU performance (thermal throttling)
- Signal quality (thermal noise)
- Error rates (increased bit errors)

# calculate_utilization_error_correlation(utilization_percent, interface_type)

    @spec calculate_utilization_error_correlation(float(), atom()) :: float()

Calculate utilization impact on error rates.

Higher utilization typically leads to increased error rates due to:

- Buffer overflows
- Increased collision probability
- Thermal effects

# get_device_correlations(device_type)

    @spec get_device_correlations(atom()) :: list()

Get standard correlation configurations for common device types.

## Examples

    correlations = SnmpKit.SnmpSim.CorrelationEngine.get_device_correlations(:cable_modem)