fix: Motor slip-based speed calculation #4

Closed
namcho wants to merge 14 commits from feature/issue-2 into main
Owner

Fixes #2: Motor slip-based speed calculation

User Request: (from issue #2)
Motor model incorrectly uses 50% speed in star mode. Speed should be based on slip which varies with load.

Changes Made:

  • Modified - Slip-based speed formula
  • Modified - Simplified motor target speed
  • Modified - Updated test expectations

Physics:

  • Speed = synchronous_speed × (1 - slip)
  • Light load (30%) = less slip ≈ 1491 RPM
  • Full load (100%) = rated slip = 1470 RPM

Closes #2

Fixes #2: Motor slip-based speed calculation **User Request:** (from issue #2) Motor model incorrectly uses 50% speed in star mode. Speed should be based on slip which varies with load. **Changes Made:** - Modified - Slip-based speed formula - Modified - Simplified motor target speed - Modified - Updated test expectations **Physics:** - Speed = synchronous_speed × (1 - slip) - Light load (30%) = less slip ≈ 1491 RPM - Full load (100%) = rated slip = 1470 RPM Closes #2
- Add modbus_server.py with base class using pymodbus
- Add modbus_rtu.py for serial RTU server
- Add modbus_tcp.py for TCP server
- Add modbus_commands.py with write handlers for registers 100-112
- Add unit tests (43 tests passing)
- Float values use IEEE 754 big-endian encoding
- State values map to CompressorState enum (0-9)
- Support callbacks for start/stop/alarm_reset/emergency_stop
- Motor speed now correctly uses slip formula: speed = synchronous_speed * (1 - slip)
- Light load = less slip = higher speed (closer to 1500 RPM)
- Heavy load = more slip = lower speed (e.g., 1470 RPM at rated load)
- Star mode voltage limits torque, not speed
- Updated test to expect correct slip-based behavior
- Added CCS3200 parameters to config (P002-P032, P226-P227):
  - Idle Pressure, Onload Pressure
  - Star Duration, Delta Transfer Time
  - Preheat Onload/Idle Time
  - Idle Working Time, Auto Waiting Delay
  - Working Mode, Idle Time S/D
- Updated PressureController with CCS3200 logic:
  - Uses idle_pressure_bar and onload_pressure_bar
  - Added auto_waiting_delay and idle_time_sd for energy saving
  - Returns STOP action for automatic mode
- Updated control.py to use new PressureController API
- All 183 tests passing
namcho closed this pull request 2026-04-06 16:03:42 +02:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
namcho/compressor-emulator!4
No description provided.