11-22-2012 12:27 PM
For a project I am creating a VI that will estimate the SOC of a battery. It will do this very accurately by using characteristic curves for a specific battery. These include relationships between voltage, discharge time, internal temperature, SOC, and remaining time at current discharge rate.
I want to have default relationship curves for these various characteristics that can then be manipulated by the user through controls. The user could then create a unique response curve using these controls. As the user changes the parameters (VI running) the graph would respond to these changes. What is the best way to do this?
My big question is how do I convert these non-linear graphs to an X-Y formula that can be used for data calculations? If I was unclear I can clear anything up. It might be easier to explain my whole project but I will see if what I have asked makes sense.
11-22-2012 12:52 PM
Let's start with the architecture.
You want to be able to dynamically adapt the GUI (type of graph) and update calculated values based on selections made by the operator. Is this correct? I typically use the producer consumer loops with an event structure. There is a template under the files menu Files > New... and select the Producer/Consumer Design Pattern (Events).
The bottom loop becomes a state machine where you handle the operator requests and can update the calculated values. You can even trigger events based on limits, or any value or situation that require additional states to handle them. Very useful when an event is needed to deal with something that is even requested by the operator or by reaching a limit, etc within the code.
I'll need more details on the non-linear graph data to an x-y formula..
11-22-2012 10:21 PM
I don't think we are on the same page. I want a user to be able to change parts of a non-linear equation that would be used to get data based on a transducer input. This formula would need to be displayed as a graph(indicator). For example, The user can change the curve of the (voltage) vs (remaining discharge time @ current discharge rate) so that a remaining discharge time could be calculated from the voltage DAQ input.
I need a way to convert between a non-linear formula, a graph of this curve, and a spreadsheet of x-y values.
ALSO, I need to display multiple curves on the same graph. An example of a graph like this is shown below.
And last thing, this is not NI related, but I would like to know what program I can use to freedraw a graph and have it convert to either a formula or a table of values. Anyone know?
11-23-2012 07:20 AM
Oh... I see... (OIC)
I don't know if you can do that with LabVIEW... I can't recall ever trying that..
Unfortunately, you can't change the value of a graph or chart using a cursor..
Although you can change the graph/chart to a control, it doesn't help.
The only thing I can think of is using an image control.. Or an API from a windows application, getting the image data, converting it to lines and then using a formula function to convert the lines to an equation..
Like I said, I've never done this, so my suggestions may not be of much use...
- sorry -
11-23-2012 07:22 AM
11-23-2012 07:24 AM - edited 11-23-2012 07:26 AM
I tried that without success... Although I though I had done this many years ago, but couldn't remember how..
What am I doing wrong? I changed it to a control. No new values are written to the graph. THe lines you see are from a previous run with made up data. I though I should be able to use the cursor, select points and move that section..
11-23-2012 07:26 AM
11-23-2012 07:35 AM - edited 11-23-2012 07:37 AM
I have the cursors, but I cannot move the line (from the original graph) and thus create new data values.
But somehow... I seem to recall having used a graph as a control and being able to change the lines and as a result change the data for the array. Darn alzheimer!!!
I should have posted this image
11-23-2012 07:41 AM
I found this thread from a year ago..
http://forums.ni.com/t5/LabVIEW/Using-a-graph-as-a-control/m-p/1703478/highlight/true#M602699
I have not looked at what the code does, yet..
THis is gonna trouble me all day long.. I gatta go to my client site... Wish I could investigate further.
11-24-2012 12:30 AM
This still hasn't really helped...
Ok lets start with more basic functions. Say I create two arrays representing the x and y axis. These would produce a graph like the one shown above. How do I generate a formula to represent these data points?
If I knew this, the user could submit their own spreadheet to use. This would give them control over the response curves