How do you use the constant block as input to set the parameter value in the Cylinder block in simscape
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I want to control the ‘stroke’ parameter value of the Cylinder in Injector1 in sh_diesel_injection model by the Constant block, and convert the whole model into a dynamic link library.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1204808/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1204813/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1204818/image.jpeg)
I set the stroke value through the Constant block and change the 'stroke' parameter value in the Cylinder block through the S-function. but it dosen't work.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1204823/image.jpeg)
set_param('sh_diesel_injection/Injector1/Cylinder','stroke', num2str(u(1))); % 'test' S-Function
I get the following error:
Cannot change parameter 'Piston stroke (stroke)' of 'sh_diesel_injection/Injector1/Cylinder' while simulation is running.
How do I solve this problem? Somebody please help me in this regard.
0 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Magnetic Elements 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!