Simulink: Signal for specified timesteps

조회 수: 2 (최근 30일)
Iljar Dickhof
Iljar Dickhof 2018년 6월 14일
댓글: Jim Riggs 2018년 6월 15일
Hello everyone,
I am now working on a simulation model that determines the annual consumption of a ventilation unit. There exsists an internal heat load which only exsist in the daytime. I want to model this in simulink.
This means I have to create a signal that only applies to the indicated time steps. There are 8760 hours in the year where every day is 24 hours long. The signal must be turned on from 8 am to 4 pm. The signal must be turned off in the remaining hours.
At the same time, the signal must be turned off in the weekend. Every week is 168 hours long. The signal must be switched off from 121 to 168 hours.
This must be simulated during the term of the year.

답변 (1개)

Jim Riggs
Jim Riggs 2018년 6월 14일
편집: Jim Riggs 2018년 6월 14일
Use a triggered subsystem to generate the desired signal. The trigger signal is based on time.
Assuming that the time signal is in hours, then
day = floor(time/24); % this is the day of the year
dayofweek = mod(day,7)+1; % this is the day of the week (1 through 7)
hour = floor(time); % this drops fractions of an hour and is the hour of the year
hourofday = mod(hour,24)+1; % This is the hour of the day (1 to 24)
The output of the "Day of Week" block is:
dayofweek < 6
This is "true" for days 1 through 5.
The output of the "hour of day" block is:
hourofday >= 8 && hourofday <= 16
These two signals are combined with an "And" block, which produces a "true" signal when the day of week is 1 through 5, and the hour of day if between 8 and 16. This signal is used to turn on the "Signal" block which is your internal daytime heat load.

카테고리

Help CenterFile Exchange에서 Modeling에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by