Conversation
|
Hi Goran, I think that the best course of action would be to change the name of the constant to better reflect its purpose (e.g., Please let me know what you think. --MMS |
|
Hi Miro,
Best regards, |
|
Hi Goran,
Sure, a better comment is certainly in order. However, the situation is actually more subtle. The On the other hand, the simplified original statement about "the state nesting depth" is justified insofar that only that many levels have been tested. The QHsm class can probably work for much deeper state nesting, but testing necessarily requires setting some (arbitrary) limit. For safety-critical systems (like in the SafeQP framework), I would rather keep the limit as the required "Condition of Use (COU)", which is needed for safety certification. I hope you understand this functional safety aspect. --MMS |
|
Ok, I see what you mean. You are basically saying to the application developer that the framework will "support" the application and has been tested up to this level. If you cross it, you might still get a functional application, but the framework cannot guarantee that. |
|
Your understanding seems correct. I would actually prefer to tell the application developer sooner rather than later (or not at all) when the state nesting level exceeds the tested threshold. But there is only so much I am willing to pay for it in terms of memory and CPU cycles. I hope this makes sense to you. |
|
Yes it makes perfect sense; overhead of this "fuse" would be too much for the added benefit. |
|
So, to close this PR, I propose the following course of action:
If these action items are agreeable to you, perhaps you can close the PR. |
Eliminates the `m_nestDepth` member variable and all associated dynamic tracking logic in `QHsm` and `QActive`. Renames `MAX_NEST_DEPTH_` to `MAX_TESTED_NEST_DEPTH_` to clarify it represents the maximum tested nesting depth, not a dynamically enforced runtime limit.
|
Based on our last messages, I think we should keep "nest depth" in the name. It feels more descriptive and better explains the purpose from the application developer's perspective (i.e., as a guideline for hierarchy design). I've gone with MAX_TESTED_NEST_DEPTH_ in a follow-up commit, along with an updated comment trying to capture the "tested limit + developer responsibility" nuance we discussed I realize this might still be a bit confusing in some technical senses, and there's probably no perfect name for this constant. Regarding your suggestion: yes, the QM modeling tool should definitely issue a warning when state nesting exceeds this threshold—it would catch potential issues at design time without runtime overhead. What do you think? |
In the current implementations of the QHsm state machines in both QP/C and QP/C++, there is a MAX_NEST_DEPTH_ limit for the maximum nesting depth of the state machine. This limit is checked at various steps in the init and dispatch methods. However, these checks fail to capture situations where initial or regular transitions lead to nested states deeper than the limit. To address this, the nesting depth should be tracked during entry to and exit from each state.
This pull request provides a proposed solution to resolve this issue.
GJ