Simulation does not respond to changing block parameters while simulation using set_param function method
    8 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
Hello,
I am using mutual inductance block to model multiple coupled coils. The mutual inductances of the coil are needed to be changed with time. I have used the set_param function method to change the mutual inductance block parameters. As I run the simulation I can see the block paramters change but the simulation does not respond to the changing parameters. The simulation runs taking in only the initialization parameters. Is there a problem in the way that I am executing the set_param function or this method wouldn't allow me to change block parameters of non signal blocks?
My simulation parameters:
solver type: discrete, step time: (1e-7)
solver: runge-kutta
simulation time: 200 msecs
Following is the set_param script which is executed in a matlab function block in simulink
function ChangeParam(k)
eml.extrinsic('set_param');
eml.extrinsic('mat2str');
BlockName = 'simulation/Hardware/tx_rx/Mutual_Inductance';
BlockParameter = 'InductanceMatrix';
L_Tx =    1.0e-04 *[ 0.2891   -0.0360   -0.0360;
    -0.0360    0.3298   -0.0216;
    -0.0360   -0.0216    0.3298];
%setting up the self inductance matrix of Rx (3x3)
L_Rx =    1.0e-04 *[ 0.3766   -0.1114   -0.1114;
    -0.1114    0.4572   -0.0713;
    -0.1114   -0.0713    0.4572];
%setting up the mutual inductance matrix of Tx-Rx (3x3)
L_TR = k*1.0e-05 *[ 0.1765   -0.1956   -0.1957;
    -0.1162    0.4378   -0.0213;
    -0.1162   -0.0213    0.4378];
% Forming a composite self+mutual inducatnce matrix (6x6)
L_Tx_Rx1 = [L_Tx, L_TR; L_TR', L_Rx];
StringValue = mat2str(L_Tx_Rx1);
set_param('simulation/Hardware/tx_rx/Mutual_Inductance','InductanceMatrix',StringValue);
The following is the mutual indictance block that I am using and want to change the block parameters of,

Following is the blok parameter window, I am changing the inductance matrix block parameter.
 
 Thank you!
Vatan Mehar
1 comentario
  Paul
      
      
 el 13 de Oct. de 2023
				Hi Vatan,
I don't change block parameters during simulation, but doesn't the diagram need to be updated after the parameters are changed via set_param?  I don't really know for sure.
Respuestas (1)
  Animesh
 el 30 de Oct. de 2023
        According to my understanding, you are unable to update parameter value for a block while running a simulation.
I am not sure why you are unable to update the value of “Inductance Matrix” using “set_param”, you can try updating the model after using “set_param”.
Example update command :-
set_param(modelname,'SimulationCommand','Update')
To read more about “set_param”, refer to the following document :-https://www.mathworks.com/help/simulink/slref/set_param.html
0 comentarios
Ver también
Categorías
				Más información sobre Model References en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


