Process flow to create dynamic speed regulation

Process flow to create dynamic speed regulation

Piercasa
Not applicable
284 Views
10 Replies
Message 1 of 11

Process flow to create dynamic speed regulation

Piercasa
Not applicable

[ FlexSim 24.2.1 ]

Hi, I need a huge help in creating a process flow which replicate this problem and your help will be super appreciated.

I have made several attempt so far, but none of them has worked properly. I have to replicate a system in which the cobot speed will be dynamically adapted based on the interarrival time and I have to translate it even in the real world through Modbus connection.

In particular, after the token has been created, I should impose a condition based on the interarrival time to set its movetime.

In particular at the moment, in the model I have set this condition, but I don't know how to replicate it in the process flow.

if (interArrivalTime>=45){

current.centerObjects[1].setProperty("MoveTime",30);

}

if (30<=interArrivalTime<45){

current.centerObjects[1].setProperty("MoveTime",20);

}

if (interArrivalTime<30){

current.centerObjects[1].setProperty("MoveTime",10);

}

Attached you can find the model so far.

PC_1610.fsm

Your help is fundamental to me.

Thank you in advance.

0 Likes
Accepted solutions (1)
285 Views
10 Replies
Replies (10)
Message 2 of 11

moehlmann_fe
Advocate
Advocate
Accepted solution

You could have an Event-Triggered Source react to the "Inter Arrival Time" event of the source. Since that event will update the robots move time, you can read the property at this point and set a Process Flow variable accordingly.

pc-1610_1.fsm

The action settings in your "Cycle 1" and "Cycle 2" variables don't make much sense. Stopping/resuming the input/output of the robots doesn't have any effect. They just react to tasks received from the queues. You'd need to either stop the robot (object.stop()) or close/open/stop/resume the ports of the queues to control the item flow.

0 Likes
Message 3 of 11

Piercasa
Not applicable

Yes, I got your point and the part about cycle 1 and 2 is there just because I took inspiration from another model, but at this point I'm sure it is wrong.

I saw your proposal and I want to make few questions about.

1) Is something missing or need to be implemented further or you think is complete?

2) In this case, the process flow token will have the same characteristics (as interarrival time and movetime as in the 3D model)?

3)How can I implement the connection to ModBus and in which moment?

4) Is not necessary to have a decide after the interarrival time has been gathered?

I make you this question since I was thinking to an implementation of this type: event triggered source --> then I need a way to assign a label to the interarrival time of the 3D model (can you explain me how to assign a label to the token which correspond exactly to the interarrival time of the correspondant item?)--> then two series of decide to choose which path the token will take (based on the interarrival time threshold)--> then I would need to place the connection to ModBus--> and then all the remaining part.

Can you please help me in solving it completely or almost? I need it too much!

Thank you and sorry for all the question I made.

0 Likes
Message 4 of 11

moehlmann_fe
Advocate
Advocate

What I demonstrated is a way to keep a Process Flow variable updated with the 'correct' move time depending on the interarrival times generated in the sources, since that seemed to be your main question.

If those variables are set up as Modbus sensor variables, then any change will get send to the server and all clients have access to the uptodate value. I don't see why a Decide would be necessary.

Since I don't have access to hardware you are supposed to use I can hardly help you set up the specifics you need in order to communicate with the robot. I have created a simple example model though (well, technically two). If you run them both in parallel on the same PC one model will act as the server and one as the client.

The server model writes the content of a queue to a holding register. The client model regularly polls this register for changes. It creates and deletes items in a queue to mimic the content in the server model.

I hope this helps you understand how a modbus connection with FlexSim can work.

modbus-example-server-model.fsm

modbus-example-client-model.fsm

0 Likes
Message 5 of 11

Piercasa
Not applicable

Thank you Felix, very helpful. But do you think it is not necessary to add the connection to ModBus as it was present in my first model? (The connection used in the first model is actually correct, like the IP address and the port as well btw)

And how is it possible to send the changing value to the real cobot?

0 Likes
Message 6 of 11

moehlmann_fe
Advocate
Advocate

The example models are meant to run on the same PC, hence the IP address "localhost" is used (which then gets translated to 127.0.0.1 or something).

The real robot would just be another modbus client, polling the server for values and acting according to them. As I said, I can't help with setting up specific hardware.

As a first step maybe try to download a modbus simulator programme and try to communicate with the robot through that. Once that works you can make the next step and connect to FlexSim.

(Just one of the first results of a google search)

https://www.reddit.com/r/PLC/comments/hq7m7f/free_modbus_simulator_programmes/

0 Likes
Message 7 of 11

Piercasa
Not applicable

Okay, thank you, last questions. Can you help me set a label in each source which take track of the interarrival time in the 3D model? Thank you very much


0 Likes
Message 8 of 11

moehlmann_fe
Advocate
Advocate

You mean you want to write the current interarrival time to a label on the source? That would just be the following line added to the arrival time code.

1729168422024.png

0 Likes
Message 9 of 11

Piercasa
Not applicable
Hi Felix,

I have tested your process flow and it prints only 10 and 20 as value of movetime of the two cobots. It means there is an error in the declaration of the condition I have set in the 3 model sources. Can you help me please?


Thank you

0 Likes
Message 10 of 11

moehlmann_fe
Advocate
Advocate
Oh, sorry, totally missed that. You're second if-condition is 'wrong' in the sense that it doesn't do what you intended.

If you chain multiple comparators like that they are evaluated from left to right. Your expression is actually ((30 <= time) < 45).

(30 <= time) is either false (0) or true (1) both of which are smaller than 45, so the whole condition is always true.

You need to use two separate comparisons linked by and 'AND' operator (30 <= time && time < 45).

0 Likes
Message 11 of 11

logan_gold
Community Manager
Community Manager

Hi @Pierpaolo, was Felix Möhlmann's answers helpful? If so, please click the "Accept" button at the bottom of the answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes