Hello! I'm a software engineer and community manager here at inxton. I'm probably working on a new feature or shooting a video for you...when I'm not in the office I ride on the wakeboard 🏄♂️ or I'm planning a trip somewhere🗺
I was browsing reddit.com/r/plc and encountered this picture with the title:
Everything in the automation industry.
I loved this picture and I was not the only one. People on Reddit loved it. This meme is a real-life metaphor to which many can relate to.
Among comments like:
"We don't make sense, we make car parts"
“The truth. In a single meme.”
A particular comment by user yellekc has caught my eye.
“Today I showed my coworker how to get the day of the week in ControlLogix, I nearly lost it. A billion-dollar company needs like a 15 rung subroutine to tell me it's Friday on my $5k controller.
I think it is a sample ACD file in any Studio5000 install.
Take a look at it.
You should read the comments, it has an "easy algorithm" suitable for "mental calculation."
I honestly think I'm getting trolled by Rockwell. This can't be the way to do it.” [source].
How to do it in a PLC? You can follow a complicated tutorial [here], read auxiliary area memory cells A351 (what in the bloody hell is that?) … Or use the power of a modern programming language!
And I’m like “I can do that”.
How to get the day of the week on a TwinCAT3 PLC? With a little help of Inxton and C#? 😊
This is how you get the day of the week in C#.
var dayOfTheWeek = DateTime.Today.DayOfWeek; Console.WriteLine(dayOfTheWeek);
You can even run this code online https://dotnetfiddle.net/pffvZh.
I created a new PLC project from the template https://github.com/Inxton/template.core.
Add a variable
DayOfTheWeek , run the builder, and write this code.
Run this code on Monday to get the same result 😉
Mondays are not that bad. But if I had to deal with silly problems every day, I would eventually hate them too.
Try Inxton to have better Mondays 😊