Lisa
unread,Dec 31, 2011, 11:33:08 PM12/31/11You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
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