{"id":46116661,"url":"https://github.com/akshatnerella/pyladdersim","last_synced_at":"2026-03-01T23:16:16.218Z","repository":{"id":260674177,"uuid":"882025000","full_name":"akshatnerella/pyladdersim","owner":"akshatnerella","description":"Pyladdersim is a PLC Ladder Logic simulation module built natively on Python","archived":false,"fork":false,"pushed_at":"2026-02-16T02:37:36.000Z","size":39707,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-02-16T08:58:13.309Z","etag":null,"topics":["ladder-logic","plc-programming","python","pythonlibrarires"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akshatnerella.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-01T18:10:43.000Z","updated_at":"2026-02-16T02:37:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"58968cdc-f43c-4a5b-8585-2abc770369a0","html_url":"https://github.com/akshatnerella/pyladdersim","commit_stats":null,"previous_names":["akshatnerella/pyladdersim"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/akshatnerella/pyladdersim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshatnerella%2Fpyladdersim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshatnerella%2Fpyladdersim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshatnerella%2Fpyladdersim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshatnerella%2Fpyladdersim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akshatnerella","download_url":"https://codeload.github.com/akshatnerella/pyladdersim/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshatnerella%2Fpyladdersim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29987656,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T22:42:38.399Z","status":"ssl_error","status_checked_at":"2026-03-01T22:41:51.863Z","response_time":124,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ladder-logic","plc-programming","python","pythonlibrarires"],"created_at":"2026-03-01T23:16:15.712Z","updated_at":"2026-03-01T23:16:16.209Z","avatar_url":"https://github.com/akshatnerella.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyLadderSim\n\n**PyLadderSim** is an educational Python library for simulating ladder logic in a programmable logic controller (PLC) environment. It includes an interactive visualization and a deterministic scan API for test and automation workflows.\n\n## Features\n\n- **Create Ladder Logic Circuits**: Add contacts, outputs, timers, counters, and edge-detection components.\n- **Interactive Toggling**: Click contacts in the visualizer to toggle their states.\n- **Real-Time Visualization**: Live, color-coded status updates for each rung and component.\n- **Deterministic Scan API**: Execute one PLC scan at a time with `scan_once()`.\n- **Educational Focus**: Designed to help students and developers learn PLC logic in an accessible way.\n\n## Installation\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/akshatnerella/pyladdersim.git\n   cd pyladdersim\n   ```\n\n2. Install required dependencies:\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n## Usage\n\n1. **Set up a basic rung**\n\n```python\nfrom pyladdersim import Contact, InvertedContact, Output, Ladder, Rung\n\nstart = Contact(\"Start\")\nstop = InvertedContact(\"Stop\")\nlamp = Output(\"Lamp\")\n\nrung = Rung([start, stop, lamp])\nladder = Ladder()\nladder.add_rung(rung)\n\nprint(ladder.scan_once())  # False\nstart.activate()\nprint(ladder.scan_once())  # True\n```\n\n2. **Use PLC primitives**\n\n```python\nfrom pyladdersim import CounterUp, RisingEdgeContact, RetentiveOutput\n\nons = RisingEdgeContact(\"ONS\")\ncounter = CounterUp(\"CTU\", preset=3)\nlatch = RetentiveOutput(\"LatchedLamp\")\n\nons.activate()\nif ons.evaluate():\n    counter.evaluate(IN=True)\n\nif counter.Q:\n    latch.evaluate(True)\n```\n\n3. **Run continuously**\n\n- `ladder.run(visualize=True)` starts the visual loop.\n- `ladder.run(cycle_time=0.2)` changes scan period.\n- Press `Q` to stop.\n\n## Components\n\n- **Contact**: Normally open contact.\n- **InvertedContact**: Normally closed contact.\n- **RisingEdgeContact / FallingEdgeContact**: One-shot edge detectors.\n- **Output / RetentiveOutput**: Standard and latched output behavior.\n- **Timers**: `OnDelayTimer`, `OffDelayTimer`, and `PulseTimer`.\n- **Counters**: `CounterUp` and `CounterDown` with `PV`, `CV`, and `Q` fields.\n\n## Visualization\n\nThe live visualization interface is built with `Tkinter`:\n- **Transparent, Clickable Components**: Contacts are interactive.\n- **Dynamic Color Coding**: Green for ON and red for OFF.\n- **Simulation Control**: UI refreshes with each ladder scan.\n\n## Example\n\nTimer-driven output with two rungs:\n\n```python\nfrom pyladdersim import Contact, InvertedContact, OnDelayTimer, Output, Ladder, Rung\n\nstart_button = Contact(name=\"Start\")\nstop_button = InvertedContact(name=\"Stop\")\ntimer = OnDelayTimer(name=\"Delay Timer\", PT=3)\ntimer_done = Output(\"TimerDone\")\nlamp = Output(name=\"Lamp\")\n\nrung1 = Rung([start_button, stop_button, timer, timer_done])\nrung2 = Rung([timer_done, lamp])\n\nladder = Ladder()\nladder.add_rung(rung1)\nladder.add_rung(rung2)\n\nladder.run(visualize=True)\n```\n\n## Contributing\n\nContributions are welcome to add features, fix bugs, and improve documentation.\n\n## CI/CD (Auto Publish to PyPI)\n\nThis repository is configured with GitHub Actions:\n- `CI`: runs tests on pull requests and pushes to `main`.\n- `PR Version Bump`: when a pull request is opened/updated, it checks release labels and commits a version bump to `setup.py` directly in the PR branch.\n- `Publish to PyPI`: builds and uploads the package when code is merged/pushed to `main`.\n\nOne-time setup required:\n1. Create a PyPI API token (`__token__`) for your PyPI project.\n2. In GitHub: `Settings -\u003e Secrets and variables -\u003e Actions`, add a repository secret named `PYPI_API_TOKEN`.\n3. Use one release label on PRs:\n   - `release:major`\n   - `release:minor`\n   - `release:patch`\n4. If no release label is present, the workflow automatically adds `release:patch` and bumps patch version.\n5. Automatic version bump commits run for same-repository PR branches; fork PRs require a maintainer to apply/version-bump after merge.\n\nIf the version already exists on PyPI, publish is skipped safely.\n\n## License\n\nThis project is licensed under the MIT License.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakshatnerella%2Fpyladdersim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakshatnerella%2Fpyladdersim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakshatnerella%2Fpyladdersim/lists"}