Dealing with large data...
jisaac
Posts: 34
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!!
0
Comments
I like to use multiple layers of structures for this type of scenario. Like this
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.
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.
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.