Adding input for valid parameter in Simscape block
Show older comments
Hi all,
I have a question about Simscape blocks. Specifically, this question concerns the “The SI Combustion Cylinder” block.
I have already managed to create my own block that contains the same source code as the original block.
In the block, the gas constant R_air is entered as a “parameter”.
Now I want to define R_air as an “input”, as is done with the “Air-Fuel-Ratio” (AFR), for example. This way, I want to be able to read R_air via the Matlab workspace, as I do with other input values such as the speed or the intake manifold pressure.
When I adapt the program code in the same way as for the AFR, I have the problem that the following error appears when creating my own Simulink library:
“Error using ssc_build
Failed to generate 'UserBib_lib'
Caused by:
Invalid use of value 'R_air'. All entities referenced in this expression must be valid parameters.
• In UserBib.EngineSICombustionCylinderModified2 (line 297)”
In line 297, R_air is used for another formula.
How can I ensure that I can add values like “R_air” to the model via an input port?
I would be very happy to receive a reply.
Kind regards,
Florian
2 Comments
Walter Roberson
on 17 Feb 2025
Getting R_air via From Workspace means that R_air would be a signal
But I am getting the hint from "In the block, the gas constant R_air is entered as a “parameter”. " that you are trying to use R_air as a parameter . Parameters are pure numeric objects, with no time components, and so are incompatible with signals
Florian
on 18 Feb 2025
Accepted Answer
More Answers (0)
Categories
Find more on Engines & Motors in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!