smia.agents.smia_agent module

class smia.agents.smia_agent.SMIAAgent(jid: str | None = None, password: str | None = None, *args, **kwargs)[source]

Bases: Agent

This 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

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

initialize_smia_attributes()[source]

This method initializes all the attributes of the SMIA.

async setup()[source]

This method performs the common setup of all types of SMIAs. It defines the Finite State Machine (FSM) of the general SMIA Agent.

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 SMIA 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_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

async get_all_asset_connections()[source]

This method returns all asset connections of the agent.

Returns:

dictionary wil all asset connections

Return type:

dict