Fix issue with CBS

This commit is contained in:
2025-12-02 11:43:04 +01:00
parent cd9ba93d58
commit c93ec89664
5 changed files with 34 additions and 7 deletions

View File

@@ -64,9 +64,6 @@ Cbs::IsReadyToTransmit()
{
NS_LOG_FUNCTION(this);
if(m_credit>=0){
if (m_state==WAITING){
UpdateCredit(false);
}
return true;
}
else{
@@ -75,6 +72,26 @@ Cbs::IsReadyToTransmit()
}
}
void
Cbs::Update()
{
NS_LOG_FUNCTION(this);
if (m_state != TRANSMITTING)
{
if (m_queue->IsEmpty())
{
m_state = IDLE;
}
else
{
m_state = WAITING;
}
}
UpdateCredit(false);
}
void
Cbs::UpdateCredit(bool trigger_cb)
{
@@ -82,8 +99,6 @@ Cbs::UpdateCredit(bool trigger_cb)
NS_ASSERT_MSG(m_idleSlope < m_maxIdleSlope, "Trying to use an idleSlope higher than " << m_maxIdleSlope << ".");
Time sinceLastCreditUpdate = Simulator::Now() - m_lastUpdateCreditTime;
NS_LOG_INFO(sinceLastCreditUpdate);
NS_LOG_INFO("State = " << m_state);
if(m_transmissionGateIsOpen){
if(m_state == WAITING)
{