How to dynamically change a block parameter value during simulation run-time?

27 views (last 30 days)
I have been trying to find an easy way of doing this, but have failed till now. The problem is like this: I want to implement a diode using an exponential approximation model (Shockley model). In the exponential model, I have the option of modifying the Saturation Current value only at the beginning of simulation, as it is not a tunable parameter. Is there any way by which I can allow the simulation to itself calculate the value of I_S at every fixed number of steps and update the Diode parameter periodically?
I have attached the model which I am working on. My objective is to reproduce a diode thermal behavior by constantly changing the I_S value of a thermally-invariable diode model in Simulink. In this example, I have used a thermally-ACTIVE diode to behave as a real diode, approximated its I_S based on real-time i-v values. Now, I want periodically update the I_S value of the second diode (thermally-INACTIVE) so that it emulates the real diode. I want to see the effects of transmission delay/jitter on the accuracy of reproduction.
This is an introductory step into doing a similar exercise for a full-fledged automotive converter/inverter for remote simulation.

Answers (1)

Chinmayi Lanka
Chinmayi Lanka on 11 Apr 2017
Edited: Chinmayi Lanka on 11 Apr 2017
Simulink provides an API that allows programmatic access to block data. You could use this API to achieve what you want to do. You can refer to the following documentation on 'Access Block Data During Simulation': https://uk.mathworks.com/help/releases/R2017a/simulink/ug/accessing-block-data-during-simulation.html
Here is a tutorial on how to tune and experiment with Block Parameter Values: https://uk.mathworks.com/help/releases/R2017a/simulink/ug/using-tunable-parameters.html
You could also use a GUI to easily tune parameters, as explained in the following example: https://uk.mathworks.com/help/simulink/ug/tune-and-visualize-your-model-with-dashboard-blocks.html
  2 Comments
Surojit Sen
Surojit Sen on 20 Apr 2017
Hi Chinmaya, thank you so much for your answer, and apologies for the delay in my response. I have read through the linked pages but unfortunately I was not able to resolve my issue. I noticed that the parameter I want to control during run-time (using block outputs from the same simulation) is non-tunable (block turns grey during run-time). The parameter in question is: Diode>Exponential Model>IS (Saturation Current).
Could you please confirm that this is indeed, non-tunable? Is there any simple way of doing what I wish to do? The model in question is uploaded in the original question.
Thank you very much!

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!