Commit f797a956 authored by Aurélien Delrieu's avatar Aurélien Delrieu

Remove simulated MODCODs from core src

parent 928d0706
......@@ -992,7 +992,6 @@ BlockDvbNcc::Upward::~Upward()
bool BlockDvbNcc::Upward::onInit(void)
{
bool result = true;
bool with_phy_layer;
map<spot_id_t, DvbChannel *>::iterator spot_iter;
if(!this->initSatType())
......@@ -1010,17 +1009,6 @@ bool BlockDvbNcc::Upward::onInit(void)
return false;
}
// Retrieve the value of the ‘enable’ parameter for the physical layer
if(!Conf::getValue(Conf::section_map[PHYSICAL_LAYER_SECTION],
ENABLE,
with_phy_layer))
{
LOG(this->log_init, LEVEL_ERROR,
"Section %s, %s missing\n",
PHYSICAL_LAYER_SECTION, ENABLE);
return false;
}
for(spot_iter = this->spots.begin();
spot_iter != this->spots.end(); ++spot_iter)
{
......@@ -1047,52 +1035,6 @@ bool BlockDvbNcc::Upward::onInit(void)
(*spot_iter).second = spot;
result &= spot->onInit();
// Launch the timer in order to retrieve the modcods if there is no physical layer
if(!with_phy_layer)
{
spot->setModcodTimer(this->addTimerEvent("scenario",
// the duration will be change when started
5000,
false, // no rearm
false // do not start
));
this->raiseTimer(spot->getModcodTimer());
}
}
if(with_phy_layer && this->satellite_type == TRANSPARENT)
{
string generate;
time_ms_t acm_period_ms;
// Check whether we generate the time series
if(!Conf::getValue(Conf::section_map[PHYSICAL_LAYER_SECTION],
GENERATE_TIME_SERIES_PATH, generate))
{
LOG(this->log_init_channel, LEVEL_ERROR,
"Section %s, %s missing\n",
PHYSICAL_LAYER_SECTION, GENERATE_TIME_SERIES_PATH);
return false;
}
if(generate != "none")
{
if(!Conf::getValue(Conf::section_map[PHYSICAL_LAYER_SECTION],
ACM_PERIOD_REFRESH,
acm_period_ms))
{
LOG(this->log_init, LEVEL_ERROR,
"section '%s': missing parameter '%s'\n",
PHYSICAL_LAYER_SECTION, ACM_PERIOD_REFRESH);
return false;
}
LOG(this->log_init, LEVEL_NOTICE,
"ACM period set to %d ms\n",
acm_period_ms);
this->modcod_timer = this->addTimerEvent("generate_time_series",
acm_period_ms);
}
}
if(result)
......@@ -1194,6 +1136,7 @@ bool BlockDvbNcc::Upward::onEvent(const RtEvent *const event)
break;
case MSG_TYPE_SESSION_LOGON_REQ:
{
LOG(this->log_receive, LEVEL_INFO,
"Logon Req\n");
if(!spot->onRcvLogonReq(dvb_frame))
......@@ -1205,25 +1148,30 @@ bool BlockDvbNcc::Upward::onEvent(const RtEvent *const event)
{
return false;
}
break;
}
break;
case MSG_TYPE_SESSION_LOGOFF:
{
LOG(this->log_receive, LEVEL_INFO,
"Logoff Req\n");
if(!this->shareFrame(dvb_frame))
{
return false;
}
break;
}
break;
case MSG_TYPE_TTP:
case MSG_TYPE_SESSION_LOGON_RESP:
{
// nothing to do in this case
LOG(this->log_receive, LEVEL_DEBUG,
"ignore TTP or logon response "
"(type = %d)\n", dvb_frame->getMessageType());
delete dvb_frame;
break;
}
break;
case MSG_TYPE_SOF:
{
......@@ -1276,89 +1224,31 @@ bool BlockDvbNcc::Upward::onEvent(const RtEvent *const event)
// Slotted Aloha
case MSG_TYPE_SALOHA_DATA:
{
if(!spot->handleSlottedAlohaFrame(dvb_frame))
{
return false;
}
break;
}
break;
case MSG_TYPE_SALOHA_CTRL:
{
delete dvb_frame;
break;
}
break;
default:
{
LOG(this->log_receive, LEVEL_ERROR,
"unknown type (%d) of DVB frame\n",
dvb_frame->getMessageType());
delete dvb_frame;
return false;
break;
}
}
case evt_timer:
{
map<spot_id_t, DvbChannel *>::iterator spot_iter;
for(spot_iter = this->spots.begin();
spot_iter != this->spots.end(); ++spot_iter)
{
SpotUpward *spot;
spot = dynamic_cast<SpotUpward *>((*spot_iter).second);
if(!spot)
{
LOG(this->log_receive, LEVEL_WARNING,
"Error when getting spot\n");
return false;
}
if(*event == spot->getModcodTimer())
{
// it's time to update MODCOD IDs
LOG(this->log_receive, LEVEL_DEBUG,
"MODCOD scenario timer received\n");
double duration;
if(!spot->goNextScenarioStepInput(duration))
{
LOG(this->log_receive, LEVEL_ERROR,
"SF#%u: failed to update MODCOD IDs\n",
this->super_frame_counter);
return false;
}
else
{
LOG(this->log_receive, LEVEL_DEBUG,
"SF#%u: MODCOD IDs successfully updated\n",
this->super_frame_counter);
}
if(duration <= 0)
{
// we reached the end of the file (or it is malformed)
// so we keep the modcod as they are
this->removeEvent(spot->getModcodTimer());
}
else
{
this->setDuration(spot->getModcodTimer(), duration);
this->startTimer(spot->getModcodTimer());
}
}
else if(*event == this->modcod_timer)
{
if(!spot->updateSeriesGenerator())
{
LOG(this->log_receive, LEVEL_ERROR,
"SF#%u:Stop time series generation\n",
this->super_frame_counter);
this->removeEvent(this->modcod_timer);
return false;
}
}
break;
}
}
break;
default:
......
......@@ -497,27 +497,11 @@ bool BlockDvbSat::Downward::onEvent(const RtEvent *const event)
}
}
}
// Scenario timer
else
{
bool found = false;
sat_gws_t::iterator gw_it;
for(gw_it = this->gws.begin(); gw_it != this->gws.end(); ++gw_it)
{
SatGw *current_gw = gw_it->second;
if(*event == current_gw->getScenarioTimer())
{
this->handleScenarioTimer(current_gw);
found = true;
break;
}
}
if(!found)
{
LOG(this->log_receive, LEVEL_ERROR,
"unknown timer event received %s\n",
event->getName().c_str());
}
LOG(this->log_receive, LEVEL_ERROR,
"unknown timer event received %s\n",
event->getName().c_str());
}
}
break;
......@@ -651,17 +635,6 @@ bool BlockDvbSat::Upward::onInit()
"initialisation\n");
return false;
}
// Retrieve the value of the ‘enable’ parameter for the physical layer
if(!Conf::getValue(Conf::section_map[PHYSICAL_LAYER_SECTION],
ENABLE,
this->with_phy_layer))
{
LOG(this->log_init, LEVEL_ERROR,
"Section %s, %s missing\n",
PHYSICAL_LAYER_SECTION, ENABLE);
return false;
}
return true;
}
......@@ -727,22 +700,6 @@ bool BlockDvbSat::Upward::onEvent(const RtEvent *const event)
}
break;
case evt_timer:
{
if(*event == this->modcod_timer)
{
if(!this->updateSeriesGenerator())
{
LOG(this->log_receive, LEVEL_ERROR,
"SF#%u:Stop time series generation\n",
this->super_frame_counter);
this->removeEvent(this->modcod_timer);
return false;
}
}
}
break;
default:
LOG(this->log_receive, LEVEL_ERROR,
"unknown event: %s", event->getName().c_str());
......
......@@ -90,9 +90,6 @@ class BlockDvbSat: public BlockDvb
/// reception standard (DVB-RCS or DVB-S2)
PhysicStd *reception_std;
/// Physical layer enable
bool with_phy_layer;
/**
* Called upon reception event it is another layer (below on event) of demultiplexing
* Do the appropriate treatment according to the type of the DVB message
......@@ -172,12 +169,6 @@ class BlockDvbSat: public BlockDvb
*/
virtual bool handleSaloha(DvbFrame *dvb_frame,
SatGw *current_gw) = 0;
/**
* @brief Add a new line in the MODCOD time series generator file
*
* @return true on success, false otherwise
*/
virtual bool updateSeriesGenerator(void) = 0;
/// The satellite spots
sat_gws_t gws;
......@@ -220,13 +211,6 @@ class BlockDvbSat: public BlockDvb
* @return true on success, false otherwise
*/
virtual bool handleTimerEvent(SatGw *current_gw) = 0;
/**
* @ brief handle scenario event timer
*
* @return true on success, false otherwise
*/
virtual bool handleScenarioTimer(SatGw *current_gw) = 0;
/**
* @brief Initialize the link
......
......@@ -165,7 +165,6 @@ BlockDvbTal::Downward::Downward(const string &name, tal_id_t mac_id):
scpc_carr_duration_ms(0),
scpc_timer(-1),
ret_fmt_groups(),
scpc_fmt_simu(),
scpc_sched(NULL),
scpc_frame_counter(0),
carrier_id_ctrl(),
......@@ -247,13 +246,6 @@ bool BlockDvbTal::Downward::onInit(void)
return false;
}
if(!this->initFmt())
{
LOG(this->log_init_channel, LEVEL_ERROR,
"failed to complete the FMT part of the initialisation\n");
return false;
}
// get the common parameters
if(!this->initCommon(RETURN_UP_ENCAP_SCHEME_LIST))
{
......@@ -654,7 +646,7 @@ bool BlockDvbTal::Downward::initDama(void)
}
}
// init fmt_simu
// init
if(!this->initModcodDefFile(this->modcod_def_rcs_type.c_str(),
&this->rcs_modcod_def,
this->req_burst_length))
......@@ -1144,17 +1136,6 @@ bool BlockDvbTal::Downward::initScpc(void)
ConfigurationList current_spot;
// init scpc_fmt_simu
// TODO: we take forward because we need S2
if(!this->initModcodSimuFile(RETURN_UP_MODCOD_TIME_SERIES,
this->scpc_fmt_simu,
this->group_id, this->spot_id))
{
LOG(this->log_init, LEVEL_ERROR,
"failed to initialize the down/forward MODCOD files\n");
return false;
}
// Duration of the carrier -- in ms
if(!Conf::getValue(Conf::section_map[SCPC_SECTION],
SCPC_C_DURATION,
......@@ -2373,42 +2354,6 @@ bool BlockDvbTal::Upward::onEvent(const RtEvent *const event)
}
break;
case evt_timer:
{
if(*event == this->modcod_timer)
{
// it's time to update MODCOD IDs
LOG(this->log_receive, LEVEL_DEBUG,
"MODCOD scenario timer received\n");
double duration;
if(!this->goNextScenarioStepInput(duration))
{
LOG(this->log_receive, LEVEL_ERROR,
"SF#%u: failed to update MODCOD IDs\n",
this->super_frame_counter);
}
else
{
LOG(this->log_receive, LEVEL_DEBUG,
"SF#%u: MODCOD IDs successfully updated\n",
this->super_frame_counter);
}
if(duration <= 0)
{
// we hare reach the end of the file (of it is malformed)
// so we keep the modcod as they are
this->removeEvent(this->modcod_timer);
}
else
{
this->setDuration(this->modcod_timer, duration);
this->startTimer(this->modcod_timer);
}
}
}
break;
default:
LOG(this->log_receive, LEVEL_ERROR,
"SF#%u: unknown event received %s",
......@@ -2465,13 +2410,6 @@ bool BlockDvbTal::Upward::onInit(void)
return false;
}
if(!this->initFmt())
{
LOG(this->log_init_channel, LEVEL_ERROR,
"failed to complete the FMT part of the initialisation\n");
return false;
}
// get the common parameters
if(!this->initCommon(FORWARD_DOWN_ENCAP_SCHEME_LIST))
{
......@@ -2504,19 +2442,6 @@ bool BlockDvbTal::Upward::onInit(void)
return false;
}
// Launch the timer in order to retrieve the modcods if there is no physical layer
// or to send SAC with ACM parameters in regenerative mode
if(!this->with_phy_layer || this->satellite_type == REGENERATIVE)
{
this->modcod_timer = this->addTimerEvent("scenario",
5000, // the duration will be change when started
false, // no rearm
false // do not start
);
this->raiseTimer(this->modcod_timer);
}
// we synchornize with SoF reception so use the return frame duration here
this->initStatsTimer(this->ret_up_frame_duration_ms);
......@@ -2556,14 +2481,6 @@ bool BlockDvbTal::Upward::initModcodSimu(void)
return false;
}
if(!this->initModcodSimuFile(FORWARD_DOWN_MODCOD_TIME_SERIES,
gw_id, this->spot_id))
{
LOG(this->log_init_channel, LEVEL_ERROR,
"failed to initialize the downlink MODCOD files\n");
return false;
}
if(!this->initModcodDefFile(MODCOD_DEF_S2,
&this->s2_modcod_def))
{
......@@ -2583,27 +2500,12 @@ bool BlockDvbTal::Upward::initModcodSimu(void)
}
}
// initialize the MODCOD IDs
if(!this->fmt_simu.goFirstScenarioStep())
{
LOG(this->log_init_channel, LEVEL_ERROR,
"failed to initialize MODCOD scheme IDs\n");
return false;
}
return true;
}
bool BlockDvbTal::Upward::initOutput(void)
{
if(!this->with_phy_layer)
{
// maximum modcod if physical layer is enabled => not useful
this->probe_st_required_modcod = Output::registerProbe<int>("Down_Forward_modcod.Required_modcod",
"modcod index",
true, SAMPLE_LAST);
}
this->probe_st_received_modcod = Output::registerProbe<int>("Down_Forward_modcod.Received_modcod",
"modcod index",
true, SAMPLE_LAST);
......@@ -2642,12 +2544,9 @@ bool BlockDvbTal::Upward::onRcvDvbFrame(DvbFrame *dvb_frame)
NetBurst *burst = NULL;
DvbS2Std *std = (DvbS2Std *)this->reception_std;
if(this->with_phy_layer)
{
// get ACM parameters that will be transmited to GW in SAC
double cni = dvb_frame->getCn();
this->setRequiredCniInput(this->tal_id, cni);
}
// get ACM parameters that will be transmited to GW in SAC
double cni = dvb_frame->getCn();
this->setRequiredCniInput(this->tal_id, cni);
// Update stats
this->l2_from_sat_bytes += dvb_frame->getMessageLength();
......@@ -2698,10 +2597,6 @@ bool BlockDvbTal::Upward::onRcvDvbFrame(DvbFrame *dvb_frame)
if(!corrupted)
{
// update MODCOD probes
if(!this->with_phy_layer)
{
this->probe_st_required_modcod->put(std->getRealModcod());
}
this->probe_st_received_modcod->put(std->getReceivedModcod());
this->probe_st_rejected_modcod->put(0);
}
......@@ -2754,12 +2649,9 @@ bool BlockDvbTal::Upward::onRcvDvbFrame(DvbFrame *dvb_frame)
if(this->state == state_running)
{
if(this->with_phy_layer && dvb_frame->getMessageType() == MSG_TYPE_TTP)
{
// get ACM parameters that will be transmited to GW in SAC
double cni = dvb_frame->getCn();
this->setRequiredCniInput(this->tal_id, cni);
}
// get ACM parameters that will be transmited to GW in SAC
double cni = dvb_frame->getCn();
this->setRequiredCniInput(this->tal_id, cni);
if(!this->shareFrame(dvb_frame))
{
......@@ -2903,7 +2795,7 @@ bool BlockDvbTal::Upward::onRcvLogonResp(DvbFrame *dvb_frame)
" %u\n", this->super_frame_counter,
this->group_id, this->tal_id);
// Add the st id in the fmt_simu
// Add the st id
if(!this->addInputTerminal(this->tal_id, this->s2_modcod_def))
{
LOG(this->log_receive_channel, LEVEL_ERROR,
......
......@@ -398,9 +398,6 @@ class BlockDvbTal: public BlockDvb
/// FMT groups for up/return
fmt_groups_t ret_fmt_groups;
// The MODCOD simulation elements for up/return link for scpc
FmtSimulation scpc_fmt_simu;
/// The uplink of forward scheduling depending on satellite
Scheduling *scpc_sched;
......
......@@ -345,22 +345,6 @@ bool DvbChannel::doSendStats(void)
/***** DvbFmt ****/
bool DvbFmt::initFmt(void)
{
// Retrieve the value of the ‘enable’ parameter for the physical layer
if(!Conf::getValue(Conf::section_map[PHYSICAL_LAYER_SECTION],
ENABLE, this->with_phy_layer))
{
LOG(this->log_fmt, LEVEL_ERROR,
"Section %s, %s missing\n",
PHYSICAL_LAYER_SECTION, ENABLE);
return false;
}
return true;
}
bool DvbFmt::initModcodDefFile(const char *def, FmtDefinitionTable **modcod_def, vol_sym_t req_burst_length)
{
string modcod_def_file;
......@@ -393,107 +377,13 @@ bool DvbFmt::initModcodDefFile(const char *def, FmtDefinitionTable **modcod_def,
return true;
}
bool DvbFmt::initModcodSimuFile(const char *simu,
tal_id_t gw_id, spot_id_t spot_id)
{
return this->initModcodSimuFile(simu, this->fmt_simu, gw_id, spot_id);
}
bool DvbFmt::initModcodSimuFile(const char *simu,
FmtSimulation &fmt_simu,
tal_id_t gw_id,
spot_id_t spot_id)
{
string modcod_simu_file;
ConfigurationList current_gw;
time_ms_t acm_period_ms;
bool loop_on_simu_file;
if(this->with_phy_layer)
{
return true;
}
if(!OpenSandConf::getSpot(PHYSICAL_LAYER_SECTION,
spot_id, gw_id, current_gw))
{
LOG(this->log_fmt, LEVEL_ERROR,
"section '%s', missing spot for id %d and gw %d\n",
PHYSICAL_LAYER_SECTION, spot_id, gw_id);
return false;
}
if(!Conf::getValue(Conf::section_map[PHYSICAL_LAYER_SECTION],
ACM_PERIOD_REFRESH,
acm_period_ms))
{
LOG(this->log_fmt, LEVEL_ERROR,
"section '%s': missing parameter '%s'\n",
PHYSICAL_LAYER_SECTION, ACM_PERIOD_REFRESH);
return false;
}
LOG(this->log_fmt, LEVEL_NOTICE,
"ACM period set to %d ms\n",
acm_period_ms);
if(!Conf::getValue(current_gw, simu, modcod_simu_file))
{
LOG(this->log_fmt, LEVEL_ERROR,
"section '%s/spot_%d_gw_%d', missing section '%s'\n",
PHYSICAL_LAYER_SECTION, spot_id, gw_id, simu);
return false;
}
if(!Conf::getValue(current_gw, LOOP_ON_FILE,
loop_on_simu_file))
{
LOG(this->log_fmt, LEVEL_ERROR,
"section '%s/spot_%d_gw_%d', missing section '%s'\n",
PHYSICAL_LAYER_SECTION, spot_id, gw_id, LOOP_ON_FILE);
return false;
}
LOG(this->log_fmt, LEVEL_NOTICE,
"MODCOD simulation path set to %s\n",
modcod_simu_file.c_str());
// set the MODCOD simulation file
if(!fmt_simu.setModcodSimu(modcod_simu_file,
acm_period_ms,
loop_on_simu_file))
{
return false;
}
return true;
}
bool DvbFmt::addInputTerminal(tal_id_t id,
const FmtDefinitionTable *const modcod_def)
{
fmt_id_t modcod;
// the column is the id
tal_id_t column = id;
if(this->fmt_simu.getIsModcodSimuDefined() &&
this->fmt_simu.getModcodList().size() <= column)
{
log_level_t lvl = LEVEL_WARNING;
if(id > BROADCAST_TAL_ID)
{
// no need to print warning for simulated terminals
lvl = LEVEL_NOTICE;
}
LOG(this->log_fmt, lvl,
"cannot access MODCOD column for ST%u\n"
"default MODCOD is used\n", id);
column = this->fmt_simu.getModcodList().size() - 1;
}
// if scenario are not defined, set less robust modcod at init
modcod = (this->fmt_simu.getIsModcodSimuDefined() ?
atoi(this->fmt_simu.getModcodList()[column].c_str()) :
modcod_def->getMaxId());
// set less robust modcod at init
modcod = modcod_def->getMaxId();
this->input_sts->addTerminal(id, modcod, modcod_def);
return true;
......@@ -527,19 +417,6 @@ bool DvbFmt::delOutputTerminal(tal_id_t id)
}
bool DvbFmt::goNextScenarioStepInput(double &duration)
{
if(!this->fmt_simu.goNextScenarioStep(duration))
{
return false;
}
this->input_sts->updateModcod(this->fmt_simu);
return true;
}
void DvbFmt::setInputSts(StFmtSimuList *new_input_sts)
{
this->input_sts = new_input_sts;
......
......@@ -74,7 +74,6 @@ class DvbChannel
pkt_hdl(NULL),
stats_period_ms(),
stats_period_frame(),
modcod_timer(-1),
log_init_channel(NULL),
log_receive_channel(NULL),
log_send_channel(NULL),
......@@ -302,9 +301,6 @@ class DvbChannel
time_ms_t stats_period_ms;