MATLAB Answers

Advices on realizing a decreasing pulsing function with Simulink.

조회 수: 1(최근 30일)
Raffaele Mencarini
Raffaele Mencarini 2021년 9월 3일
댓글: Raffaele Mencarini 2021년 9월 4일
Hello everyone! This is my first time writing in this forum, I hope you can help me with my problem! I'm working on a Simulink project that involves a thermal analysis of a satellite's propulsive system. I need to simulate the mass flow rate, m_dot, which is a linear function that decreases over time. The function that describes the mass flow rate is the following:
u = [0:1:3600]; % time interval
t_star = 3600; % time @ tank's complete depletion
m0_dot = 0.33*10^(-3); % mass flow rate at t = 0
mf_dot = 0.01*10^(-3); % mass flow rate at t = 3600s
function m_dot = fcn(m0_dot,mf_dot,t_star,u)
if (u >= 0)
y = mf_dot+(u-t_star)/t_star*(mf_dot-m0_dot);
else
y = 0;
end
m_dot = y;
end
The previous function has been implemented in Simulink through the block "MATLAB Function". The mass flow rate subsystem and it's time behavious are in the attached files.
Now that I have the main function, I need to provide my system a signal for the mass flow rate variation over time during the pulsated thrust. Basically what I want is that, during the fire time interval (ON), the mass flow rate behaves like the aforementioned function, so it decreases in time, then during the OFF interval, the flow rate is 0, and when it comes the next pulse (ON) I want the flow rate to start decreasing again (always accordingly to the previous linear function) starting from the last value of the flow rate an instant before the OFF time interval. Basically what comes out are sawtooth signals decreasing in time.
I tried to combine the linear function with a pulsed function block with delay and switch blocks, imposing the following parameter for the pulse block (see attached photo):
Sample based
Use Simulation time
Ampllitude = 1
Period = 50
Pulse width = 20
Phase delay = 0
Sample time = 5
My main problem is making the higher value of an i-th sawtooth at the same level of the lower value of the previous sawtooth. I think I can use the delay block to make the linear function "continue" after the OFF interval, but I didn't manage to solve my problem anyway.
Thank you in advance, hope to see your advices!

채택된 답변

Paul
Paul 2021년 9월 4일
It sounds like what you want is the input, u, to be the cumulative ON-time, and the output, m_dot, should be zero when the driving signal is OFF. Here is an inelegant approach that I think solves the problem, using a sine wave with 10 second period to generate ON/OFF. Note that the output of fcn had to be multiplied by ON becuse the fcn code check for u >= 0, i.e., it generates a non-zero m_dot when u == 0. Also, you may want to consider putting some protection in fcn in case u gets too large and result in m_dot < 0, unless you're controlling that via the ON/OFF logic.
  댓글 수: 1
Raffaele Mencarini
Raffaele Mencarini 2021년 9월 4일
Thank you so, so much Paul! It works exactly as I needed, I really appreciated your help!

댓글을 달려면 로그인하십시오.

추가 답변(0개)

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by