Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Your PLC Doesn't Care About Your Event Loop

Four lessons from putting asyncio on the factory floor At some point, almost every automation team picks up Python. It rarely starts as a big decision. Someone needs a quick script to log a few PLC variables to a CSV. Then the script needs a small web dashboard. Then it has to push data to a database, watch a second machine, and send an alert when a value drifts. A few months later the "quick…

Four key takeaways emerged from moving asyncio to the factory floor:

1. Round-trips are costly. A PLC responds quickly to a single read, but repeated requests cause latency. Batch requests together using sum commands to reduce round-trip time. However, remember that the PLC limits how much data can be batched in one request.

2. Async does not equal non-blocking. While the network side of an async ADS client is straightforward, decoding large responses is CPU-intensive and can block the event loop if not handled properly. Split work between chunks and use a thread pool for decoding to keep the event loop responsive.

3. Polling is a habit, but notifications are better. ADS offers a push-based model where the PLC sends updates when values change. Implement bounded queues with explicit overflow policies to handle cases where the consumer cannot keep up with the PLC's data rate. Tailor the backpressure policy to your specific use case (e.g., drop oldest, keep recent values, or deliver only the current value).

4. Keep protocol and transport separate. While the classic setup is a client connecting directly to a controller via TCP, modern installations often involve edge gateways, firewalls, or message brokers like MQTT. Design your code with a clear separation between the protocol (ADS) and the transport (TCP or MQTT) to make future network changes less painful.

Rewritten by urgent.news; may contain errors — check the original. How we use AI.

Source: dev.to

Read the original at dev.to →

More from Dev.to on urgent.news

Get the news by email. Yesterday's most-covered stories, every morning.

We track opens and clicks to improve the newsletter.

See today's edition · More options

More in Tech

Schema Markup That Still Matters in 2026

The schema markup that still matters in 2026 is the markup that describes your entity and your page accurately: Organization or LocalBusiness on the business itself, WebSite and WebPage for structure…

  • Schema markup remains relevant in 2026 for accurate entity and page description.
  • Google emphasizes structured data doesn't guarantee rich results or better rankings.

How Group Jam keeps everyone in sync without streaming a single byte of audio

Group Jam lets a few friends listen to the same song at the same moment, each on their own phone or desktop. A common first question is "so you stream the audio through your servers?" No. The room…

  • Group Jam synchronizes playback without streaming audio
  • Shared clock and playback anchor keep devices in sync
  • Sync loop corrects drift between room and local player

Part 4: Alias or Index Pattern? Index Design for Two-Way Elasticsearch Replication

In a two-stream design, the index name is the replication contract. Here is how we chose between aliases and index patterns, whether the site suffix can be automated, and how to make an app that…

  • Two-stream design uses index name suffix for replication contract
  • Index name site yyyymm determines lead cluster and auto-follow pattern
  • Aliases simplify writes but require one-to-one mapping and verification

Web Audio Cues & Ghost Previews in a Connect 4 Game

I built this tutorial around a single-file GridDrop Connect 4 browser game prompt so you can go from an empty editor to a working tabletop match without setting up bundlers, frameworks, or external…

  • Connect 4 browser game built in single index.html file
  • Features audio cues, AI modes, and accessibility
  • Deployable on GitHub Pages, Netlify, or Vercel

More from Sunday, 6 December 2026 →