Jump to content

Black Pearl

Members
  • Posts

    410
  • Joined

  • Last visited

  • Days Won

    13

Posts posted by Black Pearl

  1. The destroy user event seems completly wrong to me.

    In LV7.1, you get a crash when calling a Unregister for Event after the User Event is destroyed. I guess that LV is now checking if the refnum is still active and discarding the destroy.

    Furthermore I get error 1 when generating an Event that is already destroyed, which I use for my producer template as 'good' stop condition.

    Felix

  2. I also want to focus on real world work and not exams. For me the most challenging part was to get a software engineering around the code. I rely a lot on hardware, with failures, delays and so on while getting presented must-have-specs last minute. Here some ideas:

    * Design patterns as noted above, not only OOP but also 'LV-native' solutions (plug-ins, subpanels, AEs). At takes a lot of time and a lot of failures to really get into that. But once you have it, it makes your day. You will start modelling/designing instead of just coding out the specs. And at first, you will produce not working code but 'abstract code' (the classes where you will derive from, or a set of templates). Which of course enriches your reusable library.

    The other side of this, when the tide of workload is low, you are still busy getting all well documented for the next project. I don't think that this is easy, it's the art. And I'm still an adept...

    * All kind of methods come in here, from 'uml' to 'test driven developement'...

    * Have your code accessible. A big range with many open questions to me. The issues range from accessing the nice reusable concepts when I'm on customer site to tracking back which delivered projects might suffer from a certain bug. Have this data accessible when management asks... SVN is a helper here, bug trackers as well, have some server access is also important.

    *Bug trackers are cool anyhow. They give you a tracability of problems, can produce paper for some meetings. Most important for me was that they help me to jump from one project to the next (and they are team-wide)

    * Automating your process: you can have a greate time coding all kind of tools to speed up your process. Automatic unit tests are a success story.

    There is so many ways for an engineer to go further. And the ultimate goal is to get the boring jobs done as fast as possible. Enjoy...

    Felix

    • Like 1
  3. I discovered some mistakes in my statements above.

    StarUml is using the xmi specs V 1.3 from 2001. Current version is V2.1.1 If I remember correctly, they also can export in 1.1

    Because even the link has changed since:

    UML 1_3

    Seems like there are more specs than tools that care about them... :oops:

    I will keep updating this thread when I found out more about it. Maybe others can also give a brief comment about the xmi versions other tools claim to be able. Even better, let's share some dummy uml exports and try to import them... That way we would at least have a list of compatibility issues.

    Felix

  4. I was digging through the XMI export generated by StarUML for a StateMachine and cross-checking it with the XMI specs to broaden the scope for my uml to lv state machine compiler. Both the xmi and the xmi specs (they are a syntax definition) are written in xml, so readable for both machine and human. So I guess there is a compliance check available. I havn't yet compared it to other XMI files, so I have now experience about the real compliance limits. If someone is just exploring some tool for generating state machines, it would be nice to PM me a xmi export, so I can compare the flavours...

    Generally, I think that importing xmi files won't always work. You can nest several general container objects, here the root layer of an StarUML file:

    model(this is the project)->namespace->model(this is the diagram)->namespace->statemachine.

    It might be very specific to the tool how this can be handled.

    The next issue I expect is that the uml/xmi scope is describing very detailed bits most developers won't care, hence there is no real need to implement it into an uml tool. As an example the trigger of a transition might be resolved further as

    TimeEvent->TimeExpresssion

    where TimeExpression will be already in the form of your final code. I have the follwing 'stop' found in StarUml that the DoActivity of a state will only be converted into UML:UninterpretedAction where there is a choice of maybe 7 different 'Action types'.

    As a short summary, the xmi specs gives a lot of flexibility to implement it. I therefore doubt that importing xmi will always work, both in general and considering details.

    Felix

  5. I went deeper into this field (it became my hobby staring on the OMG's spec), and I just want to share my latest insight.

    There is a standard for saving the uml diagrams in xml called 'XMI', the syntax can be found on the OMG page. This is pretty much important, when you want to shar data between two or more uml tools or want some code autogeneration.

    So far, a big down of dia (I proposed it) is, that it doesn't support XMI. Furthermore the developers assigned that issue a low priority, meaning that they won't fix it.

    I will switch over to StarUML as well...

    Felix

  6. You also could use a two staged event consumer:

    * Register the event structure 1 for the abort event and use a timeout (0 or 1 ms), register event structure 2 for the messages and the abort event (use seperate Register for event nodes!)

    Way1: Place both event structures inside one While loop, force execution flow that event structure 2 only executes after event structure 1 went through timeout

    OR

    Way 2: place event structure 2 inside the timeout case of event structure 1

    Way one allows to make the event structure 1 a SubVI, I guess it's better to make that one reentrant. But you need a case around structure 2 anyhow (either a boolean from the subVI or throw an error and use that to inhibit execution).

    What happens (or should happen):

    * If there is an abort event prior to the loop iteration (fired befor entering the code or during processing an event in structure 2), the structure 1 will catch it, structure two will not be executed and you terminate the loop

    ELSE

    * Structure 2 is now waiting to process any events. If this is an abort event, terminate the loop

    Sounds a bit crazy, but I propably try that pattern myself...

    Felix

  7. You can use an event driven queued state machine (or better described as message handler). You will capture all events in the event structure, but instead of processing them there, you enqueue them as commands. You either can use the enqueue elements at opposite for priority events, or you use multiple queues for several priorities. The processing is handled inside the seperate consumer loop of that queue(s).

    Felix

  8. You can dynamically launch 7 reentrant SubVIs for each reader. The most recent post on this is the Tale of Two Servers on the dark side. It has evolved into a discussion about queue references and LVOOP, but in the code the launching is shown pretty well. There are also some nice little VIs to assist in the OpenG Application palette.

    And if you get a two huge spaghetti bowl with the queues, you also might have a look on the event message bus implementation.

    Felix

  9. Has someone made the Replace No Attributes method working in a version above 7.1? (I'm sure ther is an example out there). I don't have the newest versions, so I can't check browse the code of all the RCF-plugins. Can someone please post it as picture or snippet.

    Felix

  10. index.php?app=downloads&module=display&section=screenshot&id=119

    Name: UML2LV State Machin Compiler

    Submitter: Black Pearl

    Submitted: 30 Dec 2009

    File Updated: 03 Jan 2011

    Category: *Uncertified*

    LabVIEW Version: 7.1

    License Type: BSD (Most common)

    This is a toolkit to convert a state diagram designed with the editor dia into a LabVIEW state machine.

    Warning: This uses Scripting: So be aware of dragons, black holes, rusty nails and other monsters. I've only tested it in LV 7.1., got a crash every 2 hours... Bugs and workarounds in newer LV versions welcomed.

    Crashes in 8.5. Found the CAR (# 4CJFKTCS)). Edit: Fixed in V 1.0.1

    Basic Operation

    ***************

    Create an uml Chart in Dia (it is OpenSource too).

    Compile it into a LabVIEW state machine (this will generate an enum based state machine with .vi and States.ctl for the TypeDefed Enum).

    Code the States.

    Getting started

    ***************

    * You will need to have several OpenG packages installed. Dependencies: appcontrol, file, variantconfig. In order to install these, you need to get the VI package manager from:

    http://jkisoft.com/vipm/download/

    * For users of LV 7.x you need to get the TRefTraverse.llb from NI:

    http://decibel.ni.co...t/docs/DOC-5091

    From 8.0 onward they are located under vi.lib\utility

    Propably you need to fix the linking from the main vi

    * You will need to download Dia:

    http://live.gnome.org/Dia

    Customizing

    ***********

    * In the Folder LV Scripting you will find the template 'State Machine Prototype Template.vit'. You can modify this within limits to change the state machine that will be generated.

    * There is a lot of Documentation with the Code: Check out the documentation folder with the 'Tree VIs' and the uml diagrams (they are surprisingly also made with dia)

    * If you have questions, ideas or found a bug, please do not hesitate to contact me! You can do so via PM on LavaG or via my private email on the BD of the About.vi

    V 1.0.1:

    * Fixed a bug in error handling (Error Handler Close.vi)

    * Workaround for the 8.5 crash

    * Support for changed Name of CaseSelect

    * Started to add support for StarUML

    Happy New Year

    Click here to download this file

    • Like 1
  11. Somewhere I read (can't reference) that you should NEVER let the message consumer enqueue elements on it's own message queue.

    There have been several designs of SM's which fall on this category of anti-pattern: Using arrays (that was even on NI if I remember correctly), queues and the event-queue. There is even a worse example in the LAVA 1.0 (and presented as very bad) of a 'SM' that had two stacks and push/put operations on them.

    I've previously fallen into this trap, so I stick with the simple SM's either using enums or strings. If they need to receive data/messages/events, they handle it in an 'idle' state.

    Or I use some kind of message handler (which originates from producer/consumer and not SM design), which never writes back on it's own queue.

    I think on a more abstract level, this anti-pattern allows to create a positive feedback and thus has the ability to get unstable (like exploding the queue, getting into an oscillating state or even chaotic state). But other than in other systems with instability (filter design, OpAmp's), I have no idea how to model such a system and 'prove' if it's stable or not.

    Felix

  12. I found a general way to model the QSM, although it is impractical for description (but might be useful to remodel a QSM).

    Consider a simple state machine, with an dequeue element state. After every state it transits back to the dequeue state. From there it might transit to any other state depending on the queue element.

    From the modelling side, the queue is now a history data (remember the QSM architecture based on arrays?) and not part of the transition logic.

    Felix

  13. Yair: We should have a more complex view on the GObj hierarchy. The Inheritance tree is easy to browse as you descriped and also documented in the help (ther is a image of the tree structure of the public classes).

    But some of the properties are references to other objects. Examples are Lable and 'Ring Text' (I wrongly refered to it as Ring, Ring Text is a Property of NamedNumeric, Hence also of Enum). These Objects are not creatable (we have Compositions, not Aggregations). These are also not part of the inheritance tree. We can identify these as they have a submenu in the property menu and have a reference there.

    Others like Position (and I believe the 'Text' we are looking into) are of type Type Def'd Cluster (or in C-Terminology it would be a struct). They do not have a reference to return. I'm still a bit unsure if there are different properties called text or a struct might be shown inline in the Menu if no other properties exist (Like the Decoration.Text Class).

    post-15343-126156312002_thumb.png

    About the original problem, I fear that there is limited handling of User/Developer triggered Events/Actions (there are some Events for VI such as 'VI Activation'). But there are some helping properties to deal with it at the OS level, mainly I'm thinking about the BD.OSWindow property. There is a tool in the CR called 'Move Lable' which is using OS calls (Win) instead of scripting.

    If we can write down, what exactly we would expect to get, we should get that on NI's Idea Exchange, so at least they are aware about it. Depending on how scripting is managed now (after the semi-offical release), we might get a solution just hacked in by someone inoffically (as the complete interface was done before).

    Felix

  14. In my case, I did replace the Flatten/Unfalatten by a simple Type cast and it works the same (less real estate used).

    The main difference to your case is, that I travel down the class hierarchy (text is the inner part of string, ring is the inner part of all NamedNumeric's). But keyFocus seems to be as high as the general layer 'Control' in which the data container is embedded. From the errors I received, I guess that Diagram has not implemented whatever is necessary to pass the key focus to it's contents. Or does anybody have an example where you get some kind of Focus set on any BD-anything?

    Felix

×
×
  • Create New...

Important Information

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