Home AMX User Forum NetLinx Studio

which overcome the problem when I have 100,000?

which overcome the problem when I have 100,000?
Today I have:
Compiled Code takes 1330021 bytes of memory - and Token Variable Count is 90,963 (Maximum is 100000)

Comments

  • ericmedleyericmedley Posts: 4,177
    Interesting. I have several projects with much larger files sizes than yours but few with that many variables. What kind of system is this you're programming? What is a general description? Are you using modules?
  • AnarckosAnarckos Posts: 41
    is a residence, complete CardFaframes 3, IR 12 Cards, 12 Cards I / O 12 Relay Card.
    My First Project is at this level, and I'm no expert on NetLinx. I know I'm doing it less accurate. but I'm worried about those numbers.
  • ericmedleyericmedley Posts: 4,177
    Anarckos wrote: »
    is a residence, complete CardFaframes 3, IR 12 Cards, 12 Cards I / O 12 Relay Card.
    My First Project is at this level, and I'm no expert on NetLinx. I know I'm doing it less accurate. but I'm worried about those numbers.

    Yeah, You might want to have a look at your code. that seems like a high count to me. I'm not sure how you could post it here. It may be the kind of thing that you're declaring a lot of vars when you may not need to. Perhaps you can post the project file if you trust us enough to look at it.

    If there's one thing everyone here has, it's an opinion. and most folks don't seem to shy to share it with you.
  • viningvining Posts: 4,368
    I agree with e' that count seems high. On the job I'm currently connected to my last compile was:
    Compiled Code takes 2411864 bytes of memory -- Token and Variable Count is 29256 (Maximum is 100000)  
    
    and I tend to create a lot of vars, contants, waits and timelines. Of course I really have no idea what goes into that T & V count.

    Maybe your using multiple instances of modules that use a large amount of vars and constants, maybe your using the older UI modules that required an instance per TP.
  • AnarckosAnarckos Posts: 41
    Would have no problem sharing it would be difficult for you to understand the code. since it is all in Portuguese. Still need to check my code better. but what I wanted to know it, is what happens to exceed 100,000. Soon I'll post my code.
  • viningvining Posts: 4,368
    Well your system will likely crash and burn or the excess will simply be ignored.

    My tech is Portuguese but 2nd gen US so while he can speak it well he can only read it a little bit. He swears at me in Portuguese all the time but since I grew up in a Portuguese immigrant neighborhood I sort of know what he's saying.
  • ericmedleyericmedley Posts: 4,177
    I've never gotten to that point to answer what would happen. My guess (and AMX engineering can set me straight if wrong) is that the compiler would error out. Or perhaps the compiler wouldn't care but the Netlinx master would croak on you.

    Either way, I'd not be in a big hurry to find out.
    :)
  • AnarckosAnarckos Posts: 41
    heheheh, I'm still finalizing some details, just post the code.
    I also did not want to find out early, but I do not think I'll have to avoid.

    I'm using enough variables of type char:

    I think it occupies too much space.

    which consumes more:
    Variavel_Nome CHAR []
    or
    Variavel_Nome CHAR [30]
  • John NagyJohn Nagy Posts: 1,742
    The compiler will not allow the compile to occur when you cross the 100,000 count.
    AMX engineering is quite ambiguous about how the count even occurs. As our projects are huge, this was a concern, and it's not an option to just do less.

    We did many tests with small projects with just one difference each, and the reported variable count swung wildly with each minuscule change. Adding what you and I would consider to be ONE variable affected the "count" by as much as 100.

    As to why the count cannot be over 100,000... well, that's a number someone in engineering thought was high enough not to be limiting, and that's as high as they tested the system in QA. They admit that there is no actual reason to suppose that more would be a problem, they just don't allow it because they didn't test it beyond that and so they can't support it beyond that.

    With the new high memory NetLinx, it's reasonable to suppose that larger programs will need to be supported and that the "limit" will be moved up.
  • AnarckosAnarckos Posts: 41
    the real problem is not generated in the amount of variables, but the amount of variables reused. whenever you call any function and a variable pitch, helped increase the numbers.
  • I am Brazilian and can read Portuguese. I've done some very large residential projects with multiple masters and never been out of the 100,000 count. Post the code and we will take a look. Some of the guys here are very good programmers and have helped me before with modules and sample code. Even though your variables naming is in Portuguese, the main code structure is still in English and most of the guys here won't have a problem to understand them. Can you provide more details in the project: number of touch panels, remotes, lighting control, alarm, cameras, etc. I believe that if you don't define the CHAR var, its default is 255. So CHAR[] consumes more than CHAR[30]. Are you defining your variables as NON_VOLATILE or VOLATILE? Local or Global variables? Duet modules or not? Assigned Duet memory size. There are a number of ways to optimize your code and make it use less memory ad run smoothly. If you do a search here, you will find a number of different techniques. One of my favorites is to use DEV variables for IR control devices. Anyways, post your code and we will see if we can help. Believe me, the guys that have already replied to your tread have lots of experience.

    Ricardo
  • AnarckosAnarckos Posts: 41
    I am Brazilian and can read Portuguese. I've done some very large residential projects with multiple masters and never been out of the 100,000 count. Post the code and we will take a look. Some of the guys here are very good programmers and have helped me before with modules and sample code. Even though your variables naming is in Portuguese, the main code structure is still in English and most of the guys here won't have a problem to understand them. Can you provide more details in the project: number of touch panels, remotes, lighting control, alarm, cameras, etc. I believe that if you don't define the CHAR var, its default is 255. So CHAR[] consumes more than CHAR[30]. Are you defining your variables as NON_VOLATILE or VOLATILE? Local or Global variables? Duet modules or not? Assigned Duet memory size. There are a number of ways to optimize your code and make it use less memory ad run smoothly. If you do a search here, you will find a number of different techniques. One of my favorites is to use DEV variables for IR control devices. Anyways, post your code and we will see if we can help. Believe me, the guys that have already replied to your tread have lots of experience.

    Ricardo

    Sorry for not sending the code yesterday, I was without Internet access.

    Attached is the entire project, still has some things to be done, but this proncipal al.

    I have:
    CardFrame 1-12 Card IR
    CardFrame 2-12 Relay Card
    CardFrame 3-12 Card I / O

    Interfaces
    1 - MVP-5200i
    2 - MVP-CV5
    1 - MVP-5150
    3 - Keypad (I forgot the code Now)

    I have some Non_Volatile Variables,

    Netlinx I use for programming.

    The main variables in my program are in the Include "VARIAVEIS", many functions getting char[] as parameters.

  • Anarckos,

    From your code I can tell that you have some very good programming skills on how to manipulate strings and create functions. However, my approach when programming Netlinx is to always try to use the less amount of code possible to automate large systems. You can achieve that by creating modules for repetitive tasks, reducing the amount of string vars and manipulation to the very necessary tasks only, use source variables to handle all your IR needs. There are a number of techniques that can be applied to make your code use less memory and run more efficiently. Now, regarding your code, my first impression is that your problem might be related to the number of variables and constants declared and the amount of string processing, other programmers here may have even a better opinion. It is hard to change programming habits, especially when you are so deep inside a project and have spent so much time on it. But in my honest opinion, it will be to your advantage to learn how to create modules and how to use DEV arrays more efficiently. If you haven't been to the AMX Programming classes II and III yet, I strongly recommend them to you. In these classes you will learn how to optimize your code, create modules and enhance your skills on Netlinx programming. Please don't get me wrong, your programming skills are way better than mine when I started my programming ventures in the automation World, you just need some insight on how to make the most of the Netlinx programming. Please find attached some sample code on how to handle IR devices with minimal coding. Regards,

    Ricardo
  • AnarckosAnarckos Posts: 41
    Thanks Ricardo,

    Actually, I have no courses NetLinx, I come from other programming languages​​. lack of knowledge of language creates these problems. I always wanted to learn to work with modules, but never had to study it sink. STRUCT founded recently discovered, that helped me a lot. but now it's late, I can not remodel the entire process at this time. unless it is necessary realemte and fast.

    Thanks, no problems, I am here to learn, even if the whole process is wrong. need to know that.

    Soon will have a course here in Brazil, I'm ready to go.
  • a_riot42a_riot42 Posts: 1,624
    Wow that's a lot of tokens and variables. I have seen this once at another shop, and the compiler won't allow it to compile so you don't have to worry about running over the limit and having it fail in real time.

    As a reference, the job I am working on now has 3 8400s, 8 R4s, 2 MIO keypads, a full Kaleidescape system, 20 or so global and local sources, 2 large matrix switches, 5 cameras, 20 HVAC zones, 100 lighting zones, 150 security zones, and a few other doo hickeys and has a T&V count of 17118.
    Paul
  • mushmush Posts: 287
    G'day Thiago,

    I just looked at your code.
    By changing the parameters in 1 function from char to integer I was able to reduce the token/variable count by more than 1000.
    Removing all the MID_STRING references that are not required also makes a big difference.

    I hope this helps!

    Cheers
  • AnarckosAnarckos Posts: 41
    mush wrote: »
    G'day Thiago,

    I just looked at your code.
    By changing the parameters in 1 function from char to integer I was able to reduce the token/variable count by more than 1000.
    Removing all the MID_STRING references that are not required also makes a big difference.

    I hope this helps!

    Cheers

    Yes, I am removing MID_STRING. The values ​​have already fallen enough. This conversion of CHAR STRING paw, is necessary, since the function can take the percentage at which the dimmer must go. ie. I must receive, "ON", "OFF", "REVERSES or 10.50 ... 100% ...

    Another thing I'm removing are SEND_STRING 0, "'VALUE =' VARIABLE '
    It also has decreased by approximately 5000

    I think this will have to maintain.

    Tanks Mush
  • mushmush Posts: 287
    Anarckos wrote: »
    This conversion of CHAR STRING paw, is necessary, since the function can take the percentage at which the dimmer must go. ie. I must receive, "ON", "OFF", "REVERSES or 10.50 ... 100% ...

    Instead of this..
    DEFINE_FUNCTION func_ACOES_Iluminacao_DIMMER(CHAR vCircuito_Nome[], DEVLEV vDev_Circuito, CHAR vAcao[])
    {
    
    }
    func_ACOES_Iluminacao_DIMMER('EstarIntimo_Luz_Dicroica_Sofa',dv_EstarIntimo_Luz_Dicroica_Sofa[1],'255')
    func_ACOES_Iluminacao_DIMMER('SFestas_Luz_Central', dv_SFestas_Luz_Central[1], 'LIGA')
    
    

    You could do this..
    DEFINE_CONSTANT
    EstarIntimo_Luz_Dicroica_Sofa = 1
    SFestas_Luz_Central = 2
    LIGA = 256  // Join?
    DESL = 0    // Off?
    
    DEFINE_FUNCTION func_ACOES_Iluminacao_DIMMER(INTEGER vCircuito_Nome, INTEGER vDev_Circuito, INTEGER vAcao)
    {
    
    }
    func_ACOES_Iluminacao_DIMMER(EstarIntimo_Luz_Dicroica_Sofa, dv_EstarIntimo_Luz_Dicroica_Sofa[1] , 255)
    func_ACOES_Iluminacao_DIMMER(SFestas_Luz_Central, dv_SFestas_Luz_Central[1], LIGA)
    
    
    Passing in by integer reference will significantly reduce your T & V count as well as speed up your processor and reduce memory usage.

    Cheers
  • AnarckosAnarckos Posts: 41
    hehehe,
    How not thought of that before ... Thank you.
  • mushmush Posts: 287
    Anarckos wrote: »
    hehehe,
    How not thought of that before ... Thank you.

    You are welcome!
  • mushmush Posts: 287
    G'day Thiago,

    What brand and model of dimmer are you controlling?

    Cheers
  • Joe HebertJoe Hebert Posts: 2,159
    Modules
    Anarckos wrote: »
    which overcome the problem when I have 100,000?
    Today I have:
    Compiled Code takes 1330021 bytes of memory - and Token Variable Count is 90,963 (Maximum is 100000)

    This post might be helpful:
    http://www.amxforums.com/showthread.php?7920-Modules-what-good-are-they&p=54965#post54965
Sign In or Register to comment.