Author |
|
Liutart Newbie
Joined: March 02 2015 Location: Italy
Online Status: Offline Posts: 10
|
Posted: March 05 2015 at 15:57 | IP Logged
|
|
|
I have just bought PowerHome 2 but I do not understand
how to use formulas and macros. Is there a tutorial for
them?
I need to read and/or change variables and timers in the
Ocelot, but I don't know how to do this.
Edited by Liutart - March 05 2015 at 15:57
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: March 05 2015 at 21:03 | IP Logged
|
|
|
Liutart,
Welcome to PowerHome! Best way to get acquainted with
formulas is to read about them the PowerHome Help
(Alt+F12 or menu Help->Contents). I would definitely
hit all the subsections under the PowerHome Basics
section. Follow that with the Formulas section. That
should give you a pretty good idea of formulas.
Macros (although not heavily gone over in the help)
are fairly easy once you start creating one in the
PowerHome Explorer. Its just a collection of simple
commands or formulas that are executed in order (you
can get more complicated and use looping and
conditionals as well).
For the Ocelot internal timers and variables, refer to
these functions in the Help file:
ph_getothertimer
ph_getothervar
ph_setothertimer
ph_setothervar
You can test formulas using the PowerHome Multi-Editor
(under the Maintenance menu) in Formula mode
(shift+F6).
That should get you going initially. Afterwards if you
have any other questions or issues, just feel free to
post on the forum and Im sure you'll get a response
shortly.
Dave.
|
Back to Top |
|
|
Liutart Newbie
Joined: March 02 2015 Location: Italy
Online Status: Offline Posts: 10
|
Posted: March 06 2015 at 01:46 | IP Logged
|
|
|
Thanks Dave.
I read all the Help but I don't understand how to construct a formula.
I tried a formula like this:
ph_getothervar (OCELOT,100), in order to get Ocelot Variable #100
but I got Syntax error.
"OCELOT" is the ID of my controller
I need to see the risult in web center.
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: March 06 2015 at 09:56 | IP Logged
|
|
|
Liutart,
You just need to enclose the ID in single or double
quotes (alphnumeric data is considered a string and
must be quoted). Your function would now look like:
ph_getothervar("OCELOT",100)
However...I just tested this on my system and
discovered that there is a bug in the later versions
of PowerHome with these functions (ph_getothertimer,
ph_getothervar, ph_setothertimer, ph_setothervar) so
you'll get back a value of -2. Not sure which version
of PowerHome you're running. Version 2.1b should be
fine, the later versions will most likely have the
bug. I've added this to the to-do list to get fixed.
However, you should still be able control these
values. In the PowerHome Explorer under PowerHome-
>Devices->Analog I/O, create a new line for each timer
or variable you want to see. Choose I/O type of Ctlr
Timer and/or Ctlr Var. Leave the Unit at 0 and set the
point to the number of the var or timer. Of course,
fill in the other fields as appropriate such as the
ID, Description, and Controller. Press F5 to save.
These devices will now show on both the client and web
based Device status screens and are able to be
modified from there. You'll also be able to retrieve
and manipulate these values using the ph_getanalog and
ph_setanalogout functions.
Let me know how it goes.
Dave.
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: March 06 2015 at 11:39 | IP Logged
|
|
|
Liutart,
Please let me know if the above all works ok for you
or not. Ive been testing on my own Ocelot but am not
getting back proper results. I can set the variable
but when I read the data back using ph_getanalog, the
variable goes back to 0. At no time do I get an error
during the set or read process. I don't trust my
Ocelot however because a couple of months ago it
started acting up and Im no longer able to communicate
with my SECU-16 or SECU-16IR modules so Im not sure if
the varables and counters always returning 0 is a
programming issue in PowerHome or a problem with my
dying controller.
Thanks,
Dave.
|
Back to Top |
|
|
Liutart Newbie
Joined: March 02 2015 Location: Italy
Online Status: Offline Posts: 10
|
Posted: March 06 2015 at 15:20 | IP Logged
|
|
|
Hi Dave,
My PowerHome version is 2.1.5c.
Now I can set timers and variables as you explaned me,
but I cannot see them. I get back a value of -2 like
you.
Should I install 2.1.5b version to avoid this?
Do I need to unistall 2.1.5c before?
Please tell me what value I have to put in "Setup ->
Controllers -> Setting -> Analog Poll Intervall" and in
"Analog I/O -> Poll Intvl" fields. I don't know what are
the unit of measure.
Thanks
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: March 06 2015 at 15:33 | IP Logged
|
|
|
Liutart,
If you're getting -2 back you're probably executing
either the ph_getothertimer or ph_getothervar function
which won't work until I fix it. What you want to run
instead is the ph_getanalog function to retrieve the
timers and vars (check help for usage).
If you want to go back to the fully working version,
you would need to uninstall 2.1.5c and go all the way
back to 2.1b (not 2.1.5b). This is a fairly
significant step back and probably unnecessary if the
ph_getanalog function works for.
Let me know if you get the proper value back using the
ph_getanalog function as it always returns 0 for me
due to I believe my failing Ocelot.
Also, are you able to tell (by controller operation or
some other means) that when you set a var or timer
that it is actually working?
Thanks,
Dave.
|
Back to Top |
|
|
Liutart Newbie
Joined: March 02 2015 Location: Italy
Online Status: Offline Posts: 10
|
Posted: March 06 2015 at 16:21 | IP Logged
|
|
|
Hi Dave,
the ph_getanalog function works well. It returns me the
right value of variables and timers.
If I set variables it works too, the Ocelot set the
propher value, while I cannot set timers. In the Ocelot
nothing happens with it.
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: March 06 2015 at 17:01 | IP Logged
|
|
|
Liutart,
So if I understand correctly, setting and reading
variables is working fine (it doesnt for me so more
proof that my Ocelot is dying). As for timers, you can
read them, but you cant set them from within
PowerHome. Is that correct?
If so, I'll see if I have a backdoor solution that
will work for you.
Thanks,
Dave.
|
Back to Top |
|
|
Liutart Newbie
Joined: March 02 2015 Location: Italy
Online Status: Offline Posts: 10
|
Posted: March 08 2015 at 12:40 | IP Logged
|
|
|
Hi Dave,
yes, it is right. If I set timers within Device Status
window, the "Status" column change and in PowerHome
Status window I see a new line appearing with correct
"Details", but nothing happens into the Ocelot. After
that if I use ph_getanalog to chek it I get the actual
Ocelot Timer value, wich is not what I set.
Thanks
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: March 09 2015 at 23:00 | IP Logged
|
|
|
Liutart,
Appreciate the feedback. Looks like I need to revisit
the setting of a timer within the Ocelot. I'll dig
into the code and let you know what I find.
In the meantime, I a raw method to set the timer would
be this function:
ph_ctlrsq("OCELOT",8110,"",32,500)
In the above formula, "OCELOT" is the ID of your CPU-
XA/Ocelot controller. 8110 is the raw command to set a
timer. 32 is the timer number and 500 is the value to
set to the timer. Try running this function (adjust
the parameters to suit your particular setup) and let
me know if it actually changes your timer or not.
It'll help me pinpoint where the problem may lie.
Thanks,
Dave.
|
Back to Top |
|
|
Liutart Newbie
Joined: March 02 2015 Location: Italy
Online Status: Offline Posts: 10
|
Posted: March 10 2015 at 12:42 | IP Logged
|
|
|
Dave,
it's the same.I see the change in Device list but
nothing happens. If I ceck timer it is like before.
Thanks
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: March 11 2015 at 21:44 | IP Logged
|
|
|
Liutart,
Appreciate the feedback, it helped me locate the
problem. Ive got a typo in checksum generation routine
for that particular function so it will always fail.
I'll see if there is a way I can release a patch for the
2.1.5c version to fix this but it may take a few days.
Dave.
|
Back to Top |
|
|
Liutart Newbie
Joined: March 02 2015 Location: Italy
Online Status: Offline Posts: 10
|
Posted: March 12 2015 at 15:27 | IP Logged
|
|
|
Hi Dave, many thanks for your support.
I am not in a hurry, take your time. In the meantime I
have to set 160 I/O point, 88 Ocelot Variables, a Secu16
IR and a Speak Easy.
Should you need any kind of test please don't hesitate
to ask me.
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: March 20 2015 at 16:13 | IP Logged
|
|
|
Liutart,
See the update message in my first post of the 2.1.5c download thread http://power-home.com/forum/forum_posts.asp?TID=4468&PN=1&TP N=1. This version should have the checksum fix for properly setting the timer in the CPU-XA/Ocelot. Try it out and let me know.
Thanks,
Dave.
|
Back to Top |
|
|
Liutart Newbie
Joined: March 02 2015 Location: Italy
Online Status: Offline Posts: 10
|
Posted: March 22 2015 at 03:01 | IP Logged
|
|
|
Hi David,
it works perfectly now. Many thanks.
Please tell me what value I have to put in "Setup ->
Controllers -> Setting -> Analog Poll Intervall" and in
"Analog I/O -> Poll Intvl" fields. I don't know what are
the unit of measure.
Roberto
Edited by Liutart - March 22 2015 at 03:01
|
Back to Top |
|
|
Liutart Newbie
Joined: March 02 2015 Location: Italy
Online Status: Offline Posts: 10
|
Posted: March 24 2015 at 16:20 | IP Logged
|
|
|
Hi David,
I made some formulas but they doesn't work.
As I told you, now I can set Timers, but I can do that
only in "Device Status" window.
If I use ph_setothertimer("OCELOT",50,1) I got -2, but
if I use ph_ctlrsq("OCELOT",8110,"",50,1) it works.
The same is with Varibles. if I set them within "Device
Status" window they works, but they doesn't if I use
ph_setothervar.
Thanks, Roberto
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: March 24 2015 at 17:27 | IP Logged
|
|
|
Roberto,
The ph_setothertimer and ph_setothervar functions
won't work until I get the next version out. However,
just like ph_getanalog() work so should the
ph_setanalogout() function. If the analog device ID is
VAR1, then to set this to a value of 220, use this
formula:
ph_setanalogout("VAR1","220")
The thing to remember here is that the second
parameter (the value) must be sent as a string.
Concerning the Analog Poll Interval under the Ocelot
controller Settings button. This value is in seconds
but can be a decimal value. If you dont have any
analog inputs on your Ocelot, then you can just set
this to 0 to save processing. Otherwise, set it to the
number of seconds (or fraction of a second) that you'd
like ALL Ocelot analog points polled.
The Poll Intvl column in the Analog I/O screen is not
used by Ocelot devices and instead is determined by
the setting for the controller.
Dave.
|
Back to Top |
|
|
Liutart Newbie
Joined: March 02 2015 Location: Italy
Online Status: Offline Posts: 10
|
Posted: April 01 2015 at 14:38 | IP Logged
|
|
|
Hi Dave,
many thanks, now I can use both timers and variables.
Unfortunately there are lots of errors when I perform
any kind of action. It could be set output point, or
timer and variables, or reading input points or timer
and variables.
It happen almost every time.
How can I avoid this problem?
Roberto
P.S. I tried to upload images or zip file but it
doesn't work.
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: April 02 2015 at 23:46 | IP Logged
|
|
|
Roberto,
I would need to see the images in order to determine
what is going on. If the forum upload isnt working for
(it just doesnt seem to work for some people), you can
email them to me direct.
Once I see whats going on, I should be able to help you
out.
Dave.
|
Back to Top |
|
|