galluccinator Posted June 16, 2014 Report Posted June 16, 2014 Hello, I am new to ladder logic and the Unitronics system, and I had two questions: 1) Is there any way to simulate a project WITHOUT connecting the PLC controller to it? I want to see how some of the example projects run but I don't have the actual console yet. 2) How would I make the program wait for a specific condition to be met before moving on with the code? For example, I want to open a valve, and then once the pressure goes down to a certain level, shut off the valve. However, if I use a positive contact saying "If pressure is <= x" and then write a coil that shuts the valve, won't the program just skip the rung (because in the beginning it would just evaluate as false) and end the program without waiting for the condition to be fulfilled? Thank you in advance!
Saragani Posted June 17, 2014 Report Posted June 17, 2014 Currently, there isn't any simulator. Visilogic and the Vision PLCs do have a 3rd party simulator. The PLC works in scans. On each scan, the code runs from the main function, and continues to each function or code that is being called. Lets say that for example, the scan time (the time it takes for your ladder code to run from start to end) is 1ms... then it means that every 1ms, the "if pressure <= x then" would be evaluated. (So threre is no problem)
bobnorway Posted June 17, 2014 Report Posted June 17, 2014 The trick here is to write your program in steps using MB as flags. step1 = NOT step2 then set step1 flag (turn on valve output) step2 = NOT step3 and step1 and low pressure set step2 flag (turn off valve) Each network should start with a NOT contact of the next flag plus an AND of the previous flag, thus blocking an unwanted sequence. Make a program routine just for the steps Make an output routine which ties the flags to the outputs. Make a reset routine to clear all the flags.
Robin P Posted June 18, 2014 Report Posted June 18, 2014 You can perform a comparison "pressure >= X", and if True then make a Return Call. No lower rungs in the ladder will be executed unless the pressure falls below X.
MVP 2023 Flex727 Posted June 19, 2014 MVP 2023 Report Posted June 19, 2014 Hello, I am new to ladder logic and the Unitronics system, and I had two questions: 1) Is there any way to simulate a project WITHOUT connecting the PLC controller to it? I want to see how some of the example projects run but I don't have the actual console yet. 2) How would I make the program wait for a specific condition to be met before moving on with the code? For example, I want to open a valve, and then once the pressure goes down to a certain level, shut off the valve. However, if I use a positive contact saying "If pressure is <= x" and then write a coil that shuts the valve, won't the program just skip the rung (because in the beginning it would just evaluate as false) and end the program without waiting for the condition to be fulfilled? Thank you in advance! It's important to understand the PLC workflow. Here are the basics: 1) Read inputs. 2) Evaluate ladder logic. 3) Write outputs. 4) Repeat steps 1-3 continuously. Normal software is linear and runs from beginning to end. PLC software is a loop - it executes and repeats infinitely. You cannot have the program stop and wait - it will create a watchdog timer alarm. The important thing to remember is that each Output Coil should exist in only one ladder rung. Think out every condition that turns the output on and place it in a single rung. (The exception is SET & RESET coils) If you need to wait for a condition to be true before executing code, set a bit to be true when that condition exists and use it as a gate for that logic or subroutine. Use the Main Routine to execute subroutines and execute initial (startup) actions only. All program logic should take place in subroutines.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now