Skip to content
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

Wrong min/max scaling when signal has slope or offset #740

Open
lbeuster opened this issue Dec 1, 2023 · 1 comment
Open

Wrong min/max scaling when signal has slope or offset #740

lbeuster opened this issue Dec 1, 2023 · 1 comment
Assignees
Labels

Comments

@lbeuster
Copy link

lbeuster commented Dec 1, 2023

I try to convert arxml to dbc/kcd. Seems like the min/max values are scaled twice with the slope value. This happens when converting to dbc and kdc. And with all signals with a slope.

slope=0.0625
phys-max=1023.8125
internal-max=16383 (phys-max * slope)

but the converted max-value in kcd = 63.98828125 (16383 * 0.0625 * 0.0625), should be 1023.8125

In Xlsx the max value is missing.

It's the same for the offset. It is applied twice to min and max.

May be I miss something because I'm not very familiar with these CAN things?

ARXML

        <DATA-CONSTR UUID="626a0205-0000-0000-b658-00000004ec2a">
          <SHORT-NAME>DC_DC_IstSpannung_HV</SHORT-NAME>
          <DATA-CONSTR-RULES>
            <DATA-CONSTR-RULE>
              <PHYS-CONSTRS>
                <LOWER-LIMIT INTERVAL-TYPE="CLOSED">0.0000</LOWER-LIMIT>
                <UPPER-LIMIT INTERVAL-TYPE="CLOSED">1023.8125</UPPER-LIMIT>
                <UNIT-REF DEST="UNIT">/Unit/Unit_Unit_Volt</UNIT-REF>
              </PHYS-CONSTRS>
              <INTERNAL-CONSTRS>
                <LOWER-LIMIT INTERVAL-TYPE="CLOSED">0</LOWER-LIMIT>
                <UPPER-LIMIT INTERVAL-TYPE="CLOSED">16383</UPPER-LIMIT>
              </INTERNAL-CONSTRS>
            </DATA-CONSTR-RULE>
          </DATA-CONSTR-RULES>
        </DATA-CONSTR>

        <!-- hopefully this is the correct part ;) -->
        <COMPU-METHOD UUID="626a0202-0000-0000-b658-00000004ec2a">
          <SHORT-NAME>CM_DC_IstSpannung_HV</SHORT-NAME>
          <CATEGORY>SCALE_LINEAR_AND_TEXTTABLE</CATEGORY>
          <UNIT-REF DEST="UNIT">/Unit/Unit_Unit_Volt</UNIT-REF>
          <COMPU-INTERNAL-TO-PHYS>
            <COMPU-SCALES>
              <COMPU-SCALE>
                <LOWER-LIMIT INTERVAL-TYPE="CLOSED">0</LOWER-LIMIT>
                <UPPER-LIMIT INTERVAL-TYPE="CLOSED">16381</UPPER-LIMIT>
                <COMPU-RATIONAL-COEFFS>
                  <COMPU-NUMERATOR>
                    <V>0</V>
                    <V>0.0625</V>
                  </COMPU-NUMERATOR>
                  <COMPU-DENOMINATOR>
                    <V>1</V>
                  </COMPU-DENOMINATOR>
                </COMPU-RATIONAL-COEFFS>
              </COMPU-SCALE>
            </COMPU-SCALES>
          </COMPU-INTERNAL-TO-PHYS>
        </COMPU-METHOD>

KCD

    <Message id="0x2AE" name="DCDC_01_XIX_VCP_CANFD07" length="8" triggered="true" interval="10">
      <Notes></Notes>
      <Signal name="DC_IstSpannung_HV_XIX_DCDC_01_XIX_VCP_CANFD07" offset="12" length="14">
        <Value slope="0.0625" max="63.98828125" unit="Unit_Volt"/>
      </Signal>
    </Message>
@lbeuster lbeuster changed the title Wrong min/max scaling when signal has slope Wrong min/max scaling when signal has slope or offset Dec 2, 2023
@ebroecker ebroecker self-assigned this Dec 4, 2023
@ebroecker
Copy link
Owner

Hi @lbeuster

I think you have found a bug.

The arxml-parser does not take care of PHYS-CONSTRS and INTERNAL-CONSTRS.
It's more or less random which one the parser uses.
But it alwas calculates if it were INTERNAL-CONSTRS.

This is what I think happens:
The parser takes the PHYS-CONSTRS --> 1023.8125
but it thinks it's the internal val and so scales it ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants