Table Of Contents
Table Of Contents

Changing a Timer

Some changes in a model’s timers might break fingerprints, but otherwise wouldn’t invalidate the model, such as timers which don’t affect the model’s behavior. However, the change in the timers might break the default ingredient fingerprint tests. In such case, the events or modules that contain the timer need to be filtered:

  • Before making the change, filter the events or modules which involve the affected timer, and calculate the fingerprints

  • Accept the new fingerprint values

  • Make the change

  • Rerun the fingerprint tests with the same filtering

The tests should pass.

As a simplistic example, we’ll change how the removeNonInterferingTransmissionsTimer is scheduled in RadioMedium.cc. The timer deletes transmissions that no longer cause any interference (e.g. they have already left the vicinity of network nodes).

We run the fingerprint tests and filter the events in the RadioMedium module:

$ inet_fingerprinttest -m ChangingTimer -a --fingerprint-events='"not name=~removeNonInterferingTransmissions"'
. -f omnetpp.ini -c Wifi -r 0  ... : FAILED

The tests fail because the set of events used to calculate them changed. Since there was no change in the model, just in how the fingerprints are calculated, the .csv file can be updated with the new values:

$ mv baseline.csv.UPDATED baseline.csv

Now, we change the timer:

--- /docs/doc/src/tutorials/fingerprint/RadioMedium.cc.orig
+++ /docs/doc/src/tutorials/fingerprint/RadioMedium.cc.mod
@@ -244,7 +244,7 @@
     communicationCache->mapTransmissions([&] (const ITransmission *transmission) {
         auto interferenceEndTime = communicationCache->getCachedInterferenceEndTime(transmission);
         if (!removeNonInterferingTransmissionsTimer->isScheduled() && interferenceEndTime > simTime())
-            scheduleAt(interferenceEndTime, removeNonInterferingTransmissionsTimer);
+            scheduleAt(interferenceEndTime + 1E-6, removeNonInterferingTransmissionsTimer);
     });
 }
 

We re-run the fingerprint tests:

$ inet_fingerprinttest -m ChangingTimer -a --fingerprint-events='"not name=~removeNonInterferingTransmissions"'
. -f omnetpp.ini -c Wifi -r 0  ... : PASS

The model is verified. The fingerprints can be calculated without filtering, and the .csv file can be updated with the new values. This process is described in more detail in the Accepting Fingerprint Changes step.