Logic Machine Forum
LM4 storage capacity - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Hardware (https://forum.logicmachine.net/forumdisplay.php?fid=12)
+--- Thread: LM4 storage capacity (/showthread.php?tid=242)



LM4 storage capacity - s.prathmesh - 03.03.2016

Here in a project, we are using LM4 for DMX control having 1500 DMX channels. We need to run a sequence of 5 minutes in infinite loops. So, is in-built storage of LM4 is sufficient or need to use some external data storage into USB slots. If yes, please specify the capacity.

As given in system status of LM4's web-console, in-built storage is 125MB.


RE: LM4 storage capacity - admin - 03.03.2016

If you have a pre-defined sequence with 1500 channels then you need to use a different approach, as storage requests will take too much time to provide a smooth transition. The best way would be to create a table of states for each channel for each time slot (10 seconds, for example). I can give some more advice if you can specify how the sequence should behave.


RE: LM4 storage capacity - s.prathmesh - 04.03.2016

Following is the video link - https://drive.google.com/file/d/0B1XFdzfFwX2AV1JDS0p2NEpiNjA/view?invite=CIaOq80O&ts=56d5358b&pref=2&pli=1
Please check and let me know how to create table of states.


RE: LM4 storage capacity - edgars - 04.03.2016

Looks great!
Can you please ask the designer of this project to make a table which will define which channels for how long should have which color? And so with all other time slots and channels.


RE: LM4 storage capacity - gjniewenhuijse - 04.03.2016

(04.03.2016, 08:39)s.prathmesh Wrote: Following is the video link - https://drive.google.com/file/d/0B1XFdzfFwX2AV1JDS0p2NEpiNjA/view?invite=CIaOq80O&ts=56d5358b&pref=2&pli=1
Please check and let me know how to create table of states.

wow, nice project


RE: LM4 storage capacity - edgars - 14.03.2016

Here is the script (predefined-scene) for operating DMX objects on 3 x RS-485 interfaces of LogicMachine4. Add resident script, sleep time = 0. 

Big steps are defined as VALUES. RESOLUTION is a count of small steps between big steps - defines how smooth one color transits into other.  STEPDELAY defines what is delay between each small step.

Approximate time:
BIG STEP TIME = RESOLUTION * (STEPDELAY + 0.1)


Code:
if not values then
 luadmx = require('luadmx')

 -- channel values for each second for each output port
 values = {
   -- second 1
   {
     -- port 1
     { 0, 127, 255 },
     -- port 2
     { 255, 255, 0 },
     -- port 3
     { 255, 0, 0 },
   },
   -- second 2
   {
     -- port 1
     { 255, 255, 0 },
     -- port 2
     { 0, 127, 255 },
     -- port 3
     { 255, 0, 255 },
   },
   -- second 3
   {
     -- port 1
     { 0, 127, 255 },
     -- port 2
     { 255, 0, 0 },
     -- port 3
     { 255, 255, 127 },
   },
 }

 -- number of step, must be tuned manually
 resolution = 10
 -- sleep between steps, must be tuned manually
 stepdelay = 0.05

 -- list of ports to use
 ports = {
   '/dev/RS485-1',
   '/dev/RS485-2',
   '/dev/RS485-3',
 }

 function init(port, count)
   local ctx, err = {}

   -- init dmx
   ctx.dm, err = luadmx.open(port)

   if not ctx.dm then
     error('Port ' .. tostring(port) .. ' error: ' .. tostring(err))
   end

   -- channel count
   ctx.count = count
   ctx.dm:setcount(count)

   -- reset channel map
   ctx.values = {}
   ctx.deltas = {}

   -- fill channel map
   for chan = 1, count do
     ctx.values[ chan ] = 0

     ctx.dm:setchannel(chan, 0)
   end

   ctx.dm:send()

   return ctx
 end

 function set(ctx, values, resolution)
   local value, delta

   -- check for new values for each channel
   for chan = 1, ctx.count do
     value = values[ chan ] or 0
     ctx.deltas[ chan ] = (value - ctx.values[ chan ]) / resolution
     ctx.values[ chan ] = value
   end

   ctx.ticks = resolution
 end

 function step(ctx)
   local ticks = ctx.ticks - 1

   -- transition for each channel
   for chan = 1, ctx.count do
     local delta = ctx.deltas[ chan ]

     if delta ~= 0 then
       local value = ctx.values[ chan ] - ctx.deltas[ chan ] * ticks
       ctx.dm:setchannel(chan, value)
     end
   end

   ctx.dm:send()
   ctx.ticks = ticks
 end

 ctxlist = {}
 for i, port in ipairs(ports) do
   ctxlist[ i ] = init(port, #values[ 1 ][ i ])
 end
end

for sec, secvalues in ipairs(values) do
 for id, ctx in ipairs(ctxlist) do
   set(ctx, secvalues[ id ] or {}, resolution)
 end

 for i = 1, resolution do
   for id, ctx in ipairs(ctxlist) do
     step(ctx)
   end

   os.sleep(stepdelay)
 end
end