ModelicaStandardLibrary icon indicating copy to clipboard operation
ModelicaStandardLibrary copied to clipboard

Be clearer about units in RobotR3 motor

Open HansOlsson opened this issue 9 months ago • 4 comments

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 avatar Mar 12 '25 09:03 HansOlsson

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 5542be30bc34d3a383adcde117ddbd9b11f7ecb3 and 544d814c8c17b88e5e8e2d3a983d23766902a0b1.

📒 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.

coderabbitai[bot] avatar Apr 09 '25 10:04 coderabbitai[bot]

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

HansOlsson avatar Apr 09 '25 10:04 HansOlsson

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.

beutlich avatar Apr 09 '25 10:04 beutlich

But the poem, oh, the poem...

casella avatar Apr 11 '25 10:04 casella