Flexsim Questions

3 views
Skip to first unread message

Rachelle Kun

unread,
Aug 4, 2024, 2:48:20 PM8/4/24
to thandbarpica
Im trying to add a UR5 robot model as part of an academic work but the .skp model I downloaded from 3d wirehouse, but when I leave only the robot model it doesn't allow me to add the movements of the robot.

Hi @Lucas_gabriel A, was one of Jason Lightfoot's or Yumi Nishijima's answers helpful? If so, please click the "Accept" button at the bottom of the one that best answers your question. Or if you still have questions, add a comment and we'll continue the conversation.


I'm pretty sure the joint system of the UR5 doesn't match those of the FlexSim 6-axis robot, so even if you succeed in bringing in the shapes and map them to the right components, you'll not get correct kinematic behavior.


I am aware that normally you would use either the arrival sequence or the arrival schedule to set the arrivals. Which makes use of the table.

But I would like to have random intervals but of a set number of flow items.

I am trying to do a simulation given a set number of flow items how long I would need to clear this amount by adjusting various elements such as including the number of workers, while keeping it realistic by having random intervals.


Sorry for the very beginner questions, I would not be using the schedule nor the sequence method since my items are in large shapes and large quantities. I am choosing the second method where I will close the output of the source in a trigger. So I have set a On exit trigger where I assume this is where I will stop the output if the items created have reached a number say 3 ( for testing). But currently I have a parsing error and from previous experience this means that the variable is wrong. How do i fix this then?


Here "object" is a placeholder for a pointer reference to the object whose output you want to read. In trigger functions the object they are defined on can generally always be accessed through the variable current. The stop output option uses this as the default value for the Object field, for example, as shown in your screenshot (the output of current will be closed).


Thanks, doing this I can limit the output, but the value has to be 1 less than the actual value i am going for. It also turns out that there was a similar question posted by someone. -the-source-output.html


Essentially what I am trying to do is assign a label called "sendDirection" to the box that gets created. Once it arrives at the Decision point 'DP8' if its value is 1 it should go to DP7 and if not it should go to DP9. I cannot find a way to route the box using decision points in process flow, so I tried hard coding logic onto the decision point but it does not work. On top of this, even if the box hits the pack station the operator does not start the task sequence.


You just need to change some of the syntax, but your logic is correct. Because you are assigning the sendDirection label on the created objects and not the token. You will use item.sendDirection instead of token.sendDirection in the trigger of DP8. It is also good to have a default destination value or else it will throw an error.


There were some errors with the Create TS activity for small boxes that I believe are unrelated to your question. But the attached model includes fixes for both. We just had to use your labels to determine which operator was the task executer and which station to travel to. Let me know if you have any questions


Almost ready with the updated model in the right version. But to answer that your other question, because the label sendDirection we are assigning is either 1 or 2, we need to change the cases in Send Item By Case to be 1 or 2. Also make sure that the Case Function doesn't include an equal sign.


When I said a "non-programmer" I mean somebody that doesn't hold a Computer Science degree (so he/she would be expected to know about networks, sockets, os, spawning, app architecture, a couple or three programming languages, and what not). I meant people coming from other backgrounds (which could be engineering, maths, physics...) and intend to use a simulation tool, in combination with Python (some level of programing is obviously required). I think this is not a strange situation nowadays in industry or in academia.


In writing the code in -or-c-or-python.html, I first implemented a direct connection to the flexsim.dll with an API for communicating directly with it from Python. This works well if you want to communicate with FlexSim immediately in-line within your Python code. Doing so makes it extremely difficult and complicated to see the updates in FlexSim though, as FlexSim then runs as a sub-process of the Python script rather than an application with its own event loop for processing GUIs messages, interacting with the mouse and keyboard, repainting views, etc.


The socket communication code was actually simpler for non-programmers than trying to deal with the application directly. The socket code is honestly not very complicated. The main complication is that I only posted the Python side of that code. An example with both sides of the communication (FlexScript and Python) boiled down to the basics instead of showing an RL example would show how simple this type of communication is. Directly accessing FlexSim is quite a bit more complicated than inter-process communication with sockets.


So it isn't out the question that we could create a C API that can be directly accessed from Python to execute functions in FlexSim, and we could also make it easy to call Python functions from FlexSim (similar to calling C++ DLL functions right now). Neither of those features seem to address your original question though (and were explicitly excluded by your original question).


I agree that this is a good application of simulation, and many industrial engineers are gravitating toward using python to solve these questions. Over the past week or so I have been thinking myself about the problem of AGV dispatching/scheduling, and have thrown around the idea of creating an example in FlexSim of a tabu search method for optimizing the scheduling of AGVs within some time horizon. As I thought about implementing this, the question came, should I implement the algorithm in FlexScript, or would it be more beneficial to implement the tabu search in a commonly used language like python? The advantage of implementing it in python is that, once the algorithm is written and optimized (and if I have implemented it properly) it would be relatively easy to then plug that python tabu search algorithm into a live system. But, yes, as Phil mentioned, I don't think you're going to get this without some programming, as, obviously, python is a programming language.


The key, though, is implementing the python algorithm such that it is host-agnostic. In other words, the python algorithm needs to not assume that it is communicating with FlexSim, but that there is just some host feeding it information, and it processes that information, and gives back decisions. Thus, it should not use FlexSim-specific types. I think this would be relatively easy to do, because most of FlexSim's Variant types have direct corollaries in python. Flexsim's Map is essentially a python dict. FlexSim's Array is essentially a python list. FlexSim's string is essentially a python str, and so on. The one type that might not translate well would be node references. So the simulation story would be, FlexSim runs my AGV model. At some point in the model, FlexSim needs to schedule AGV job assignment out for the next 20-30 minuts. FlexSim calls the python algorithm, and it passes one or more Maps, Arrays, strings, or numbers into the function, that give enough information to the python algorithm regarding what needs to be scheduled. The FlexSim engine automatically translates the parameters passing into the function into native python types, then calls the function. The algorithm then executes, and gives back one of the same various types. Then FlexSim's engine then translates back into FlexSim-native types, and the function returns.


Anyway, this is something we definitely want to look into for future FlexSim development. It fits well as a digital twin strategy, where FlexSim becomes a testing application for real algorithms that will be deployed in live systems.


I recently got a proof of concept working, wherein a python function is called from within FlexSim, to make a decision as to which of multiple items to pull from an upstream queue. Hopefully in the next release cycle (22.1) I can get this to a releasable state so you can use it as well.


With that said, obviously there are still questions to answer as to the "orientation" of python scripting using FlexSim. Phil's implementation of RL takes the approach that python should completely control FlexSim, i.e. it is responsible for spawning instances of FlexSim, running them, obtaining result data, etc. This approach uses inter-process communication to control FlexSim. On the other hand, my implementation takes the approach that FlexSim "controls" python, i.e. certain python functions and algorithms are called from within FlexSim, and make decisions that direct the simulation. In my approach, FlexSim is technically the "controlling" application, and python services requests from the controlling application. In Phil's approach, python is the "controlling" application, and FlexSim services requests from the controlling application.


In the end, either one of these approaches can be useful, depending on the modeling situation. Our task as developers is to make both approaches as intuitive and seamless as possible, and perhaps to even let users use both in conjunction.


This a really nice feature. Just tested in the newest FlexSim 22 Update 1 with a very simple model. It works pretty well. Model and Python file are attached. Put them under the same directory to test it. Great work from FlexSim!


Hi anonymous user, was Felix Mhlmann's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

3a8082e126
Reply all
Reply to author
Forward
0 new messages