VIsualisation with MODBUS TCP

200 views
Skip to first unread message

Bernd

unread,
Jun 10, 2013, 2:24:06 AM6/10/13
to comman...@googlegroups.com
Hi,

I'm testing at the moment commandfusion to make a visualisation for my home with a WAGO PLC (750-880).
I've tried the Modbus TCP demo and I can read and write my variables on the PLC, but the demo is only working with buttons which need to be pressed.
Is it possible to make a visualisation which is automatically updating states ?
Also I don't know what is the response of the PLC, so I can use the regex in the feedback ?

Is there anybody who can help me with those questions.
I just need a small demo with an button to write, a symbol which is showing a state and a slider which is showing an analog value.
With a demo like that I can figure out and work. If this is working I can start getting a first license and building my visualisation.

Thanks in Advance
Bernd


Florent Pillet

unread,
Jun 10, 2013, 2:38:00 AM6/10/13
to comman...@googlegroups.com
This is more a general question than something related to MODBUS in particular.

Since MODBUS won't send constant updates, you have to request them at regular interval to update your UI. For this, you have the options of:

- setting a page timer on the page that needs to display the status. Page timer will fire a command which is configured to execute a JavaScript function, which in turn requests a state update from MODBUS and uses the resulting values to update sliders, buttons, etc

- similarly and directly from JavaScript, setup a timer with setInterval() (see https://developer.mozilla.org/en-US/docs/Web/API/window.setInterval )
that will call into your function to request state from MODBUS.

Once you get a status update, you'll receive values (typically, integers when you query registers). To fill a slider, you'll have to convert the value from its initial range to the range 0-65535 which is the range our sliders operate in.

For example, if the value you receive is in the range -100 to +100 and you want to assign it to slider a40, you'll do the following:

var sliderValue = Math.max(65535, (modbusValue + 100) * (65535.0 / 200.0));
CF.setJoin("a40", sliderValue);


Hope this helps,
Florent
--
Florent Pillet - Software Engineering Lead



Bernd

unread,
Jun 10, 2013, 10:34:36 AM6/10/13
to comman...@googlegroups.com

Hi,

thanks for the fast reply.
I will try it in the next few days and see how far I can get.
Is there a OnChange Event for the sliders ?

Thanks
Bernd

Jarrod Bell

unread,
Jun 10, 2013, 6:16:02 PM6/10/13
to comman...@googlegroups.com
You can use the ObjectPressed, Dragged, Released events:
http://commandfusion.com/docs/scripting/gui.html#cF.ObjectPressedEvent

Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


--
You received this message because you are subscribed to the Google Groups "CommandFusion Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to commandfusio...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Bernd

unread,
Jun 16, 2013, 11:11:39 AM6/16/13
to comman...@googlegroups.com, jar...@commandfusion.com
Hi,
 
the reading/writing to the PLC is working now.
The only thing which is not working is the timer.
I've seen that I need to add a command to the system manager, but How can  I tell the command to
execute a Javascript function ?
 
Thanks in advance
Bernd

Terence

unread,
Jun 16, 2013, 8:49:57 PM6/16/13
to comman...@googlegroups.com
After creating the command, go to the command properties and attach the JS code at the "Javascript" part

Bernd

unread,
Jun 17, 2013, 1:46:35 PM6/17/13
to comman...@googlegroups.com, terry...@gmail.com
I think I've found my problem.
The Timer is set up for the portrait format, but my visu is for testing only setup in landscape format.
How can I Change the timer to landscape or add a timer for landscape format ?

THX

Barry Gordon

unread,
Jun 17, 2013, 5:00:50 PM6/17/13
to comman...@googlegroups.com

Timers are page oriented, so what ever you did for the lanscape version of the page do a similar thing for the portrait version

--

Jarrod Bell

unread,
Jun 17, 2013, 9:26:46 PM6/17/13
to comman...@googlegroups.com
Try this solutions posted here (if you are running the beta guiDesigner version):
https://groups.google.com/forum/?fromgroups#!topic/commandfusion/6GgaiRHAGCw


Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


--

Bernd

unread,
Jun 18, 2013, 1:16:24 PM6/18/13
to comman...@googlegroups.com, jar...@commandfusion.com
The new .exe is working ;)
Now my visu tests are over, next month I will get my first License for iPad :)
Great work guys
Reply all
Reply to author
Forward
0 new messages