Dealing with large data...
jisaac
Junior Member
Gentlemen,
i have the following scenario:
in controlling a lighting system the following pieces of data must be taken into account & are needed for control. Im trying to find a way to keep all this data together (prefer structure) but cant seem to avoid having to use a multi- dimensional array.. note--i like to avoid multi dimen arrays when possible plus i like that structures have that "." feature , i.e -- music[1].title or tracks[2].artist. heres what i need--
zones--several light zones lets use 10 as an example (ie kitchen, pool house, mas.bed, etc)
within each zone exist several light fixture(loads) i.e. kitchen cans, kitchen island lights, kitchen undercab
for each light fixture(loads) several pieces if data are needed-- load id, load value, load name etc.
is there any way to handle the above in structure? i cant see how--any thoughts on how you would deal with this?
Thanks in advance for any help!!
i have the following scenario:
in controlling a lighting system the following pieces of data must be taken into account & are needed for control. Im trying to find a way to keep all this data together (prefer structure) but cant seem to avoid having to use a multi- dimensional array.. note--i like to avoid multi dimen arrays when possible plus i like that structures have that "." feature , i.e -- music[1].title or tracks[2].artist. heres what i need--
zones--several light zones lets use 10 as an example (ie kitchen, pool house, mas.bed, etc)
within each zone exist several light fixture(loads) i.e. kitchen cans, kitchen island lights, kitchen undercab
for each light fixture(loads) several pieces if data are needed-- load id, load value, load name etc.
is there any way to handle the above in structure? i cant see how--any thoughts on how you would deal with this?
Thanks in advance for any help!!
Comments
-
Try Multi Structure
I like to use multiple layers of structures for this type of scenario. Like thisSTRUCTURE _Fixture { CHAR sName[64] //Name of fixture i.e. Kitchen Cans, Kitchen island pendant INTEGER nType //Type of fixture i.e. Can, fluorescent INTEGER nDraw //Current Draw } STRUCTURE _LightingInfo { CHAR sName[64] _Fixture Fixture[16] } DEFINE_VARIABLE _LightingInfo stLightZone[10] DEFINE_START stLightZone[1].sName = 'Kitchen' stLightZone[1].Fixture[1].sName = 'Kitchen Cans' stLightZone[1].Fixture[1].nType = 1 stLightZone[1].Fixture[1].nDraw = 280 stLightZone[1].Fixture[2].sName = 'Kitchen island Pendant' stLightZone[1].Fixture[2].nType = 2 stLightZone[1].Fixture[2].nDraw = 120 stLightZone[2].sName = 'Bedroom' stLightZone[2].Fixture[1].sName = 'Bedroom Downlights' stLightZone[2].Fixture[1].nType = 1 stLightZone[2].Fixture[1].nDraw = 460
You can add more elements to the structures and hold all sorts of data. Thats why I use structures all the time and hardly ever use multi-dim arrays. -
I know it's just a 'flavor' thing, but I'd just do an MultiDim array myself. There's no real memory advantage one way or another. So, it's just a matter of personal taste in how you like to do the code.
-
Except
Except with multi-dim arrays you can't hold CHARs and INTEGERs and LONGs ect... all at the same time in a nice neat package.
i.e. This does not work;
SomeData[1][1] = 1 //input number
SomeData[1][2] = 'Some Source Name' //source name
But this does;
SomeData[1].nInputNum = 1 //input number
SomeData[1].sSourceName = 'Source Name' //source name
For me by creating a structure I know and remember exactly what data should be in the second dim of the array.
Like you said its a matter of taste. I prefer to work with data in this way. -
You can go pretty deep with structures and have different branches off shoot with other braches just by putting previous devined structures into another structure and then putting that into another structure so on and on ...like Dan did here:
STRUCTURE _LightingInfo { CHAR sName[64] _Fixture Fixture[16] }Use short names though cuz the deeper you go the longer you line is:stLightZone[1].Fixture[2].nDraw[2].cPaper[4].nCrayon
So you can easily do a room and then break it down by lighting, audio, hvac, shades, presets and then each sub category can have what ever you want in it.
Leave a Comment
Categories
- All Categories
- 2.5K AMX General Discussion
- 922 AMX Technical Discussion
- 514 AMX Hardware
- 502 AMX Control Products
- 3 AMX Video Distribution Products
- 9 AMX Networked AV (SVSI) Products
- AMX Workspace & Collaboration Products
- 3.4K AMX Software
- 151 AMX Resource Management Suite Software
- 386 AMX Design Tools
- 2.4K NetLinx Studio
- 135 Duet/Cafe Duet
- 248 NetLinx Modules & Duet Modules
- 57 AMX RPM Forum
- 228 MODPEDIA - The Public Repository of Modules for Everyone
- 943 AMX Specialty Forums
- 2.6K AMXForums Archive
- 2.6K AMXForums Archive Threads
- 1.5K AMX Hardware
- 432 AMX Applications and Solutions
- 249 Residential Forum
- 182 Tips and Tricks
- 146 AMX Website/Forums
