Пример #1
0
 public override ValueSpecification clone()
 {
     LiteralString vs = new LiteralString("");
     vs.CLASSTYPE = CLASSTYPE;
     vs.Type = this.Type;
     vs.sValue = sValue;
     return ((ValueSpecification)vs); ;
 }
Пример #2
0
        public override ValueSpecification clone()
        {
            LiteralString vs = new LiteralString("");

            vs.CLASSTYPE = CLASSTYPE;
            vs.Type      = this.Type;
            vs.sValue    = sValue;
            return((ValueSpecification)vs);;
        }
Пример #3
0
        public override ValueSpecification createValueFromString(string str)
        {
            ValueSpecification valueSpec = null;

            if (type == "real" || type == "double")
            {
                valueSpec = new LiteralReal(str);
            }
            else if (type == "integer")
            {
                valueSpec = new LiteralInteger(str);
            }
            else if (type == "string")
            {
                valueSpec = new LiteralString(str);
            }
            else if (type == "boolean")
            {
                valueSpec = new LiteralBoolean(str);
            }

            /*else if (type =="color")
             *  valueSpec = new Color(str);
             * else if (type =="Vector3")
             *  valueSpec = new Vector3(str);*/
            else if (type == "rotation")
            {
                valueSpec = new RotationVector(str);
            }
            else if (type == "shape")
            {
                //valueSpec = (UnityShapeSpecification)ScriptableObject.CreateInstance("UnityShapeSpecification");
                //((UnityShapeSpecification)valueSpec).instantiate(str);
            }
            else if (type == "point")
            {
                //valueSpec = (UnityPointSpecification)ScriptableObject.CreateInstance("UnityPointSpecification");
                //((UnityPointSpecification)valueSpec).instantiate(str);
            }

            /*else if (type =="path")
             *  valueSpec = new PathSpecification(str);
             * else if (type =="sound")
             *  valueSpec = new UnitySoundSpecification(str);
             * else if (type =="animation")
             *  valueSpec = new UnityAnimationSpecification(str);*/
            else
            {
                Console.WriteLine("Default : value is string");
                valueSpec = new LiteralString(str);
            }
            return(valueSpec);
        }
Пример #4
0
 public override ValueSpecification createValueFromString(string str)
 {
     ValueSpecification valueSpec = null;
     if (type == "real" || type == "double" || type == "float")
     {
         valueSpec = new LiteralReal(str);
     }
     else if (type == "integer")
     {
         valueSpec = new LiteralInteger(str);
     }
     else if (type == "string")
     {
         valueSpec = new LiteralString(str);
     }
     else if (type == "boolean")
     {
         valueSpec = new LiteralBoolean(str);
     }
     /*else if (type =="color")
         valueSpec = new Color(str);
     else if (type =="Vector3")
         valueSpec = new Vector3(str);*/
     else if (type == "rotation")
     {
         valueSpec = new RotationVector(str);
     }
     else if (type == "shape")
     {
         //valueSpec = (UnityShapeSpecification)ScriptableObject.CreateInstance("UnityShapeSpecification");
         //((UnityShapeSpecification)valueSpec).instantiate(str);
     }
     else if (type == "point")
     {
         //valueSpec = (UnityPointSpecification)ScriptableObject.CreateInstance("UnityPointSpecification");
         //((UnityPointSpecification)valueSpec).instantiate(str);
     }
     /*else if (type =="path")
         valueSpec = new PathSpecification(str);
     else if (type =="sound")
         valueSpec = new UnitySoundSpecification(str);
     else if (type =="animation")
         valueSpec = new UnityAnimationSpecification(str);*/
     else
     {
         Console.WriteLine("Default : value is string");
         valueSpec = new LiteralString(str);
     }
     return valueSpec;
 }
Пример #5
0
        public override ValueSpecification createValueFromString(string str)
        {
            string type = unit.Classifier.name;
            ValueSpecification valueSpec = null;
            if (type == "real" || type == "double")
            {
                valueSpec = new LiteralReal(str);
            }
            else if (type == "integer")
            {
                valueSpec = new LiteralInteger(str);
            }
            else if (type == "string")
            {
                valueSpec = new LiteralString(str);
            }
            else if (type == "boolean")
            {
                valueSpec = new LiteralBoolean(str);
            }

            return valueSpec;
        }
Пример #6
0
        public override ValueSpecification createValueFromString(string str)
        {
            string             type      = unit.Classifier.name;
            ValueSpecification valueSpec = null;

            if (type == "real" || type == "double")
            {
                valueSpec = new LiteralReal(str);
            }
            else if (type == "integer")
            {
                valueSpec = new LiteralInteger(str);
            }
            else if (type == "string")
            {
                valueSpec = new LiteralString(str);
            }
            else if (type == "boolean")
            {
                valueSpec = new LiteralBoolean(str);
            }

            return(valueSpec);
        }
        protected void manageRequestAction(ACLMessage msg)
        {
            Agent agt = (Agent)(this.Host);

            string content = msg.Content;

            FIPASLParserResult result = parseFipaSLExpression(content);

            if (result.success)
            {
            if (result.isAction)
            {
                bool done = false;

                AgentBehavior behavior = agt.getBehaviorByBame(result.action.actionName);

                if (behavior != null)
                {
                    Dictionary<string, ValueSpecification> parameters = new Dictionary<string, ValueSpecification>();

                    if (result.action.paramName.Count > 0)
                    {
                        for (int i = 0; i < result.action.paramName.Count; i++)
                        {
                            LiteralString stringValue = new LiteralString(result.action.paramValue[i]);
                            parameters.Add(result.action.paramName[i], (ValueSpecification)(stringValue));
                        }
                    }
                    else
                    {
                        for (int i = 0; i < result.action.paramName.Count; i++)
                        {
                            LiteralString stringValue = new LiteralString(result.action.paramValue[i]);
                            parameters.Add("param" + i + '0', (ValueSpecification)(stringValue));
                        }
                    }

                    BehaviorScheduler.Instance.executeBehavior(behavior, agt, parameters, false);
                    ACLMessage reponse = new ACLMessage(ACLPerformative.AGREE);
                    reponse.Content = msg.Content;
                    reponse.Receivers.Add(msg.Sender);
                    agt.send(reponse);
                    done = true;
                }

                Class classifier = agt.Classifier;
                Operation operation = null;
                if (classifier != null && classifier.Operations.ContainsKey(result.action.actionName))
                {
                    operation = classifier.Operations[result.action.actionName];
                    //System.Console.WriteLine("Operation:" + operation.getFullName());
                }
                if (operation != null)
                {
                    Dictionary<string, ValueSpecification> param = new Dictionary<string, ValueSpecification>();
                    List<Parameter> parameters = operation.Parameters;
                    List<string> paramValue = result.action.paramValue;
                    List<string> paramName = result.action.paramName;

                    if (parameters.Count == paramValue.Count)
                    {

                        for (int i = 0; i < parameters.Count; i++)
                        {
                            // Pour tous les parametres issus de l'operation
                            string parameterName = parameters[i].name;

                            // Cherche l'indice de ce parameter dans paramsName
                            int indice = 0; bool found = false;
                            while (!found && indice < paramName.Count)
                            {
                                if (paramName[indice] == parameterName)
                                {
                                    found = true;
                                }
                                else
                                {
                                    indice++;
                                }
                            }

                            if (found)
                            {
                                string strVal = paramValue[indice];

                                System.Console.Write("Type : " + parameters[i].Type.getFullName());
                                System.Console.Write(" - Name: " + parameters[i].name);
                                System.Console.WriteLine(" - Value: " + strVal);

                                string typeName = parameters[i].Type.getFullName();
                                if (typeName == "boolean" || typeName == "integer" || typeName == "real" || typeName == "string")
                                    param.Add(parameters[i].name, parameters[i].Type.createValueFromString(strVal.ToLower()));
                                else
                                {
                                    try
                                    {
                                        InstanceSpecification inst = MascaretApplication.Instance.getEnvironment().getInstance(strVal.ToLower());
                                        param.Add(parameters[i].name, new InstanceValue(inst));
                                    }
                                    catch (NullReferenceException)
                                    {

                                    }

                                }

                            }
                        }

                        //BehaviorScheduler.Instance.executeBehavior(operation.Method, agt, param, false);
                        /*
                            List<ActionNode> possibleTranslation = _translateOperationToActions(operation);

                            shared_ptr<AgentBehaviorExecution> abe = agt->getBehaviorExecutionByName("ProceduralBehavior"); //hasslich... ja...
                            shared_ptr<ProceduralBehavior> pbe  = shared_dynamic_cast<ProceduralBehavior> (abe);

                            if (possibleTranslation.size() && pbe)
                            {
                                //add actionNode in ProceduralBehavior

                                pbe->pushActionToDo(possibleTranslation[0]);
                            }
                            else
                            {
                                //call method
                        */
                                BehaviorExecution be = BehaviorScheduler.Instance.executeBehavior(operation.Method, agt, param, false);
                /*
                                if (be != null)
                                {
                                    be.addCallbackOnBehaviorStop(bind(&SimpleCommunicationBehavior::_onBehaviorStop,this,_1));

                                    _requestedAction[be->getSpecification()->getName()].push_back(msg->getSender());
                                }*/
                           // }

                        ACLMessage reponse = new ACLMessage(ACLPerformative.AGREE);
                        reponse.Content = msg.Content;

                        System.Console.WriteLine("Content-Sent: " + reponse.Content);
                        reponse.Receivers.Add(msg.Sender);
                        agt.send(reponse);
                    }
                    else
                    {
                        ACLMessage reponse = new ACLMessage(ACLPerformative.NOT_UNDERSTOOD);
                        string contentRep = "";
                        contentRep += content;
                        reponse.Content = contentRep;
                        reponse.Receivers.Add(msg.Sender);
                        agt.send(reponse);
                    }
                }
                else
                {
                    string procName = result.action.actionName;
                    bool found = false;
                    OrganisationalEntity askedOrg = null;
                    Procedure askedProc = null;
                    Role askedRole = null;
                    List<OrganisationalEntity> orgs = agt.Plateform.Organisations;

                    for (int iOrg = 0; iOrg < orgs.Count; iOrg++)
                    {
                        List<RoleAssignement> assigns = orgs[iOrg].RoleAssignement;

                        for (int iAss = 0; iAss < assigns.Count; iAss++)
                        {
                            if (assigns[iAss].Agent.toString() == agt.Aid.toString())
                            {
                                OrganisationalStructure os = orgs[iOrg].Structure;
                                List<Procedure> procs = os.Procedures;

                                for (int iP = 0; iP < procs.Count; iP++)
                                {
                                    System.Console.WriteLine(procName + " / " + procs[iP].name);
                                    if (procs[iP].name == procName)
                                    {
                                        askedProc = procs[iP];
                                        askedOrg = orgs[iOrg];
                                        askedRole = assigns[iAss].Role;
                                        found = true;
                                    }
                                }
                            }
                        }
                    }

                    if (found)
                    {
                        ACLMessage reponse = new ACLMessage(ACLPerformative.AGREE);
                        reponse.Content = msg.Content;
                        reponse.Receivers.Add(msg.Sender);
                        agt.send(reponse);

                        // Recherche du comportement procedural
                        // UGGLY
                        //System.Console.WriteLine("1");
                        AgentBehaviorExecution pbehavior = agt.getBehaviorExecutingByName("ProceduralBehavior");

                        //AgentBehaviorExecution> behavior2 = agt->getBehaviorExecutionByName("ActionListenerBehavior");
                        //System.Console.WriteLine("2");
                        if (pbehavior != null)
                        {
                            ProceduralBehavior procBehave = (ProceduralBehavior)(pbehavior);

                            Dictionary<string, ValueSpecification> procParams = new Dictionary<string, ValueSpecification>();
                            for (int i = 0; i < result.action.paramName.Count; i++)
                            {
                                LiteralString stringValue = new LiteralString(result.action.paramValue[i]);
                                procParams.Add(result.action.paramName[i], stringValue);
                            }

                            //System.Console.WriteLine("3");
                            Activity act = askedProc.Activity;
                            //List<ActivityNode>  nodes  = act.Nodes;

                            procBehave.pushProcedureToDo(askedProc, askedOrg, askedRole, procParams);
                            //procBehave.restart();

                            ACLMessage reponse2 = new ACLMessage(ACLPerformative.AGREE);
                            reponse2.Content = msg.Content;
                            reponse2.Receivers.Add(msg.Sender);
                            agt.send(reponse2);
                        }
                        /*
                        else if (behavior2)
                        {
                            shared_ptr<ActionListenerBehavior> procBehave  = shared_dynamic_cast<ActionListenerBehavior> (behavior2);

                            procBehave->pushProcedureToDo(askedProc, askedOrg, askedRole, Parameters());
                            procBehave->restart();

                            shared_ptr<ACLMessage> reponse = make_shared<ACLMessage>(AGREE);
                            reponse->setContent(msg->getContent());
                            reponse->addReceiver(msg->getSender());
                            agt->send(reponse);
                        }*/
                        else
                        {
                            if (!done)
                            {
                                ACLMessage reponse3 = new ACLMessage(ACLPerformative.NOT_UNDERSTOOD);
                                string contentRep = "";
                                contentRep += result.action.actionName;
                                reponse3.Content = contentRep;
                                reponse3.Receivers.Add(msg.Sender);
                                agt.send(reponse3);
                            }
                        }
                    }
                    else
                    {
                        if (!done)
                        {
                            ACLMessage reponse = new ACLMessage(ACLPerformative.NOT_UNDERSTOOD);
                            string contentRep = "";
                            contentRep += result.action.actionName;
                            reponse.Content = contentRep;
                            reponse.Receivers.Add(msg.Sender);
                            agt.send(reponse);
                        }
                    }
                }
            }
            else
            {
                // Proposition Non encore traite....
            }
            }
            else
            {
            System.Console.WriteLine("[SimpleCommunicationBehavior Warning] Parsing error. Message content parsing error: " + content);

            ACLMessage reponse = new ACLMessage(ACLPerformative.NOT_UNDERSTOOD);
            string contentRep = "";
            contentRep += content;

            reponse.Content = contentRep;
            reponse.Receivers.Add(msg.Sender);
            agt.send(reponse);
            }
        }
        protected void manageRequestAction(ACLMessage msg)
        {
            Agent agt = (Agent)(this.Host);

            string content = msg.Content;

            FIPASLParserResult result = parseFipaSLExpression(content);

            if (result.success)
            {
                if (result.isAction)
                {
                    bool done = false;

                    AgentBehavior behavior = agt.getBehaviorByBame(result.action.actionName);

                    if (behavior != null)
                    {
                        Dictionary <string, ValueSpecification> parameters = new Dictionary <string, ValueSpecification>();

                        if (result.action.paramName.Count > 0)
                        {
                            for (int i = 0; i < result.action.paramName.Count; i++)
                            {
                                LiteralString stringValue = new LiteralString(result.action.paramValue[i]);
                                parameters.Add(result.action.paramName[i], (ValueSpecification)(stringValue));
                            }
                        }
                        else
                        {
                            for (int i = 0; i < result.action.paramName.Count; i++)
                            {
                                LiteralString stringValue = new LiteralString(result.action.paramValue[i]);
                                parameters.Add("param" + i + '0', (ValueSpecification)(stringValue));
                            }
                        }

                        BehaviorScheduler.Instance.executeBehavior(behavior, agt, parameters, false);
                        ACLMessage reponse = new ACLMessage(ACLPerformative.AGREE);
                        reponse.Content = msg.Content;
                        reponse.Receivers.Add(msg.Sender);
                        agt.send(reponse);
                        done = true;
                    }

                    Class     classifier = agt.Classifier;
                    Operation operation  = null;
                    if (classifier != null && classifier.Operations.ContainsKey(result.action.actionName))
                    {
                        operation = classifier.Operations[result.action.actionName];
                        //System.Console.WriteLine("Operation:" + operation.getFullName());
                    }
                    if (operation != null)
                    {
                        Dictionary <string, ValueSpecification> param = new Dictionary <string, ValueSpecification>();
                        List <Parameter> parameters = operation.Parameters;
                        List <string>    paramValue = result.action.paramValue;
                        List <string>    paramName  = result.action.paramName;

                        if (parameters.Count == paramValue.Count)
                        {
                            for (int i = 0; i < parameters.Count; i++)
                            {
                                // Pour tous les parametres issus de l'operation
                                string parameterName = parameters[i].name;

                                // Cherche l'indice de ce parameter dans paramsName
                                int indice = 0; bool found = false;
                                while (!found && indice < paramName.Count)
                                {
                                    if (paramName[indice] == parameterName)
                                    {
                                        found = true;
                                    }
                                    else
                                    {
                                        indice++;
                                    }
                                }

                                if (found)
                                {
                                    string strVal = paramValue[indice];

                                    System.Console.Write("Type : " + parameters[i].Type.getFullName());
                                    System.Console.Write(" - Name: " + parameters[i].name);
                                    System.Console.WriteLine(" - Value: " + strVal);

                                    string typeName = parameters[i].Type.getFullName();
                                    if (typeName == "boolean" || typeName == "integer" || typeName == "real" || typeName == "string")
                                    {
                                        param.Add(parameters[i].name, parameters[i].Type.createValueFromString(strVal.ToLower()));
                                    }
                                    else
                                    {
                                        try
                                        {
                                            InstanceSpecification inst = MascaretApplication.Instance.getEnvironment().getInstance(strVal.ToLower());
                                            param.Add(parameters[i].name, new InstanceValue(inst));
                                        }
                                        catch (NullReferenceException e)
                                        {
                                        }
                                    }
                                }
                            }

                            //BehaviorScheduler.Instance.executeBehavior(operation.Method, agt, param, false);

                            /*
                             *  List<ActionNode> possibleTranslation = _translateOperationToActions(operation);
                             *
                             *  shared_ptr<AgentBehaviorExecution> abe = agt->getBehaviorExecutionByName("ProceduralBehavior"); //hasslich... ja...
                             *  shared_ptr<ProceduralBehavior> pbe  = shared_dynamic_cast<ProceduralBehavior> (abe);
                             *
                             *  if (possibleTranslation.size() && pbe)
                             *  {
                             *      //add actionNode in ProceduralBehavior
                             *
                             *      pbe->pushActionToDo(possibleTranslation[0]);
                             *  }
                             *  else
                             *  {
                             *      //call method
                             */
                            BehaviorExecution be = BehaviorScheduler.Instance.executeBehavior(operation.Method, agt, param, false);

                            /*
                             * if (be != null)
                             * {
                             *  be.addCallbackOnBehaviorStop(bind(&SimpleCommunicationBehavior::_onBehaviorStop,this,_1));
                             *
                             *  _requestedAction[be->getSpecification()->getName()].push_back(msg->getSender());
                             * }*/
                            // }



                            ACLMessage reponse = new ACLMessage(ACLPerformative.AGREE);
                            reponse.Content = msg.Content;

                            System.Console.WriteLine("Content-Sent: " + reponse.Content);
                            reponse.Receivers.Add(msg.Sender);
                            agt.send(reponse);
                        }
                        else
                        {
                            ACLMessage reponse    = new ACLMessage(ACLPerformative.NOT_UNDERSTOOD);
                            string     contentRep = "";
                            contentRep     += content;
                            reponse.Content = contentRep;
                            reponse.Receivers.Add(msg.Sender);
                            agt.send(reponse);
                        }
                    }
                    else
                    {
                        string procName = result.action.actionName;
                        bool   found    = false;
                        OrganisationalEntity askedOrg  = null;
                        Procedure            askedProc = null;
                        Role askedRole = null;
                        List <OrganisationalEntity> orgs = agt.Plateform.Organisations;

                        for (int iOrg = 0; iOrg < orgs.Count; iOrg++)
                        {
                            List <RoleAssignement> assigns = orgs[iOrg].RoleAssignement;

                            for (int iAss = 0; iAss < assigns.Count; iAss++)
                            {
                                if (assigns[iAss].Agent.toString() == agt.Aid.toString())
                                {
                                    OrganisationalStructure os    = orgs[iOrg].Structure;
                                    List <Procedure>        procs = os.Procedures;

                                    for (int iP = 0; iP < procs.Count; iP++)
                                    {
                                        System.Console.WriteLine(procName + " / " + procs[iP].name);
                                        if (procs[iP].name == procName)
                                        {
                                            askedProc = procs[iP];
                                            askedOrg  = orgs[iOrg];
                                            askedRole = assigns[iAss].Role;
                                            found     = true;
                                        }
                                    }
                                }
                            }
                        }

                        if (found)
                        {
                            ACLMessage reponse = new ACLMessage(ACLPerformative.AGREE);
                            reponse.Content = msg.Content;
                            reponse.Receivers.Add(msg.Sender);
                            agt.send(reponse);

                            // Recherche du comportement procedural
                            // UGGLY
                            //System.Console.WriteLine("1");
                            AgentBehaviorExecution pbehavior = agt.getBehaviorExecutingByName("ProceduralBehavior");

                            //AgentBehaviorExecution> behavior2 = agt->getBehaviorExecutionByName("ActionListenerBehavior");
                            //System.Console.WriteLine("2");
                            if (pbehavior != null)
                            {
                                ProceduralBehavior procBehave = (ProceduralBehavior)(pbehavior);

                                Dictionary <string, ValueSpecification> procParams = new Dictionary <string, ValueSpecification>();
                                for (int i = 0; i < result.action.paramName.Count; i++)
                                {
                                    LiteralString stringValue = new LiteralString(result.action.paramValue[i]);
                                    procParams.Add(result.action.paramName[i], stringValue);
                                }

                                //System.Console.WriteLine("3");
                                Activity act = askedProc.Activity;
                                //List<ActivityNode>  nodes  = act.Nodes;

                                procBehave.pushProcedureToDo(askedProc, askedOrg, askedRole, procParams);
                                //procBehave.restart();

                                ACLMessage reponse2 = new ACLMessage(ACLPerformative.AGREE);
                                reponse2.Content = msg.Content;
                                reponse2.Receivers.Add(msg.Sender);
                                agt.send(reponse2);
                            }

                            /*
                             * else if (behavior2)
                             * {
                             *  shared_ptr<ActionListenerBehavior> procBehave  = shared_dynamic_cast<ActionListenerBehavior> (behavior2);
                             *
                             *  procBehave->pushProcedureToDo(askedProc, askedOrg, askedRole, Parameters());
                             *  procBehave->restart();
                             *
                             *  shared_ptr<ACLMessage> reponse = make_shared<ACLMessage>(AGREE);
                             *  reponse->setContent(msg->getContent());
                             *  reponse->addReceiver(msg->getSender());
                             *  agt->send(reponse);
                             * }*/
                            else
                            {
                                if (!done)
                                {
                                    ACLMessage reponse3   = new ACLMessage(ACLPerformative.NOT_UNDERSTOOD);
                                    string     contentRep = "";
                                    contentRep      += result.action.actionName;
                                    reponse3.Content = contentRep;
                                    reponse3.Receivers.Add(msg.Sender);
                                    agt.send(reponse3);
                                }
                            }
                        }
                        else
                        {
                            if (!done)
                            {
                                ACLMessage reponse    = new ACLMessage(ACLPerformative.NOT_UNDERSTOOD);
                                string     contentRep = "";
                                contentRep     += result.action.actionName;
                                reponse.Content = contentRep;
                                reponse.Receivers.Add(msg.Sender);
                                agt.send(reponse);
                            }
                        }
                    }
                }
                else
                {
                    // Proposition Non encore traite....
                }
            }
            else
            {
                System.Console.WriteLine("[SimpleCommunicationBehavior Warning] Parsing error. Message content parsing error: " + content);

                ACLMessage reponse    = new ACLMessage(ACLPerformative.NOT_UNDERSTOOD);
                string     contentRep = "";
                contentRep += content;

                reponse.Content = contentRep;
                reponse.Receivers.Add(msg.Sender);
                agt.send(reponse);
            }
        }
        public override double execute(double dt)
        {
            MascaretApplication appli = MascaretApplication.Instance;

            //bool found = false;
            OrganisationalEntity askedOrg = null;
            Procedure askedProc = null;
            Role askedRole = null;

            List<OrganisationalEntity> orgs = appli.AgentPlateform.Organisations;

            appli.VRComponentFactory.Log("CallGlobalActivity");

            for (int iOrg = 0; iOrg < orgs.Count; iOrg++)
            {
                appli.VRComponentFactory.Log(" Org " + orgs[iOrg].name + " ?");
                if (orgs[iOrg].name == action.OrganisationalEntity)
                {
                    appli.VRComponentFactory.Log("Org : " + orgs[iOrg].name + " found");

                    OrganisationalStructure os = orgs[iOrg].Structure;
                    List<Procedure> procs = os.Procedures;
                    askedOrg = orgs[iOrg];

                    for (int iP = 0; iP < procs.Count; iP++)
                    {
                        if (procs[iP].name == action.Procedure)
                        {
                            appli.VRComponentFactory.Log("Procedure " + procs[iP].name + " found");
                            askedProc = procs[iP];
                            //  appli.AgentPlateform.Agents
                            //  Agent agt = appli.AgentPlateform.Agents[assigns[iAss].Agent.toString()];
                            foreach (KeyValuePair<string, Agent> nameAgentDict in appli.AgentPlateform.Agents)
                            {

                                Agent agt = nameAgentDict.Value;
                                VirtualHuman vh = null;
                                string type = agt.GetType().ToString();
                                appli.VRComponentFactory.Log(agt.name + " ---Type :  "+ type);
                                if(type.Contains("VirtualHuman"))
                                {
                                    appli.VRComponentFactory.Log(agt.name + " ---------CallGlobalBehaviourExecution");

                                    AgentBehaviorExecution pbehavior = agt.getBehaviorExecutingByName("ProceduralBehavior");

                                    if (pbehavior != null)
                                    {
                                        appli.VRComponentFactory.Log("Procedure launched for " + agt.name);
                                        scenarioActivity = new GlobalActivity(askedProc.Activity.name);
                                        scenarioActivity.globalActivity = askedProc.Activity;

                                        Dictionary<string, ValueSpecification> param = new Dictionary<string, ValueSpecification>();

                                        LiteralString orgEntity = new LiteralString ((action.OrganisationalEntity));
                                        param.Add("orgEntity", (ValueSpecification)(orgEntity));
                                        LiteralString orgStructure = new LiteralString (os.name);
                                        param.Add("orgStructure", (ValueSpecification)(orgStructure));

                                        //geb = scenarioActivity.createBehaviorExecution(agt,param,false);
                                        appli.VRComponentFactory.Log("===================================================Behaviour scedular launched for " + agt.name);
                                        BehaviorScheduler.Instance.executeBehavior(scenarioActivity, agt, param, false);

                                    }
                                }

                            }
                        }
                    }
                }
            }
            return 0;
        }