Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple AAS in AAX package #19

Closed
StenGruener opened this issue Jul 7, 2022 · 9 comments
Closed

Multiple AAS in AAX package #19

StenGruener opened this issue Jul 7, 2022 · 9 comments

Comments

@StenGruener
Copy link

Dear team,

# For adding a second AAS to the package, we can simply call `write_aas()` again.
# Warning: This will create a second XML/JSON part in the AASX Package, which is compliant with the "Details of the
# Asset Administration Shell" standard up to version 2.0.1, but not supported by AASX Package Explorer.

could someone update me on a status of AASX-package-explorer versions of multiple AAS in the AASX package?

@s-heppner
Copy link
Contributor

The current state of the write_aas function in aas.adapter.aasx.AASXWriter for version 2.0.1 of the meta-model (Release 0.2.2) does still write seperate AASs in seperate parts.
For questions about the AASX package explorer, please refer to the project: https://github.com/admin-shell-io/aasx-package-explorer, as we are not affiliated.

In the upcoming relase for version 3.0RC02 of the meta-model, the function write_aas() is going to write all the data into one aas-spec (aasx/data.xml or aasx/data.json) file in accordance to the specification, therefore the problem should not arise anymore.

@StenGruener
Copy link
Author

Any idea on the roadmap for "the upcoming release for version 3.0RC02"?

@s-heppner
Copy link
Contributor

Realistically, it might still need 2-3 months to the release, considering the upcoming examination phase at university and following summer vacations.
But you're very welcome to try out the WIP branch. Most changes should already be present at this point, with the main missing features being the SubmodelElementStructs and SubmodelElementLists.

@jorgegomezjumh
Copy link

Dear team,

# For adding a second AAS to the package, we can simply call `write_aas()` again.
# Warning: This will create a second XML/JSON part in the AASX Package, which is compliant with the "Details of the
# Asset Administration Shell" standard up to version 2.0.1, but not supported by AASX Package Explorer.

could someone update me on a status of AASX-package-explorer versions of multiple AAS in the AASX package?

I am attempting to write two or more AAS in one AASX file, but I am unable to achieve this by creating another object store. Additionally, I have tried placing both AAS in the same object store, calling 'write_aas()' again, and using a different 'aas_id.' However, both methods yield the same result. I successfully generate an AASX file that opens correctly in AASX Package Explorer, but it only contains the first AAS.

I am still working with version 2, as it is currently impossible for me to transition to version 3. I am facing difficulties in reading the AASX file generated by the aasx-package-explorer.2023-11-17.alpha in basyx-python-sdk-main using AASXReader. Although I attempted to use the AASFix repository, I am unable to read the AASX file of version 3.

@s-heppner
Copy link
Contributor

I am attempting to write two or more AAS in one AASX file

Can you try to add several AAS Identifiers to the AASXWriter.write_aas() function?

As you can see, the aas_ids parameter actually allows for Iterable:

    def write_aas(self,
                  aas_ids: Union[model.Identifier, Iterable[model.Identifier]],
                  object_store: model.AbstractObjectStore,
                  file_store: "AbstractSupplementaryFileContainer",
                  write_json: bool = False) -> None:

I think it could look something like this, if you place all AAS in the same ObjectStore:

aas_ids = []
for obj in self.objStore:
    if isinstance(obj, AssetAdministrationShell):
        aas_ids.append(obj.id)
writer.write_aas(aas_ids, ...

I am facing difficulties in reading the AASX file generated by the aasx-package-explorer.2023-11-17.alpha

I'm sorry to hear that. Can you provide the error messages? We're not affiliated with the AASX Package explorer, nor the "AASFix" tool, but if it turns out a bug on our end, we'll fix it of course.

@s-heppner s-heppner reopened this Feb 7, 2024
@jorgegomezjumh
Copy link

I have tried to write using this code in v3. It seems that the aasx file is written but when you try to open in AASX Package Explorer this errors appears to me:

image

When I try to use the AASFix another errors appears to me:

image

When using the reader function, I've encountered various errors while attempting to read the AASX file exported by AASX Package Explorer version 3. Even after applying AASFix, the issues persist:

With normal aasx:

image

After AASFix:

image

@s-heppner
Copy link
Contributor

Looking at your error messages in the last image you provided, it would appear something went wrong in the installation of your basyx-python library.

As you can see:

... is of type <class 'basyx.aas.model.base.ModelReference'> expected <class 'aas.model.base.ModelReference'>

the former is definitely what it is supposed to be.

So, I suspect you installed our basyx library at the level of "aas", when it should have been installed at the directory level above, starting with "basyx.aas".
I'm not sure how you did achieve this, so my suggestion is to completely uninstall basyx and reinstall it using

pip install basyx-python-sdk

which will install v1.0.0, that represents v3.0 of the spec.

What I would also heavily suggest to read into Python virtual environments and using those on a project level basis.

As a last friendly tip, please provide stacktraces and error messages as text in the future, as that is easier to read through than screenshots and can be searched through.

@jorgegomezjumh
Copy link

Thank you very much.

The problem was with the files and the version, using this new basyx-python-sdk after using AASFix tool I can read the aasx file exported by the AASX. Package Explorer v3.

@s-heppner
Copy link
Contributor

Great, I'm happy I could help!
I'll close this issue now, but feel free to reopen it, if you have any further questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants