Introduction to PLC Programming with C++

Поділитися
Вставка
  • Опубліковано 3 лис 2024

КОМЕНТАРІ • 66

  • @caffeinatedinsanity2324
    @caffeinatedinsanity2324 Рік тому +4

    Nice thing most PLCs support simulatenous use of both languages. LD or FBD takes care of mechanical controls, while C++/ST excel at crunching numbers for complex calculations or any form of analysis. I remember in college, I would create ST functions I would sneak into a LD program, because my teacher was so obstinate about using LD or SFC.

  • @MrAr4uk
    @MrAr4uk Рік тому +12

    Good afternoon, yes, this is interesting, but there are nuances, not all automation engineers know C ++, and also if we are talking about large projects, like the "blast furnace" example, where there are a lot of mechanisms and sensors, and in the event of a breakdown, you need to quickly find the cause , considering that everything is done on the PLC, then the LD language is the most optimal of all those listed, I once wrote a program completely in ST, when creating an object, I had to rewrite everything in LD, since this was required by the operation, I think, as for the developer, use C++ has more features, but for exploitation, these are only minuses

  • @Automation_Control_Tuning
    @Automation_Control_Tuning Рік тому +10

    Well explained. This is where the benefits of DCS over PLC are apparent. Using ST these and many other functions difficult in Ladder. Great option for PLC’s to raise the data options.

    • @realpars
      @realpars  Рік тому +2

      Thank you very much!

    • @mathieufasquelle3159
      @mathieufasquelle3159 Рік тому

      You mean dual safety?

    • @bradystewart5534
      @bradystewart5534 Рік тому +8

      A PLC can be part of a DCS. You obviously don't know what you are talking about, just like the guy who runs this channel. Distributed control system means just that.. it has nothing to do with NOT having a PLC. Also using ST inside a PLC is not very useful if you work in a company with more than just yourself... most technicians can't troubleshoot ST and you are just making a nightmare for yourself. There's really nothing you can't do in ladder that you need ST for.. maybe initialization stuff but even that not ideal.
      It's even smarter to leverage ladder logic even if it's less elegant because it makes troubleshooting for technicians far easier. Designing systems for the end user and not your own pride is what good engineers do.

    • @MrAr4uk
      @MrAr4uk Рік тому +2

      @@bradystewart5534 something tells me that you think from the height of your competence, apparently LD, this is your maximum, for this reason you are rude to everyone in the comments)))

    • @bradystewart5534
      @bradystewart5534 Рік тому

      @@MrAr4uk You're the 90IQ moron who can't understand writing code for a target audience... also you acted like learning multiple types of languages was hard. If you were smart you'd know once you learn one programming language, you know them all. Whether it's C, C++, C# / .NET, javascript, SQL, ladder logic.. I am your superior at everything clown. You don't even have an engineering degree so I don't know why I bother to explain more advanced topics to someone so limited.

  • @Andrew-rc3vh
    @Andrew-rc3vh Рік тому +1

    I created my own language to do this sort of thing and it has logging built into it. It's a functional programming language so it's easier than C but can do more than the non-C alternatives above. How the logging works is that for each output the programmer defines the user can just tick a box and it will log and and display real-time web graphs. Actually the code to do the logging is rather more complicated than your example. I've built in data compression, which is good if you are logging a lot of data and need to display it from the database.

    • @okbrb
      @okbrb Рік тому

      Github link?

  • @JesusNajera-si1to
    @JesusNajera-si1to Місяць тому

    Same thing can be done with MX component by Mitsubishi electric., amazing Work realparts!!

  • @syufrijal
    @syufrijal Рік тому +5

    Very good explanation about PLC programming with c++...thanks for your information

  • @rosyidmunawarwicaksono4494
    @rosyidmunawarwicaksono4494 Рік тому +4

    Very useful as a thesis reference

    • @realpars
      @realpars  Рік тому

      Great to hear that, Rosyid! Best of luck :)

  • @jahndo
    @jahndo 8 місяців тому

    C++ is actually lower level than ladder diagram. The terms high and low mean the abstraction level in programming languages and c++ has fewer abstractions than ladder diagram

  • @mybox6177
    @mybox6177 10 місяців тому

    Okay, it is good to see how to do it in a VS

  • @faouzibounoua
    @faouzibounoua Рік тому +3

    Keep going 👑🔥

  • @KevinNguyen-tw5ml
    @KevinNguyen-tw5ml Рік тому

    Thank you!

  • @kevinwikram1245
    @kevinwikram1245 Рік тому +1

    Thank you for this video

  • @deeplazydev
    @deeplazydev Рік тому

    Random watch but I found it interesting (I wrote PLC code at secondary school 20 years ago). Bad C++ code style.

  • @nayrbsworld3048
    @nayrbsworld3048 6 місяців тому

    whats the difference of log in hmi and c+? are they different

    • @realpars
      @realpars  6 місяців тому

      Hi there. Thanks for reaching out. I'm not sure I understand your question correctly, but in HMI or C++, "log" refers to a record of system events and data. Please let me know if I misunderstand your question.

  • @khanyithegreat
    @khanyithegreat Рік тому +1

    I need that starter kit.

  • @JKTCGMV13
    @JKTCGMV13 Рік тому +1

    What are the minimum system requirements to warrant a PLC? I program with microcontrollers at work every day. When would I switch from a generic micro controller to a standard PLC?

    • @DO-xw1zp
      @DO-xw1zp Рік тому +3

      PLCs are just rugged and industrialized controllers that are geared toward industrial environments that require very high uptime and reliability. For a microcontroller that say runs an appliance, you might have to reboot it periodically. If you are controlling an industrial process a reboot might cost millions of dollars in clean up as well as other problems.

    • @realpars
      @realpars  Рік тому +3

      Hiya! Great question and perfect timing..... We'll be releasing a new video shortly called "PLC vs PC: Which is Better for Industrial Automation?". Stay tuned!

    • @MrWaalkman
      @MrWaalkman Рік тому +2

      At GM the threshold was more than six relays. That is, if the design requires more than six control relays (contactors and starters don't count), the relays would be replaced with a PLC.
      As for an embedded controller, at $5,000 - $10,000 per minute for downtime it makes no sense whatsoever to cut corners with an embedded controller (and let's be clear, a PLC is just another form of an industrially hardened embedded controller). The one that I knew of that snuck in was a brake fluid boiling point tester which ran off of an 8052 (IIRC), and would crash quite frequently.
      One of the earliest versions of a "PLC" that I saw was a controller that was basically logic gates and had its "program" wire-wrapped in. This was at the old Shreveport Truck & Bus plant in the Paint shop. When it was retired from service, the guys kept it as their own museum piece. We also used old Selsyns from WWII destroyers for line master/slave position control. And the job rate was set from a Veeder Root (old school gas pump) :)
      But getting back on track, uptime is crucial, and while the brains can be a micro controller (and usually is), the I/O has to be industrially hardened to take whatever the outside world tries to hand it.

    • @JKTCGMV13
      @JKTCGMV13 Рік тому

      @@MrWaalkman thanks for the detailed answer 😁
      Sounds to me like the cost of downtime is the biggest factor that I hadn’t thought of. Nothing I’ve written had to run unattended for long periods of time where a reboot would’ve caused an issue.
      It seems that if your system has a high penalty for downtime, and if the controls are simple enough to be done on a standard PLC, then that’s a perfect spot for it. Using standard PLC programming software would mean you’re using a well tested and robust framework, while writing your own C code for a microcontroller could have all the bugs in the world.
      I’ve worked on rocket engine test software that had to be more rugged than an arduino (sitting out in the desert handling hundreds of channels of up to 28V I/O), using all the industry standard din rail mounting signal condition and DAQ equipment, like Nation Instruments I/O. The complexity of the software requires that it be run on a desktop PC but interfaced with all the relays and signal conditioners through the NI equipment. The company spent a lot of money testing the software, and it was also only used for short duration tests while actively monitored by humans. It absolutely couldn’t crash during a test, but it also had no penalty for being rebooted between tests. That’s the most rugged I’ve ever needed a system to be. All my other controllers sit in a comfortable air conditioned room.

    • @bradystewart5534
      @bradystewart5534 Рік тому

      @@realpars Please don't tell people to use a PC for industrial automation. You already made this hack video... if you don't know why PC based control is equally as hack then just stop making videos. You're not good at this.

  • @olgaourgent8944
    @olgaourgent8944 Рік тому

    Thanks so much 👍

  • @nikolaydubina
    @nikolaydubina Рік тому

    is it possible to do Tracing as well? logs are good, but next step for observability is tracing!!

    • @realpars
      @realpars  Рік тому +1

      Hi there. Trending is certainly possible.

  • @seventhson27
    @seventhson27 Рік тому +2

    I used to work in "customer support" for programming. We had a saying "C" will let you shoot yourself in the foot. It's harder to shoot yourself with C++, but when you do, it's with a bazooka.

  • @exolimited
    @exolimited Рік тому +3

    It makes sense and well explained

  • @hanimh7727
    @hanimh7727 Рік тому

    awesome! Thanks👏

  • @imangorji5152
    @imangorji5152 Рік тому

    wow i jast love it 🤓

  • @nikolaydubina
    @nikolaydubina Рік тому

    nice!

  • @DmitriNesteruk
    @DmitriNesteruk Рік тому

    Am I right in thinking that unless you have realtime or environment requirements, it's perfectly feasible to avoid PLCs altogether in favor of, say, RPi or KNX or something similar?

    • @epolpier
      @epolpier Рік тому +2

      PLCs are only for industries because it's not only about microcontroller but also strictly defined but rather simple IOs. In general PLC programs are simple in terms of funcionality but they control very important factors in industry and therefore are standarized.

    • @realpars
      @realpars  Рік тому

      Hi @Dmitri Nesteruk. Thanks for your question. I hope we didn't give you the impression that the only consideration for choosing a PLC was realtime and/or environmental issues. As we said in the video, flexibility with programming in 61131 languages and ease of expansion is important. Compatibility with field devices and available I/O modules is also essential.

    • @caffeinatedinsanity2324
      @caffeinatedinsanity2324 Рік тому

      You technically could, but bear in mind PLCs don't have all the software overheads that OSs tend to have like Web Browsers, Media Players, etc... I guess you could put a special OS to turn it into an embedded system and improve its execution speed, because one of the requirements for HVAC and especially Industrial PLCs, is execution speed.

  • @nikolaydubina
    @nikolaydubina Рік тому

    interesting!!

  • @eli25jk70
    @eli25jk70 Рік тому

    Really up to the user on what they prefer. Reality is its running all the same in the background.

  • @floydian48
    @floydian48 Рік тому +1

    well even just for starting a motor, it is needed tens of code! it really makes sense hahah

  • @florincheche163
    @florincheche163 Рік тому

    👍

  • @MrHaggyy
    @MrHaggyy Рік тому +1

    Oh this is sweat. I know why PLC is used for factory control, but C/C++ is a far more capable language for aditional services and a gate for a fab to any cloud based activity.

  • @Stabby666
    @Stabby666 Рік тому +2

    C++ is actually a lower level language than the others.

  • @spacexnix
    @spacexnix Рік тому

    it's incredible! Very cool. let's have more examples of programming with PLCnext in high-level languages 🦾