integ lower limit in simscape custom component
Show older comments
Hello,
I am having troubles defining the lower limit in a custom block in simscape. I want to integrate a variable from a specific point of the simulation (defined by an event trigger) up to the actual simulation time, and use it as a condition for an if equation. I defined the event trigger as follows:
events
when initialevent
t_L = {0, 's'};
elsewhen edge(T>49 || T<51)
t_L = time;
end
end
The equation section looks like this:
if T<49 || T>51
Q == mass*sp_heat*T.der;
else if integ(Q,t_L)<1000
T.der == 0;
else
Q == mass*sp_heat*T.der;
end
end
I cannot even start the simulation, receiving the following error:
Failed to generate 'UserLibrary.ComponentTest'
Caused by:
['']: Expression is not of expected variability: parametric.
• In UserLibrary.ComponentTtest (line 115)
Line 115 is the one with the integration condition else if integ(Q,t_L)<1000
If I change the variable t_L to a value, it works, so I do not know where the problem is. I cannot find much documentation in the integ function, so I really appreciate your comments.
Thank you
Accepted Answer
More Answers (0)
Categories
Find more on Discrete Events and Mode Charts 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!