Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Changing parameter values during simulation

Subject: Changing parameter values during simulation

From: nandita ch

Date: 29 Jul, 2014 21:37:18

Message: 1 of 2

Hi I have a model of field oriented control of PMSM in simulink. I have assigned the machine parameter values in a m-file. I need to change the resistance value in the middle of simulation (while the simulation is running). The resistance is given as a Gain block in one of the subsystems of the designed machine block.

Could anyone please help by suggesting the ways I can do this.
Thank you in advance.

Subject: Changing parameter values during simulation

From: Phil Goddard

Date: 30 Jul, 2014 02:14:11

Message: 2 of 2

Depends whether you want to do it manually, from a piece of code, or automatically at some time in the simulation.

manually:
- open the gain block
- put in the new value
- press OK or Apply
(If you changed the value of the variable in the Workspace, then just open the gain block and press OK)

from a piece of code
- you need to use function set_param to change the block's gain value.

automatically at a given time point
(there are more complex ways to do this which are sometimes required, but the simplest approach is).
- don't use a Gain block, use a product block where one of the inputs gets a time varying signal from the Workspace
- define a variable that defines the time varying nature of your gain value and use it as an input to the model

Phil.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us