ATTENTION

This FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices.


flexsim.com

Go Back   FlexSim Community Forum > FlexSim Software > Q&A
Downloads

Q&A Using Flexsim and building models

  #1  
Old 11-16-2007
Nico Zahn's Avatar
Nico Zahn Nico Zahn is offline
Flexsim User
 
Join Date: Sep 2007
Location: Bingen am Rhein, Germany
Posts: 179
Downloads: 19
Uploads: 4
Thanks: 66
Thanked 60 Times in 32 Posts
Rep Power: 201
Nico Zahn has a spectacular aura aboutNico Zahn has a spectacular aura about
Default Object Orientated Programming and Inheritance

Hi there,
I have a modell with about 50 identical Processes and I want to build 1 mother Object, put it in the library and use the inheritance to apply changes to all the objects in modell. Is there a way to do that easily in Flexsim? In other tools I guess the inheritance is a standard thing to change many objects at once...
__________________
kind regards Nico.
  #2  
Old 11-16-2007
Cliff King's Avatar
Cliff King Cliff King is offline
Vice President Technical Services
 
Join Date: Jul 2007
Location: Utah
Posts: 272
Downloads: 158
Uploads: 14
Thanks: 102
Thanked 304 Times in 110 Posts
Rep Power: 412
Cliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud of
Default

Inheritance is a two-edged sword. Sometimes you want child objects to inherit from their parents, and some times you do not. We chose to have children inherit their parent's behavior, but not their parent's visual, physical and variable attributes. In other words, we did not want a lot of kids running around looking like their ugly parents, but we thought it would be okay for them to behave like their parents (in other words not mess their pants and whine at the dinner table). There are lots of ways to quickly copy attributes from a parent to a child; or from any object to any other group of objects for that matter. For starters we have lots of options in a view's sidebar to copy things from the highlighted (yellow bounded) object to one or more selected objects (red bounded). There are many commands available for doing all the things you can do with the sidebar using script if you prefer. There is also the duplicate option if you want the children to be exact replicas of their parents, and createcopy() is a command for doing this. I personally like to skip the parent/child copying approach, and make a Model Control GUI that I associate with the "Control" button on the tool bar. It's a rather simple task of creating a model specific GUI that allows the user to key in or select specific variables and attributes of their choice that they would like applied to a large group of objects in the model. In the OnPress function of a button widget on the same GUI, I write some simple script that goes through the model and updates attributes of objects in the model based on the information entered by the user. It seems like there have been some models posted with an example of this, but I don't remember where they are off the top of my head...

Last edited by Cliff King; 11-19-2007 at 07:01 PM.
The Following User Says Thank You to Cliff King For This Useful Post:
Scott Mackay (10-08-2009)
  #3  
Old 11-17-2007
Nico Zahn's Avatar
Nico Zahn Nico Zahn is offline
Flexsim User
 
Join Date: Sep 2007
Location: Bingen am Rhein, Germany
Posts: 179
Downloads: 19
Uploads: 4
Thanks: 66
Thanked 60 Times in 32 Posts
Rep Power: 201
Nico Zahn has a spectacular aura aboutNico Zahn has a spectacular aura about
Default Copy and Paste

Hi Cliff,
so the Flexsim Library uses inhertance. Flexsim itself is based on C++ which is object orientated and uses inheritance. So my question is would it be possible to build a object which is using the inheritance, with all the disadvantages you mentioned above.
I talked to Tom and Ralf and they both said it would be possible but would need a lot of effort.
So I´m going the other way, with the copy and paste, which our customer thinks is a work around. They have been using tools which where using the inheritance and is asking us to do the same.
The object I have to keep changeable and reuseable is now a chain of processes in a visual tool and can be found in a user lib.
The object gets served by some operators and has to be connected to a network.
Copy and Paste only works if you got an object you can copy your changes to. This works well with me so far, as I made up a litte user command to quickly select all objects of a certain kind. I put them to a group and copy my changes to them.
But if I have to add a process to the visual tool, I have no aim for the copy and paste.

ideas now are:
1.To write a piece of code which copies a highlited object in all the selected objects, positions the object in the selected objects and draw all the connections the source object had.

2. Set up a GUI which will automaticly
generate a modell from the user lib. Positioning, naming the objects would be possible with this but each time I let this GUI put up all the objects to my modell I would need to reconnect them to the network.

I have to say that I think Flexsim is misssing the ability to generate a inheritating object in a User Library. This would be a very nice functionality.
I will add this to your change request list soon.
Anyhow by now I have to try to put our customer back to the though that he has selected the right tool.
__________________
kind regards Nico.
  #4  
Old 11-19-2007
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default

Hi Nico,


If you are looking at inheritance of code, a good approach is also that for the triggers you call a Flexscript function or even a function from a DLL.
That way if you have 50 objects in your model you only have to change the code in 1 location because all these objects triggers point to the same function.

Regards,

Steven
  #5  
Old 11-19-2007
Nico Zahn's Avatar
Nico Zahn Nico Zahn is offline
Flexsim User
 
Join Date: Sep 2007
Location: Bingen am Rhein, Germany
Posts: 179
Downloads: 19
Uploads: 4
Thanks: 66
Thanked 60 Times in 32 Posts
Rep Power: 201
Nico Zahn has a spectacular aura aboutNico Zahn has a spectacular aura about
Default Global Functions

Hi Steve,
yes I though about that, but the point is it is still a work around and you would have to pass all the paramters and values you need to the function.
Wouldn´t that slow the model down?
All the triggers of those objects (right now there are about 11 Objects each having at leats 5 triggers = 55 global functions) in global code could also get a little confusing, I guess it could end up in a fight against the law of entropy..
__________________
kind regards Nico.
  #6  
Old 11-19-2007
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default

Hi Nico,

I agree that it is a workaround and we have had the same discussion with Flexsim earlier also. In the beginning they actually also played with the idea to let you make library objects.
Besides the things Cliff mentioned, there is also the problem that the library objects are so complex that if you start using them without exactly knowing what you are doing, you end up getting bugs and problems and then Flexsim is the only one to solve your problems. So they end up with a help desk full of people just solving problems from users building library objects without fully understanding what they are doing.

But if they could come up with a kind of label or user inheritance or something of that kind, that might be a good idea.


But coming back to your remarks about speed and the amount of triggers. To tackle that we create a DLL and have a .ccp file per object. Passing the objects is than also automatically taken care off and you compile, so speed is not an issue at all.

Regards,

Steven
The Following User Says Thank You to Steven Hamoen For This Useful Post:
Scott Mackay (10-08-2009)
  #7  
Old 11-19-2007
Cliff King's Avatar
Cliff King Cliff King is offline
Vice President Technical Services
 
Join Date: Jul 2007
Location: Utah
Posts: 272
Downloads: 158
Uploads: 14
Thanks: 102
Thanked 304 Times in 110 Posts
Rep Power: 412
Cliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud of
Default Flexsim is Object Oriented and does have Inheritance!

I hope to be very clear in my response, because it is totally erroneous for anyone to believe that Flexsim does not have inheritance! In fact, one could argue that Flexsim is the only simulation package that has true inheritance, or that is truly an object oriented program (OOP) with all the benefits of inheritance, modularity, polymorphism, and encapsulation. It is disappointing when competitive products claim to be exclusively object oriented just because they have "model building objects" in their software. To claim that Flexsim is not object oriented, or does not have inheritance, is wrong. We incorporated strict object oriented features of C++ as our design philosophy; thereby adhering to universally accepted standards for OOP.

Based on the level of interest from our users, it would be possible to modify our current user interface, to provide more flexibility with linking object data. My guess is that those who are asking for “inheritance” are really asking for the ability to establish dynamic data links between nodes in the tree. They are not going to be satisfied with the ability to inherit from the class object in the Library tree from which the object in their model was instantiated from. They will want the ability to not only pick and choose which nodes of an object are “inherited”, but also which object (in their model) they would like it to inherit from. Actually, this is also very doable in Flexsim. Currently, objects in Flexsim have standard attribute nodes named "classes" and "superclasses" which are used to reference the true lineage of an object in terms of inheritance. It would be a simple matter to make available another attribute we called "linkedobject" that when added to the object data tree of an object in the model, it would invoke special functionality in the current binding mechanism to redirect the pointers of all nodes with “inheritance” switched on to the companion node of the specified linked object. I will be curious to see what kind of user interest there is out there in this sort of feature. In the mean time, please continue to use the tools currently provided such as Global Variables, User Functions, User Libraries, and the large number of quick duplication and copying tools available.

Last edited by Anthony Johnson; 11-20-2007 at 01:09 AM.
The Following User Says Thank You to Cliff King For This Useful Post:
Scott Mackay (10-08-2009)
  #8  
Old 11-20-2007
Tom David's Avatar
Tom David Tom David is offline
Flexsim User
 
Join Date: Aug 2007
Location: Schwaebisch Gmuend, Germany
Posts: 430
Downloads: 157
Uploads: 47
Thanks: 486
Thanked 450 Times in 233 Posts
Rep Power: 520
Tom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant future
Default

Cliff,

This subject becomes more and more interesting, because we have a potential customer (Nico already spoke about him and he is not the only one who asked these questions) who is really interested in OOP and says that the most other simulation packages provide this functionality.

I agree with you Cliff and as far as I understand the world (keep in mind, I am not a programmer) the most other packages have more a “model building objects” functionality.
Anyway, if Flexsim has this functionality it is another argument why Flexsim is in the moment the most advanced simulation package on the market.

Yesterday I started to work on my first “real” user library to understand how I would build such a library and which concept I should use. I started this, because I know that Nico has these questions from the potential customer and I wanted to understand the whole subject better to be able to answer his questions in a better way.

I build a model with the Basic Conveyor, because I thought this might be a good task because I am sure that I will use this guy a lot in the future because of some of my customers doing a lot of stuff with conveyors (a lot of “because” in this sentence, so I am sure this is not proper English).


Anyway as a first step I build the model and made a user library from the model, just by putting the objects in the library. This is working but some work if I have changes in the objects functionality.


As a second step I made all the trigger code to User Commands and now changes are much faster and this is working. Disadvantages that I already have with my four “own” Basic Conveyor objects 18 user commands (so I understand what Nico do not like on this method).

I gave the User Commands names which makes sense in my eyes, which makes them pretty long (e.g. BC_ReceiveRelease_OnReset(obj current) ).
So I wish that I could make the left side of the User Command Window larger to read the whole name.
The next thing I discovered is that it would be nice to be able to select all the User Commands at once and add them to the User Library as Component for Automatic Install.
Could we put this on the development list?

The advantages I see is that I have in the triggers on the object just the User Command call and can have additional code from the user here (model logic). And with User Commands the code is still readable and very easy to get access to (compared with a DLL).


The third step I planed for today was to put the User Commands in a DLL to hopefully make the handling with the functions more comfortable, even if I need a DLL to do so.
The advantage of a DLL as far as I understand is that the code is protected, faster because of compiling, etc. One disadvantage could be that the DLL file needs to be at the right place.
What I have to take care of is, that the triggers are not directly do the DLL function call, but call a node function which makes the DLL call. Because than the user can still add own code in the triggers (model logic).
I am pretty sure I know how to do this, because I did this in the past for testing and it worked. I also read Steven’s post (in thread: Use of user DLL in Flexsim) which is using a User Command to do the DLL call which is a pretty good idea in my eyes (Thanks Steven!).
This, if you could pass the function name into the User Command, prevents to have additional nodes for each DLL function call, because now only one node (User Command) is needed. Unfortunately I did not figure out how to do so, but I keep trying.
If anyone knows how to do it or if it is just not possible, please give me a hint.


The fourth step I was starting to think about was to understand how to make a “real” OOP library in Flexsim but I was not sure where to start.
Your post let me believe that there is a way to do this and that it might be complicated the first time but that it is doable.


Cliff, I like to ask if there would be a possibility to make a small example. Maybe only one object with only one “trigger” which uses inherence, but the user can still add own functionality (model logic).
I am sure such an example would give me a point to start and I also pretty sure that more people are interested in understanding how to do such a thing.

In the moment I would be happy with maybe not the perfect solution.
What you call ‘the ability to establish dynamic data links between nodes in the tree sound more complicated’.
What you call ‘the ability to inherit from the class object in the Library tree from which the object in their model was instantiated from’ sounds for me that the one I could use first.


Sorry, Guys, that I wrote such a long post again, but it looks like I am not able to keep it short.

Take care
tom the (A)tom
__________________
tom the (A)tom: "We have solved our problems ... now we have to fight the solutions."
The Following User Says Thank You to Tom David For This Useful Post:
Scott Mackay (10-08-2009)
  #9  
Old 11-20-2007
Nico Zahn's Avatar
Nico Zahn Nico Zahn is offline
Flexsim User
 
Join Date: Sep 2007
Location: Bingen am Rhein, Germany
Posts: 179
Downloads: 19
Uploads: 4
Thanks: 66
Thanked 60 Times in 32 Posts
Rep Power: 201
Nico Zahn has a spectacular aura aboutNico Zahn has a spectacular aura about
Default

Hi there,
if you say that Flexsim is using everything which is meant by OOP, your right, but those functionalities are not very accessable for users.

So if you ask me as user to vote for or against a functionaly which works like an inheritance and lets me edit a user library object and then inherits (or copys) it to all the objects having the 'linked object'-node pointing to my user-lib object, I would vote yes, but I think you could improve this.

The datasharing should be able to distinguish which nodes of the userlibrary objects are shared with the 'linked objects' and which are not.
To be perfect the concept should be something like a command...
inherit { // The code // }
So you can design your main functionality on the user library object, and maintain it there, but you would also have the ability to add unique code to every 'linked object' in the modell.
__________________
kind regards Nico.
  #10  
Old 11-20-2007
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default

Quote:
Originally Posted by Nico Zahn View Post
The datasharing should be able to distinguish which nodes of the userlibrary objects are shared with the 'linked objects' and which are not.
To be perfect the concept should be something like a command...
inherit { // The code // }
So you can design your main functionality on the user library object, and maintain it there, but you would also have the ability to add unique code to every 'linked object' in the modell.
Nico,

There is already a good way to do this. For instance if you have an entrytrigger variable that you've set up to call a dll function where your main functionality is defined, then as the last command inside your dll function you could call nodefunction() on a text label of the object. The text label would be the place where those using your user library object to build a model with could write code unique to the object in the model. You can make the OnEntry (or whatever you wish to call it) edit field in your custom GUI for the object link to the label node rather than the entrytrigger variable node. Your GUI would need to toggle the label node as flexscript or C++ when users edit the field similar to the way Flexsim does in their standard GUIs. This approach will allow you to have your own library-object-specific code in the DLL and have separate model-object-specific code for all the objects in the model that were created from the library object. The fact that the DLL file doesn't reside in the library object itself has its advantages. It can be convenient to work with one DLL file for all functions associated with all the objects in your user library as apposed to going around and finding the code in all the different fields of the various objects of the library...

I hope it is clear what I mean

Regards,

Steven

Last edited by Cliff King; 11-20-2007 at 02:59 PM. Reason: Nice suggestion Steven! I took the liberty of explaining your approach with a little more detail.
The Following User Says Thank You to Steven Hamoen For This Useful Post:
Scott Mackay (10-08-2009)
  #11  
Old 11-21-2007
Tom David's Avatar
Tom David Tom David is offline
Flexsim User
 
Join Date: Aug 2007
Location: Schwaebisch Gmuend, Germany
Posts: 430
Downloads: 157
Uploads: 47
Thanks: 486
Thanked 450 Times in 233 Posts
Rep Power: 520
Tom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant future
Default

Okay Guys,

Because I wanted to understand the world better, I mean the OOP world or let me say how to have functionality for a library in one place, I made two small examples.
Maybe than it will also be easier for us to discuss about this subject.

In the first example I put all the main code into User Commands and in the second example I put all the main code into a DLL.

I like the suggestion from Steven and Cliff in the last post, but I did it a little bit different.
I call from the trigger (e.g. TD_Source OnCreation) a nodefunction and the DLL call is in a node. I organized it in this way that I made a node called DLL under the object and have all the DLL calls as subnodes under this DLL node.
If I do not want inherit code from the User Command or DLL I can just make the function call a comment (“//”). I can also add additional functionality in the trigger direct.
I like this and this is why I did it this way.

I learned a lot and figured out that with the functionality of making User Commands as Component for Automatic Install, it is very easy to copy them from one model into another. Just put them in a User Library, open a new model, load the library and they are there. Great!

Because I did not found how to transfer a User Event in an easy way (I know there might be ways to do it), I put my Init Code I usual have in an User Event Init in the OnReset of the Source. This code I put into the Source directly not using a User Command or a DLL, because I want the user directly to be able to see what is going on here.

I also figured out that I can make the Model Control GUI a Component for Automatic Install in the library. So if I load the library the GUI is there, the only thing I have to do is to make the GUI the Model Control GUI. There might be a way to do this automatically but I am also fine by doing it manually.

I was impressed, that I can also put items from the flow item bin into the library as an Automatic Install Component. Looks like someone was really think about this stuff.

I also made an UserCommand to check if the DLL exists and if the DLL call was successful.

The random function in the DLL I found on the InterNet in a C++ forum. So don't ask me what the function is doing. It is doing what I was expecting and that enough for me .
Carpe retem ... Use the net ...

I am not sure if I did my modeling and programming in a “good” way, but at least I learned a lot.

I would be happy to get feedback from you guys, if you have suggestions, hints, etc.


In general I like to say, that I like the way Flexsim does the User Library, because it is so easy to make your own library.
Even if this library might not be really object oriented, I think the easy creation of your own library makes the library already valuable.
This is the Flexsim concept and this is in my eyes much more advanced than some other simulation packages.

Okay, if there would be an easy way also to make an object oriented library it would be even better, but I am not sure if I would be able to make a robust flexible library. I would think you need some experience before you are able to do this.

Maybe we will get a small example from the Flexsim guys as a start. I am looking forward to learn more about OOP and OOLibraries in Flexsim.

Anyway, I really hope I get some feedback from you guys.

Take care
tom the (A)tom
Attached Files
File Type: zip Sample_Library_TD.zip (371.5 KB, 351 views)
__________________
tom the (A)tom: "We have solved our problems ... now we have to fight the solutions."
The Following User Says Thank You to Tom David For This Useful Post:
Scott Mackay (10-08-2009)
  #12  
Old 11-22-2007
AlanZhang's Avatar
AlanZhang AlanZhang is offline
Flexsim Super Moderator
 
Join Date: Aug 2007
Location: CA
Posts: 289
Downloads: 64
Uploads: 0
Thanks: 88
Thanked 91 Times in 47 Posts
Rep Power: 225
AlanZhang is a jewel in the roughAlanZhang is a jewel in the roughAlanZhang is a jewel in the rough
Default

Hi all,

This thread is a little bit confusing. I am not sure what is the main point here? Are we looking for a specific feature that Flexsim does not have, or a general discussion on Flexsim is OOP or not?

It seems that one point is how to share code between Flexsim objects. For every object that you dragged from library to the model, you will get a copy. Once the object is created, it has no linkage to the original object in the library (correct me if I am wrong). This has its advantage since you can easily custom each object's beahvior. Also when you distribute your model , you do not need to distribute the library.

However, this has its disadvantage too (Anything cannot be perfect ). That is, it would be hard to have the copied objects share a common behaviors. Yes, they already have their common behaviors same as the library object. But many times I found that I need to modify the behavior during the development process. And I could easily have more than 100 objects which has same behavior, say same entry_trigger (probably same situation as mentioned by Nico). And what kind of behavior should be put there is not so clear yet at the begining of the model development. Thus I cannot create an user libary object at the begining then drag the library object to create my model. And when finally I have a clear idea about the behavior, the model becomes very complex and I do not want to build the model from the scrach again. (But I agree with Cliff and Tom that those copy tools in the side-bar are very handy.)

The way I solve the problem is to use C++ code to do the behavior. This is similar to using DLL or user command. But I do not like user command since it has some limitations, for example, limited parameter types, no type checking ect. I do not use DLL since it is basicly the same as using C++ code but needs some extra work.

For example, if I want some common behavior in the entry trigger of a bounch of processors, I would like to create a C++ function called myProcessorEntryTrigger() and put it in the entry trigger of those processors. Then I will create a C++ file (say mycplus.cpp) to hold these functions. Then I create a global C++ node, and put something like,
Code:
include "mycplus.cpp"
in that global C++ node so that the model can use those functions. By doing this way, once I change the code in the mycplus.cpp, it will have effects on all the object using that piece of code.

This may not be the best way and may not be the OOP that we are dicussing here either. But I hope it will shed some light on how to share common behaviors among many objects practically.

Thanks.
Alan
  #13  
Old 11-22-2007
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default

Quote:
Originally Posted by AlanZhang View Post
Hi all,

This thread is a little bit confusing. I am not sure what is the main point here? Are we looking for a specific feature that Flexsim does not have, or a general discussion on Flexsim is OOP or not?
Hi Alan,

As far as I understand the discussion, it follows 2 paths. 1 is the general OOP discussions, which I think is more general and might have some future implications. The other is how to overcome the problem of not having real inheritance in the library and there a number of posts on how to solve that problem.

Quote:
Originally Posted by AlanZhang View Post
It seems that one point is how to share code between Flexsim objects. For every object that you dragged from library to the model, you will get a copy. Once the object is created, it has no linkage to the original object in the library (correct me if I am wrong). This has its advantage since you can easily custom each object's beahvior. Also when you distribute your model , you do not need to distribute the library.

You are right about the first part, there is no linkage anymore. Concerning your second part about distributing, if you call a function on a trigger, like you do and like we all propose, then you can still distribute the models without the library and still have some kind of link between the library objects(or the functions that represent them) and the objects in your model.

Quote:
Originally Posted by AlanZhang View Post
I do not use DLL since it is basicly the same as using C++ code but needs some extra work.
Well here I disagree, there is one big difference, when using DLL's you don't have to compile anymore when building models. So building models goes a lot faster. (And if your customers are used to not compilling, it is difficult to explain why they have to compile again)
Besides that, even development is faster because a DLL compiles/rebuilds must faster than complete flexsim. The only extra time is setting up the DLL, but if you have done that once, it is just a copy paste story.

But the other conclusion that I can draw from your post, and the other posts in this thread, is that actually everybody that is creating user libraries, ends up doing it the same way: Letting the triggers call a function, wether that is a DLL function, C++ function or just a usercommand.

Regards,

Steven
The Following User Says Thank You to Steven Hamoen For This Useful Post:
Scott Mackay (10-08-2009)
  #14  
Old 11-26-2007
Nico Zahn's Avatar
Nico Zahn Nico Zahn is offline
Flexsim User
 
Join Date: Sep 2007
Location: Bingen am Rhein, Germany
Posts: 179
Downloads: 19
Uploads: 4
Thanks: 66
Thanked 60 Times in 32 Posts
Rep Power: 201
Nico Zahn has a spectacular aura aboutNico Zahn has a spectacular aura about
Default Dll Library

Hi there,
I want to thank Tom for the nice work he did. If you never used a DLL before, his work is of great worth.
But now, that I could take a closer look at this solution. (Phil you said that this would be a good way) I have to disagree. In my opion all the functions in one code file , or even in several DLLs can get quite confusing.
Handing over Parameters to the DLL is limited (10) and passing strings not possible (yet).
If I change the DLL I have to compile it and then test it in Flexsim.
The only advantage I see is that you can keep your code from the users eye, by handing out the compiled DLL.
I still think having the inheritance as a userfriendly functionality inside of Flexsim would be very usefull.
__________________
kind regards Nico.
  #15  
Old 11-26-2007
Cliff King's Avatar
Cliff King Cliff King is offline
Vice President Technical Services
 
Join Date: Jul 2007
Location: Utah
Posts: 272
Downloads: 158
Uploads: 14
Thanks: 102
Thanked 304 Times in 110 Posts
Rep Power: 412
Cliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud of
Default Inheritance (data linked nodes)

Due to the interest with inheritance (data linked nodes) in Flexsim, I've added a new request (item 415) to our Development List. This is how the request reads at this time (please feel free to comment) :

Provide the ability to establish dynamic data links between nodes in the tree. Would like the ability to choose which nodes in an object's data tree are to be linked, and what object they are to be linked with.
This should be possible with the following development steps:
  1. Take advantage of one of the currently unused bit flags (switches) for a node to represent whether or not the node's data is to be data_linked to another node's data.
  2. Add another object attribute called linkedobject
  3. Modify current binding mechanism so that it stores proper pointers of all data_linked nodes to the partner node on the linkedobject instead of the current object.
  4. Add tools in Tree view's sidebar to toggle the data_linked switch of selected nodes. At the same time we should probably include radial buttons to toggle nodes as either flexscript, C++ or DLL.

Last edited by Cliff King; 03-15-2008 at 10:00 AM.
The Following User Says Thank You to Cliff King For This Useful Post:
Scott Mackay (10-08-2009)
  #16  
Old 12-01-2007
mgiubilato mgiubilato is offline
Flexcon, Flexsim Distributor, Italy
 
Join Date: Aug 2007
Location: Pecetto Torinese (IT)
Posts: 24
Downloads: 24
Uploads: 0
Thanks: 93
Thanked 22 Times in 11 Posts
Rep Power: 169
mgiubilato will become famous soon enough
Default

Cliff,
i miss if you also thought in your specifications at the derived object support : an object istance that inherit most of its behavior from an existing library object, but some attributes (for example the exittrigger), specificcally set for that object.
It is one of the most powerful concept of O.O. modelling.

About the binding mechanism, could also be disabled ? so a model can be loaded without loading the proper userlibrary (and this a shortcoming of O.O. modelling, it works only if you everything loaded, at least in most of the simulators, eM-Plant ahead all).

Sorry for the "not proper" usage of this thread.
Regards
  #17  
Old 12-05-2007
Cliff King's Avatar
Cliff King Cliff King is offline
Vice President Technical Services
 
Join Date: Jul 2007
Location: Utah
Posts: 272
Downloads: 158
Uploads: 14
Thanks: 102
Thanked 304 Times in 110 Posts
Rep Power: 412
Cliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud of
Default

I think my proposed solution is a good fit for these types of issues because the "linkedobject" can be defined as any object you want; it can be a true class object in the library tree, or it can be another instance in the model tree.
The Following User Says Thank You to Cliff King For This Useful Post:
Scott Mackay (10-08-2009)



All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.