Thread Subject: Data exchange between Simulink model and JADE agents

Subject: Data exchange between Simulink model and JADE agents

From: Lisa

Date: 1 Jan, 2012 04:33:08

Message: 1 of 2

While I was surfing the web on communicating between Simulink model and JADE agents, I came across few postings but did not find any solution. I would like to request you to share with me a sample code to achieve this. Please note that JADE platform and SIMULINK model are on the same machine. My requirement is:

I want to send some i/p data from the simulink block that I have designed to a JADE agent. This JADE agent should take this data and append it with some other text and send it back to simulink.

E.g: Simulink will send the i/p as 100 KW to the Agent.
The Agent should receive this data and append a string "Power," and the resultant output to be returned to Matlab model: "100 KW Power."

**********************Sample code of my Agent*****************************************
package examples.MAS;

import jade.core.Agent;
import jade.core.behaviours.CyclicBehaviour;
import jade.core.messaging.MessagingHelper;
import jade.core.messaging.MessagingService;
import jade.lang.acl.ACLMessage;

public class MASAgent extends Agent {

  protected void setup() {
   System.out.println("Hello World! My name is "+getLocalName());
   //I would like to know how to receive simulink i/p data and create a message with my o/p to be sent back to the simulink block
addBehaviour(new CyclicBehaviour() {
public void action() {
ACLMessage msg = myAgent.receive();
if (msg != null) {
System.out.println("Received message from agent "+msg.getSender().getLocalName()+". Reply...");
ACLMessage reply = msg.createReply();
reply.setPerformative(ACLMessage.NOT_UNDERSTOOD);
myAgent.send(reply);
}
else {
block();
}
}
});
   // Make this agent terminate
// doDelete();
  }
}


Thanks,
Lisa

Subject: Data exchange between Simulink model and JADE agents

From: Alexander Prostejovsky

Date: 20 Jan, 2012 18:00:09

Message: 2 of 2

Hi Lisa,

have a look at those papers for possible approaches to your problem:
http://rua.ua.es/dspace/bitstream/10045/16638/1/JoPha_4_3_01.pdf
http://www.softwareresearch.net/fileadmin/src/docs/publications/C102.pdf

As we're apperantly working in the same field (MAS in electric distribution grids in my case) I'd be happy if you keep me informed on your findings!

Best regards,
Alex


"Lisa " <lisaway13@yahoo.com> wrote in message <jdonm4$b7h$1@newscl01ah.mathworks.com>...
> While I was surfing the web on communicating between Simulink model and JADE agents, I came across few postings but did not find any solution. I would like to request you to share with me a sample code to achieve this. Please note that JADE platform and SIMULINK model are on the same machine. My requirement is:
>
> I want to send some i/p data from the simulink block that I have designed to a JADE agent. This JADE agent should take this data and append it with some other text and send it back to simulink.
>
> E.g: Simulink will send the i/p as 100 KW to the Agent.
> The Agent should receive this data and append a string "Power," and the resultant output to be returned to Matlab model: "100 KW Power."
>
> **********************Sample code of my Agent*****************************************
> package examples.MAS;
>
> import jade.core.Agent;
> import jade.core.behaviours.CyclicBehaviour;
> import jade.core.messaging.MessagingHelper;
> import jade.core.messaging.MessagingService;
> import jade.lang.acl.ACLMessage;
>
> public class MASAgent extends Agent {
>
> protected void setup() {
> System.out.println("Hello World! My name is "+getLocalName());
> //I would like to know how to receive simulink i/p data and create a message with my o/p to be sent back to the simulink block
> addBehaviour(new CyclicBehaviour() {
> public void action() {
> ACLMessage msg = myAgent.receive();
> if (msg != null) {
> System.out.println("Received message from agent "+msg.getSender().getLocalName()+". Reply...");
> ACLMessage reply = msg.createReply();
> reply.setPerformative(ACLMessage.NOT_UNDERSTOOD);
> myAgent.send(reply);
> }
> else {
> block();
> }
> }
> });
> // Make this agent terminate
> // doDelete();
> }
> }
>
>
> Thanks,
> Lisa

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
simulink Lisa 31 Dec, 2011 23:34:13
jade Lisa 31 Dec, 2011 23:34:13
java Lisa 31 Dec, 2011 23:34:13
rssFeed for this Thread

Contact us at files@mathworks.com