LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

creating a hysteresis loop-graph

Solved!
Go to solution

Hello. I am trying to create like a graph that creates what will look like a hysteresis loop. This Vi ramps up to 200 Volts in 20 Volt increments, then it ramps back down to 0, in 20 Volt decrements. What I would like to do is create a graph that will plot this, showing it going from 0-200 then 200-0. I have tried an X-Y graph, which I thought it would be but cannot get the data types to match. Under the state labeled "Run Test" it shows Displacement and Voltage. I would like to have this graph show both the voltage and the displacelement value. The password is 2015. Thank you

0 Kudos
Message 1 of 5
(4,603 Views)

Did you post the correct VI? The one you posted does not have a graph and it does not have a state labeled "Run Test" although there is a "Testing" state. None of the subVIs or typedef controls is present either.

 

You need to accumulate the data from the voltage and displacement measurements into arrays so that they can be plotted on the XY Graph.

 

Other comments: Eliminate the sequence structures. With a state machine you do not need them.

- Eliminate right to left wiring. It makes it difficult to understand your code.

- Eliminate local variables. With the state machine and shift registers you do not need them.

- Nested loop are generally not a good idea in state machines. Simply add a counter and repeat the "Testing" state 21 times. You will also need to move the file I/O to a different state so it does not get repeated.

- Consider an event structure for capturing user interactions.

 

Lynn

Message 2 of 5
(4,590 Views)

@johnsold wrote:

Did you post the correct VI? The one you posted does not have a graph I took my graph out because I couldn't get it to work.

 

 

it does not have a state labeled "Run Test" although there is a "Testing" state. Testing is the correct one

 

You need to accumulate the data from the voltage and displacement measurements into arrays so that they can be plotted on the XY Graph.  This is what I was having trouble doing. I coudn't get the values to plot on the graph. Nothing I tried allowed connecting the values of the voltage and displacement to the graph.

 

Other comments: Eliminate the sequence structures. With a state machine you do not need them.

- Eliminate right to left wiring. It makes it difficult to understand your code.

- Eliminate local variables. With the state machine and shift registers you do not need them.

- Nested loop are generally not a good idea in state machines. Simply add a counter and repeat the "Testing" state 21 times. You will also need to move the file I/O to a different state so it does not get repeated.

- Consider an event structure for capturing user interactions. Originally I started with Event Structure but couldn't figure out how to get it to work for me.

 

Lynn


 

0 Kudos
Message 3 of 5
(4,580 Views)
Solution
Accepted by topic author ceilingwalker

You can connect an array of complex data to it. Or you can connect a cluster of two arrays, or an array of x,y clustered points.

 

UpDownGraph.png

Message 4 of 5
(4,551 Views)

@Gregory wrote:

You can connect an array of complex data to it. Or you can connect a cluster of two arrays, or an array of x,y clustered points.

 

 


This worked. Thank you

0 Kudos
Message 5 of 5
(4,508 Views)