05-15-2013 10:12 AM
Dear LabVIEW Forum Members,
This may appear to be a trivial question however I am having difficulty trying to solve this problem using the LabVIEW vi's & environment. I explain as follows:
I need to calculate and display, in graph form, the contents of a Hopper that is initially filled to 100 tonnes. The hopper is being discharged and filled at the same time, I have the values of filling and discharging in 1 second intervals. The contents of the Hopper is a simple mass balance calculation, Hopper Contents = Inlet material - Outlet material. Below are the first few data sets:
Material Into Hopper Material out of Hopper Theoretical Hopper contents
0 0 100
0 1.534057 98.465943
0.345 5.250186 93.560757
0.6 6.801075 87.359682
How can I iteratively calculate and use the 'Theoretical Hopper contents' calculation from the Hopper inlet and outlet ? I am using the Simulation & Control Frame so I cannot use the For Loop within this frame. Attached is me vi program so far and the Build XY Graph2 is where I'm wanting to display this Hopper contents data.
Any help would be gratefully appreciated.
Regards,
05-15-2013 10:52 AM
You can use a feedback node to pass the current contents to the next loop. It works the same way as a shift register.
05-15-2013 10:52 AM - edited 05-15-2013 10:54 AM
Hi bunny,
- you should use shift registers (or feedback nodes) to forward values from one iteration to the next...
- you should use a (while) loop in your VI to keep it running...
- you don't need to convert from ARRAY(DBL) to DDT to ARRAY(DBL) to apply a multiplication operation...
05-15-2013 11:58 AM
I had not used the simulation toolkit, yet, so I took a minute to play with the wires - and to see if the snippet will work:
05-16-2013 06:31 AM
Thanks for your response post and snippet. I'm not sure why you need to have the feedback element for X for all 3 graphs since the simulation time automatically increments in 1 second intervals. The graph for Hopper contents in your snippet is not what I was expecting.
For my application the Hopper is pre-charged to 100 tonnes (start condition), I'm having trouble trying to get the program working with this pre-set value and then using the data (material inlet to Hopper and material out of Hopper) to update the actual Hopper contents.
05-16-2013 12:35 PM
The feedback for x is because I removed the xy graph express VI, which makes the xy graph into an xy chart (kind of).
Looking at it again, perhaps it would be easier to use three regular waveform charts. Then you don't have to do anything with x.
I faked a data file instead of pulling the data out of the graphs you posted.
Oh, I put some breakpoints down and did some single-stepping. You are indexing the "Material Into Railcar" array with the Simulation time, which is not an integer.
05-16-2013 09:55 PM
The problem I'm having is how to initialise the hopper contents to 100 tonnes and to then carry out the update on hopper contents based on the material input and output from Hopper in 1 second increments. I know what to expect based on some hand calculations with approximate values however I'm having difficulty in implementing the calculation within LabVIEW.
You said in your reponse "You are indexing the "Material Into Railcar" array with the Simulation time, which is not an integer" - does this mean that it doesn't work properly ? I though that this part was working ok ?
05-19-2013 06:09 PM
Hello bunnykins,
I believe what crossrulz was referring to is that because you are using the simulation time (which is not an integer value) to index the array, you'll likely run into round-off error. This may be intentional, but is still worth mentioning. For instance, if your simulation time is 1.73 seconds (coerced to 2), you'll be indexing at row 3 rather than row 2.
Regards,
05-22-2013 09:20 PM
Thanks for the explanation. I thought that the simulation time was in 1 second intervals (integer values) since within the Simulation Frame 'Configure Simulation Parameters', 'Continuous Time Step and Tolerance' I have set the following parameters to one (1) second:
'Initial Step Size' = 1s
'Minimum Step Size' = 1 s
'Maximum Step Size' = 1s
When I viewed the indicator value of the Simulation Time it appears to be incrementing in 1 second intervals.
05-22-2013 09:26 PM
Maybe those values changed for me, though I don't know how - I didn't mess with them. Initial Step Size was 0.01. I only saw it while probing the wires.