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 02-17-2009
Doug Beaton Doug Beaton is offline
Flexsim User
 
Join Date: Feb 2009
Posts: 3
Downloads: 0
Uploads: 0
Thanks: 2
Thanked 0 Times in 0 Posts
Rep Power: 0
Doug Beaton is on a distinguished road
Default Developer's manual / Adding new object classes

Hi there,

I'm somewhat new to FlexSim but am well versed in C++ and object-oriented programming. I'd like to make some additions to the program so that the models I build more closely resemble the real-life processes I'm trying to simulate. My first question is a simple one:

1.) Is there any kind of developer's manual or similar document that outlines the code structure, and the steps necessary to add new object classes to FlexSim?

My second question isn't so much of a question per se, but an invitation for ideas/comments about what I'm trying to do. For starters I'd like to create two new object classes. One is a discrete flow item that is capable of carrying a certain amount of fluid (but does not necessarily have fluid in it all the time). The second is a processor that receives these new flow items, fills them with fluid (via a fluid input connected to the processor) and then sends them on their way.

For a less abstract example, picture a cafeteria. The discrete flow items are customers. Each customer has an empty cup of artbitrary size. The customers go to a drink machine (processor object) and fill their cups with a certain drink (chosen by a probability distribution), then proceed to the checkout. At the checkout they pay a certain amount based on the size of their cup and the type of drink they've chosen.

That's not exactly what I'm going for, but the example illustrates the types of objects I need to create. Behind the drink machine would be several fluid tanks for holding the different types of beverages, and other objects to determine how often the beverages are refilled.

I have several ideas about how to create these new classes, but to do so I need some information about code structure and how to link DLLs etc. Any information that could give me a head start would be much appreciated.

Thanks for taking the time to read by post.


Cheers,

Doug
  #2  
Old 02-17-2009
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

Doug,

I started with Flexsim about 5 years ago and I came from a simulation product that required you creating new objects all the time (although not object oriented) So when I started with Flexsim that was what I started doing but very soon found my self in some nasty situations because the objects in Flexsim are very well thought out and also very complex.

Flexsim then adviced me to use the standard objects because they are tested and give you already a lot of handles by using the triggers. On top of that they created a basicFR and basicTE for those circumstances that the basic objects simply didn't do it. And until now we were always able to do everything we want with the two basic objects (and we have build some complicated libraries with those, I think even Flexsim CT is constructed using basicFR's and basicTE's).

If I look at your problem (although you simplyfied it so I'm not 100% sure) I'm wondering why you would create new objects. If you use the basic objects like a processor and an operator and use the messagetrigger you can do already what you want.

If you really want to have your own objects start out with the basicFR and basicTE. That is what they are made for. There is quite some information about those in the user manual and there are demo models that you can download that use those objects.

Steven
The Following User Says Thank You to Steven Hamoen For This Useful Post:
Doug Beaton (02-20-2009)
  #3  
Old 02-18-2009
Jörg Vogel's Avatar
Jörg Vogel Jörg Vogel is offline
Flexsim User
 
Join Date: Sep 2007
Location: Hannover, Germany
Posts: 643
Downloads: 35
Uploads: 0
Thanks: 802
Thanked 665 Times in 410 Posts
Rep Power: 642
Jörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond repute
Default

Hi Doug,

there exists the possibilty to move a whole object into another. For example you can move a reservoir into a flowitem. this couple can be attached to the flowitem bin as a new flowitem. It is probably not the elegant way you wanted, but it works.

Jörg
The Following User Says Thank You to Jörg Vogel For This Useful Post:
Doug Beaton (02-20-2009)
  #4  
Old 02-20-2009
Doug Beaton Doug Beaton is offline
Flexsim User
 
Join Date: Feb 2009
Posts: 3
Downloads: 0
Uploads: 0
Thanks: 2
Thanked 0 Times in 0 Posts
Rep Power: 0
Doug Beaton is on a distinguished road
Default

Hi Steven and Jorg,

Thank you both very much for your replies.

Steven:

You're correct that the simplified situation I described (and the situation we're actually trying to simulate) can already be modeled in Flexsim. Some people at my company have already created models to do so. The reason I'd like to make new classes specifically for these problems is so that the 3D visualization of the models will look more like the real life processes. This way it will be much easier for our clients to understand, and be impressed by, our models.

I've looked at the basicFR and basicTE classes. While they do look very useful, neither of them appear to be setup to create new fluid objects. The class heirarchy for the two basic objects look like this:

FlexsimObject->Dispatcher->TaskExecuter->BasicTE
FlexsimObject->FixedResource->BasicFR

While all the fluid objects are subclasses of:

FlexsimObject->FluidObject

As such the basicFR and basicTE classes don't inherit any of the attributes of the fluid object.

So my two basic goals are:
1.) Create a discrete FlowItem capable of carrying a set amount of FluidItem.
2.) Create a processor with two inputs (discrete FlowItem and FluidItem) and one output (discrete FlowItem) that takes the FlowItems I've created, fills them with fluid, and then passes them on to the rest of the model.

If this can be done using the basicFR and/or basicTE classes that's okay by me. But it certainly isn't clear to me how this could be done. The closest I've come is having a FluidSink that deletes fluid at the same rate it would be loaded into the discrete FlowItem, while the FlowItem is in a processor. While this works, it isn't exactly ideal, and certainly doesn't look like the real-life process.

Jorg:

That sort of thing could work for me. Do you know how exactly I could move a resevoir into a FlowItem? And as well, how I could then have it connect to objects with fluild inputs/outputs as it moves through the model?

Again thank you both very much for helping me.


Doug
  #5  
Old 02-22-2009
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default Crude model

Hi Doug,

Just in case this (simplified approach) helps you, I've attached a model which has ondraw code added to the containers to show a cylinder depicting the level of containers filled by the fluidtoitem object (via a processor and combiner). As long as you don't have thousands of containers this could be ok. Another way of showing the level could be to resize an object held within the container (another flowitem maybe)

I used the fluidtoitem object in this example because it kind of preserves the flows in the model (and is easy), but equally I can imagine using the sink as you describe and changing a label for level on the flowitem. That would work too and it would be at the resolution of one tick (which may be better). Obviously the drawcode (or resize of an internal object if you're doing it that way) would have to refer to that label instead of the container content that I have in this example.

For constant filling rates it's easily to interpolate the level giving another way of acheiving a smooth fill. In that case the ondraw code could do the calculation if 'filling' and just read the current level if not filling. The calculation would need just the start level and the filling rate. You'd need to set these and the flag to indicate that it was filling, at the start of filling, and update them at the end.

So if it were me, I think I'd prefer to add just the data needed to a standard flowitem - say current level, max level etc. - and get the standard Flexsim objects to do the rest, with some code for managing the extra data on the labels. That rather than try to implement some new classes. The only caveat to that would be if some processing was done in the vessel, or you needed different flow rates or mixtures to be passed into it. I'd be interested to hear A.J.s view.

Hope this helps you too.

Jason
Attached Files
File Type: zip ItemVessel.zip (114.4 KB, 289 views)

Last edited by Jason Lightfoot; 02-22-2009 at 06:28 PM.
  #6  
Old 02-23-2009
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

Doug,

On the visualisation, Jason gave you an example of ondraw code, but are you aware that you can import different 3D shapes to go along with your own code?

Another thing, have you though about using a userlibrary? That way you take the objects you want to use, change the 3D shape, change the ondraw code and add the code to the triggers and then simply add that object to your own userlibrary. Now when you are at a client you load the userlibrary (or have it loaded standard) and simply build your model up with the standard objects and your own!

Steven
  #7  
Old 02-24-2009
Jörg Vogel's Avatar
Jörg Vogel Jörg Vogel is offline
Flexsim User
 
Join Date: Sep 2007
Location: Hannover, Germany
Posts: 643
Downloads: 35
Uploads: 0
Thanks: 802
Thanked 665 Times in 410 Posts
Rep Power: 642
Jörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond repute
Red face

Hi Doug,

I build a small model that creates a new flowitem on reset and move this item into the flowitem bin.
You can manage the flow to the combined flowitem withthe command moveobject.

Jörg
Attached Files
File Type: zip createNewItemCombination.zip (37.2 KB, 385 views)

Last edited by Jörg Vogel; 12-03-2014 at 03:42 AM.
  #8  
Old 02-25-2009
Doug Beaton Doug Beaton is offline
Flexsim User
 
Join Date: Feb 2009
Posts: 3
Downloads: 0
Uploads: 0
Thanks: 2
Thanked 0 Times in 0 Posts
Rep Power: 0
Doug Beaton is on a distinguished road
Default

Hey Guys,

Thanks for your replies. I'm bogged down with some other projects at work at the moment. But once I've got some time I'll try out some of your suggestions and let you know how I do.

Thanks again,

Doug

Tags
developer's manual, new object classes


Thread Thread Starter Forum Replies Last Post
manual entry danieldiep Q&A 5 11-26-2007 06:11 AM
adding a button on the tool bar Pablo Concha Q&A 4 09-13-2007 10:46 AM
Adding member eith Flexscript Lars-Olof Leven Q&A 2 08-22-2007 08:00 AM


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.