필터 지우기
필터 지우기

Simulation Time and Date

조회 수: 4 (최근 30일)
JR
JR 2017년 11월 12일
댓글: JR 2017년 11월 13일
Hello,
I have a simulink model where I need to get the simulation time in the format of year.month.day.hours.minutes.seconds at each time step of the simulation.
I have the start time/date of the simulation (StartTime), and the simulation clock gives me the time elapsed in seconds (Count), its just I can't find an easy way to convert this to a date/time format.
In Matlab it would be easy, by using 'StartTime + seconds(Count)'. So I tried to use a Matlab Function block, declaring the extrinsic function 'seconds', but this is not working and I suspect that if this were to work it would slow down the simulation a fair bit.
I thought this would be easy to do, so perharps I'm missing something really obvious here! Any help would be much appreciated. Thank you.

답변 (2개)

Yogananda Jeppu
Yogananda Jeppu 2017년 11월 13일
Try and make a simulink block with 6 outputs Year, Month, Day, hr min , sec. Divide the clock block output with the respective seconds to get the outputs. Add the initial values.
  댓글 수: 1
JR
JR 2017년 11월 13일
Hello, and thanks for your suggestion! My concern is that, by doing it this way, it won't include all the leap days and other calendar changes that occur over the long term.

댓글을 달려면 로그인하십시오.


Yogananda Jeppu
Yogananda Jeppu 2017년 11월 13일
Try and make a simulink block with 6 outputs Year, Month, Day, hr min , sec. Divide the clock block output with the respective seconds to get the outputs. Add the initial values.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by