MATLAB Answers

How to give time in hours in simulink?

9 ビュー (過去 30 日間)
Muhammad Saqlain Haider
Muhammad Saqlain Haider 2020 年 8 月 13 日
コメント済み: Walter Roberson 2020 年 8 月 16 日
Hello Everyone
As we know that Simulink runs simulation in seconds but I have a model which I need to run for many days. I wanted to give parameters values on hourly basis in my model as is given in my data but I know that Simulink runs simulation in seconds so any suggestions that How can I give these values in simulink input. I am attaching the image that shows nature of data. I hope you guys will get sense of my question from this data. Time here is in hours so every value

  4 件のコメント

表示 1 件の古いコメント
Muhammad Saqlain Haider
Muhammad Saqlain Haider 2020 年 8 月 14 日
Like I am not using clock block so it means that when I am running simulation for 24 units, I can say that its 24 hours..rigt? Thats what are you trying to say?
Walter Roberson
Walter Roberson 2020 年 8 月 14 日
I think so.
Of course the meaning of sin waves or square waves or the like are going to be affected: if you want N simulated samples/second for a generated wave you would have to make it 60*60 times larger to get the appropriate number of samples per hour.
And labels in plots and scopes might say Hz when your intended meaning is samples/unit instead. Cosmetics.
Muhammad Saqlain Haider
Muhammad Saqlain Haider 2020 年 8 月 14 日
Probably you are right but I have doubt on it

サインインしてコメントする。

回答 (1 件)

Jonas
Jonas 2020 年 8 月 14 日
Can you set the sampling time of your model to 3600, such that it calculates once every hour?

  8 件のコメント

表示 5 件の古いコメント
Walter Roberson
Walter Roberson 2020 年 8 月 14 日
A From Spreadsheet block is being used. The first column is not available as data: it is being converted into the times that the remaining columns are associated with.
There is no way that I know of to From Spreadsheet, consume all of the entries quickly, multiply them by 3600 on the fly, and use the results as time signals to make the remaining data columns available at.
Or rather, the only way I know how to do that in Simulink would be by way of initialization function callbacks that used a MATLAB Function Block to read the spreadsheet as data, do the multiplication, and write it out to a temporary file, and then connect the temporary file as the input of From Worksheet
Muhammad Saqlain Haider
Muhammad Saqlain Haider 2020 年 8 月 16 日
Can you eleborate your last answer a little bit. I am sorrry I could not understand that. it will be much appreciated.
Walter Roberson
Walter Roberson 2020 年 8 月 16 日
The idea is that during initialization you could replace the spreadsheet with a different one that had the time multiplied.

サインインしてコメントする。

タグ

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by