Skip to content

Be clearer about units in RobotR3 motor #4591

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

HansOlsson
Copy link
Contributor

@HansOlsson HansOlsson commented Mar 12, 2025

The only controversial part is the name RaR.

Without this change based on
La.L=250/(2*D*w) and C.C=(1/250)*D/w
one might conclude that D has unit Siemens (inverted Ohm).

Summary by CodeRabbit

  • New Features

    • Introduced a configurable parameter for adjusting the motor’s electric resistance.
  • Refactor

    • Updated parameter definitions to clarify motor frequency and damping.
    • Revised component calculations for inductance, resistance, and capacitance to rely on the new resistance parameter, enhancing simulation flexibility and accuracy.

@HansOlsson HansOlsson added the L: Mechanics.MultiBody Issue addresses Modelica.Mechanics.MultiBody label Mar 12, 2025
@HansOlsson HansOlsson added this to the MSL4.2.0 milestone Mar 12, 2025
Comment on lines 8 to 9
parameter SI.AngularVelocity w_max=315 "Maximum speed of motor";
parameter SI.Current i_max=9 "Maximum current of motor";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
parameter SI.AngularVelocity w_max=315 "Maximum speed of motor";
parameter SI.Current i_max=9 "Maximum current of motor";

Remove if not used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not confident in removing that in this PR.

Plotting the different axis*.motor.emf.i and axis*.motor.speed.w; indicates that the speed is within the bounds - but that the current peaks above the maximum. (For axis3 it is close to 15 A, so significantly above.)
I don't know - it could even be different for the different axis (it's worse for axis 1, 2, 3 and they are different.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope @MartinOtter can give feedback.

@beutlich beutlich added the example Issue only addresses example(s) label Mar 12, 2025
@beutlich beutlich changed the title Be clearer about units. No actual change. Be clearer about units in RobotR3 motor Mar 12, 2025
@beutlich beutlich requested a review from MartinOtter March 13, 2025 15:54
Copy link

coderabbitai bot commented Apr 9, 2025

Walkthrough

This change updates the motor model in the RobotR3 utilities by adjusting parameter types and modifying calculation formulas. The parameter w is now defined as an angular frequency, and the damping constant D includes a unit annotation. A new parameter RaR (electric resistance) has been added, and the formulas for the inductor, resistor, and capacitor have been updated to reference RaR rather than hardcoded constants. These modifications provide greater flexibility in tuning the motor parameters.

Changes

File Changes Summary
Modelica/Mechanics/.../RobotR3/Utilities/Motor.mo - Parameters: Updated w from Real (time constant) to SI.AngularFrequency (angular frequency), and added unit "1" to D.
- New Parameter: Added RaR as SI.Resistance with a default of 250.
- Calculations: Modified inductor (La), resistor (Ra), and capacitor (C) expressions to use RaR instead of a fixed value.

Poem

In my burrow of code I hop with cheer,
Tweaks in motor parameters now appear.
From angular spins to resistance so true,
My circuits dance as they compute anew.
With every change, my logic does gleam—
A rabbit's delight in a motor's dream!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5542be3 and 544d814.

📒 Files selected for processing (1)
  • Modelica/Mechanics/MultiBody/Examples/Systems/RobotR3/Utilities/Motor.mo (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Modelica/Mechanics/MultiBody/Examples/Systems/RobotR3/Utilities/Motor.mo
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: external_c_checks_cmake_windows-cygwin
  • GitHub Check: external_c_checks_cmake_windows-msvc

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@HansOlsson
Copy link
Contributor Author

I find the experiment with coderabbit interesting and the statements look suggestive.
However, the summary completely misses the intent of the changes.

@beutlich
Copy link
Member

beutlich commented Apr 9, 2025

I find the experiment with coderabbit interesting and the statements look suggestive. However, the summary completely misses the intent of the changes.

Yes, it's experimental. The summary feature is rather useless. The actual review comments seem more promising to me, however that's not part of a free service and only available now during the coderabbit trial phase of 14 days.

@casella
Copy link
Contributor

casella commented Apr 11, 2025

But the poem, oh, the poem...

HansOlsson and others added 3 commits April 22, 2025 06:54
The only controversial part is the name RaR.

Without this change based on
La.L=250/(2*D*w) and C.C=(1/250)*D/w
one might conclude that D has unit Siemens (inverted Ohm).
…s/Motor.mo


Change to angular frequency, seems likely to be correct.

Co-authored-by: Thomas Beutlich <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
example Issue only addresses example(s) L: Mechanics.MultiBody Issue addresses Modelica.Mechanics.MultiBody
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants