Use spreadsheet time input for simulation timestep?

Hi all,
I am importing data from several spreadsheets, as would like to use the Time column of one of them to act as a 'master' time from which the simulation will be run from. In other words I'd like the time output of the simulation to exactly match the time column of the spreadsheet.
How would I go about implementing this?
Thanks

2 件のコメント

Adam Danz
Adam Danz 2018 年 12 月 12 日
What do you need help with (you haven't asked a question)?
Here are some tips on how to get help here:
Gazebo
Gazebo 2018 年 12 月 12 日
編集済み: Gazebo 2018 年 12 月 12 日
I need help with using a spreadsheet time column as the simulation time.
My question would be
How do I use a spreadsheet time column for the simulation time?
Many thanks

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

 採用された回答

Fangjun Jiang
Fangjun Jiang 2018 年 12 月 12 日

0 投票

Theoritically you can't specify the exact simulation time as it is determined by other factors such as accuracy or tolerance. The time vector in your Excel file could have non-zero start time, large time step, etc.
Practically, you can set up your solver to match your desired time vector, if it is starting from zero, having a fixed time step.
More generically, you can run your simulation, get the output, and then re-sample the output to match your time vector. See Simulation, Model Configuration Parameters, Solver and Data Import/Export.

4 件のコメント

Gazebo
Gazebo 2018 年 12 月 12 日
編集済み: Gazebo 2018 年 12 月 12 日
Thanks for the help. The main problem with your first suggestion is that the time vector in the .csv is not fixed step (ranges between 0.2 to 0.7s). The other issue is that the spreadsheet also contains triggers ( one column is a boolean flag that changes the code execution, so sampling this value twice or skipping over it would result in an unaccurate simulation, even if I resample the output).
I will continue to explore options, thanks.
Fangjun Jiang
Fangjun Jiang 2018 年 12 月 12 日
I would treat the column of boolean flag as one of the inputs. Use this input to trig the execution of some Simulink subsystems. So this has nothing to do with time vector or sample time.
Gazebo
Gazebo 2018 年 12 月 13 日
Apologies, I meant that the main issue is the result of the previous execution is fed into the next ( I need to use a lot of memory blocks).
Fangjun Jiang
Fangjun Jiang 2018 年 12 月 13 日
You can save the output and state of a simulation and use that to continue another simulation. Or, if the simulation is confinuously running, use Merge block to merge multiple conditionally executed subsystmes. Anyway, trying to specify the simulation time vector seems in the wrong direction.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeInteractive Model Editing についてさらに検索

製品

リリース

R2018a

質問済み:

2018 年 12 月 12 日

コメント済み:

2018 年 12 月 13 日

Community Treasure Hunt

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

Start Hunting!

Translated by