Trace Gas Removal Loop
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello,
I'm trying to create a feedback loop that either removes a trace gas from a system or adds trace gas back to the system based on the outlet trace gas mass fraction. I've tried using If-Else blocks, switches, and boolean logic. I'm unable to get to a result that makes sense or I get errors. The errors I'm getting are typically because of what I believe is a circular logic loop. However, I have been unable to determine how to break that loop.
What I wish to achieve is that the trace gas removal block is triggered when the outlet is greater than a value "X", turns off when it is less than or equal to "X", and vice versa for the trace gas add block.
I've attached the "test" simulink model I've been using to work out the issue before incorporating it into my actual model.
3 Commenti
Umar
il 5 Feb 2025
Modificato: Walter Roberson
il 5 Feb 2025
Hi @Ryan,
I don’t have Simulink installed but after going through your comments, I would suggest to effectively create a feedback loop for trace gas control in Simulink, you can utilize a combination of blocks that avoid circular logic. Instead of using If-Else blocks directly, consider implementing a Stateflow chart or using a combination of logical blocks and memory elements.
Stateflow Chart: This allows you to define states for "Remove Trace Gas" and "Add Trace Gas." You can set conditions based on the outlet mass fraction. For example:
* If the outlet mass fraction > X, transition to the "Remove Trace Gas" state.
* If the outlet mass fraction ≤ X, transition to the "Add Trace Gas" state.
https://www.mathworks.com/help/stateflow/gs/stateflow-charts.html
Logical Blocks: Use a combination of Relational Operator blocks to compare the outlet mass fraction with your threshold "X." Connect these to a Switch block that controls the output to your trace gas removal and addition blocks.
Memory Block: To prevent circular logic, consider using a Memory block to store the previous state of the trace gas control, ensuring that the system does not oscillate between states.
Here’s a simple example of how you might set this up:
% Pseudocode for Stateflow
if outlet_mass_fraction > X
% Trigger removal
else
% Trigger addition
end
By structuring your model this way, you can effectively manage the trace gas levels without encountering circular logic errors.
Hope this helps.
Risposte (1)
Yifeng Tang
il 7 Feb 2025
Hi Ryan,
The logic you have in mind is likely to trigger lots of zero-crossing/chattering, and as @Walter Roberson pointed out, you need a "range". I think a Relay will do the job. I attached a simple example built based on what you have.

The relay will switch to negative trace gas flow if the mass fraction in the volume is higher than 0.011, and add trace gas if it's less than 0.009. I added a flow source to drive a stream of gas into the volume from an upstream reservoir. The trace gas concentration changes between 0.03 and zero, so without the trace gas source, the mass fraction in the volume will change between 0 and 0.03 periodically.

With the trace gas source, it'll try to maintain between 0.011 and 0.009.

Do you think this is close to what you have in mind?
0 Commenti
Vedere anche
Categorie
Scopri di più su General Applications in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
