Home AMX User Forum NetLinx Studio

timeline id duplicate in a module

I have defined a timeline id in the main program, and then use a module which also defined with the same timeline id. It seems work without any problem. But I am wondering how the compiler do with such a case? Any idea?

Comments

  • viningvining Posts: 4,368
    Everything declared in module has an additional idenifier added to the name so while the compiler sees something like TL1 for the main timeline 1 it sees and references something like somemod_instance-1_TL1 . Obviously not quite like that but you get the idea. Same applies for contants, variable, etc. which is why everything declared in a module instance is unique to that instance because the compiler appends or prepends and idenifier specific to the module instance.
  • f0ghuaf0ghua Posts: 16
    Well, thanks vining, but what I concern is the id number(the value, not the name) of timeline. since the timeline "TL_MAIN=1" declared in main program and "TL_MODULE=1" in module both have id '1', how does the compiler distinguish them? ( you know, when we defined 2 timelines with different name but same value in the main program, one of them will not work)
  • viningvining Posts: 4,368
    The same thing still applies after all what's a name or a number to the compiler basically they're same thing just a bunch of 1s & 0s. anything declared in a module only exists in the module and the program references them by appending or prepending a unique id for that module and instance.
  • f0ghuaf0ghua Posts: 16
    Got it. Thanks again.
  • ericmedleyericmedley Posts: 4,177
    Vining is correct. Your concerns are, however, natural in that the timeline sits kind of funny in the normal logic of things. If we were talking about a device being declared inside a module or using a device inside a module that happens to occur elsewhere in code, then we do indeed have to mind the fact that a button/channel/level/custom event will indeed fire in and out of the module(s).

    So, since the TIMELINE_EVENT is indeed an event, one could easily assume the same behavior would apply. However, this is not the case. TIMELINE_EVENTs are indeed isolated within the module(s) and do not traverse to the rest of the program.

    This is just one of those cases where Netlinx kinda breaks its own logic flow. There are other cases as well.
  • KielLKielL Posts: 29
    Thank you for clarifying this for me, too. With the NX controllers, I find myself using more timelines across modules now rather than dumping things into DEFINE_PROGRAM. So now I have a TL_FEEDBACK that runs in any modules that update the touchpanel, and coincidentally, they all are id 1. Haven't seen any problems with it yet, so I'm glad to hear that it does isolate timelines to the module they're created in.
  • JeffJeff Posts: 374
    KielL wrote: »
    So now I have a TL_FEEDBACK that runs in any modules that update the touchpanel, and coincidentally, they all are id 1.

    I've been doing this for years with NI and NX series masters and have had no problems. I actually have an include file that's like 12 lines long that defines the timeline id and interval, starts the timeline in define_start, and calls tp_fb(). Then in my module I just declare a function tp_fb() and it handles feedback. One less thing to manually input into every module, one less thing to clutter up the module with when I'm troubleshooting. Works perfectly, and they obviously all have the same ID because they're reading the same file.

Sign In or Register to comment.