Filter löschen
Filter löschen

Using parallel computing WITHIN a Simulink simulation

2 Ansichten (letzte 30 Tage)
michaelborg
michaelborg am 23 Okt. 2012
I have a for loop within a my simulink model (using the For Iterator block). In my case, I have around 2000-3000 iterations each time step. From my searching, I have only found that parallel computing can only be used to run simulations in parallel, rather than within a single simulation. Is it possible to use parallel computing for the for loop within a single simulink simulation?

Antworten (1)

Ryan G
Ryan G am 23 Okt. 2012
You cannot use parallel computing for this operation. Can I ask why you are doing this? Although there may be a perfectly valid reason, perhaps reconsidering your approach may help speed things up.
  2 Kommentare
michaelborg
michaelborg am 23 Okt. 2012
I have a number of input components (around 1000), and for each component I have to use a lookup table to find a corresponding value. I wish to use parallel computing because initially I initially had 50 input components, but when I increased this to 1000 to get more accurate results, the simulation significantly slowed down. Is it possible to use the parfor statement in a Matlab Function block?
Ryan G
Ryan G am 23 Okt. 2012
Bearbeitet: Ryan G am 23 Okt. 2012
I don't believe you can do it in a MATLAB function either. Maybe, but I wouldn't try it.
Have you looked into turning the subsystem into a model reference and running in accelerator mode? That would definitely speed things up and is supported.
Lookup tables can also be kind of slow, have you considered alternatives to the lookup? If they are simple (2-d, maybe 3-d) you may be able to fit an equation to the data and use that instead. Might be faster.
I do want to reiterate what I mentioned earlier as this 1000 input line throws a red flag in my mind. Although it is fully possible this is the best/fastest way to do the operation you desire, whenever I see the same thing being repeated, I have to step back and look at the problem to make sure it's the best way to do it.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by