Hello Guest it is October 14, 2019, 02:29:53 AM

Author Topic: compare immediate not working  (Read 8804 times)

0 Members and 1 Guest are viewing this topic.

Offline TPS

*
  •  1,388 1,388
    • View Profile
Re: compare immediate not working
« Reply #10 on: June 18, 2015, 04:38:10 PM »
Hi George,

i will be offline for a couple of day's.
if after this "day's" nobody got a brain
"solution" we will try to get this working
in VB.

Thomas
anything is possible, just try it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: compare immediate not working
« Reply #11 on: June 19, 2015, 08:58:23 AM »
Hi Thomas

That's brilliant thanks for that. I need all the help I can get

I have made a bit of progress on the brains

Two things

First          I have noticed that It doesn't appear to like the formulae output

just as an integer. Instead it seems to prefer it in terms of the inputs ABCD

so for each formulae I picked an input that had a 1 value then multiplied it

by the required tool number   ie  for tool 4      A*4   rather  than just 4   etc etc

Second     I came across some guide notes written by poppabear and he states



•   You cant have the same object as an output, follow as an input further down in the same brain and expect it to change condition on a single scan. Brains only does ONE state change per object per scan. (at least that is what I have found). It is hit or miss if your doing it across several Brains then it will depend on execution position and last state wins……..   The only exception to this is Local Vars which appear for all intents and purposes to update locally at that scan, again that is also hit or miss, I have seen it work like that and NOT work like that………go figure……. Keep to the reusing the Output only once as an input in the same brain and you should do OK for the most part.



So I took out the repeated use of current tool dro  tied all the lobes together with an OR command and terminated to a single current tool dro


I did this for both brains ie tools 1 - 4    and tools    5 - 8   and I thought it worked  but just as poppabear predicted both brains are competeing with each

other for priority  sometimes it will work perfectly sometimes it will output 0 for 4 tools.   !!#*@*@*#*!!



Anyway my next train of thought was to change the two termination values for each brain to V1 and V2

 

ie  Current Tool DRO       to  local var  V1   and    local var V2


then write a third brain

local var                                          Formulae                 Termination

V1                 no operation

                                                    ADD  A  +  B             Current Tool DRO

V2                 no operation


ie at any time either A or B will equal 0

but when running this my computer locks up   so it doesn't like something!!!!



So still some work to do.

Hopefully someone else from the forum will jump in with the answer.


Anyway thanks again and enjoy your weekend

cheers George

Re: compare immediate not working
« Reply #12 on: June 19, 2015, 01:51:46 PM »
Hi Guys

I have since read that you can't use local variables as inputs or the system locks up (been there)

so I have now tried


input1         no operation          Formulae                           termination

input2         no operation
                                              (A*B*C*D) +v1 + v2         Current Tool DRO
input3         no operation

input4         no operation


where (A*B*C*D) will always be 0 and either v1 or v2 will be zero depending upon turret position



This has not worked either. I can't get the new brain to recognise the local variables V1 and V2


it just outputs 0. How can I transfer variables from one brain to another?



Can anyone shed some light on this?

cheers George
Re: compare immediate not working
« Reply #13 on: June 19, 2015, 05:16:35 PM »
Hi Guys

Just a quick note to say I think I've cracked it.

I didn't manage to get two brains to swap variables

but I did manage to shorten the program so it stopped throwing up errors

basically in my first attempt I was using 4 inputs to define each tool station

if fact I just needed 3 and in some case 2

ie  input2 = 0  AND  input3 = 0   uniquely describes tool station 4    etc etc

if I get a chance over the weekend I will do a quick summary of my findings

just in case anyone else is wanting to do anything similar.


cheers George

Offline TPS

*
  •  1,388 1,388
    • View Profile
Re: compare immediate not working
« Reply #14 on: June 22, 2015, 02:52:05 AM »
Hi George,
back again.

in VB it would be easy, am i am sure that it will work
like this.

' tool position 1
If (IsActive(INPUT1) And IsActive(INPUT2) And IsActive(INPUT3) And Not IsActive(INPUT4)) Then
   SetCurrentTool( 1 )
End If

Thomas


« Last Edit: June 22, 2015, 03:07:20 AM by TPS »
anything is possible, just try it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: compare immediate not working
« Reply #15 on: June 22, 2015, 02:35:06 PM »
Hi Thomas

Hope you had a good weekend.

Thanks for that I will keep it in mind.

I managed to get the brain program working eventually. It hasn't failed

yet but I am still keeping a close eye on it for the moment. I still get the feeling

brains contains bugs but hopefully they only expose themselves during the programming

phase. If the brain proves to be unreliable I will make use of your suggestion of script.

The reason I wanted a brain to monitor the tool position is just for speed.

I thought it would mean that I could use a much shorter tool change macro.

That is my next project.

Just for information in case anyone else is looking to write a similar brain I have attached

a photo of the final program and one of it in action.

My observations/recommendations  are as follows

(the observations may or may not be correct but may allow you to spot a common trend and hence identify a bug)

1) Read poppabears user guide to brains first. (forum user documents) Wish I had found it earlier.

2) Although I could not see a reason why it should not work. The immediate compare function did

    not seem to work for me. Luckily Thomas showed me a workaround.

3) The formulae box did not like straight forward integer values. Instead they needed to be in terms of an input.

4) Could not get local variables ie V0 V1  to pass from one brain to another. If they can only stay within one brain they
   
    must be of very limited use.

5) Only use a particular output once within a brain. It might even confuse it if two or more brains are trying to output

    to the same location I don't know but worth checking if you are having problems.

6) The length of the brain seems to be an issue. For me any program over 20 line the scroll feature would kick in and incorrect results achieved.

    When reading poppabears notes I think he said 50 lines was the max but he normally stopped at 40.  Maybe screen size

   can have an influence !!.  If this is the case maybe temporarily changing the screen resolution may be a workaround.

7) If you are still struggling and needs to post for help hopefully Thomas or one of the other regular contributors will answer your call.

   I don't know where we would be without them.

Thanks Guys

George

Offline TPS

*
  •  1,388 1,388
    • View Profile
Re: compare immediate not working
« Reply #16 on: June 22, 2015, 03:36:39 PM »
Hi George,

7) If you are still struggling and needs to post for help hopefully Thomas or one of the other regular contributors will answer your call.

   I don't know where we would be without them.

Thanks Guys

George


Thank You

Thomas
anything is possible, just try it.
if you find some mistakes, in my bad bavarian english,they are yours.

Offline BR549

*
  •  6,902 6,902
    • View Profile
Re: compare immediate not working
« Reply #17 on: June 23, 2015, 12:52:36 AM »
Just so you know teh Sampling rate for the I/O with brains is NO faster than the Macropump BOTH run at 10hzs  ( 10 samples per sec).

Just a thought, (;-) TP