Time-varying state space and data store read/write sncyro help

1 view (last 30 days)
Hey everyone so I am trying to create an adaptive controller which basically semi-real time will identify frequencies and then update the controller. I have a controller block mask with two main subsystems. The error signal comes in and is split to two functions.
Path 1) signal goes into a buffer of 1024 sample (.001 sample rate) and is fed into an FFT which then goes into an embeded function which picks the highest 3 frequencies and calculates the state-space controller matrices. I have the 4 matricies set as global which access the 4 data store memory blocks.
***Path one only needs to execute every 1024 time steps as the buffer block takes that many samples so using a triggered subsystem is correct?
Path 2) goes into a embded function which has 5 inputs (the error signal and 4 data store memory read blocks) which are used to calculate the discrete state space controller output. The states are persistent variables.
What I need help is I am getting errors saying that the second path is trying to access the data store memory before the second path could write to them. How do i instil some persistence and data validity in my controller to make sure the second path doesn't read until first path is written.

Answers (0)

Community Treasure Hunt

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

Start Hunting!