Subclassing closed source Simscape components
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I would like to define a custom engine, starting from Simscape's Generic Engine. For instance, how should one replicate the engine braking example using inheritance?
The conserving port F has only speed properties. So, how can I add the braking torque?
Using the code below, I get an error saying that: 't' is not defined in this scope.
component MyEngine < sdl.engines.generic_engine
parameters(Size = variable)
TorqueEMB = {[-100 -200], 'N*m'}; % Engine motoring torque
SpeedEMB = {[ 600 1200], 'rpm'}; % Engine motoring speed
end
intermediates
Temb = tablelookup(SpeedEMB, TorqueEMB, F.w - B.w,...
interpolation = linear, ...
extrapolation = nearest); % Engine motoring brake torque
end
equations
t == -Temb;
end
end
0 commentaires
Réponses (1)
Steve Miller
le 10 Oct 2022
The diagnostic you have received is telling you that the variable you have used is not defined. You need to define the torque relative to nodes in the block. Look at the source code for the Ideal Torque Source to see the definition there.
The torque defined in the Generic Engine block is "trq". You can see this from Simscape logging. I believe you want to add an additional torque, not redefine the existing "trq", so I would recommend completing the definition of "t" in your code above.
--Steve
2 commentaires
Steve Miller
le 20 Oct 2022
Hi Geraldo - some engineers prefer to work in a schematic, some prefer to write equations in textual form. Using subsystem2ssc(), you can have both. The resulting set of equations will be the same once Simscape manipulates the equations, so whichever process you prefer, you can use.
Voir également
Catégories
En savoir plus sur Engines & Motors dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!