Is it possible to program this onto a Click PLC? If so, I need help anyway.

I can't upload I can only do quick replies so that's why I do links.

I cannot upload because my work computer does not allow it. Hopefully I can send the program to my own email then when I get home I can upload the file.
 
Cool beans.


Rung 9(I think?) of the Main Program calls subroutine [1 Idle State] IF DS1 is 1.

Then that subroutine [1 Idle State] has its Rung 1 conditional on DS1 being 1. Since subroutine [1 Idle State] will not be called unless DS1 is already 1, one of those conditionals, either in the Main Program or in subroutine [1 Idle State], is unnecessary.
 
Also, you are not following the pattern @OkiePC suggested in Post #85, where the state logic (e.g. if step is 1 and start button is pressed, then move to step 10) is in one subroutine and the business logic (e.g. if in state 10, then run pump and close solenoid valve) is in another subroutine.

So all of the [COPY step# => DS1] instructions will be in the same state logic subroutine, and there will be no other output instructions (SET, RST, OUT, etc.) in that state logic subroutine. The exception will be one RST instruction to clear the step_changed bit to 0 at the start of the state logic subroutine, and a SET instruction to set the state_changed bit to 1 in parallel with each [COPY step# =? DS1] instruction, plus a NC Contact testing that state_changed bit on every rung in the state logic subroutine, to ensure that there is at most one step change per scan cycle, so no steps are skipped.

It will be much clearer if you partition it like that. The scan cycle is running near 1kHz, so having all of the state logic execute in one subroutine, and all of the business logic in another subroutine, should not be a problem.
 
Here is the program file.

The subroutine information did not stick clearly with me. Some of the words you guys are using are foreign to me but I will try my best to follow them.
Tomorrow I will try to reread what Okie said, in my mind subroutine meant everything can go in order basically, but at least I tried and built something that I can learn from. I will be here tomorrow asking questions probably.
 
You don't want to put conditions on the subroutine calls. That opens up a can of worms that will quickly turn into a can of whoop a$$.

The only time I would do that is for first scan (initialize things on power up) or for special data manipulations, but never for machinery control.

I'm going to rewrite some of this and upload a revision later.
 
Is there a schematic yet? I am seeing some conflicts...Analog inputs are assigned:
CH1 = DF5
CH2 = DF2
CH3 = DF3
CH4 = DF4

But the comments on those addresses and their usages suggest perhaps a misunderstand or overlap.
 
Oh dear ...
Untitled.png
Rungs 1 and 2 are basically the same [NC bit OUT bit], with the second rung also trying to run a TON (Timer ON-delay) named T2.

Let's Beaufort* the logic for Rung 1:

  • It looks like the code expects the Y001/Y002 bits to be 0, and they need to be 1 for this Sequence 10 (Y001 opens to let air go to the pneumatic pump; Y002 closes the pressure relief valve so that pressure can be accumulated)
  • On the first scan, if Y001 is a 0, then
    • the -]/[- NC Contact instruction
      • "looks for a 0" at address Y001,
      • and finds it,
      • so the NC Contact -]/[- output rung evaluates to True,
    • Which causes the OUTput Coil -( )- instruction to write a 1 to Y001
    • I.e. this rung inverts Y001 from a 0 to a 1
  • HOW-SOME-EVER,
  • On the next scan, Y001 is a 1
    • The -]/[- NC Contact instruction
      • looks for a 0 at address Y001,
      • and does not find a 0 on this scan, because Y001 is 1,
      • so the NC Contact -]/[- output rung evaluates to False,
    • Which causes the OUTput Coil -( )- instruction to write a 0 to Y001
    • I.e. this rung also inverts Y001, although from a 1 to a 0 this time
  • On each subsequent scan, one of the two scenarios plays out, so Y001 alternates between 0 and 1, or vice versa, on each scan.
The same thing happens on Rung 2, except it is Y002 that alternates its value on each scan.

There an additional side effect in that TON T2 starts on scans when Y002 is 0, but then resets on the next scan when Y002 is 1. So TON T2 never expires.


* That is intended as a compliment, the same way Click and Clack, The Tappett (Magliozzi) Brother's said that "to Bernstein" means to double-clutch.
 
Also, consider the following as a cleaner alternative for the Sequence 40 Business and State logic:
Untitled2.png





That executes functionally equivalent logic to the original below, which, with its multiple writes of 50 to DS1 Sequence Step, requires a bit more mental horsepower to read and understand:
Untitled.png
 
i'm jumping in a little bit late, but i have some questions.

you mentioned hydrostatic test, but you are using air, not water or other liquid.
what is your application? i am assuming you are pressure testing a closed vessel. if this is air, you need safety measures to protect the operator and others from debris in case of leaks. you also need a valve to close off the air to the vessel being tested to separate it from the air supply. you also need high pressure valves that will operate at 250+ psi. there also needs to be an air dump valve to exhaust to the atmosphere. you don't need to remove the clamping mechanism at the tank inlet. i have built some of the hydrostatic testers before.
james
 
Using compressed air going into a water pump. The outlet of the pump is connected to the local tap water supply.
The application of this is to pressure test hoses, these are industrial made hoses and most of them are custom specifications. We need to test these hoses if they can withstand a certain pressure for a certain time. So yes it's a closed vessel, the hose is. The pressure relief valves will all be on the water side of the system. There will be one valve for cutting off air supply to the pump and also one for relief the pressure of the air. I posted on page 5 of this forum a rough diagram of the system.
 
Hello, I did some cleaning up on the program. Sorry I cannot post the zip file itself; I can do that later after work today.
I think it terms of being simple I think I did the best I can. Let me know how it looks compared to the first version.

Also, I still need more information on how a subroutine works, I feel like I am still missing some key information that made my first version look nasty.

I also added more detailed comments this time around.

https://online.flippingbook.com/view/781801958/

I also made a version without the pre-test and post-test values so that removes one sequence. Now that I think about it, I probably will not have a post and pre-test pressure for the final version.
The reason why is because subroutine (Posttest checkups checks) if the pressure in the system is in between +/- 5% of the pressure setpoint. There is no reason for me to have a pre and posttest pressure because all we care about is if the pressure in the system is in the tolerance range of +/- 5% of the setpoint. If its below or above these thresholds, then the test fails and otherwise it passes. Also is simpler for the programming.

Here is the version without the post and pretest pressure, its simpler! How I use the subroutines is probably wrong so let me know my errors and mistakes or what I can improve and make simpler:

https://online.flippingbook.com/view/782048503/

I also have a question. After someone presses the start button on the HMI that button turns into a one and never goes back to zero. Then when the test ends and goes back to the main program, the start button will be 1 still so the pressure test will start again. Do I need to add somewhere to reset the start button, stop button, emergency button, and other things just like I did with the display messages?
 
Last edited:
Questions

1)After someone presses the start button on the HMI that button turns into a one and never goes back to zero, right? Then when the test ends and goes back to the main program, the start button will be 1 still so the pressure test automatically will start again on rung 5 of the main programs, this also is the same for the emergency buttons and stop buttons. Do I need to add somewhere (like subroutine 0) to reset the start button, stop button, emergency button, and other things just like I did with the display messages on subroutine 1?

2)On the main program, rungs numbered 2 and 3 which are safety features. Do I need to copy and paste these 2 rungs into the subroutines 10,20,30, and 40? If the program is scanning subroutine 20 and as the pressure is building someone pulls the emergency button or maybe the pressure goes over the overpressure point, will rungs 2 and 3 on the main program execute while scanning the subroutines?

In easier terms, will rungs 2 and 3 work if at any point someone pulls the emergency button, or the pressure is over the overpressure point?
 
Last edited:
Is there a schematic yet? I am seeing some conflicts...Analog inputs are assigned:
CH1 = DF5
CH2 = DF2
CH3 = DF3
CH4 = DF4

But the comments on those addresses and their usages suggest perhaps a misunderstand or overlap.

Yes there is a schematic and part list on this thread I posted. Check post #70 and #73 on page 5 of this thread. I will be using 1 input which is a pressure transmitter. That transmitter will be connected to Ad1 and will transmit the scaled data into DF5. The rest of the input channels I don't use. Maybe I will use it later
 
I also have a question. After someone presses the start button on the HMI that button turns into a one and never goes back to zero. Then when the test ends and goes back to the main program, the start button will be 1 still so the pressure test will start again. Do I need to add somewhere to reset the start button, stop button, emergency button, and other things just like I did with the display messages?

Yes, assuming the HMI inputs are momentary buttons, which seems to be the case from what you are saying happens, you probably need to reset those buttons in the PLC program.

TL;DR

There are typically at least a couple of ways to configure HMIs to write the state of HMI buttons into their representative bits in the PLC Data Registers.

  • Write a 1 to the PLC each time the button is pressed; do nothing when the button is released.
  • Write a 1 to the PLC when the button is pressed; write a 0 to the PLC when the button is released.
The first case is called "set and forget," and it is the most reliable.

It appears in your situation the HMI is configured for set-and-forget. One way to deal with this would be to have two rungs, or a rung with two branches:

  • First rung/branch: look for a 1 in that bit conditionally on the Sequence being at step 0, and react accordingly (e.g. transition to step 10)
  • Second rung/branch: reset that bit to 0 unconditionally.
When the process is in Sequence step 0 and the button is pressed,

  • the first conditional branch nsures that a valid button press is responded to on the first scan scan it is detected,
    • and does not risk missing the button press before of the second unconditional branch clears it,
      • because the first branch is evaluated before the second branch (top-to-bottom, left-to-right),
  • And the second unconditional branch clears the bit so it not detected again in future scans.
When not in Sequence step 0 and the button is pressed,

  • the first conditional branch correctly ignores the invalid press as it should, and
  • the second unconditional branch ensures the button press does not hang around like a stale f@rt around during future scans.
 
Last edited:

Similar Topics

Hello. I have been trying to crack this one without success and could not find any hint after several search attempts. I wonder if any CODESYS...
Replies
4
Views
3,884
Hello, I'm pretty sure I know the answer to this, but wanted to verify with the experts. Am I able to write a program using the Micro Starter...
Replies
7
Views
3,134
First off, i am new to ladder logic. I do have some experience programming microcontrollers in C. I will try and give a short version and if more...
Replies
7
Views
1,973
This is a CompactLogix L33ERM, version 30 (31 is too unstable on my machine to work with), with a Kinetix 5500 drive. I have a program where...
Replies
2
Views
1,981
Good morning guys! I have a doubt. I uploaded a program from a S7-200xp on the field and took it to the office. Before doing any test I tried to...
Replies
7
Views
2,131
Back
Top Bottom