Skip to content

Require sustained coil current before relay switches#250

Open
esaruoho wants to merge 1 commit intopfalstad:devfrom
esaruoho:relay-minimum-switch-time
Open

Require sustained coil current before relay switches#250
esaruoho wants to merge 1 commit intopfalstad:devfrom
esaruoho:relay-minimum-switch-time

Conversation

@esaruoho
Copy link
Copy Markdown

@esaruoho esaruoho commented Mar 2, 2026

Summary

Test plan

  • Place a relay with the new model (default) and verify normal switching works
  • Verify brief current spikes (e.g., from back-EMF) don't trigger false switching
  • Test with different switching time values
  • Verify old model relays (switchingTime = 0) are unaffected
  • Reset circuit → verify relay resets cleanly

Fixes #67

🤖 Generated with Claude Code

@esaruoho
Copy link
Copy Markdown
Author

@pfalstad any takes on this?

@MatNieuw
Copy link
Copy Markdown

Why is a threshold timer needed? Because of the self-inductance of the coil, there is a noticeable delay before the current exceeds the "activate" threshold, I can see it both in real measurements measuring when the NC contact starts to open, and in simulation's scope. And does the back-EMF mentioned in #67 contain enough energy for the relay to start moving?

@esaruoho esaruoho changed the base branch from v3-dev to dev April 15, 2026 09:49
Brief back-EMF transients from one relay coil could incorrectly
trigger another relay because the model switched instantly when
current crossed the threshold. Now the coil current must remain
above/below the on/off threshold for at least half the switching
time before the relay starts moving, matching real relay inertia.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@esaruoho esaruoho force-pushed the relay-minimum-switch-time branch from 416ff57 to a31cb62 Compare April 15, 2026 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants