Jump to content

ToyLab

Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by ToyLab

  1. Thanks again for your suggestions.

    To overlay the task.vi it seems that I need at least one dynamical dispatched input, so that if the base class task.vi is called, it knows witch Task.vi from the child class should be executed. I could use an extra input just to determin the correct child class and then find a method to take the correct DVR from the cluster and work with that. To avoid blocking, I would pull the task out of the in-place-element structure and feed the object to the task.vi in the dynamical dispatched input. However I would not use it but take the reference of the object holding all DVRs....

    This makes it not realy intutive... but let me play around with it a little mybe I missunderstand your suggestions at the moment :)

    Edit: A secound problem might be the selection of the correct reference from the object holding all references ...

  2. First thank you very much for all you effort. I attached a small sample project to clarify things.

    16 hours ago, Tim_S said:

    The data value reference (DVR) is a pointer to the data (in your case an object). Entering the in place element (IPE) structure using the data value read/write puts a lock on the reference to ensure no one else tries to modify the data. This blocks any other code from using the DVR. So the only way for other code to access the data is to write back to the DVR when leaving the IPE. The only way to use a DVR in the way you are trying is to only access it at the moment you need to, which is not what you are doing. There is a significant time-cost of locking/unlocking the DVR that can make this a very undesirable way to use it.

     

    3 hours ago, smithd said:

    I'd suggest one workaround being that you introduce DVRs within the class rather than around the class

    Yes and I am wondering how I can hand the reference into the derived tasks. It was not possible for me to dispatch the object reference dynamically.

    I do have a few other ideas reaching from creating a copy of the object to using a reference to reference construct, but both have other drawbacks and might not work.

    First I try to find out if the construct is somehow decent, before I spend more time to investigate further solutions. Maybe you could provide me with your expert opinions :)

    LVOOP_TaskSample.zip - usage of the Get and Set functions of ClassA and ClassC are not implemented (probably doesn't matter)

    Btw. in my first project I have used the messaging system (Clustered Queues with function/type and variant) of NI. Its hard to explain but I didn't like much - thats why I started with OOP.

     

  3. Hello everybody,

    I am trying to create a common task class in labview where I would like to substitude the task vi with a task vi of different moduls. So that it would be possible to start, stop, set cycle time ... for each derived class. Additionaly I only like to use reference, since the task should run whereas I use the functions to access its private data.

    For example I would run two modules classes which are derived from the task: a measurment device and a generator device. Each class task communicates with its device and saves the data information in its private members. With read functions I would like to access the data from wherever by knowing the reference without waiting for the task to end.

    The picture below shows the task frame. The task itself is the vi receiving the dereferenced class. Since dynamic dispatching is needed I ran into problems handing the reference directly to the task. Understandably this blocks all my functions during the active time of the task.

    TaskFrame.png

    My question would be if there is a method whereas I could hand the reference to the task and still be able to use dynamic dispatching; to only dereference when a member is written.

    I hope I could express my problem in understandable way, otherwise I try my best to answer question.

    Don't forget I am new to Labview and english ;)

    Best regards

    Martin

     

×
×
  • Create New...

Important Information

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