-
Notifications
You must be signed in to change notification settings - Fork 0
Sd 22337 monarch fine grained control real time telemetry selection feature #19
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
base: monarch
Are you sure you want to change the base?
Changes from all commits
e7d9b28
a8d20de
676c595
7b7b248
a8417b3
44d0660
a81d937
2194258
89fcab3
ffaccb8
e5542e5
cec7325
1111a33
8364b49
fa2548c
4ef83b9
36423d7
5afba79
d733f34
e5ac3b4
1cbf9e5
68ed031
07a2bee
eb29119
385f5e7
b2e2b44
2886c73
85976a8
64ddc57
d1d6ee0
8bc9f66
e29f932
b7c88d6
e3300df
db525b2
4666674
28e6dba
04a7dd4
9d2d037
0dc4928
e41c94a
f029f40
1113fe2
f46f354
0401851
9939696
50aee70
ccaf0df
0313fdf
8f2611a
35001e0
cb306e0
ff0e9f9
7000c06
ec92b85
39c9da6
fb11e82
37bf9f3
544fdd8
5e66eae
66b4941
8281ba0
bd518d4
53f26ef
d20d9f7
77eea4c
7a92fff
7d8408c
3299e7d
339cf30
d46fd86
830f7f8
b838dce
576e7d1
c5af8a6
257d3e0
1d995a6
261a0fa
b8e8036
1b7805c
6a501bd
6b85467
fb0ceb8
2ae9028
1753f20
0fbfd4c
b2ac193
2552beb
5dd5661
db2f95a
5254ed5
816055e
3fada10
2a7b922
838fe1d
9c9cd65
97d5150
0a4ba78
d81d623
17f90a9
0d55888
eed08fd
8f144e2
64e5f36
bab01f1
668895e
4db19fb
9a7465e
054ab76
08769de
202b24b
aedd4cb
2abe732
0db83af
b6ddf58
3cd0d9c
75a6688
f82d309
93ea44d
ecaddce
c954822
6e2b510
c921ebe
2b0cb92
53c5eff
8eecaa1
bf0133f
5507a57
15929e9
95971ad
a450176
59d6193
113aa04
3e34927
68c551c
8c1ef2f
c8b8737
222d71a
f11f36a
b9989f1
86116d8
80ff04b
f809fcb
6bd7920
4ad0650
0466a3c
b9f4d98
7b48ee8
a311693
bcbdd0c
dbe7065
c360794
7eb48ee
2a9af07
ba3a789
130d4ae
e40839f
885487d
e1c3dd1
b39a8c8
6b42e1a
9f5c2d3
feb79d2
8db30ec
9c76d92
06f2229
a4181ea
ce5d0e4
790dd02
5eb4087
905429e
440b315
49bc976
f0e620d
77870ad
7693fb3
c7ae709
974cde6
24f214f
d4050db
b40fde9
1c8fb28
97dc5c8
a5a4b77
310525f
e397fef
8a72a58
82515ba
3d41df1
3509b8e
ff83a11
f3be4d3
9ad6b8e
43b8057
346181b
18d87a1
5212390
8a87c59
b9d5b82
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -305,8 +305,8 @@ void TlmPacketizer ::Run_handler(const FwIndexType portNum, U32 context) { | |
|
|
||
| for (FwIndexType section = 0; section < TelemetrySection::NUM_SECTIONS; section++) { | ||
| PktSendCounters& pktEntryFlags = this->m_packetFlags[static_cast<FwSizeType>(section)][pkt]; | ||
| TlmPacketizer_GroupConfig& entryGroupConfig = | ||
| this->m_groupConfigs[static_cast<FwSizeType>(section)][entryGroup]; | ||
| // Per-packet override if one is set (via ENABLE/FORCE/CONFIGURE_PACKET*), else the group-derived policy. | ||
| const Svc::PacketConfig entryGroupConfig = this->effectiveConfig(section, pkt, entryGroup); | ||
|
|
||
| // Packet is updated and not REQUESTED (Keep REQUESTED marking to bypass disable checks) | ||
| if (isNewData && pktEntryFlags.updateFlag != UpdateFlag::REQUESTED) { | ||
|
|
@@ -535,6 +535,85 @@ void TlmPacketizer ::CONFIGURE_GROUP_RATES_cmdHandler(FwOpcodeType opCode, | |
| this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); | ||
| } | ||
|
|
||
| void TlmPacketizer ::GET_PACKET_CONFIG_cmdHandler(FwOpcodeType opCode, | ||
| U32 cmdSeq, | ||
| U32 packetId, | ||
| const Svc::TelemetrySection& section) { | ||
| FW_ASSERT(section.isValid()); | ||
| if (section < 0 or section >= TelemetrySection::NUM_SECTIONS) { | ||
| this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::VALIDATION_ERROR); | ||
| return; | ||
| } | ||
| FwChanIdType pkt = 0; | ||
| if (not this->findPacketIndexById(packetId, pkt)) { | ||
| this->log_WARNING_LO_UnknownPacketId(packetId); | ||
| this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::VALIDATION_ERROR); | ||
| return; | ||
| } | ||
| const Svc::PacketConfig eff = | ||
| this->effectiveConfig(static_cast<FwIndexType>(section.e), pkt, this->m_fillBuffers[pkt].level); | ||
| Svc::PacketConfigEntry entry; | ||
| entry.set_packetId(packetId); | ||
| entry.set_section(section.e); | ||
| entry.set_config(eff); | ||
| this->tlmWrite_QueriedPacketConfig(entry); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: might need a note: |
||
| this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); | ||
| } | ||
|
|
||
| void TlmPacketizer ::ENABLE_PACKET_cmdHandler(FwOpcodeType opCode, | ||
| U32 cmdSeq, | ||
| U32 packetId, | ||
| const Svc::TelemetrySection& section, | ||
| const Fw::Enabled& enable) { | ||
| FwSizeType s = 0; | ||
| FwChanIdType pkt = 0; | ||
| // Validate on ground data (no assert): bad enable / section / unknown id -> VALIDATION_ERROR. | ||
| if (not enable.isValid() or not this->resolveAndSeedOverride(section, packetId, s, pkt)) { | ||
| this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::VALIDATION_ERROR); | ||
| return; | ||
| } | ||
| this->m_packetOverride[s][pkt].set_enabled(enable); | ||
| this->mirrorOverride(section, pkt, packetId); | ||
| this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); | ||
| } | ||
|
|
||
| void TlmPacketizer ::FORCE_PACKET_cmdHandler(FwOpcodeType opCode, | ||
| U32 cmdSeq, | ||
| U32 packetId, | ||
| const Svc::TelemetrySection& section, | ||
| const Fw::Enabled& enable) { | ||
| FwSizeType s = 0; | ||
| FwChanIdType pkt = 0; | ||
| if (not enable.isValid() or not this->resolveAndSeedOverride(section, packetId, s, pkt)) { | ||
| this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::VALIDATION_ERROR); | ||
| return; | ||
| } | ||
| this->m_packetOverride[s][pkt].set_forceEnabled(enable); | ||
| this->mirrorOverride(section, pkt, packetId); | ||
| this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); | ||
| } | ||
|
|
||
| void TlmPacketizer ::CONFIGURE_PACKET_RATES_cmdHandler(FwOpcodeType opCode, | ||
| U32 cmdSeq, | ||
| U32 packetId, | ||
| const Svc::TelemetrySection& section, | ||
| const Svc::RateLogic& rateLogic, | ||
| U32 minDelta, | ||
| U32 maxDelta) { | ||
| FwSizeType s = 0; | ||
| FwChanIdType pkt = 0; | ||
| if (not rateLogic.isValid() or not this->resolveAndSeedOverride(section, packetId, s, pkt)) { | ||
| this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::VALIDATION_ERROR); | ||
| return; | ||
| } | ||
| Svc::PacketConfig& cfg = this->m_packetOverride[s][pkt]; | ||
| cfg.set_rateLogic(rateLogic); | ||
| cfg.set_min(minDelta); | ||
| cfg.set_max(maxDelta); | ||
| this->mirrorOverride(section, pkt, packetId); | ||
| this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); | ||
| } | ||
|
|
||
| void TlmPacketizer::configureSectionGroupRate( | ||
| const Svc::TelemetrySection& section, //!< Section grouping | ||
| FwChanIdType tlmGroup, //!< Group Identifier | ||
|
|
@@ -567,6 +646,100 @@ FwIndexType TlmPacketizer::sectionGroupToPort(const FwIndexType section, const F | |
| return outIndex; | ||
| } | ||
|
|
||
| Svc::PacketConfig TlmPacketizer::effectiveConfig(FwIndexType section, FwChanIdType pkt, FwChanIdType group) const { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "effective" in the sense of prioritize the per-packet override...and if there's none -> then use the group config of which the packet is a part |
||
| const FwSizeType s = static_cast<FwSizeType>(section); | ||
| if (this->m_packetOverridden[s][pkt]) { | ||
| return this->m_packetOverride[s][pkt]; | ||
|
Comment on lines
+651
to
+652
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Once a packet has been overridden, how is it cleared? Do we need a new command? |
||
| } | ||
| // Not overridden: derive from the group policy for this packet's level (legacy behavior). | ||
| const TlmPacketizer_GroupConfig& gc = this->m_groupConfigs[s][group]; | ||
| Svc::PacketConfig eff; | ||
| eff.set_enabled(gc.get_enabled()); | ||
| eff.set_forceEnabled(gc.get_forceEnabled()); | ||
| eff.set_rateLogic(gc.get_rateLogic()); | ||
| eff.set_min(gc.get_min()); | ||
| eff.set_max(gc.get_max()); | ||
| return eff; | ||
|
Comment on lines
+654
to
+662
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This and the return on 652 is building/copying a new PacketConfig and returning by value every evaluation cycle. Consider refactoring to return a reference a performance improvement. |
||
| } | ||
|
Comment on lines
+651
to
+663
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This definitely needs to be documented in the SDD. Overwritten disabled packets have a higher "authority" than Forced Enabled Groups. |
||
|
|
||
| bool TlmPacketizer::findPacketIndexById(U32 packetId, FwChanIdType& pkt) const { | ||
| for (FwChanIdType p = 0; p < this->m_numPackets; p++) { | ||
| if (this->m_fillBuffers[p].id == packetId) { | ||
| pkt = p; | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| Svc::PacketConfig TlmPacketizer::defaultPacketConfig() { | ||
| // seeds the default the first time the packet is overridden, assuming these parameters | ||
| // were not configured ahead of this packet being enabled: enabled, not forced, | ||
| // output-on-change, no thresholds. | ||
| Svc::PacketConfig cfg; | ||
| cfg.set_enabled(Fw::Enabled(Fw::Enabled::ENABLED)); | ||
| cfg.set_forceEnabled(Fw::Enabled(Fw::Enabled::DISABLED)); | ||
| cfg.set_rateLogic(Svc::RateLogic(Svc::RateLogic::ON_CHANGE_MIN)); | ||
| cfg.set_min(0); | ||
| cfg.set_max(0); | ||
| return cfg; | ||
| } | ||
|
|
||
| bool TlmPacketizer::resolveAndSeedOverride(const Svc::TelemetrySection& section, | ||
| U32 packetId, | ||
| FwSizeType& s, | ||
| FwChanIdType& pkt) { | ||
| if (not(section.isValid() and section >= 0 and section < TelemetrySection::NUM_SECTIONS)) { | ||
| return false; | ||
| } | ||
| if (not this->findPacketIndexById(packetId, pkt)) { | ||
| this->log_WARNING_LO_UnknownPacketId(packetId); | ||
| return false; | ||
| } | ||
| s = static_cast<FwSizeType>(section.e); | ||
| if (not this->m_packetOverridden[s][pkt]) { | ||
| this->m_packetOverride[s][pkt] = TlmPacketizer::defaultPacketConfig(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be overriding with the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1, This also ignores the current group level config |
||
| this->m_packetOverridden[s][pkt] = true; | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| void TlmPacketizer ::configIn_handler(FwIndexType portNum, FwSizeType count, const Svc::PacketConfigBatch& batch) { | ||
| // load overrides from an external component's persistant storage of the overrides (intended to be used after a reboot) | ||
| const FwSizeType cap = static_cast<FwSizeType>(Svc::PacketConfigBatch::SIZE); | ||
| const FwSizeType n = (count < cap) ? count : cap; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider a warning EVR if the cap is exceeded. |
||
| for (FwSizeType i = 0; i < n; i++) { | ||
| const Svc::PacketConfigEntry& entry = batch[i]; | ||
| const Svc::TelemetrySection section = entry.get_section(); | ||
| if (not(section.isValid() and section >= 0 and section < TelemetrySection::NUM_SECTIONS)) { | ||
| continue; | ||
| } | ||
| FwChanIdType pkt = 0; | ||
| if (not this->findPacketIndexById(entry.get_packetId(), pkt)) { | ||
| this->log_WARNING_LO_UnknownPacketId(entry.get_packetId()); | ||
| continue; | ||
| } | ||
| const FwSizeType s = static_cast<FwSizeType>(section.e); | ||
| this->m_packetOverride[s][pkt] = entry.get_config(); | ||
| this->m_packetOverridden[s][pkt] = true; | ||
| } | ||
| } | ||
|
|
||
| void TlmPacketizer::mirrorOverride(const Svc::TelemetrySection& section, FwChanIdType pkt, U32 packetId) { | ||
| // persistent storage component should mirror this state; skip if not wired | ||
| if (not this->isConnected_configOut_OutputPort(0)) { | ||
| return; | ||
| } | ||
| const FwSizeType s = static_cast<FwSizeType>(section.e); | ||
| Svc::PacketConfigEntry entry; | ||
| entry.set_packetId(packetId); | ||
| entry.set_section(section); | ||
| entry.set_config(this->m_packetOverride[s][pkt]); | ||
| Svc::PacketConfigBatch batch; | ||
| batch[0] = entry; | ||
| this->configOut_out(0, 1, batch); | ||
| } | ||
|
|
||
| void TlmPacketizer::missingChannel(FwChanIdType id) { | ||
| // search to see if missing channel has already been sent | ||
| for (FwChanIdType slot = 0; slot < TLMPACKETIZER_MAX_MISSING_TLM_CHECK; slot++) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,15 @@ module Svc { | |
| @ Input configuration port | ||
| async input port configureSectionGroupRate: ConfigureGroupRate | ||
|
|
||
| @ Per-packet configuration mirror to persistent storage managed by an external component | ||
| @ Each entry carries the full override for the addressed packet/section and is pushed | ||
| @ whenever an ENABLE_PACKET / FORCE_PACKET / CONFIGURE_PACKET_RATES command changes it. | ||
| output port configOut: TlmPacketConfigUpdate | ||
|
|
||
| @ Per-packet configuration reload from the persistence storage component | ||
| @ That storage component pushes it's config into this port when commanded to do so (usually at boot-up) | ||
| async input port configIn: TlmPacketConfigUpdate | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this was motivated by the use-case... somehow the TlmPacketizer needs to get the persisted packet-overrides after a reboot...this port is the way you get this config in here
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Might need a note here: |
||
|
|
||
| @ Telemetry input port | ||
| sync input port TlmRecv: Fw.Tlm | ||
|
|
||
|
|
@@ -125,6 +134,41 @@ module Svc { | |
| maxDelta: U32 @< Maximum Sched Ticks between packets to send when using EVERY_MAX logic | ||
| ) \ | ||
| opcode 5 | ||
|
|
||
| @ Query the effective per-packet configuration. The result is emitted on the | ||
| @ QueriedPacketConfig telemetry channel; unknown ids raise UnknownPacketId. | ||
| async command GET_PACKET_CONFIG( | ||
| packetId: U32 @< Packet identifier | ||
| section: TelemetrySection @< Section to query | ||
| ) \ | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. after sending this command check the |
||
| opcode 6 | ||
|
|
||
| @ Enable / disable a single packet in a section (per-packet override) | ||
| async command ENABLE_PACKET( | ||
| packetId: U32 @< Packet identifier | ||
| section: TelemetrySection @< Section to configure | ||
| enable: Fw.Enabled @< Enable / disable this packet | ||
| ) \ | ||
| opcode 7 | ||
|
|
||
| @ Force telemeter a single packet even when it (or its section) is disabled | ||
| async command FORCE_PACKET( | ||
| packetId: U32 @< Packet identifier | ||
| section: TelemetrySection @< Section to configure | ||
| enable: Fw.Enabled @< Force enable / disable | ||
| ) \ | ||
| opcode 8 | ||
|
|
||
| @ Configure the rate logic and thresholds for a single packet | ||
| async command CONFIGURE_PACKET_RATES( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Feel like there should also be a command to "reset" or "default" the overwritten packet --> or is that a design decision that the user MUST reconfigure via a manager if they want to revert to group configs? |
||
| packetId: U32 @< Packet identifier | ||
| section: TelemetrySection @< Section to configure | ||
| rateLogic: RateLogic @< Rate logic | ||
| minDelta: U32 @< Minimum Sched ticks between sends (ON_CHANGE_MIN logic) | ||
| maxDelta: U32 @< Maximum Sched ticks between sends (EVERY_MAX logic) | ||
| ) \ | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the three functions above mirror the same functionality available for the "group"-level...now we're exposes the "per-packet" more 'fine-grain' level |
||
| opcode 9 | ||
|
|
||
| @ Parameter to control section enable flags | ||
| external param SECTION_ENABLED: SectionEnabled default TELEMETRY_SECTION_ENABLED_DEFAULTS | ||
| @ Parameter to control section configuration | ||
|
|
@@ -194,6 +238,15 @@ module Svc { | |
| format "Telemetry ID 0x{x} update of size {} exceeds configured size {}" \ | ||
| throttle 10 | ||
|
|
||
|
|
||
| @ A configuration command or query referenced a packet id not present in this deployment | ||
| event UnknownPacketId( | ||
| packetId: U32 @< The packet id | ||
| ) \ | ||
| severity warning low \ | ||
| id 7 \ | ||
| format "Packet id {} not found in packet list" | ||
|
|
||
| # ---------------------------------------------------------------------- | ||
| # Telemetry | ||
| # ---------------------------------------------------------------------- | ||
|
|
@@ -202,6 +255,9 @@ module Svc { | |
| telemetry GroupConfigs: SectionConfigs id 0 | ||
| telemetry SectionEnabled: SectionEnabled id 1 | ||
|
|
||
| @ Effective per-packet configuration, emitted in response to GET_PACKET_CONFIG | ||
| telemetry QueriedPacketConfig: PacketConfigEntry id 2 | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. notice the comment here...esp useful for debugging |
||
|
|
||
| array TelemetrySendSection = [NUM_CONFIGURABLE_TLMPACKETIZER_GROUPS] FwIndexType | ||
| array TelemetrySendPortMap = [TelemetrySection.NUM_SECTIONS] TelemetrySendSection default TELEMETRY_SEND_PORT_MAPPING | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note this "batched config write" feature is required b/c of the
FW_COM_BUFFER_MAX_SIZE(~2k) limitation means we can only send out theconfigOutport so many per-packet override configs serialized at a time...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be moved to
TlmPackizerCfg.fpp