smia.agents.smia_agent module¶
- class smia.agents.smia_agent.SMIAAgent(jid: str | None = None, password: str | None = None, verify_security: bool = False)[source]¶
Bases:
AgentThis is the top level in the hierarchy of SPADE Agents. It extends the own class Agent of SPADE. The SMIA Agent will be the generic and from which all other types of SMIAs will start.
- acl_svc_requests = {}¶
Dictionary to save FIPA-ACL service requests
- acl_svc_responses = {}¶
Dictionary to save FIPA-ACL service responses
- interaction_id_num = 0¶
Identifier for Intra AAS interaction, created by the SMIA
- interaction_requests = {}¶
Dictionary to save Intra AAS interaction requests
- interaction_responses = {}¶
Dictionary to save Intra AAS interaction responses
- negotiations_data = {}¶
Dictionary to save negotiations related information
- aas_model = None¶
Object with the extended AAS model
- css_ontology = None¶
Object with the Capability-Skill-Service ontology
- asset_connections = None¶
Class with the Asset Connection methods
- agent_services = None¶
Class with the all services of the Agent
- lock = None¶
Asyncio Lock object for secure access to shared SMIA objects
- async setup()[source]¶
This method performs the common setup of all types of Managers. It defines the Finite State Machine (FSM) of the general SMIA Agent.
- async get_interaction_id()[source]¶
This method returns the identifier of the AAS Intra interactions of the SMIA.
- Returns:
identifier of the interaction id.
- Return type:
str
- async increase_interaction_id_num()[source]¶
This method increases the interaction id number for the AAS Intra interactions between the SMIA and the AAS Core.
- async save_new_acl_svc_request(thread, request_data)[source]¶
This method adds a new ACL Service Request to the global acl service requests dictionary of the SMIA.
- Parameters:
thread (str) – thread of the ACL Service Request.
request_data (dict) – all the information of the ACL Service Request in JSON format.
- async save_acl_svc_response(thread, response_data)[source]¶
This method adds a specific Inter AAS interaction response to the global responses dictionary of the SMIA for this type of interaction.
- Parameters:
thread (str) – thread of the ACL Service response.
response_data (dict) – all the information of the ACL Service response in JSON format.
- async remove_acl_svc_request(thread)[source]¶
This method removes an ACL Service Request from the global acl service requests dictionary of the SMIA.
- Parameters:
thread (str) – thread of the ACL Service Request.
- async get_acl_svc_request(thread)[source]¶
This method gets the information of an ACL Service Request from the global acl service requests dictionary of the SMIA using the thread. :param thread: thread of the ACL Service Request. :type thread: str
- Returns:
all information of the ACL Service Request in JSON format (null if the thread does not exist).
- Return type:
dict
- async save_interaction_request(interaction_id, request_data)[source]¶
This method adds a specific Intra AAS interaction Request to the global requests dictionary of the SMIA for this type of interaction using a specific interaction id.
- Parameters:
interaction_id (str) – interaction identifier of the Intra AAS interaction request.
request_data (dict) – all the information of the Intra AAS interaction Request in JSON format.
- async save_interaction_response(interaction_id, response_data)[source]¶
This method adds a specific Intra AAS interaction response to the global responses dictionary of the SMIA for this type of interaction.
- Parameters:
interaction_id (str) – identifier of the Intra AAS interaction response.
response_data (dict) – all the information of the ACL Service response in JSON format.
- async remove_interaction_request(interaction_id)[source]¶
This method removes an Intra AAS interaction Request from the global requests dictionary of the SMIA for this type of interaction.
- Parameters:
interaction_id (str) – interaction identifier of the Intra AAS interaction Request.
- async get_interaction_request(interaction_id)[source]¶
This method gets the information of an Intra AAS Interaction Request from the global acl service requests dictionary of the SMIA using the interaction identifier. :param interaction_id: interaction identifier of the Intra AAS interaction Request. :type interaction_id: str
- Returns:
all information of the Intra AAS Interaction Request in JSON format (null if the thread does not exist).
- Return type:
dict
- async save_negotiation_data(thread, neg_data)[source]¶
This method saves the information of a specific negotiation in which the SMIA has participated. The data is stored in the global object for all negotiations of the SMIA.
- Parameters:
thread (str) – thread of the negotiation
neg_data (dict) – all the information of the specific negotiation
- async save_asset_connection_class(interface_reference, asset_connection)[source]¶
This method adds a new asset connection to the global variable of the agent.
- Parameters:
interface_reference (basyx.aas.model.ModelReference) – reference of the interface of the AssetConnection
asset_connection – class with all information about the AssetConnection
- async get_asset_connection_class_by_ref(asset_connection_ref)[source]¶
This method gets the asset connection class using its reference.
- Parameters:
asset_connection_ref (basyx.aas.model.ModelReference) – reference of the asset connection
- Returns:
class of the asset connection
- Return type:
assetconnection.asset_connection