Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » Default Parameters in Template Bug ?(When using function in template for default parameters, the function is not recall.)
Default Parameters in Template Bug ? [message #1777997] Thu, 07 December 2017 14:07 Go to next message
Emilien Bourdy is currently offline Emilien BourdyFriend
Messages: 5
Registered: December 2017
Junior Member
Hi everyone !

I'm integrating ITS tests used by ETSI with TTWB in TITAN. But to my dismay, for DENM, default parameter for timestamp in the templates use a function to get current time.
But when I execute the tests, this function is called at the begining, before all initialize, and they are not recall, so after two tests, I have 40 s of difference between my time and tester time (I precise that they are on the same machine).

So, my question is : is it a Titan bug, or will it stay like that and change all call to these template to use the function to initialize the parameter.

It's simpler with example : I'm have to change
m_denm(
                    m_denmMgmtConTermination(
                        m_tsActionId,
                        -,
                        c_transmissionInterval * 4 / 1000,
                        c_transmissionInterval
                    ),
                    v_situation,
                    m_denmLocation_zeroDelta
                )

to
m_denm(
                    m_denmMgmtCon(
                        m_tsActionId,
                        -,
                        c_transmissionInterval * 4 / 1000,
                        c_transmissionInterval,
                        f_getCurrentTime(),
                        f_getCurrentTime()
                    ),
                    v_situation,
                    m_denmLocation_zeroDelta
                )

because the template is
template (value) ManagementContainer m_denmMgmtCon(
            template (value) ActionID p_actionID,
            template (value) StationType p_stationType := f_getTsStationType(),
            template (value) ValidityDuration p_validityDuration := defaultValidity,
            template (omit) TransmissionInterval p_transmissionInterval := omit,
            template (value) TimestampIts p_detectionTime := f_getCurrentTime(),
            template (value) TimestampIts p_referenceTime := f_getCurrentTime()
        ) := {
            actionID := p_actionID,
            detectionTime := p_detectionTime,
            referenceTime := p_referenceTime,
            termination := omit,
            eventPosition := m_tsPosition,
            relevanceDistance := lessThan50m,
            relevanceTrafficDirection := allTrafficDirections,
            validityDuration := p_validityDuration,
            transmissionInterval := p_transmissionInterval,
            stationType := p_stationType
        }


I hope I was clear, and you can answer to my question.
Best regards
E. Bourdy
Re: Default Parameters in Template Bug ? [message #1778030 is a reply to message #1777997] Fri, 08 December 2017 11:10 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Emilien,


OK , this is what I understood so far:

If for the template m_denmMgmtCon one relies on the default value of the parameter say p_referenceTime (which is the return value of f_getCurrentTime() ) and invokes this parameter with "-",
like here :

m_denmMgmtConTermination(
                        m_tsActionId,
                        -,
                        c_transmissionInterval * 4 / 1000,
                        c_transmissionInterval,
                        -,    //default:= f_getCurrentTime() 
			-,    //default:=f_getCurrentTime() 
			isCancellation 
                    )


then the value of the parameter stays the same

(Mind that I have used "-" which does not appear in your example; please confirm that this is an oversight from your part)


If instead of the "-" we use the function as parameter, as in:

m_denmMgmtConTermination(
                        m_tsActionId,
                        -,
                        c_transmissionInterval * 4 / 1000,
                        c_transmissionInterval,
                        f_getCurrentTime(), 
			f_getCurrentTime(), 
			isCancellation 
                    )




then the parameter value changes accordingly at every new invokation.


Please confirm that I understood correctly;


I have verified it and this is indeed the current behaviour.
I can't tell yet you whether this is a fault or not ; we have to look into the standard carefully;

I will come back to you soonest


Best regards

Elemer


[Updated on: Fri, 08 December 2017 16:02]

Report message to a moderator

Re: Default Parameters in Template Bug ? [message #1778036 is a reply to message #1778030] Fri, 08 December 2017 12:44 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Emilien,


you might also be interested in the following:


we have an ITS suite (not the most recent one though ) which is functional and adapted to Titan, see here:

https://github.com/elnrnag/ITSG5_TS_Titanized_TA

-the test ports used are a hybrid of our adaptations and the ETSI Java test adapters ( so the ATS is connected to these adapters)
-the PER codecs are based on asn1c

Most of the code been tested and working against a Cohda box

We are working on the latest version of the code , but for that we don't have an open source PER codec solution.


If interested in details pls contact https://github.com/elnrnag

BR

Elemer


[Updated on: Fri, 08 December 2017 16:03]

Report message to a moderator

Re: Default Parameters in Template Bug ? [message #1778253 is a reply to message #1778036] Tue, 12 December 2017 11:11 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Emilien,

Here's our conclusion:
- this is a side effect of a speed optimization:
Titan calls the function referred as default parameter at the beginning of execution
and then reuses the return value to save time;

This works well for deterministic functions , but causes problems with non-deterministic ones , as those that depend on time.
What we can offer as a solution is to implement the standard behaviour in runtime 2 (function test runtime) ,
but keeping the current behaviour in the default runtime (runtime 1 , load test runtime) .

Practically this means that users of runtime 1 will have to continue to use direct function references as parameters as you did.

Users of runtime 2 will have the choice of using the standard notation for default "-".

I don't have an ETA for this modification, most likely it will be added during January.

BR
Elemer
Re: Default Parameters in Template Bug ? [message #1778254 is a reply to message #1778036] Tue, 12 December 2017 11:13 Go to previous messageGo to next message
Emilien Bourdy is currently offline Emilien BourdyFriend
Messages: 5
Registered: December 2017
Junior Member
Hi Elemer,

Thanks for your answer.

You get it, it's because with m_denmConMgmt template, termination is set to omit, so from detectionTime to termination they are initialized with default value.

I've ask Yann Garcia from FSCOM to know if there is a detail on TTCN standard and he answer that if we want default value initiliazed only at the beginning it should be taged @deterministic to not re-evaluate the value each time we need default value.

For your ITS test suite, I'll see if we can use it with our ITS stack (I don't know why we couldn't), because we made codec for CAM/DENM/GN but when we saw that ETSI was working on ACPorts for GeoNetworking, we decided to wait until they end this part.

Emilien
Re: Default Parameters in Template Bug ? [message #1778258 is a reply to message #1778254] Tue, 12 December 2017 11:38 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Emilien,

yes, we know about the @deterministic, but it poses two problems;

-first , the majority of functions are deterministic , so it would be easier to mark those which aren't (with @nondeterministic maybe?)
-secondly it would cause legacy problems, as in our existing test suites with speed requirements the functions are not marked with @deterministic so the above modification
would cause issues


However, we will be evaluating the different options

BR

Elemer



Re: Default Parameters in Template Bug ? [message #1780101 is a reply to message #1778258] Wed, 17 January 2018 12:03 Go to previous message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Emilien,

we have implemented the correction in Runtime 2 , as discussed above,

see https://bugs.eclipse.org/bugs/show_bug.cgi?id=529019

We will not release a binary at this time, if you need this modification please compile from source.

You can migrate your project to Runtime 2 with a loss of speed of execution you will probably not notice.

To change your project you will have to do the following modifications in your Makefile (after running a make clean first of course):

1. add -DTITAN_RUNTIME_2 to CPPFLAGS:

# Flags for the C++ preprocessor (and makedepend as well):
CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)/include -DTITAN_RUNTIME_2


2. add -R to compiler flags:

# Flags for the TTCN-3 and ASN.1 compiler:
COMPILER_FLAGS = -L ..other flags.. -R


3.change TTCN3_LIB to ttcn3-rt2 or ttcn3-rt2-parallel (from ttcn3 or ttcn3-parallel)

# Execution mode: (either ttcn3 or ttcn3-parallel)
TTCN3_LIB = ttcn3-rt2-parallel




Best regards
Elemer
Previous Topic:TTCN-3 template question
Next Topic:Debug: Using the value of an optional field containing omit
Goto Forum:
  


Current Time: Fri Apr 19 13:09:15 GMT 2024

Powered by FUDForum. Page generated in 0.02421 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top