How can I count the number of times an input reaches a certain value?
1 次查看(过去 30 天)
显示 更早的评论
Hello,
I am using Simulink where I have a model of a heat pump, where I simulate frost accumulation. What I am trying to do is count the total number of times (during the simulation) the Frost layer thickness has reached 8.25 mm for example.
I have tried various methods, such as implementing switches, sum blocks, delay blocks, nothing has worked so far. At least not properly.
I cannot provide much details as the project is confidential. But part of the task is to count how many times the frost sheet on the outdoor unit has reached a certain value.
P.S. I do not have much experience with MatLab commands and scripts. I would really appreciate solutions solely involving Simulink.
0 个评论
回答(1 个)
Jonas
2021-2-19
Take the signal for the frost layer thickness, use a Relational Operator to compare if the signal is larger than a constant of 8.25 (second input). The output will be a boolean telling true or false. Connect this boolean signal to a Triggered Subsystem. Inside this triggered subsystem, you could for example use a Data Store Read and Data Store Write block, where it reads from the read block, adds 1 to it, and writes it to the write block. The Data Store Memory block should be located outside the triggered subsystem. There are also possibilities by using a Unit Delay block and adding it with one.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!