Problem seems to be triggered when replacing an existing function with a similar function, then any new vars stop working, any changed vars stop working, and the function stops returning any output even though it's getting everything valid input.
Posts made by robl
-
RE: HMI Cannot add more variables
-
RE: HMI Cannot add more variables
Hi,
Again I start to have this problem where new variables just are not picked up, and they are correctly linked in. They are again not available in the HMI. The PLC value is just "no value" after build and deploy, and I can't get it to set an initial value whatever I try.
I don't get the error about variable 'Variable' unlike last time however.
Any help on how I can get it working. Re-creating entire programs just to get this working again remotely is very time consuming and risky.
Result is: make one small change and large amounts of the program stop working correctly because they are not getting the values needed for the functions to work.
Any thoughts? Or just abandon it all and see if something else is less fragile? Node Red?? Not something I can do remotely right now but worth looking in to?
-
RE: Random delay / timer
Yes! So obvious when you see it! Thanks :)
Looking at the debug output, the rand block is running all the time, even though it is only needed to generate one number at a time. I am not sure if this wastes CPU, or if it is more efficient to only enable it when triggered, and turn it off again once the number has been generated. What do you think?
I took your logic and made it behave like TON but with a random time (so, the output of my timer will go in to this, then the output of this will be delayed by some random time, so the result would be, the light will come with a random delay of on up to an hour after 6PM, or whenever the time is set by the timer.)
(This first turns on the rand -> integer sequence for 1s, then after 1s, TON_0 switches on to capture number and to activate the actual switch on delay)
-
Random delay / timer
Hello,
I'd like to do some occupancy simulation so that lights go on at slightly different times every day. I have a Time Program block, which is set for lights to come on at a certain time and/or when it gets dark at dusk, but I'd like to add a function to select a random number of seconds, or minutes between 0 and 60 minutes, and delay the ON from the timer (With a TON by some random time interval up to 60 minutes.)
I've played about with the RAND function and LIMIT, FLOOR, TRUNC etc but it's not quite what I need.
Say for example I want to pick a random number between 0 and 3600 (seconds), convert this to a time and pass it to TON. (Switch On Delay)
My function using rand can return a number higher than 3600, which LIMIT then just sets to 3600, so it returns 3600 more often and is not really random.
Any thoughts on how to do this? Seems like a useful function to have anyway. Could be a function that outputs a new number every time it receives an input, since RAND is a bit difficult to work with because it's constantly generating new random numbers, so it's hard to connect this to TON. (I had to use an Integer shift register + TP) to make it generate a new number just when it receives an input.
Rob
-
RE: HMI Cannot add more variables
Yes, it's very odd.
In the end, I reverted to an older version of the project and just re-did the all the missing parts, since I had 3 days in Austria to deploy it all and needed to fix it before returning to the UK. I can remotely access it via the proxy for the time being though to do updates.
I thought it would be a good idea to put everything in my google drive folder, so that when changes happen, it's automatically backed up somewhere. Mervis IDE does not seem to like this though. During the build when you have HMI parts, it pops up some errors:
I just click "Abort" on each of these errors every time it builds, and it seems to build anyway.
It was working fine with Google Drive before I started to create HMI Projects (e.g. only function blocks) I think it basically tries to delete some files after it builds and something goes wrong as the files are still being worked on by Google Drive syncing, or these files only exist for a short time and it just takes Google Drive a while to catch up with syncing and then deleting them.) Sometimes I get errors about another process having a file open, but usually running the build again or restarting the IDE, it works. Doesn't seem to cause any noticeable problems, but perhaps if that part of the project did not change, it won't cause a problem if it fails to update that particular file.
Then I thought I should save the file as... to a new location on a local directory instead of Google Drive and open this. This gets rid of the errors during build, but the variable problems started to occur as above. Adding new ones doesn't work, even when they are correctly linked to a function block, and worked before. Only thing I have done was replace one function block with different, similar function block, and link it back in as before.
I tried all sorts of things to get it working again, making new variables... clearing the flash variables.. nothing seemed to fix it.
So I had to abandon that project and go back to the one on google drive.
I notice it has this error appearing about a missing part in the file, though I have not noticed anything is broken. I'm not sure how the path got to have "Google Drive\google drive" in there, since this is obviously wrong. (Its somehow in there twice.)
-
RE: HMI Cannot add more variables
Ok - I've lost another one that was working before. I have changed the logic in the main program to do something slightly different with the global variable. But now it has also gone from the HMI.
Error PLC PLC
WebControl 6 3 Unable to write variable link 'HMI_3_06', check if the property 'Variable' is set properly and build the project again.Any advice what to do? I don't understand what is going wrong. Start new project again from scratch? :-(
-
RE: HMI Cannot add more variables
Here's a screen shot from the variables browser. I am not sure why new variables, or this one specifically went wrong after I added a new one - appears crossed out "PLC Value" in the variable browser. Have I reached some maximum in the number that can be defined?
-
HMI Cannot add more variables
Hello,
When I try to add variables into an HMI setter, I get the error:
Error PLC PLC
WebControl 1 2 Unable to write variable link '', check if the property 'Variable' is set properly and build the project again.I have added lots of other variables, but one of them in particular, although it shows in the program, does not show up in the HMI to be used.
If I try to add new variables, they do not show up in the HMI to be used.
HELP!!
-
RE: Mervis HMI Emulation
I would like to do this to, but I believe it is not currently possible because the windows RT lacks the fastcgi layer in order to support HMI.
Are you able to get Windows RT working at all to simulate unipi devices? I managed to connect to it but then didn't really understand what I needed to do if I just wanted to play about with logic blocks without requiring a unipi device connected.
-
RE: Correct timezone offset setting.
Yeah, what I mean is, I first downloaded the configuration, saw that the setting was already 0, and then just uploaded it again. I didn't actually change anything in between. Anyway, seems to have now got it set correctly. Thanks for the help!
The multiple interfaces problem is odd, since the two interfaces are NOT both connected at the same time. eth0 was just set to DHCP and not connected, but the wlan0 interface only works properly when eth0 is plugged in. If eth0 is unplugged, the wlan interface works for a while but then eventually stops working properly.
This seems to be a Raspberry Pi issue people are reporting elsewhere, though not easy to debug as the unipi display port isn't accessible to connect, so it's hard to see exactly what's going wrong. (Maybe I will take the SD card and boot it in a regular Raspberry PI with a display connected, so I can better understand what is going on.)
The issue would seem to be a combination of the default ARP behaviour in Linux which responds with the wrong MAC address, DHCP, and that when there is no cable connected, in some situations Raspberry Pi still thinks it's up and tries to use eth0 anyway. (/etc/interfaces "auto eth0" vs. "allow-hotplug eth0")
So far, I have both interfaces set to dhcp, and I did have "auto eth0" in /etc/network/interfaces but looks like this was causing some of the problems, so I set it back to "allow-hotplug wlan0 eth0". and then set:
/sbin/sysctl net.ipv4.conf.all.arp_ignore=1
Now, when eth0 cable is removed, the interface still shows as "UP" but it deletes the routes and remove the IP config from the interface, and then because it responds to ARP with the correct MAC address for wlan0, it doesn't break.
Also set "wireless-power off" under the wlan0 interface config, but not sure if that made any difference. It would seem that some wireless APs are able to send a magic APSD request which causes the interface to go into power save mode. I don't think my AP does this.
I'll see how I get on. Worst case, I will have to just add commands to toggle eth0 down when wlan0 comes up, and toggle eth0 up again when wlan0 goes down, called from up / down hooks in /etc/network/interfaces.
-
RE: Using HMI JSON API fastcgi/backend
@martin-kudláček I would like to be able to trigger certain things based on some external data, for example get some weather data, or read from an external calendar or web page, and then trigger something in Mervis. Mervis really could use the ability to call an external script and push the output of that into a variable, for example.
Reading though the forum here, it looks like it's not advisable to have Evok and Mervis in place at the same time.
Whilst the web interface HMI is okay, it's not possible to have HMI and a logic block (say, the Output from a momentary button logic, and HMI controlling it at the same time.) I have to do a hack to read variables set by the HMI, do the logic in the Function block, and then set the variable back again for the HMI. You end up having to awkwardly process a lot of logic state, and this makes it quite complicated if you want to control things from both the web interface and physical inputs.
I may have a look at Evok, but didn't really find a nice web front-end for it that might be suitable for a home automation type project which look like they would be fast enough/don't require a lot of coding. I understand it might be possible to interact with it using say, python and Modbus, but it doesn't look that friendly to work with.
-
Using HMI JSON API fastcgi/backend
Hello,
I am trying to read/set things via the HMI API JSON backend, but I'm not having any luck so far.
Trying a command like:
curl --header "Content-Type: application/json" --request POST --data '{"ver":"1"}' http://127.0.0.1:9999/
And variations, but I'm not getting any response, although the server does appear to be listening on the port 9999:
root@L203-sn218:/etc/network# netstat -an | grep 9999 tcp 0 0 0.0.0.0:9999 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:9999 127.0.0.1:34224 ESTABLISHED tcp 0 0 127.0.0.1:34230 127.0.0.1:9999 TIME_WAIT tcp 0 0 127.0.0.1:34224 127.0.0.1:9999 ESTABLISHED
It connects, but no data comes back, so it just eventually times out. While this is waiting to timeout, the HMI web interface is also unresponsive. It's not mentioned in API documentation how to connect to which port, or the how to structure the URL, for example.
I tried to structure a query like this and send this with curl to port 80 and port 9999, but I get the same no-response. (or port 80 returns 404 error).
{"ver":1,"v":["svc://defaultConnection/9566[0,1]","svc://defaultConnection/9566[0,1]"]}:
Any pointers would be greatly appreciated.
-
RE: Correct timezone offset setting.
This seems to have worked - although when I did "download configuration" and the re-uploaded it, the timezone offset was still set to 0, it has applied it correctly this time.
Network interface setting reverted to "DHCP" from the previous static, but since I am using the Wifi interface, I commented out the reference to /etc/network/if-eth0.conf in /etc/network/interfaces.
The raspberry Pi seems to get really confused when wlan and eth0 are both configured for DHCP. When eth0 is disconnected, wlan0 interface stops working properly and everything slows to a crawl.
Only way I've seen to resolve it so far is to set eth0 to static and only use wlan0 with DHCP.
Thanks!
-
Correct timezone offset setting.
Hello,
Despite having UTC offset set to 0 in the PLC properties, and the time being set correctly in UTC:-
root@L203-sn218:~# date Mon 14 Jan 19:23:22 UTC 2019 root@L203-sn218:~# hwclock --localtime 2019-01-14 19:23:27.912454+0000
The result of "getlocaltime" in mervis is always 1 hour ahead.
Any ideas how to get it to use UTC time properly?
Thanks.
-
RE: Updating functions in IDE
@tomas_hora I'm not sure that made any difference.
I have to do some more testing, (For some reason the IDE has been crashing on me a lot when I try to do certain things like delete outputs or function blocks.) but what I think is happening is that the correct logic is being uploaded to the PLC, but the "debug" output (e.g. when using manual mode switches) loses track of things after the update.
Exiting and restarting the Mervis IDE, it seems to come back again.
-
Updating functions in IDE
Hello,
I've started to write some of my own function blocks/functions in Mervis IDE, however, I notice that if I update them, most of the time I need to go back to the main function block where they are called from, delete them all and put them back in again before they work when deployed.
(i.e, I make a minor change to a function, build -> deploy -> debug) then on testing, the function block doesn't behave as it should (some or all inputs don't result in expected outputs.)
If I delete the function block and add it again, connect it all up again, build -> deploy -> debug, it works then as expected.
Is there a way to refresh the functions without having to delete and re-add them? If I have 20 switches, it's going to get painful if I have to delete all the functions they are connected to and re-add them all every time.
Thanks.
-
RE: FBD function error
@martin-trojan I just encountered the same error:
"there is not declared any retval output for function 'testfunction'. FBD functions have to have retval explicitly declared"
After some experimentation, I just created a bool output on the right side called "retval".
It's set to "False" by default but it seems happy with True also.Not sure how this is used in FBD, but it might be needed in ST scripts to determine if there were errors encountered while the block tried to execute. (e.g. if it returns > 0 then stop) etc.
Perhaps one of the unipi team can comment on what it is for?
Anyway - it seems to build without errors now.
-
RE: Compilation problem
@msoenen Check that your inputs are not still set to Manual Mode.
(Any yellow hilighted input.) When in Debugging Mode, Right-click it, select "Manual Mode" and then make sure the checkbox is not ticked, then hit OK (even if it's already unticked.)
I got caught out by this a couple of times. PLC input does not respond if Manual Mode is still enabled.
-
RE: Direct Switch ?
Ah. Seems I just realised where I was going wrong.
I was missing the step to configure the module. Deploying the solution is not enough.
"We just changed the configuration of the PLC modules, which is not applicable by simply uploading the solution. To save the configuration, follow the UniPi - Configure Module tutorial."