How to create a custom component in Simscape, with input as variable parameter ?

Hello,
I am trying to create a custom component in Simscape, based on the "Tire (Friction Parameterized)" component.
Basically, I want some of its parameters, lets say the "rolling radius", to be an input of the component, so that I can change its value during the simulation, just as I can change the value of a "variable inertia" with a PS input.
I tried to create some new inputs in the source code, but it seems that I can't use these inputs in the equations, as they are not defined as parameters. I also tried to define new equations, to impose the value as the parameter to be the same as the input, but then I have more equations than parameters.
Any idea on how to solve this issue ? Maybe the method consisting of using those parameters as input is not the best one, I am open to other solutions.

2 Kommentare

Hi @Neil,
If you are trying to modify the "Tire (Friction Parameterized)" component to allow parameters like the rolling radius to be changed dynamically during the simulation you can consider the following approach:
  • Instead of defining "r_tire" as a parameter, you can define it as a variable so it can change over time:
variables
r_tire = {0.3, 'm'}; % Rolling radius (Now a variable instead of a parameter)
end
  • Now link "r_tire" to the input "Radius" using an equation:
equations
r_tire == Radius; % Assign the input value dynamically
end
  • Now, just replace "r_tire" wherever you were using it as a parameter in the model equations.
These modifications might help you to update the rolling radius dynamically based on the input signal during simulation.
Thank you for your answer.
I have added your modifications in my code, but unfortunaley, I am unable to generate the block in Simulink (see error in the attached image).
It seems that the format "variable" is not working in some equations.
Do you have any solution ?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Simscape Driveline finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2024b

Gefragt:

am 3 Feb. 2025

Kommentiert:

am 24 Feb. 2025

Community Treasure Hunt

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

Start Hunting!

Translated by