-
-
Notifications
You must be signed in to change notification settings - Fork 511
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
Ensure only one PowerCommand and ActivePowerCommand is queued #1093
base: master
Are you sure you want to change the base?
Conversation
neither a PowerCommand nor an ActivePowerCommand shall be enqueued if another one is already pending.
Reading up on this in relation to #1201. While I understand your restriction to one of the commands each per command type and inverter in the queue, I think there might be two intended solutions: a) FIFO: as you described allow only one command per type and inverter and do not allow new commands until this has executed. b) LIFO: allow only one command per type and inverter and remove the old command from and add the new command instead to the queue. This may be more complex as we would need to discard the inverter response from the radio, eventually discarding received data and preventing the radio loop to request potentially missing frames / packets. Also note that the radio may have to send multiple packets or frames and/or may receive multiple response packets / frames. For multiframe responses the radio may have to re-request the missing packets. |
@schlimmchen I had an other thought when reviewing this with #2237 in mind. We could add a target (and actual) value to each of our inverters. We may consider to keep the current blocking behaviour in case a permanent Limit is set, as we want to make sure this is followed. What will the Inverter (ex. HM600) actually do, when we first set a permanent limit of 400W, then a temporary limit of 300W and at last set a permanent limit of 600W ? |
You mean something like updateInverter() in OpenDTU-OnBattery?
It will produce 400W once the 400W limit was received, then 300W when the 300W limit was received, then 600W when the 600W limit was received. Frankly, I don't understand the question 😉 Oh, you send a persistent limit in the last step, okay. Well, it's like I said. The limit sent is the limit applied. The only difference it that the limit is persisted or not. I am not sure what your proposal changes with regard to this PR. This change is implemented in OpenDTU-OnBattery -- but maybe it could be reverted to the upstream state? I am not sure... I did not sufficiently annotate the change, so I can't say why this was or maybe still is important for the DPL. I'll look into it again some time. |
@schlimmchen the reason I was asking about temporary vs. persistent limits is that with the above approach we just update a "soft" target limit in the OpenDTU and do not need to guarantee that it will be actually sent to the inverter in due time. E.g. in case a newer temporary limit is given we then try to send the new limit instead. |
Neither a PowerCommand nor an ActivePowerCommand shall be enqueued if another one (of the same type) is already pending.
Adding multiple
PowerCommand
s orActivePowerCommand
s is not bad in general, but suppose the following situation:ActivePowerCommand
was queued and the command state was set toCMD_PENDING
.ActivePowerCommand
is queued and the command state is set toCMD_PENDING
again.ActivePowerCommand
. The "last command state" is changed toCMD_OK
orCMD_NOK
.ActivePowerCommand
pending, but the "last command state" is notCMD_PENDING
.This check restricts one of each of the commands per inverter. It seems to me that this is a reasonable limitation.
Another possible solution might be to check the radio queue for other commands of the same type and keeping the
CMD_PENDING
state. This is computationally more expensive, but would make sure that racing commands would all be processed. The current implementation will reject a second command of the same type.