# Self-configurable Manufacturing Industrial Agent: SMIA
[](https://test.pypi.org/project/smia/) [](https://hub.docker.com/r/ekhurtado/smia/)  [](https://app.codacy.com/gh/ekhurtado/I4_0_SMIA/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) [](https://i4-0-smia.readthedocs.io/en/latest/)
[//]: # (# TODO Use it when SMIA is published in PyPI)
[//]: # ([](https://pypi.python.org/pypi/smia) [](https://hub.docker.com/r/ekhurtado/aas-manager/)  [](https://app.codacy.com/gh/ekhurtado/I4_0_SMIA/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) [](https://i4-0-smia.readthedocs.io/en/latest/))

[//]: # (The logo image need to be obtained externally)
[//]: # (//Dependiendo del modo de GitHub oscuro o claro se añade una imagen u otra))
The Self-configurable Manufacturing Industrial Agent (SMIA) is a proposal for the implementation of the concept of the I4.0 Component from the Reference Architectural Model Industrie 4.0 (RAMI 4.0) as an AAS-compliant agent-based Digital Twin (DT). The features of the SMIA approach include:
- free & open-source
- AAS-compliant: standardized approach
- Ontology-based
- easily customizable and configurable
- self-configuration at software startup
- easy to usage
- containerized solution
> 💡 **TIP:**
> For more details on Self-configurable Manufacturing Industrial Agent (SMIA) see the [📄 **full documentation**](https://i4-0-smia.readthedocs.io/en/latest/).
## Usage
> ❗ **IMPORTANT:**
> At the moment there is no final version available for the SMIA.
> The project is currently under development.
> Therefore, SMIA is not a ready-to-use implementation.
> New features and bug fixes will be uploaded during development.
Multiple ways of running SMIA software are available. The associated GitHub repository shows how to run the base SMIA software.
In this case, how to use the SMIA Python package is shown.
### Installation
The SMIA approach can be easily installed using [pip](https://pip.pypa.io/en/stable/):
```
pip install smia
```
[//]: # (TODO actualizar con el nombre cuando se publique)
### Available facilities
The SMIA approach offers different facilities for its use:
- ``smia.launchers``: some launchers to run the base SMIA software.
- ``smia.launchers.smia_cli_starter.py``: launcher to run the SMIA software by passing the AAS model as CLI argument.
- ``smia.launchers.smia_starter.py``: launcher to run the SMIA software by passing the AAS model through Python code.
- ``smia.launchers.smia_docker_starter.py``: launcher to run the SMIA software as Docker container by passing the AAS model as environmental variable.
- ``smia.agents``: the Agent classes available to be instantiated and used.
- ``smia.agents.SMIAAgent``: the generic SMIA agent.
- ``smia.agents.ExtensibleSMIAAgent``: the extensible SMIA agent offering all extension methods.
- ``smia.assetconnection``: tools related to connection with assets.
- ``smia.assetconnection.HTTPAssetConnection``: tools related to connection with assets through HTTP communication protocol.
The other modules are available for import when, for example, developing an extension to SMIA.
[//]: # (TODO actualizar con los que se presenten)
#### Extensibility
SMIA extensibility is provided through the special agent ``ExtensibleSMIAAgent``. It provides some methods to extend the base SMIA and add own code:
- ``add_new_agent_capability(behaviour_class)``: this method adds a new agent capability to SMIA to increase its intelligence and autonomy. The new capability is added as a SPADE behavior instance.
- ``add_new_agent_service(service_id, service_method)``: this method adds a new agent service to SMIA to increase its intelligence and autonomy. The new service is added as a Python method that will be called when the service is requested.
- ``add_new_asset_connection(aas_interface_id_short, asset_connection_class)``: this method adds a new asset connection to SMIA. The new connection is added by the instance class inherited from the official SMIA generic class ``AssetConnection`` and the associated AAS interface element.
### Examples
Create and run an ``SMIAAgent``:
```python
import smia
from smia.agents.smia_agent import SMIAAgent
smia.load_aas_model('<path to the AASX package containing the AAS model>')
my_agent = SMIAAgent()
smia.run(my_agent)
```
#### Extensibility examples
Create an ``ExtensibleSMIAAgent``:
```python
import smia
from smia.agents.extensible_smia_agent import ExtensibleSMIAAgent
smia.load_aas_model('<path to the AASX package containing the AAS model>')
my_agent = ExtensibleSMIAAgent()
```
Add new ``Agent Capability`` to ``ExtensibleSMIAAgent``:
```python
import spade
from smia.agents.extensible_smia_agent import ExtensibleSMIAAgent # Import from the SMIA package
new_capability = spade.behaviour
my_extensible_agent.add_new_agent_capability(new_capability)
```
Add new ``Agent Service`` to ``ExtensibleSMIAAgent``:
```python
from smia.agents.extensible_smia_agent import ExtensibleSMIAAgent # Import from the SMIA package
my_extensible_agent.add_new_agent_service(new_service_id, new_service_method)
```
Add new ``Asset Connection`` to ``ExtensibleSMIAAgent``:
```python
from smia.agents.extensible_smia_agent import ExtensibleSMIAAgent # Import from the SMIA package
my_extensible_agent.add_new_asset_connection(aas_interface_id_short, asset_connection_class)
```
Complete example of an Extensible SMIA agent:
```python
import smia
import asyncio
from spade.behaviour import CyclicBehaviour
from smia.agents.extensible_smia_agent import ExtensibleSMIAAgent # Import from the SMIA package
from my_asset_connections import MyAssetConnection
class MyBehaviour(CyclicBehaviour):
async def on_start(self):
print("MyBehaviour started")
self.iteration = 0
async def run(self):
print("MyBehaviour is in iteration {}.".format(self.iteration))
self.iteration += 1
await asyncio.sleep(2)
def new_service_method():
print("This is a new service to be added to SMIA.")
def main():
my_extensible_agent = ExtensibleSMIAAgent()
smia.load_aas_model('<path to the AAS model>')
my_behav = MyBehaviour()
my_extensible_agent.add_new_agent_capability(my_behav)
my_extensible_agent.add_new_agent_service('new_service_id', new_service_method)
new_asset_connection = MyAssetConnection()
my_extensible_agent.add_new_asset_connection('new_connection_idshort', new_asset_connection)
smia.run(my_extensible_agent)
if __name__ == '__main__':
main()
```
## Dependencies
The SMIA software requires the following Python packages to be installed to run correctly. These dependencies are listed in ``pyproject.toml`` so that they are automatically obtained when installing with ``pip``:
- ``spade`` (MIT license)
- ``basyx-python-sdk`` (MIT license)
- ``owlready2`` (GNU LGPL licence v3)
[//]: # (TODO actualizar con los que sean)
## License
GNU General Public License v3.0. See `LICENSE` for more information.
Raw data
{
"_id": null,
"home_page": null,
"name": "smia-autotest",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "smia, dt, aas, i4.0",
"author": null,
"author_email": "Ekaitz Hurtado <ekaitz.hurtado@ehu.eus>",
"download_url": "https://files.pythonhosted.org/packages/95/b6/52607d44e94e84be6241ba9cbf4183ce79dfba74f167f12fe1d6ad96ee2e/smia_autotest-0.2.1.11.tar.gz",
"platform": null,
"description": "# Self-configurable Manufacturing Industrial Agent: SMIA \n\n[](https://test.pypi.org/project/smia/) [](https://hub.docker.com/r/ekhurtado/smia/)  [](https://app.codacy.com/gh/ekhurtado/I4_0_SMIA/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) [](https://i4-0-smia.readthedocs.io/en/latest/)\n\n[//]: # (# TODO Use it when SMIA is published in PyPI)\n[//]: # ([](https://pypi.python.org/pypi/smia) [](https://hub.docker.com/r/ekhurtado/aas-manager/)  [](https://app.codacy.com/gh/ekhurtado/I4_0_SMIA/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) [](https://i4-0-smia.readthedocs.io/en/latest/))\n\n\n\n\n\n\n[//]: # (The logo image need to be obtained externally)\n\n[//]: # (//Dependiendo del modo de GitHub oscuro o claro se a\u00f1ade una imagen u otra))\n\nThe Self-configurable Manufacturing Industrial Agent (SMIA) is a proposal for the implementation of the concept of the I4.0 Component from the Reference Architectural Model Industrie 4.0 (RAMI 4.0) as an AAS-compliant agent-based Digital Twin (DT). The features of the SMIA approach include:\n\n- free & open-source\n- AAS-compliant: standardized approach\n- Ontology-based\n- easily customizable and configurable\n- self-configuration at software startup\n- easy to usage\n- containerized solution\n\n> \ud83d\udca1 **TIP:**\n> For more details on Self-configurable Manufacturing Industrial Agent (SMIA) see the [\ud83d\udcc4 **full documentation**](https://i4-0-smia.readthedocs.io/en/latest/).\n\n## Usage\n\n> \u2757 **IMPORTANT:**\n> At the moment there is no final version available for the SMIA.\n> The project is currently under development.\n> Therefore, SMIA is not a ready-to-use implementation.\n> New features and bug fixes will be uploaded during development.\n \nMultiple ways of running SMIA software are available. The associated GitHub repository shows how to run the base SMIA software.\n\nIn this case, how to use the SMIA Python package is shown.\n\n### Installation\n\nThe SMIA approach can be easily installed using [pip](https://pip.pypa.io/en/stable/):\n\n```\npip install smia\n```\n[//]: # (TODO actualizar con el nombre cuando se publique)\n\n### Available facilities\n\nThe SMIA approach offers different facilities for its use:\n\n- ``smia.launchers``: some launchers to run the base SMIA software.\n - ``smia.launchers.smia_cli_starter.py``: launcher to run the SMIA software by passing the AAS model as CLI argument.\n - ``smia.launchers.smia_starter.py``: launcher to run the SMIA software by passing the AAS model through Python code.\n - ``smia.launchers.smia_docker_starter.py``: launcher to run the SMIA software as Docker container by passing the AAS model as environmental variable.\n- ``smia.agents``: the Agent classes available to be instantiated and used.\n - ``smia.agents.SMIAAgent``: the generic SMIA agent.\n - ``smia.agents.ExtensibleSMIAAgent``: the extensible SMIA agent offering all extension methods.\n- ``smia.assetconnection``: tools related to connection with assets.\n - ``smia.assetconnection.HTTPAssetConnection``: tools related to connection with assets through HTTP communication protocol.\n\nThe other modules are available for import when, for example, developing an extension to SMIA.\n\n[//]: # (TODO actualizar con los que se presenten)\n\n#### Extensibility\n\nSMIA extensibility is provided through the special agent ``ExtensibleSMIAAgent``. It provides some methods to extend the base SMIA and add own code:\n\n- ``add_new_agent_capability(behaviour_class)``: this method adds a new agent capability to SMIA to increase its intelligence and autonomy. The new capability is added as a SPADE behavior instance.\n- ``add_new_agent_service(service_id, service_method)``: this method adds a new agent service to SMIA to increase its intelligence and autonomy. The new service is added as a Python method that will be called when the service is requested.\n- ``add_new_asset_connection(aas_interface_id_short, asset_connection_class)``: this method adds a new asset connection to SMIA. The new connection is added by the instance class inherited from the official SMIA generic class ``AssetConnection`` and the associated AAS interface element.\n\n### Examples\n\nCreate and run an ``SMIAAgent``:\n```python\nimport smia\nfrom smia.agents.smia_agent import SMIAAgent\n\nsmia.load_aas_model('<path to the AASX package containing the AAS model>')\nmy_agent = SMIAAgent()\n\nsmia.run(my_agent)\n```\n\n#### Extensibility examples\n\nCreate an ``ExtensibleSMIAAgent``:\n```python\nimport smia\nfrom smia.agents.extensible_smia_agent import ExtensibleSMIAAgent\n\nsmia.load_aas_model('<path to the AASX package containing the AAS model>')\nmy_agent = ExtensibleSMIAAgent()\n```\n\nAdd new ``Agent Capability`` to ``ExtensibleSMIAAgent``:\n```python\nimport spade\nfrom smia.agents.extensible_smia_agent import ExtensibleSMIAAgent # Import from the SMIA package\n\nnew_capability = spade.behaviour\nmy_extensible_agent.add_new_agent_capability(new_capability)\n```\n\nAdd new ``Agent Service`` to ``ExtensibleSMIAAgent``:\n\n```python\nfrom smia.agents.extensible_smia_agent import ExtensibleSMIAAgent # Import from the SMIA package\n\nmy_extensible_agent.add_new_agent_service(new_service_id, new_service_method)\n```\n\nAdd new ``Asset Connection`` to ``ExtensibleSMIAAgent``:\n\n```python\nfrom smia.agents.extensible_smia_agent import ExtensibleSMIAAgent # Import from the SMIA package\n\nmy_extensible_agent.add_new_asset_connection(aas_interface_id_short, asset_connection_class)\n```\n\nComplete example of an Extensible SMIA agent:\n\n```python\nimport smia\nimport asyncio\nfrom spade.behaviour import CyclicBehaviour\nfrom smia.agents.extensible_smia_agent import ExtensibleSMIAAgent # Import from the SMIA package\nfrom my_asset_connections import MyAssetConnection\n\nclass MyBehaviour(CyclicBehaviour):\n async def on_start(self):\n print(\"MyBehaviour started\")\n self.iteration = 0\n\n async def run(self):\n print(\"MyBehaviour is in iteration {}.\".format(self.iteration))\n self.iteration += 1\n await asyncio.sleep(2)\n\ndef new_service_method():\n print(\"This is a new service to be added to SMIA.\")\n \ndef main():\n my_extensible_agent = ExtensibleSMIAAgent()\n smia.load_aas_model('<path to the AAS model>')\n \n my_behav = MyBehaviour()\n my_extensible_agent.add_new_agent_capability(my_behav)\n \n my_extensible_agent.add_new_agent_service('new_service_id', new_service_method)\n \n new_asset_connection = MyAssetConnection()\n my_extensible_agent.add_new_asset_connection('new_connection_idshort', new_asset_connection)\n \n smia.run(my_extensible_agent)\n\nif __name__ == '__main__':\n main()\n```\n\n## Dependencies\n\nThe SMIA software requires the following Python packages to be installed to run correctly. These dependencies are listed in ``pyproject.toml`` so that they are automatically obtained when installing with ``pip``:\n\n- ``spade`` (MIT license)\n- ``basyx-python-sdk`` (MIT license)\n- ``owlready2`` (GNU LGPL licence v3)\n\n[//]: # (TODO actualizar con los que sean)\n\n## License\n\nGNU General Public License v3.0. See `LICENSE` for more information.\n",
"bugtrack_url": null,
"license": "GNU Affero General Public License v3",
"summary": "Self-configurable Manufacturing Industrial Agent (SMIA).",
"version": "0.2.1.11",
"project_urls": {
"Changelog": "https://i4-0-smia.readthedocs.io/en/latest/release_notes.html",
"Documentation": "https://i4-0-smia.readthedocs.io/en/latest/",
"Homepage": "https://github.com/ekhurtado/I4_0_SMIA",
"Issues": "https://github.com/ekhurtado/I4_0_SMIA/issues",
"Repository": "https://github.com/ekhurtado/I4_0_SMIA"
},
"split_keywords": [
"smia",
" dt",
" aas",
" i4.0"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "0028772b2e5b29381ad6135b5277d3792bf93eb05836c36896c5195bc8e96ef8",
"md5": "7d619b35afe7354249b90228a20809f7",
"sha256": "9bbe1350674f814ca9e20b9d056ca6cc894de65b2004391aa7294dc4a46a9de7"
},
"downloads": -1,
"filename": "smia_autotest-0.2.1.11-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7d619b35afe7354249b90228a20809f7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 122768,
"upload_time": "2025-02-21T13:06:17",
"upload_time_iso_8601": "2025-02-21T13:06:17.269189Z",
"url": "https://files.pythonhosted.org/packages/00/28/772b2e5b29381ad6135b5277d3792bf93eb05836c36896c5195bc8e96ef8/smia_autotest-0.2.1.11-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "95b652607d44e94e84be6241ba9cbf4183ce79dfba74f167f12fe1d6ad96ee2e",
"md5": "c2f01d1dacfda93d2a20701ac344f6ff",
"sha256": "af88a45f7d927fedef495093d30f48c832d5686df7d30e1f361a247cb2958002"
},
"downloads": -1,
"filename": "smia_autotest-0.2.1.11.tar.gz",
"has_sig": false,
"md5_digest": "c2f01d1dacfda93d2a20701ac344f6ff",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 452102,
"upload_time": "2025-02-21T13:06:18",
"upload_time_iso_8601": "2025-02-21T13:06:18.914058Z",
"url": "https://files.pythonhosted.org/packages/95/b6/52607d44e94e84be6241ba9cbf4183ce79dfba74f167f12fe1d6ad96ee2e/smia_autotest-0.2.1.11.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-21 13:06:18",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ekhurtado",
"github_project": "I4_0_SMIA",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "smia-autotest"
}