LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

latch delay feed back?

Olroit, here we are.
Basically the heater is O0.1.
On can set/write single bits to a PLC, but onle read back words. Hence Output word 0 which then gets bit 1 extracted. So at the end i set a bit, and read it back.

Cheers and thanks again,

Steffen
0 Kudos
Message 11 of 47
(1,624 Views)

I looked at your code...  You need to re-design it.

Design the approach by functionality.

Functions:

1:  Front Panel Button:  to turn Heater ON or OFF

2.  LED Indicator:  To indicate state of the heater.

3.  Remote Switch:  represents something somewhere which can also control the heater.  Something that affects the status of the heater, thus the LED.

Since the Front Panel button also indicates the status of the heater, same as the LED, you could combine them into one.

However, your code uses logic (and the bad use of Local Variables) instead of states.

Consider this:  You need to read the change of state of the Front Panel button.  You need to read the state of the LED at regular intervals.   Since the application does not interact or affect the state of the external switch, maybe we should represent it by simply reading the LED.  Another VI that has access to the LED could turn it ON & OFF, which is a better representation...

I'll see if I can whip up a better example.

RayR

Message 12 of 47
(1,616 Views)

Please forgive me if I missed something in my quick read of this thread.

This sound like yet another example of a race condition, two un-coordinated writers of the same value.

If you can control the PLC's code I'd recomend you include logic to check a boolean flag that will serve as a "set output" request. It should only be writen by the PC and read by the PLC. If the PLC sees it is set and the conditions are correct, then the PLC set the output as requested.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 13 of 47
(1,613 Views)
Agreed, Ben.
 
That's why I suggest using a state machine to simulate the PLC...  to get the LED & button state right..  🙂
Message 14 of 47
(1,611 Views)
Hi Joe,

well, thats what I had until now: setting a vale and reading back the LED. But then the switch "says" its ON. the LED says, its ON. Which is true, since the LED reads it back from the PLC. To switch it OFF for real I have to first switch it ON, then OFF again....
Hm, just at at beginners level, never heard about states before (in LV)

Cheers,

Steffen
0 Kudos
Message 15 of 47
(1,578 Views)
Hi Ben,

hm, that would be the solution. But, its a PLC training module, am not meant to change the progam on the PLC.
Whats wrong with local variables?

Steffen.
0 Kudos
Message 16 of 47
(1,575 Views)
I will modify the original example and fit it with your code by using a State Machine....
 
Be back soon..
Message 17 of 47
(1,555 Views)

Before completing the example, I need to know the following..

WHich switch has precedence over the other?

In other words, does the FP heater switch over-ride the remote one and does it reset the state of the remote switch?

Because you could press the FP switch to turn OFF the heater, but meanwhile, if the remote switch's state is ON, then when you read that state, it will turn ON the heater again..  So what happens with the remote switch?

RayR

Message 18 of 47
(1,546 Views)
Hi Joe,

thet is what happens just now, since they are influencing each other they start oscillating. I.e. when I switch ON, the PLC is OFF the PLC goes on for a short while, but as soon as I release, my switch goes back to OFF. I should have priority, but if the process needs to change the state of my switch it should have the possibillity. Maybe some sort of delay or latch, means I switch to a state, the PLC switches to that state, I read it back and the switch stays in that position until I or the process changes the state. So for a certain amount of time I would override the process (PLC).
Sorry, English is not my 1st language.

Cheers,

Steffen.
0 Kudos
Message 19 of 47
(1,541 Views)
I realized what you described when I was implementing the example, which is why I was asking the question.
 
So if I understand correctly, you would want to use the Front Panel button to over-ride the PLC external control to the heater.  I could write the example so that the heater is only controlled by the Front Panel switch.  The Front Panel switch would only be affected by changes in state of the PLC and not the current (active) state. 
 
I can do the example and you'll see what I mean..
 
RayR
Message 20 of 47
(1,532 Views)