Jump to content

Recommended Posts

I am working on some labview code that I really want to use OOP.  I have some classes, ie, motor, relay, potentiometer, etc that I am using and wanted to incorporate in a state machine. I wonder if there are some good examples of this?  I found a thread on here discussing it http://lavag.org/topic/13064-object-based-state-machine-pattern/ , but I am not clear if it answers my question. 

1. When I try to wire a class into a state machine (while loop with a case structure), I always get a broken wire in the while loop. It says the wire type is different?  Am I thinking of this incorrectly. I have a class object I put on the block diagram, i wire it to 'Initialize.Vi' and it breaks (there and on any vi from that class).


Thanks,

Link to comment

It sounds like you haven't setup your inheritance correctly.
 

http://zone.ni.com/reference/en-XX/help/371361H-01/lvconcepts/creating_classes/

 

You're asking fairly vague questions that are pretty hard to answer without writing a lot. Maybe posting some code would help (it would definitly give us the answer to your first question), but really, you need to ask some more specific questions.

Link to comment

Sorry about the vague description above. I wrote it while in the middle of the task with me understanding all that I was working on at the time.  I sort of figured out where I was having issues, but still not sure why. So, the first time I tried what is shown below, the wire between the class object on the left and the Init.vi in the State Machine was broken.  I couldn't figure out why. Then, I just tried it with the init.vi on the outside of the state machine and the wire was no longer broken. While trying to figure out how to explain to you guys my challenge, I again tried to put the Init.vi inside the State Machine, and now i don't have a broken wire.  I am losing it...any thoughts.

Object Oriented and State Machine
Album: Gunter Awesomes
1 images
0 comments

Edited by Walter Gunter
Link to comment

It would be easier if you simply posted the code, however, I suspect that the class going into your init function is not the same as the one coming out.  

 

Other LVOOP comment, take a look at the Actor Framework.  It comes with labVIEW, and I think will take you to a better place, however, it is probably a difficult place to start off with LVOOP as some of the conceptual aspects of it are more difficult than the code you've presented.

Link to comment
  • 1 month later...

I dont know if this will help you or not, but would love to get feedback from you on its usefulness.  I have attached an example project that compares a very simple piece of code written with a QMH, written with an LVOOP approach, and written with the Actor Framework.  I used this as a demo at a recent CLA/CLD summit.  It is intended to be an apples to apples to apples comparison for someone who is looking to learn LVOOP/Actor Framework.  It was originally posted on the NI Community Forums, but I apparently cant link to the page from LAVA(?) (Thanks Todd).

 

 

EDIT: Replaced attached files with link to files on the NI Community Forums so that I only have to maintain one set of files: https://decibel.ni.com/content/docs/DOC-32600

 

 

Link to comment
It was originally posted on the NI Community Forums, but I apparently cant link to the page from LAVA(?).

Live links are down due to spam. If you place the cursor within the link text and click the "Unlink" button (just below the smiley face, for me), the link text shows up:

 

post-107-0-18908600-1384325006.png

  • Like 1
Link to comment

awesome timing..I have had to put my program on the back burner as other fires have popped up and had higher priority. I just learned about the Actor Framework at NI Days in DC and determined since I was going down the QMH/State Machine path, that it might be a good idea to use it in my program. So, today, I am starting again and you have posted the LVOOP 2012 examples for my benefit and learning.  I will post an update once I make some progress. I might need help determining what my Actors are....

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.