02-05-2025 10:43 AM
Please do not attach a new VI that has exactly the same name as a different VI posted earlier!
02-05-2025 10:47 AM
@alhabeeb wrote:
I figured it out but it kind of a mess because I need to convert the current to mass flow rate by this formula
Flow Rate=(Measured Current_mA−4mA)/16mA.
Any way to organize it more?
Is the result correct?
Why do you have two identical diagram constant each if one each would be sufficient? You can branch the wire!
02-05-2025 11:01 AM
That piece of code you can create a sub-vi, and reuse it everytime you need to convert the mA readings into Flow
02-05-2025 11:31 AM
Why do you have two identical diagram constant each if one each would be sufficient? You can branch the wire!
I branced them as shown in the attached VI.
02-05-2025 11:31 AM - edited 02-05-2025 11:32 AM
@LVNinja a écrit :
That piece of code you can create a sub-vi, and reuse it everytime you need to convert the mA readings into Flow
Yes it could be.
Thanks
02-05-2025 11:59 AM
Done correctly, you can just incorporate the correct scaling of m_sec and m-prim into the array diagram constants outside the loop. You also need to decide how to chart and save things. You should append the ER to the 1D array for saving and you should also decide if you want three charts (currently, two of these unscaled "m_..." values will show on the P chart, not something that makes a lot of sense.
02-05-2025 12:42 PM
Here's what I might do for the math using simulated data. (I could not deal with your disorganized front panel, but you should figure it out.
02-06-2025 02:17 AM
@altenbach a écrit :
Here's what I might do for the math using simulated data. (I could not deal with your disorganized front panel, but you should figure it out.
Hi,
-Yes, I want also to chart m_sec, m_prim and ER.
- Your code has no control for the target time!
- Also, I want to indicate the all values in numerics and charts.
- To be honest, I didn't understand how did you scale the m_sec and m_prim ^_^
Thanks a lot
Alhabeeb
02-06-2025 06:10 AM
@alhabeeb wrote:
I figured it out but it kind of a mess because I need to convert the current to mass flow rate by this formula
Flow Rate=(Measured Current_mA−4mA)/16mA.
Any way to organize it more?
Thanks
ALAHBEEB
So it's a typical 4-20mA module? Usually that's the normalization, then you need to scale it to the original range.
02-06-2025 11:14 AM
@alhabeeb wrote:
-Yes, I want also to chart m_sec, m_prim and ER.- Your code has no control for the target time!
- Also, I want to indicate the all values in numerics and charts.
- To be honest, I didn't understand how did you scale the m_sec and m_prim ^_^
I was demonstrating the scaling and intentionally left out the target time. You already figured out how to deal with it with just a comparison and case structures. No need to leave that in, cluttering the code. Same with all your indicators. It would be much easier to use arrays of indicators for each class.
If you want to chart these three values, you need to decide where (P chart? T chart? A third chart? Two more charts? Second Y scales?). I cannot make that decision for you.
I always assume that you are honest, no need to state that. Scaling is just a linear mapping and you can calculate what the constants should be from first principles. That's what I did. In your old code, you scaled twice in a row, first by multiplying by 1 and adding zero, then subtracting 0.004 and dividing by 0.016. This is the same as multiplying by 62.5 (1/0.016) and adding -0.000064 (-1 x 0.016 x 0.004). Right?