Menu

possible Bugs I found:

2015-02-02
2015-04-17
  • Franz Preyser

    Franz Preyser - 2015-02-02

    Hello Everybody.

    I'm studying Mathematics with a focus on modeling and simulation at the Technical University of Vienna. I'm using PowerDEVS for my master-thesis and therefore I have already spent quite a time working with PowerDEVS. As I found some bugs, I would like to report them here. I am using the version from 2014-03-17 and Ubuntu 14.04 as operating system. The Scilab-version is 5.5.0.
    And here is the list of bugs I found:
    - If you create a new model and want to save it in a new folder, there are only lower-case names allowed for both, the folder-names and the file-names. Because, if you use upper-case-letters, PowerDEVs will convert all upper-case-letters into lower-case-letters and search for the resulting names which, of coures, don't exist. I guess the reason is, that Windows is not case-sensitiv with path-names, whereas Linux is.
    - If you create a new atomic model and you want to set the number of inputs of that atomic block as parameter, you can create a new String-parameter and enter %Inputs as it's value. If you then want to retrieve the number of inputs in the Init-function of the atomic DEVS, it simply works with:
    int n_inports = (int)va_arg(parameters,double);
    If one tries the same with the block outputs(using %Outputs for the parameter-value), everything works fine, appart from the fact, that
    (int)va_arg(parameters,double);
    again returns the number of inputs instead of the number of outputs.
    - Annotations in a model make a lot of problems. It's not allowed to include line-breaks or commas "," in an Annotation. If line-breaks are used, and you save the model, closed it and open it again, PowerDEVS crashes immediately. To be able to reopen the model, you have to open the .pdm file with a text-editor and remove the line breaks.
    If you use commas in an Annotation, the next time you open your model, the annotation won't be diplayed as a whole, but only the first letters in it.
    - If you have two annotations in your model which have exactly the same content, the position of one of them is altered each time you open the model.
    - The From-Workspace - Block produces an output at t=0 twice. (I allready could fix that bug)
    - If you create a list-parameter in an atomic DEVS where other paremters have been defined already, and you want to change the order of the list-parameter, PowerDEVS crashes.

    I hope this helps you a little bit improving PowerDEVS. I have to say, I realy appreciate that software, especially the fact that it is open-source and cooperates with Scilab.
    Thanks a lot to the inventors of PowerDEVS for their great work!

     

    Last edit: Franz Preyser 2015-02-02
  • Federico Bergero

    Hi Franz, I will have a look at these bugs and reply to you.
    Fede

     
  • Franz Preyser

    Franz Preyser - 2015-02-03

    Hello again!

    I think I found another one:
    In one atomic model I programmed, I use a String-parameter. If there occures a semicolon ";" in the description of the parameter, everything in the description til the ";" is added to the String returned for the parameter-value.

     
  • Federico Bergero

    Hey Franz I have corrected most of the bugs you mentioned and uploaded a new version (953). Try it and let me know! (save your models first just in case).

     
  • Franz Preyser

    Franz Preyser - 2015-03-28

    Hi! Thanks a lot. I'm sorry, I am very busy at the moment with writing my diploma thesis. That's why I didn't find time so far to test the new PowerDEVS-Version.

    Ok, then let's see:
    - The case-sensitivity - problem does still exist. It isn't possible to use upper-case letters in the names of code-files (or their directories). If you create a new code-file for an atomic block and use upper-case letters in it's name and select it as code-file for that block, then you get an error-message when you try to right-click on that block and choose 'edit code'.
    - the thing with the return-value for number of outputs works now.
    - Annotations with line-breaks and commas to work now, however they still change their position each time you open the model for the next time...
    - changing the order of list-parameters works now
    - the 'From Workspace - Block' leads to an memory-access-error now.(I have a working version, where I fixed the bug, shall I send it via mail?)
    - the problem with semicolons in the description-field does still exist.
    - there is a problem with scilab(but this already existed before as well): it prints the following warnings:

    Warning: Scilab 6 will not support the file format used.
    Warning: Please quote the variable declaration. Example, save('myData.sod',a) becomes save('myData.sod','a').
    Warning: See help('save') for the rational.

    During my diploma thesis, I have programmed an atomic DEV&DESS - block. It can be used to directly implement a model formulated with DEV&DESS-formalism in PowerDEVS.
    Additionally I altered the message-format, that is used for communication between blocks in PowerDEVS. At the moment these messages are simply void-pointer and thus can be used for sending anything you like. However, the receiver always needs to know what he is receiving, especially if he is supposed to hand on this message while preserving its type. That's why I programmed a kind of (polymorphic, abstract)basic-message-class, called DEVSMessage which every other message-class(i.g. QSSDoubleArray, vector) is derived of. I think, the advantage of this approach is, that you now can derive further message-classes from the existing ones and send instances of this derived message-classes through blocks who expect instances of a base-class. Additionally, I programmed it that way, that those blocks, expecting instances of the base class handle the received message as if it would be of the base class-type, but still pass on an altered version of the derived class-instance. Furthermore after applying my changes (via simply exchanging the engine-files event.h and event.cpp as well as vector.h) all old library-blocks and examples should still work, because they shouldn't notice, that they do not use void-Pointer anymore (at least, it worked with those i tested).
    The motivation for this was to improve reusability of programmed library blocks for cases where you want to send instances of custom-defined message classes(like for example a class for entities in the simulation of production-processes).

    If you are interested, I would send you my diploma-thesis including all source-files, when it is finished. This will be approximately end of june.

    One last issue: I'm supervising other students with simulation-projects with PowerDEVS and they are using MS Windows and are experiencing some problems with it (especially with the very-old Scilab-Version, that is in use there). I would be very grateful, if you could compile a new Windows-installer and put it on source-forge. I tried it on my own, but it didn't work at the first try and at the moment I'm to busy with my diploma thesis to work that out.

    Thanks a lot for your efforts, with best regards, Franz

     
  • Philipp Raich

    Philipp Raich - 2015-04-01

    I would like to join in on that discussion, as I was busy debugging PowerDevs on various different machines in the last few weeks:

    (Disclaimer: My work is closely related to that of Franz Preyser, thus I recently had access to his changes mentioned above)

    • The Scilab warning ("Warning: Scilab 6 will not support the file format used.") was apparently fixed in [r954]. Unfortunately, this seems to break the Scilab connectivity for Scilab 5.3.3 (as available in Ubuntu 12.04.5 LTS), because Scilab will not recognize the option (variable name in quotes), and as far as I can tell it also breaks for Scilab 5.5 (available in Ubuntu 14.04.2 LTS), because the file-format which is then selected by setting the variable name in quotes is not compatible anymore with the method PDevs uses to read vectors/matrices from the file. Using a library to read sod-files (Scilab Open Document) would be preferable IMO and more robust. I had to revert that fix for now.
    • The changes mentioned by Franz Preyser above uncovered one issue in the vector/matrix_gain block, where a "dereferencing type-punned pointer" apparently leads to a gcc optimization, thus the output of this block will always be lost ('yvec=*(vector*)y;' in matrix_gain.cpp). Avoiding 'y[]' as intermediate result and saving to yvec directly throughout the block resolved the issue for us. I think though that our currently used method relies on the QSSDoubleArray implemented by Franz. Nevertheless, dereferencing type-punned pointers should certainly be avoided, as gcc cannot guarantee that it won't optimize things away.
    • One (slightly opinionated) comment: I think you should consider enforcing code format rules (indentation most of all, but also braces '{}' for blocks). Inconsistent indentation and 'if' without {}, topped with multiple statements in the same line with ';' between, are one of many (widely accepted) code formatting "don'ts" that lead to hardly readable code and sometimes hours of debugging and frustration. There are several tools out there being used for this purpose (indent, lint).
    • And a unrelated note: We are currently completely avoiding the PDevs installer for our current workflow, as we need to make changes to both, PDevs itself and the used models, and the installer just introduces indirection and confusion for less-savy people. For the sake of simplicity we just track the project as a whole, and changed some things accordingly, so that it can be built and run in the source-dir itself, and avoiding assumptions about paths ('$(HOME)/powerdevs/'). The installer certainly makes sense up to some point, but the resulting construction as a whole is slightly confusing and error-prone. Changes in the model are never reflected or tracked by svn/git (we use git and track the upstream project via svn2git), unless they are manually copied back again, on the other side 'newer' versions of PDevs will not be installed, once the svn-revision is marked as 'revision'M, as the version string does not change anymore.
      Running PDevs from source as we do should certainly be simpler IMO, and there is no real need to "install" anything on Linux, besides the automatic dependency resolution, IMHO. Building a new installer also takes quite some time compared to the actual build time of the binaries. Then there is this RTAI image sitting in the repository...
    • Running PDevs under Windows I can currently not recommend. We certainly had issues, and some computations seem to suffer considerably compared to Linux.
    • Also, if things fail when running PDevs/Scilab (e.g. missing folders that were just expected to be there), there are rarely any error messages indicating what exactly went wrong.

    On a happier note, I am very thankful for your work so far and wrote my comments with the best intentions. I don't expect you to change anything because of my comments and I will be happy to supply patches if desired.

    Best regards,
    Philipp Raich

     

    Related

    Commit: [r954]


    Last edit: Philipp Raich 2015-04-01
  • Federico Bergero

    Hi Philipp & Franz, welcome to PD! Thanks for all the bugs/changed suggested.
    A few things:
    We also do not recommend Windows version (anyways I'm trying to compile a new version with Qt5 and Scilab5). The simulation runs slower for some reason.
    Is true that on Linux perhaps is the installer is not needed...for CS students. For a naive user the installer is easier than getting svn code, Qt libraries, compile, etc. If you prefer just use the svn, but I think the installer is still needed.
    About the modifications to code/blocks to the source: is true that the changes are not reflected to the svn directly. This is done to let every user have their own version of the blocks (modified or new). If that block is fixed/useful to the general crowd of PD he/she can include it in PD (uploading it to the SVN).
    About the indentation: yes...it would be great to do the force that...but is hard and everybody has different styles.
    About Scilab: I'm running Scilab 5.5.0 and the quotes seem to work. I will have a look about switching to HDF5 file format.
    About the QSSDoubleArray blocks I will have a look about it.

    Thanks for the suggestions. Also PowerDEVS is a open source collaborative project. You are welcomed to join the team and fix/change/add the suggestions.

    Also I would like to know what are you guys researching and how are you using PD.

    Best
    Fede

     
  • Federico Bergero

    Hi Peter & Franz
    I have commited some changes to the SVN.
    I have changed the scilab comunitaction to use HDF5. If you build it from source in Linux you will have to install libhdf5-dev.
    I have updated the Scilab module (BackDoor) for Windows. I'm trying to include it on ATOMS (the Scilab module manager). When it is included I will re-compile a new version on Windows. If you are eager to get it working on windows let me know.

    Best
    Fede

     
  • Philipp Raich

    Philipp Raich - 2015-04-17

    Hi Federico,

    thank you for your effort regarding our concerns, it is highly appreciated on our side. I'll have a look at it.
    Windows is not of utmost importance at the moment, but might be somewhere in the future. I think we will continue our tests with Linux for now.

    You also asked what we are using PDevs for, which I forgot to answer. We are researching/evaluating DEVS/DESS for various applications which require simulation of continuous and discrete portions of a system, and we have currently set our eyes on PDevs. I am sure I can elaborate more on this once we made some progress with our research.

    Until then, we might have some smallish questions or patches regarding certain parts of PDevs we encounter bit by bit, in which case I will just open a respective thread here as soon as possible.

    All the best, and thank you again,
    Philipp

     

Log in to post a comment.