integ lower limit in simscape custom component
显示 更早的评论
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
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Discrete Events and Mode Charts 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!