PDA

View Full Version : Table copy Lua - Netremote


Manser
April 18th, 2007, 02:19 AM
I'm wondering if there is a easy way to copy a table in the lua environment of NR
to NR?
I do it now with SetVariable for every index of the lua table.

Rob H
April 18th, 2007, 03:24 AM
That's pretty much it. Are these tables numerically indexed?

Manser
April 18th, 2007, 03:45 AM
yes they are, so I have to do it with a "for" function related to the index, right? That's ok, I just thought that there could be a something like NetRemote.Setvariable("[newtable]", [Luatable])

Rob H
April 18th, 2007, 04:34 AM
No, not in NetRemote, Girder does have a NetRemote.SendStemmedTable though

Manser
April 18th, 2007, 05:51 AM
Rob, this script in girder should create a table in NR right?

tester = {1,2,3,4,5,6,7}

NetRemote.SendStemmedTable(index, tester)

I ask because it dosn't!

Rob H
April 18th, 2007, 07:43 AM
what's index?

You need to supply a base label e.g. 'test', then it will create labels test_1, test_2, test_3 etc.

Manser
April 18th, 2007, 08:42 AM
Ops, I forgot the little " ' ", I'm sorry

NetRemote.SendStemmedTable("TwilineReg.index", globalRegister_Tab)

Manser
April 18th, 2007, 08:56 AM
Hey Rob, If I have a gap in the index of the table I want to send.

ex.
globelRegister_Tab[1]-[240] for all digital values and
globelRegister_Tab[300]-[540] for all analog values
globelRegister_Tab[600]-[700] and so on

It only send me the first 240 values of the table, right?

Rob H
April 18th, 2007, 10:20 AM
Yes, it only works with 'arrays', ie tables with contiguously numbered indices starting at 1.

Manser
April 19th, 2007, 03:26 AM
An other question rob,

sending a table with NetRemote.SendStemmedTable, where the table has about 3000 values in it, to a Netremote client, block my pc for about 3s. I think thats the time which NR need to update all the values.

What would you recommend to do? Is it better to send the values in smaller tables or is there an other way?

Rob H
April 19th, 2007, 03:43 AM
That's an awful lot of variables to send - do you really need to send all of them to NR?

Let's step back from this and look at the intention - what are you trying to do?

Manser
April 19th, 2007, 04:52 AM
Ok, I'm working at a com driver for a building automation system.
I have there several different data Register.

At the moment I read this Register for ex.

OR Register = output register every second from the system
They are 112 Register 16bit "2 * 56 Register hex values"
they are in use for 112 Analog values or, it depends on the configuration of the building system, every 8 OR Register represent 16 digital data points.

That means that after I read the 112 Register I have to transform them in digital
data points every 8 Register means 7 * 16 *2 = 224 digital data points.
then I put this values in a table globalRegister_Tab[1]-[224]

Then I transform the 112 Register in Analog values because I don't now how the systemintegrator of the system configure them

Means 112 Values transform for ex in temp values "°C"
then I put this values in a table globalRegister_Tab[300]-[412]

But they could also be other values for ex. "Lux"," km/h", "larger temp °C", "%"
means I have to transform the 112 analog register in every possible unit and put them in the globalRegister_Tab[500]-[1500]

thats because they have different ranges, for ex.
0-255 = 0-100% means 255 / 2.55
0-255 = 0-31.875°C means 255 / 8
0-255 = 0-127.5 Km/h means 255 / 2

And I have some more Register Typs for example: 40 analog register which represent the internal Temp values and Predefined Temp values

So the table grows up until [3200] at the end every update of the table I compare the table and if a value has changed I send the table to NR.

Do you understand what I'm doing? ;-)

I do that like this because I don't want to modify the comdriver for every new project!
So I only have to look how the system integrator of the building automation system has configured his projekt and I only have to take the right data point in NR the show or modify the value.
Your right most of the values in the table are not in use because there is only one possible function for it.
If it is in use as digital data all the possible analog values are not to use.

this works perfect until the table has a size up to 1000 values so maybe I only have to send instead of one big table several smaller ones

theguywiththefunnyhair
April 19th, 2007, 05:33 AM
sending a table with NetRemote.SendStemmedTable, where the table has about 3000 values in it, to a Netremote client...

Are you sending this to a NR ppc client, and if so does NR ever exit when you do?

Manser
April 19th, 2007, 05:39 AM
At, the moment i'm testing with PC clients XP and wallPanels running win CE5.0

But I could imagine that this could be a problem with ppc ;-)

Do you have some experience with it?

I mean I if MB send a large playlist 7000 songs or more it works to!

Rob H
April 19th, 2007, 08:24 AM
Personally, I think I'd be inclined to just send the 112 values straight to NR and do the calculations there, either that or split the table into multiple tables.

Manser
April 19th, 2007, 08:34 AM
that's what I wanted to do first, but I though"t" that doing all the calculation on
a pc running girder is the better way "more power" !

well I will try to split them

Rob H
April 19th, 2007, 09:45 AM
How do you actually decide which value to use in NR?

Manser
April 19th, 2007, 11:04 AM
I have to look into the configuration file of the building automation system, there I can see what's sort of inputs and outputs are set on every data register.

the solution I do it right now, is the simplest way, next step could be a more powerful girder file where I could set the typ of every register data.

something like;
if analogregister1 = temp do only the temp calculation
if analogregister1 = digital do only the digital calculation

so I could set every register and they do only the right calculation for every data register

and the best way would be to program a configuration mask in girder ;-)

Rob H
April 19th, 2007, 01:44 PM
That would be the best solution I think.