Ciao a tutti ho un problema in merito all'ereditarietà di una funzione :
Questa è la funzione che si trova nella classe padre :
TypeId
WifiRadioEnergyModel::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::WifiRadioEnergyModel")
.SetParent<DeviceEnergyModel> ()
.AddConstructor<WifiRadioEnergyModel> ()
.AddAttribute ("IdleCurrentA",
"The default radio Idle current in Ampere.",
DoubleValue (0.000426), // idle mode = 426uA
MakeDoubleAccessor (&WifiRadioEnergyModel::SetIdleCurrentA,
&WifiRadioEnergyModel::GetIdleCurrentA),
MakeDoubleChecker<double> ())
.AddAttribute ("CcaBusyCurrentA",
"The default radio CCA Busy State current in Ampere.",
DoubleValue (0.000426), // default to be the same as idle mode
MakeDoubleAccessor (&WifiRadioEnergyModel::SetCcaBusyCurrentA,
&WifiRadioEnergyModel::GetCcaBusyCurrentA),
MakeDoubleChecker<double> ())
.AddAttribute ("TxCurrentA",
"The radio Tx current in Ampere.",
DoubleValue (0.0174), // transmit at 0dBm = 17.4mA
MakeDoubleAccessor (&WifiRadioEnergyModel::SetTxCurrentA,
&WifiRadioEnergyModel::GetTxCurrentA),
MakeDoubleChecker<double> ())
.AddAttribute ("RxCurrentA",
"The radio Rx current in Ampere.",
DoubleValue (0.0197), // receive mode = 19.7mA
MakeDoubleAccessor (&WifiRadioEnergyModel::SetRxCurrentA,
&WifiRadioEnergyModel::GetRxCurrentA),
MakeDoubleChecker<double> ())
.AddAttribute ("SwitchingCurrentA",
"The default radio Channel Switch current in Ampere.",
DoubleValue (0.000426), // default to be the same as idle mode
MakeDoubleAccessor (&WifiRadioEnergyModel::SetSwitchingCurrentA,
&WifiRadioEnergyModel::GetSwitchingCurrentA),
MakeDoubleChecker<double> ())
.AddTraceSource ("TotalEnergyConsumption",
"Total energy consumption of the radio device.",
MakeTraceSourceAccessor (&WifiRadioEnergyModel::m_totalEnergyConsumption))
;
return tid;
}
La classe figlia deve richiamare questo metodo e aggiungere questo codice
AddAttribute ("Potenza",
"The default power in db",
DoubleValue (0.2),
MakeDoubleAccessor (&WifiRadioModelloEnergetico::SetPowerLevel,
&WifiRadioModelloEnergetico::GetPowerLevel),
MakeDoubleChecker<double> ());
Confido in un vostro aiuto..grazie anticipatamente