From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error messages


@labview99 wrote:

You have sent me a link where it uses an event structure in the state machine. Why? I don't want to use an event structure. On the JKI page there are state machines without the event structure.


Because that was the example in the example finder.  No one says you have to use an event structure.  Examples tend to be simplified versions of code but also show common variations so you can see what is possible.  Something you can learn from, see the possibilities and build upon them.  Discard those things that don't apply to your situation.

 

Expand your mind.

 

HAVE YOU EVER PROGRAMMED BEFORE IN YOUR LIFE?

Message 111 of 143
(896 Views)

@labview99 wrote:

You have sent me a link where it uses an event structure in the state machine. Why? I don't want to use an event structure. On the JKI page there are state machines without the event structure.


Did you look at the example? You don't have to have the Wait for Event state. It's just showing you how to construct a state machine, and many people want to have the Event structure.

0 Kudos
Message 112 of 143
(896 Views)

@labview99 wrote:

I think like this is okey


This is certainly a step in the right direction. Be sure that you include an output for the next state from every state.

Message 113 of 143
(895 Views)

okey, thank you.

Now what I have been trying to find out for so long is how to access an array that is inside the VI that I use in the "Send to position" state to change a value.

0 Kudos
Message 114 of 143
(879 Views)

Did you ever upload a drawing of your state machine?

Sorry if you did and I forgot it... it's been 100+ posts.

 

Once you have some nice diagram, you're really just looking to create an enum with a case for every "bubble" in your diagram, and then logic inside to determine which arrow out of the bubble to choose (and of course, code to do whatever that state is for!)

 

Often this will involve going back to the same state you just went through (any kind of waiting state, checking your position until it reaches a target value, etc), and then sometimes there will always be one transition, sometimes there might be several to choose from (for example, by using Select nodes).

 

Naming is important when it comes to clarifying the intent of your state machine. Perhaps you could tell us what the names of your intended states are, and we could give suggestions?


GCentral
Message 115 of 143
(876 Views)

@labview99 wrote:

okey, thank you.

Now what I have been trying to find out for so long is how to access an array that is inside the VI that I use in the "Send to position" state to change a value.


Are you wanting to set the values during execution?

If so, you'll need some means of reading user input.

 

The idle state + Event Structure that was recently discarded is one option.

Another would be to check some control (polling) for changes - but if you're doing this, it's effectively just the hard way to check for a Value Change event...

 

Can you describe (again, perhaps) the full aims of your application?

  • What do you want to have happen?
  • What do you want to do/set before clicking run?
  • What do you want to do whilst the VI/program is running?
  • How should the program move from one behaviour to another? What behaviours are there at any given time?
  • etc...

GCentral
0 Kudos
Message 116 of 143
(872 Views)

@labview99 wrote:

okey, thank you.

Now what I have been trying to find out for so long is how to access an array that is inside the VI that I use in the "Send to position" state to change a value.


I have given you this answer multiple times. Bring the code from your subvi into the state machine. If you need to access it during execution then it should not be buried in a subvi. Furthermore there are lots of states that you have buried inside your subvi. Move those into your state machine. 

0 Kudos
Message 117 of 143
(868 Views)


I try to explain what I want to do. 

When the VI in the state "Mandar a posiicon" verifies if the cylinder has reached its position, and if it has not arrived it will go to the "error" state. In that state, I have to correct to move the cylinder to the correct position. To make the cylinder move again, send it to the correct position, I would have to go to the array that I use in the VI of the state "Mandar a posicion" and modify a value of the array, so that the cylinder goes to the position that corresponds to it.

I have also thought that perhaps accessing that array is not possible and because of that I think to do it the next thing. I  get the position in which the cylinder is,
then I subtract the position the cylinder is with the position it should have been in.

What option should I do?

0 Kudos
Message 118 of 143
(864 Views)

@labview99 wrote:


I try to explain what I want to do. 

When the VI in the state "Mandar a posiicon" verifies if the cylinder has reached its position, and if it has not arrived it will go to the "error" state.


So here I'd like to mention again what I said about naming states. Is it really an "error" if the position is not reached immediately? Probably there is some time needed to complete a movement, and if you go immediately to measure, then error, you will probably spend lots of time in the "error" state. Maybe this is a good description in your opinion, maybe not.

I'd be tempted to choose different naming to indicate you're waiting, not necessarily that something has gone wrong (and maybe go to an error state after some time, if you still didn't reach the target position).

 


@labview99 wrote:

In that state, I have to correct to move the cylinder to the correct position. To make the cylinder move again, send it to the correct position, I would have to go to the array that I use in the VI of the state "Mandar a posicion" and modify a value of the array, so that the cylinder goes to the position that corresponds to it.

I have also thought that perhaps accessing that array is not possible and because of that I think to do it the next thing. I  get the position in which the cylinder is,
then I subtract the position the cylinder is with the position it should have been in.

What option should I do?


It sounds like here you want to choose between "relative" and "absolute" movements. Which you choose depends on what your motor/cylinder expects - if it expects an absolute position, send the same target value over and over.

If it expects a relative motion, send a decreasing value as you get closer and closer to the target position (the difference you described).


GCentral
Message 119 of 143
(860 Views)

The problem is that if the cylinder does not reach the position, it is usually because someone has invaded a safety barrier on the cylinder. Then you have to rearm the machine and then if I change a value of the array of the subVi that I have told you, the movement of the cylinder resumes. Because of that I would like to acces to the array.

0 Kudos
Message 120 of 143
(853 Views)