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

Create a template file for XTCE Packets #67

Closed
maxinelasp opened this issue Aug 21, 2023 · 15 comments
Closed

Create a template file for XTCE Packets #67

maxinelasp opened this issue Aug 21, 2023 · 15 comments
Assignees
Labels
enhancement New feature or request Level: L0 Level 0 processing

Comments

@maxinelasp
Copy link
Contributor

Topic:

Create a template with common fields and parameters for all (or most) XTCE packet files.

Description:

This file should include things like the CCSDS header, which are common to all files. The goal is to have one template which we can copy out of for other XTCE files.

Requirements

Include some kind of comment making it clear that it came from a template and where you can find the template.

@maxinelasp maxinelasp added enhancement New feature or request Level: L0 Level 0 processing labels Aug 21, 2023
@maxinelasp maxinelasp added this to IMAP Aug 21, 2023
@maxinelasp
Copy link
Contributor Author

@tech3371 Maybe you want to take this one on?

@maxinelasp
Copy link
Contributor Author

May be related to #6 for an XCTE script builder - @GFMoraga What do you think? Does it make sense to integrate some kind of template into your script?

@GFMoraga
Copy link
Contributor

This is related! I think the Python code I have will help with this. The is to format the code with '''information''' so the user can understand/change inputs when needed.

'''Create CCSDS Header parameters, which should be the same for all IMAP instruments'''

'ccsds_parameters = [
{"name": "VERSION", "parameterTypeRef": "uint3", "description": "CCSDS Packet Version Number (always 0)"},
{"name": "TYPE", "parameterTypeRef": "uint1", "description": "CCSDS Packet Type Indicator (0=telemetry)"},
{"name": "SEC_HDR_FLG", "parameterTypeRef": "uint1", "description": "CCSDS Packet Secondary Header Flag (always 1)"},
{"name": "PKT_APID", "parameterTypeRef": "uint11", "description": "CCSDS Packet Application Process ID"},
{"name": "SEG_FLGS", "parameterTypeRef": "uint2", "description": "CCSDS Packet Grouping Flags (3=not part of group)"},
{"name": "SRC_SEQ_CTR", "parameterTypeRef": "uint14", "description": "CCSDS Packet Sequence Count (increments with each new packet)"},
{"name": "PKT_LEN", "parameterTypeRef": "uint16", "description": "CCSDS Packet Length (number of bytes after Packet length minus 1)"},
{"name": "SHCOARSE", "parameterTypeRef": "uint32", "description": "CCSDS Packet Time Stamp (coarse time)"}]'

@GFMoraga
Copy link
Contributor

Or are you suggesting something like:

CCSDS headers

xtce:ParameterSet
<xtce:Parameter name="VERSION" parameterTypeRef="uint3">
xtce:LongDescriptionCCSDS Packet Version Number (always 0)</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="TYPE" parameterTypeRef="uint1">
xtce:LongDescriptionCCSDS Packet Type Indicator (0=telemetry)</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="SEC_HDR_FLG" parameterTypeRef="uint1">
xtce:LongDescriptionCCSDS Packet Secondary Header Flag (always 1)</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="PKT_APID" parameterTypeRef="uint11">
xtce:LongDescriptionCCSDS Packet Application Process ID</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="SEG_FLGS" parameterTypeRef="uint2">
xtce:LongDescriptionCCSDS Packet Grouping Flags (3=not part of group)</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="SRC_SEQ_CTR" parameterTypeRef="uint14">
xtce:LongDescriptionCCSDS Packet Sequence Count (increments with each new packet)</xtce:LongDescription>
</xtce:Parameter>
<xtce:Parameter name="PKT_LEN" parameterTypeRef="uint16">
xtce:LongDescriptionCCSDS Packet Length (number of bytes after Packet length minus 1)</xtce:LongDescription>
</xtce:Parameter>

SequenceContainer

<xtce:SequenceContainer name="CCSDSPacket">
xtce:EntryList
<xtce:ParameterRefEntry parameterRef="VERSION" />
<xtce:ParameterRefEntry parameterRef="TYPE" />
<xtce:ParameterRefEntry parameterRef="SEC_HDR_FLG" />
<xtce:ParameterRefEntry parameterRef="PKT_APID" />
<xtce:ParameterRefEntry parameterRef="SEG_FLGS" />
<xtce:ParameterRefEntry parameterRef="SRC_SEQ_CTR" />
<xtce:ParameterRefEntry parameterRef="PKT_LEN" />
<xtce:ParameterRefEntry parameterRef="SHCOARSE" />
</xtce:EntryList>
</xtce:SequenceContainer>

@maxinelasp
Copy link
Contributor Author

Either is fine, depending on how your script works. But, it's my preference that it's in a different file, so it's easy to update and to see when it's getting updated.

@GFMoraga
Copy link
Contributor

Gotcha. Something that is named "xtce_packet_temp.md/yml/py/xml" ?

@maxinelasp
Copy link
Contributor Author

Yes, except write out "template", because I read that as "temporary"! But yes, basically some kind of template which can be shared across different instruments. But, don't make it markdown, because that will be annoying for programming. If you make it something non-xml (which I think would make it easier to edit) make sure you add something in your script to output it as XML. That way, someone who is using the template but not your script can still use the template.

@GFMoraga
Copy link
Contributor

@maxinelasp I just saw this, and I think I could add this to my current PR, but can do a new one too. Could you look at the open PR and see what you like in the sense of making a template? I tried to add guidelines in the script, so I would take from those to make this template.

@maxinelasp
Copy link
Contributor Author

Either adding it to the current PR or adding to a later one would be fine. It looks like what you have is good in the PR, you would just need to pull out some of the template generation into a new "generate_ccsds_header_xml" type function, and then it is easy to import that method and call it to get the XML. I will take a look at that PR some time this week, ping me if I haven't by like Thursday or Friday.

@GFMoraga GFMoraga self-assigned this Aug 23, 2023
@tech3371
Copy link
Contributor

I am checking in to see if I need to create XTCE template file (which I don't mind doing) or what @GFMoraga has done this?

@GFMoraga
Copy link
Contributor

@tech3371 look at my PR and see. I was going to make a CCSDS header template like Maxine suggested.

@maxinelasp
Copy link
Contributor Author

I think what you have is great, Gabriel! Maybe Tenzin can look through my suggestions and see if that PR completes this ticket, or if there's some additional work to be done there. It might be worth just merging that PR quickly and then coming back to it to rework it to be more of a general template. But I think what you have for the template and the code generation tools in that PR looks good! (PR: #72 )

@tech3371
Copy link
Contributor

If we can generalized his work on current PR #72 , Then what he has done is far better than what I would have done, which is just XTCE file with same example and more comments.

@GFMoraga
Copy link
Contributor

So, I add a new file to #72 which is the 'generate_ccsds_header_xml.py'

How do we close this issue and do y'all @maxinelasp @tech3371 think this is a good start? We can move the file too.

@maxinelasp
Copy link
Contributor Author

Yes, I think that's definitely sufficient for this issue!

@github-project-automation github-project-automation bot moved this to Done in IMAP Aug 23, 2023
@tech3371 tech3371 added this to the Decom and L1A Complete milestone Oct 4, 2023
@tech3371 tech3371 moved this from Done to Ready for Test in IMAP Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Level: L0 Level 0 processing
Projects
Status: No status
Development

No branches or pull requests

3 participants