Hello,
I'd like to convert the continuous weight(g) value comming from Serial card to mass flow rate.
so this flow rate will be connected to PV of PID function block for control v/v.
They don't have official formula so I have to calculate to convert weight(g) to mass flow rate(g/s)
It should be calculated within 1 sec.
I already try to make program with CTR, OND, PDE, NDE so I can save previus scan value and next scan value and then both can be subtract last value from current value.
However, It is so slow even though I set scan time(100ms) of Control Module and OND duration time(0.1 sec)
I need your help
If you can access the presentations from last fall's Exchange, Jim Coleman of Savannah River Project presented a great paper on virtual sensors. You might be able to use his technique, which was to use a Dead time block to calculate a derivative, in your case delta weight per time. Jim also pointed out some "features" of the canned Dead time block you may want to avoid. Noise is your enemy when taking a derivative of a real time measurement.
Here I found a link to the presentation:
https://emersonexchange365.com/events/minneapolis_2017/m/presentations/5040
Note that . . . you must sample much slower than any unknown or random latency in the serial data. If you want a flow "update" once a second, I would want your serial comms to be 10x that or better. You may find you need to back off on the flow calculation updates if your serial data updates are subject to unknown latency.
Advice given without warranty and with no endorsement from my employer. Test all schemes and perform required PHA.