Is there a way to share channel bandwidth proportionallIy?

Hello, I have my ISP channel bandwidth limit dynamically changing. So I have only maximum possible bandwidth limit. I have 2 types of users 1 - guests and 2 - staff.
The task is

  1. Allow guest users utilize all free channel bandwidth, when it is not used by staff users. So staff users always has priority over guests and they are garanteed to utilize all channel bandwidth.
  2. All available guests bandwidth equally shared between each user. The same for the staff users.
    guest user subnet: 10.1.0.0/28, staff: 10.1.0.32/27
    I have created small tesing environment using virtualboxes. ISP port emulated by linux network interface reducing rate with the TBF
tc qdisc replace dev eth0 root tbf rate 2500Kbit latency 50ms burst 1540

My RouterOS queue tree is:

/queue simple
add limit-at=2200k/2200k max-limit=2200k/2200k name=parent queue=\
    pcq-upload-default/pcq-download-default target=10.1.0.0/24 total-queue=\
    wireless-default
add limit-at=1500k/1500k max-limit=2M/2M name=staff parent=parent priority=\
    4/4 queue=pcq-upload-default/pcq-download-default target=10.1.0.32/27 \
    total-queue=wireless-default
add limit-at=500k/500k max-limit=2M/2M name=guest parent=parent queue=\
    pcq-upload-default/pcq-download-default target=10.1.0.0/28 total-queue=\
    wireless-default

I need you to check also if this configuration is correct for the purposes I have listed above. As I can see It works correctly until ISP bandwidh stands greater that 2200k. But when it goes lower it stops working. I tried to play with priority but is has no effect. I know it is HTB special things. But I am searching for an approach how to share ISP channel bandwidth proportionally. For example if bandwidth goes lower than parent queue limit it starts to share all available between guest and staff as 1500/500. Is it possible somehow? Or some other way how to give rate priority for staff users?

use pcq queue in parent is useless - this work only in leaf child.

htb work fair only if sum of rate<=parent rate. (htb rate == limit-at in ros) if you don’t know current speed, use small limit-at in two child, only proportion between these two matter. so, for example, if expected speed drop to 1000kbit, try limit-at 700kbit and 300kbit or what you want. all over 1000 they will get in proportion 7/3.

do test and say…)

ps:
If you use priority, all these calculations is useless, result is almost unpredictable, probably queue with high priority will get all or something around all

Thank you for your reply. I have already had the idea you suggested. But I did test again exactly with values from your post. It does not work, rate starts changing randomly in classes, like as if there is no any traffic control at all. Here is my test configs, please check if I did exactly what you said:
ISP interface:

 qdisc tbf 8003: dev eth0 root refcnt 2 rate 1100Kbit burst 1539b lat 50.0ms

Queues:

[admin@MikroTik] /queue simple> print
Flags: X - disabled, I - invalid, D - dynamic 
 0    name="parent" target=10.1.0.0/24 parent=none packet-marks="" priority=8/8 
      queue=default/default limit-at=2200k/2200k max-limit=2200k/2200k 
      burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s 
      bucket-size=0.1/0.1 total-queue=wireless-default 

 1    name="staff" target=10.1.0.32/27 parent=parent packet-marks="" 
      priority=4/4 queue=pcq-upload-default/pcq-download-default 
      limit-at=700k/700k max-limit=2M/2M burst-limit=0/0 burst-threshold=0/0 
      burst-time=0s/0s bucket-size=0.1/0.1 total-queue=wireless-default 

 2    name="guest" target=10.1.0.0/28 parent=parent packet-marks="" 
      priority=8/8 queue=pcq-upload-default/pcq-download-default 
      limit-at=300k/300k max-limit=2M/2M burst-limit=0/0 burst-threshold=0/0 
      burst-time=0s/0s bucket-size=0.1/0.1 total-queue=wireless-default

about priority. May be I do something wrong? But I can’t get any effect from it, you see I set 4/4 for staff, so it is expected to catch almost all traffic, but this does not happen.

about priority. limit-at is always guarantee even there is priority

in this setup, up to 1000kbit priority will not work, because two child have guaranteed 300k and 700k.
but if try 2000 as limit in tbf, probably those child with 4/4 priority will get all over 1000 up to 2000 =1700, and those child with 8/8 will stay with his guarantee 300k

by the way, you can use parent max-limit to cut speed, and simplify test without tbf