시뮬레이션(Simulated)


simulated 센서 플랫폼은 function에 의해 주어진 time-varying signal V(t)를 생성하는 시뮬레이션 센서를 제공합니다.

V(t) = M + A sin((2 pi (t - t_0) / w) + P) + N(s)

where:

  • M = the mean value of the sensor
  • A = the amplitude of the periodic contribution
  • t = the time when a value is generated
  • t_0 = the time when the sensor is started
  • w = the time period in seconds for a single complete cycle of the periodic contribution
  • P = the phase offset to add to the periodic contribution, in units of degrees
  • N(s) = the random Gaussian noise with spread s

The output will be limited to 3 decimals.

설정

시뮬레이션 센서를 설치에 추가하려면 configuration.yaml 파일에 다음을 추가하십시오.

sensor:
  - platform: simulated

Configuration Variables

name

(string)(Optional)

The name of the sensor.

Default value:

simulated

unit

(string)(Optional)

The unit to apply.

Default value:

value

amplitude

(float)(Optional)

The amplitude of periodic contribution.

Default value:

1

mean

(float)(Optional)

The mean level of the sensor.

Default value:

0

period

(integer)(Optional)

The time in seconds for one complete oscillation of the periodic contribution.

Default value:

0

phase

(float)(Optional)

The phase offset (in degrees) to apply to the periodic component.

Default value:

0

seed

(integer)(Optional)

The seed value for the random noise component.

Default value:

999

spread

(float)(Optional)

The spread is the range of the randomly distributed values about their mean. This is sometimes referred to as the Full Width at Half Maximum (FWHM) of the random distribution.

Default value:

None

relative_to_epoch

(boolean)(Optional)

Whether to simulate from epoch time (00:00:00, 1970-01-01), or relative to when the sensor was started.

Default value:

true

사례

실제 데이터를 시뮬레이션하는 예제를 제공하기 위해 다음 설정을 사용하여 시뮬레이션된 상대 습도 센서(%)를 추가할 수 있습니다.

sensor:
  - platform: simulated
    name: 'simulated relative humidity'
    unit: '%'
    amplitude: 0 # Turns off the periodic contribution
    mean: 50
    spread: 10
    seed: 999
    relative_to_epoch: false