Data event multiple or....
Denis
Posts: 163
Hi
I would like to know wich way is better to do?
I have to monitoring a line feedback for 20 loads from Vantage controler. I get many answer depending wich event will go on.
In my program, wich is better to use... a DATA_EVENT with multiple nested IF ELSE ? Or multiple DATA_EVENT for the same device ?
Can I use multiple DATA_EVENT for the same device ?
ex:
I would like to know wich way is better to do?
I have to monitoring a line feedback for 20 loads from Vantage controler. I get many answer depending wich event will go on.
In my program, wich is better to use... a DATA_EVENT with multiple nested IF ELSE ? Or multiple DATA_EVENT for the same device ?
Can I use multiple DATA_EVENT for the same device ?
ex:
DATA_EVENT [dvVANTAGE] { Statement1 } DATA_EVENT [dvVANTAGE] { Statement 2 }
0
Comments
Use one DATA_EVENT with a SELECT - ACTIVE format.
See AMX tech note 616.
http://www.amx.com/techsupport/PDNTechNote.asp?id=616
Thanks for this info
Also, it will almost certainly cause confusion down the road as the code needs updating. It's much more programmer-friendly to have everything in one spot. If there are more than a few lines of code in an event, I prefer as well to put them in a function or call that is triggered by the event. That also cuts down on redundant code for similar functions.
I'm followed your recommandations on tech note, and I get some problems as results.
When I monitoring the complete feedback <nLOAD_STATUS> I get the good feedback, but during the process, after 2 or three 3 press button, <nSTATUS> has a reverse result ( it's 0 when it must be greater than 0 and greater than 0 when it must be 0 )
The ending results is my flag is always on...
why ?
Concerning feedback format,
< LO 1 2 1 4 0 > or < LO 1 2 1 4 XX > XX = any value between 1 and 100
Explain: <LO> LOAD <1> Master 1 <2> Enclosure 2 <1> Module 1 <4> Load 4 <0 0r XX> Value of power in %
< LO 1 2 1 4 95 > in this string the value is 95 %
9 is 10th character in nREPLY array
In my program, I want when the value is 0 as my flag is off and On when the value is greather than 0
In help file is indicate "data sent and received over the RS232 interface should be in ASCII format and in all capitol letters."
I'm also going to assume you have more than one load you'll want to track. If so, you'll have to parse out the master, module, and loads an put them into an array.
Given the format of the string, you should not be doing REMOVE_STRING() using 'LO' as the string to find and remove.
Given the example you had (including the < and > which I am not sure are part of the string, or are just there to show the string), the string nV_REPLY would contain '< LO' and the string nLOAD_STATUS would contain ' 1 2 1 4 95 >'.
If there is a string delimiter (such as > in your format listed), you should change it to:
As for which character(s) in the nV_REPLY array is Value of the load power, I can't tell from what you said, but it doesn't look like the 10th character in your example.
< > it's only for delimitate de string ( if it will do confuse please advise me what can I take to do that )
The string like this LO 1 2 1 4 95
I get 9 only if I ask for the 10th character
In other word I need to know if this character is 0 or greather 0 to put my flag on or off
JJames
Indeed, I have 20 loads to check status. In the lighting system there are some timed event controled by lightning control, and I need to know all status change for my LCD panel
Next, use this as a baseline your DATA_EVENT:
From here, your flags will be ON or OFF based on the load's percentage. If it's zero, it will be considered off. Anything greater than zero, will be considered on. So, if you evaulate like this:
IF(nLOAD_STAT[1][6]) // IF THE LOAD IS ON . . .
or
IF(!nLOAD_STAT[1][6])// IF THIS LOAD IS OFF . . .
Hi tried your code but I get this report from compiler, I tried some tricks with this code but I get other problem report
I created LOC_VAR CHAR for nLOAD_STATUS ( I think as you have forget it)
Vantage support confirm me as the string results is in ASCII format
Since I'm working with feedback on serial control for the first time, is it possible to tell me if AMX system see carriage return even we don't see in the string? I'm just speaking with Vantage support and he confirm to me as Vantage controler send each time a carriage return character
Since I don't know if AMX see it, I replaced $OD by LO
I forgot the first part of code you post .
I place volatile var and delete line as I create, replace "$OD" instead 'LO'and do new test and now I get this
The nLOAD_STAT needs to be defined up under the DEFINE_VARIABLE section near the top. It needs to be a multidimensional array.
The first number (3) will be the number of modules you're trying to read from. The 8 shouldn't change because you can only have 8 loads per module.
If you replaced the $0D with 'LO', you will only get the 'LO' and none of the valuable information we need.
The REMOVE_STRING will only remove up to whatever information IF it finds a '1' in the "Reply" string. Since we MIGHT have more than one master, we need to look for the first space, and remove up to and including it. So now, nMASTER = '1 ', but since we use ATOI, it removes the space, and nMASTER = 1. Reply now contains only the module, load and percent. This is repeated until we know there won't be anymore spaces and we just convert the remaining information in Reply to nPERCENT.
nLOAD_STAT should be declared up in the DEFINE_VARIABLE section like I said earlier. Most (if not all) of your errors are coming from here. It should read:
Hopefully this mkaes more sense.
Make sure it's a zero, and not an "Oh". Should be "Zero-Dee"
Special tanks to JJames for his great help, now all works fine