From: Karan on 21 Jun 2010 13:30 Walter Roberson <roberson(a)hushmail.com> wrote in message <hvgpgi$6l3$1(a)canopus.cc.umanitoba.ca>... > Karan wrote: > > > For anyone else.... > > Following instruction will help you: > > 1) UDP Send Block > > Example: > > IP:192.168.1.102 (IP of the remote machine you want to send the data to > > - Host IP) > > Port:35353 > > Local port:4444 (It is very important to define local port, Thanks to > > Walter ...why see above posts) > > > > 2)UDP Receive Block > > IP:192.168.1.101 (IP of the machine you are going to receive data from - > > Server IP) > > Port: 4444 (Same as local port of Server....NO IDEA WHY) > > Local port: 35353 (Same as port of Server...NO IDEA WHY Again ) > > Think of it like mailing letters to each other; when you send out a letter > then you have to put the address of the other person in the destination area, > and you have to put your own address in the return address area; when the > other person gets your letter, they address their reply by reading your > address out of the return area and writing that in as the destination for the > letter, and they put in their address in the return address of the outgoing > message. > > It is true that the IP address contains some of this kind of information, but > think of an IP address as giving the address of an apartment building: you > need to know the room number as well in order to get to the right location. Hey Walter, you are amazing..... Thanks to you, I got my simulation running and I was able to send data to remote machine :). I want to try something new, I am not sure if it possible or not so before I start my research I thought I would have expert's opinion. This is what I want to do, I would like to use GUI to run simulation. GUI is on Comp1, and simulation file is on Comp2. I want to use my GUI to run simulation on Comp2 and send data back to Comp1. Is this possible? If so please guide me where to start. I have GUI and simulink file ready for the simulation. Thank you very much ! :)
From: Walter Roberson on 21 Jun 2010 16:11 Karan wrote: > This is what I want to do, I would like to use GUI to run simulation. > GUI is on Comp1, and simulation file is on Comp2. I want to use my GUI > to run simulation on Comp2 and send data back to Comp1. Is this > possible? If so please guide me where to start. > > I have GUI and simulink file ready for the simulation. Yes, there should not be any great problem with that. This will be UDP, so you cannot count on replies making it through. On the receiver, Comp2, open the UDP block and start looping. In each loop, send out a "I am here" message, wait for a bit of time, test to see if you got anything in response, and if you did not, loop back around to try again. If you did get something and it was big enough to be a full command, read the command out of the link, break it up in to arguments, and call the simulation file the appropriate arguments. When the run is finished, enter a loop. In each loop, send out the results, wait for a bit of time, test to see if you got anything in response, and if you did not, loop back and try again; if you did get an acknowledgement then you are done this cycle. If though you got another command then the implication is that your sending of the command response did not get through and you need to send it again. On the other side, Comp1, open the UDP block and start looping. In each loop, wait for a bit of time, test to see if you got anything, and if not then loop back around again; if you did get a "I am here" message, then send the command to the link. Enter a loop. In each loop, wait a bit of time, test to see if you got a response and if not then loop back again; if you did get a result response then you are done this cycle so send an acknowledgement. If, though, what you got back was instead an "I am here" message then the implication is that the command did not make it over to the other side and you need to resend the command.
From: Karan on 21 Jun 2010 18:49 Walter Roberson <roberson(a)hushmail.com> wrote in message <hvoh5n$eeg$1(a)canopus.cc.umanitoba.ca>... > Karan wrote: > > > This is what I want to do, I would like to use GUI to run simulation. > > GUI is on Comp1, and simulation file is on Comp2. I want to use my GUI > > to run simulation on Comp2 and send data back to Comp1. Is this > > possible? If so please guide me where to start. > > > > I have GUI and simulink file ready for the simulation. > > Yes, there should not be any great problem with that. > > This will be UDP, so you cannot count on replies making it through. > > On the receiver, Comp2, open the UDP block and start looping. In each loop, > send out a "I am here" message, wait for a bit of time, test to see if you got > anything in response, and if you did not, loop back around to try again. If > you did get something and it was big enough to be a full command, read the > command out of the link, break it up in to arguments, and call the simulation > file the appropriate arguments. When the run is finished, enter a loop. In > each loop, send out the results, wait for a bit of time, test to see if you > got anything in response, and if you did not, loop back and try again; if you > did get an acknowledgement then you are done this cycle. If though you got > another command then the implication is that your sending of the command > response did not get through and you need to send it again. > > On the other side, Comp1, open the UDP block and start looping. In each loop, > wait for a bit of time, test to see if you got anything, and if not then loop > back around again; if you did get a "I am here" message, then send the command > to the link. Enter a loop. In each loop, wait a bit of time, test to see if > you got a response and if not then loop back again; if you did get a result > response then you are done this cycle so send an acknowledgement. If, though, > what you got back was instead an "I am here" message then the implication is > that the command did not make it over to the other side and you need to resend > the command. Hey Thanks again. Sorry but I am could not understand correctly. And I might not have given enough information to you. Say Comp1 has a GUI in which I can enter number (constant), so if the simulink model was on local comp I would just use set_param to set parameter in simulink. But GUI is on comp1 while simulink model is on comp2. That model has a constant block in which I can set a integer. I want to set that on comp2 while I enter number on comp1. Once that is done, for now I want to add one (I can do that using simulink block) and send the result back to comp1. This is what I would like to do..... THANK YOU VERY MUCH ! ! You Rock ! :)
From: Walter Roberson on 22 Jun 2010 14:31 Karan wrote: > Say Comp1 has a GUI in which I can enter number (constant), so if the > simulink model was on local comp I would just use set_param to set > parameter in simulink. But GUI is on comp1 while simulink model is on > comp2. That model has a constant block in which I can set a integer. I > want to set that on comp2 while I enter number on comp1. Once that is > done, for now I want to add one (I can do that using simulink block) and > send the result back to comp1. My instructions remain unchanges. You send data from A to B with safeguards to ensure that B eventually receives something even if the UDP packets go missing. Eventually the parameter from A makes it to B and you read out the parameter and place the simulink call with that value. When you want to send the result back, do so, but keep a copy of the result and keep retrying in case the other end says "I haven't received anythign yet" in case the packet goes missing. UDP packets are NOT reliable transmission. Think of reduced-rate post cards that the post office is allowed to throw away if the delivery service gets busy. For that matter, think of the postal carrier throwing away post-cards if the carrier just didn't feel like delivering them, with the post office saying "Tough tootsies, you paid reduced postage for a _chance_ the card would get through and we can hold bonfires with your post-cards if we feel like it!" Thus if you want to know whether a postcards gets through, the only way is to keep sending more cards, each asking to RSVP and for the recipient to keep sending back replies; eventually _something_ will get through, seconds or hours later.
From: Hooman on 22 Jun 2010 15:06 On Jun 22, 2:31 pm, Walter Roberson <rober...(a)hushmail.com> wrote: > Karan wrote: > > Say Comp1 has a GUI in which I can enter number (constant), so if the > > simulink model was on local comp I would just use set_param to set > > parameter in simulink. But GUI is on comp1 while simulink model is on > > comp2. That model has a constant block in which I can set a integer. I > > want to set that on comp2 while I enter number on comp1. Once that is > > done, for now I want to add one (I can do that using simulink block) and > > send the result back to comp1. > > My instructions remain unchanges. You send data from A to B with safeguards to > ensure that B eventually receives something even if the UDP packets go > missing. Eventually the parameter from A makes it to B and you read out the > parameter and place the simulink call with that value. When you want to send > the result back, do so, but keep a copy of the result and keep retrying in > case the other end says "I haven't received anythign yet" in case the packet > goes missing. > > UDP packets are NOT reliable transmission. Think of reduced-rate post cards > that the post office is allowed to throw away if the delivery service gets > busy. For that matter, think of the postal carrier throwing away post-cards if > the carrier just didn't feel like delivering them, with the post office saying > "Tough tootsies, you paid reduced postage for a _chance_ the card would get > through and we can hold bonfires with your post-cards if we feel like it!" > > Thus if you want to know whether a postcards gets through, the only way is to > keep sending more cards, each asking to RSVP and for the recipient to keep > sending back replies; eventually _something_ will get through, seconds or > hours later. Hello Karan and Walter, This is something that I am very much interested in. I haven't started to play with this idea, but it has been on my mind for a long time. Since my knowledge of UDP and TCP/IP is next to none, it would be very helpful if one you guys can post a simple example to the list or directly to me. I am interested in doing something like Karan explained; two computers, one has a GUI to change the parameters and such, the other one where MATLAB/Simulink resides and the simulation will happen. Would it be possible for the Simulink model to send data back to a GUI plot element? And if yes, will this happen while the simulation is running or one has to wait until simulation is completed? Thanks, Hooman
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: Ga optimization code needs to correct Next: export figure to PDF/EPS messes colors |