Axxcess programming: looping commands
ryanww
Posts: 196
Hello. I need help, and don't have time to really figure it out. I have a couple of ideas on how this can be done, but I am hoping someone may have a better idea or can tell me if my thoughts are on the correct path.
Here is what I am trying to do: Periodically send out a series of serial commands maybe every 30 seconds. I have to poll a dimmer rack to see if some lights are at a level above 0 so that it can trigger the HVAC system. Basically I was hoping that I could have a single group to poll, but the rack won't allow me to do that. I have to poll about 5-8 dimmers and just get a general census of the status.. Depending on what the status of some of those dimmers are, I have to send out a string saying whether the dimmers in one room are on to trigger that hvac unit, or if dimmers in another room are on to trigger that hvac unit.
I was thinking of putting the section just right on the main program. Where it is just a:
Send string...
if statment
(true) send string..
Or I can just put a call in the main line and in the call have all that.
I am just worried about it going to fast and stalling up, and I don't know how to just to execute the commands every 30 or so seconds.
Thanks for your help!
Ryan
Here is what I am trying to do: Periodically send out a series of serial commands maybe every 30 seconds. I have to poll a dimmer rack to see if some lights are at a level above 0 so that it can trigger the HVAC system. Basically I was hoping that I could have a single group to poll, but the rack won't allow me to do that. I have to poll about 5-8 dimmers and just get a general census of the status.. Depending on what the status of some of those dimmers are, I have to send out a string saying whether the dimmers in one room are on to trigger that hvac unit, or if dimmers in another room are on to trigger that hvac unit.
I was thinking of putting the section just right on the main program. Where it is just a:
Send string...
if statment
(true) send string..
Or I can just put a call in the main line and in the call have all that.
I am just worried about it going to fast and stalling up, and I don't know how to just to execute the commands every 30 or so seconds.
Thanks for your help!
Ryan
0
Comments
Should be simple enough.
Thanks again!
Ryan
When one of the itmes (PUSH/RELEASE/boolean statement/etc.) becomes active, it processes wahatever requires processing, then continues on.
After checking the entire code, it will check for expired WAITs and other housekeeping and process those. Unless your code it too unwieldly, the WAIT 300 should process pretty accurately every 30.0 seconds.
This is a *very* basic description, but should explain the process for you until you get into anything extremely complex (and please upgrade to Netlinx if you do).
Thanks again for the help!
Ryan
Wouldn't that start a new wait every pass though mainline?
You can make pseudo-timelines in Axcess:
The timing will be related to how long your program is. So you will have to tweak the loop length and the values at which your events occur. You can also have many more events that occur at other loop values.
This method works quite well for regularly polling devices in a specific order. It also works for sending strings at some interval while holding down a button, such as a command to up the volume of some device.
Dynamic (non-named) waits could potentially start every time mainline runs - but I have never seen that happen.
--D
--D
Note the last line - unnamed waits are treated as seperate enities, where if you name them, they are recognized as sharing the wait with all like-named waits. It's not simply a matter of being able to cancel them, there are cases where they can behave differently because of this. So unless you are deliberately trying to exploit this, waits should always be named to avoid unexpected behavior. It may well be this does not carry over to NetLinx, and I haven't found any reference to that; this applies to Axcent programming.
In Axcess, it is much better to do the pseudo-timeline I exampled a few posts back if you want repetitious events.
I have never used the pseudo method. I would like to try it though. It look fairly solid. Now how do I know how fast it will increment the nLOOP? I am going to use waits in the code with it because I basically have 3 sections of dimmers that it is going to check. So it will start with the first section, poll that dimmer, and if it returns anything higher then 2500 as the value then it will send a string out to the hvac. If else, it will poll the next dimmer channel to see if that is higher then 2500. And then it will do a third. Then probably a couple second wait I will start the process over with another batch of channels. It will be polling the same device though so I cant send it all out at once.
Now my other question is about how to read the incoming data string. The string output is basically like this: Send String DR,"'[BALLROOM.Downlights.nINT]'" so it will return '[BALLROOM.Downlights.nINT=0]'
The nINT value is the value of the actual intensity. It returns a 16 bit number (0-65535) 0-100%. When doing an if command to look at the string, what would be best to use to look for the value to see if it is above like 2500 or if it was converted to an tad smaller number (0-255)? And I am also not sure how to format it to look for a value greater then 2500. I knew, but am totally blanking on it..
Thanks for all the help! Sorry to bring out all the old-school stuff.. but hey, it still works really well and is way solid!
Ryan
Some of the best stuff comes out of these little side debates, it's an excellent advantage of this type of venue. I've learned quite a lot from all the various impromptu discussions that spring up on these forums.
It depends on how long your Axcess program is. I would not use this method if the timing bewteen events triggered in the pseudo-timeline is critical.
The pseudo-timeline method has two main benefits:
1. It will guarantee the sequence in which your events occur.
2. It will guarantee a MINIMUM time between the events.
You can make a button light up or something every time the loop goes around to get an idea of the timing.
Say I hit a push. then if I do a wait 10 on 1,1.. wait 20 on 1,2.. or could I just do wait 10 each time and then they just follow the previous wait.
Ryan
<do something> and <do second thing> will both happen at essentially the same time. Whereas with,
<do something> will happen after one second and <do second thing> will happen a second after that.
Wait 10
<do something>
Wait 15
<do something else>
is that something that I shouldn't do? Does it put more strain on the processor because it is doing multiple waits at the same time?
Ryan
Yea, I name almost all of the waits. Some things use cancel waits so it works out nicely.
Ryan