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

Checking property consistency along connection instance does not work correctly #665

Closed
lwrage opened this issue Jan 26, 2016 · 7 comments
Closed

Comments

@lwrage
Copy link
Contributor

@lwrage lwrage commented Jan 26, 2016

Example model: AutonomousVehicleSystem from https://github.com/bisc/collision_detection_aadl.git
Instantiate system implementation avoidance_subsystem.impl in avoidance_subsystem.aadl
Connection instances have error markers about inconsistent latency value, but all values in the declarative model are identical.

@reteprelief
Copy link
Contributor

@reteprelief reteprelief commented Jan 26, 2016

The CacheThe default compares the objects. To fix some problems we added content comparison for certain cases (references and list of references and literals.
Need to add comparisons for int, real, range of int/real.

Loading

@lwrage
Copy link
Contributor Author

@lwrage lwrage commented Jan 26, 2016

We had overridden the equals method in property value classes to make this work. However this caused bug #524. In the fix we renamed the equals to sameAs(). This one needs to be used when checking property consistency.

Loading

@lwrage lwrage self-assigned this Jan 26, 2016
@lwrage lwrage added this to the 2016.1 milestone Jan 26, 2016
@lwrage lwrage closed this in f552055 Jan 27, 2016
@lwrage
Copy link
Contributor Author

@lwrage lwrage commented Feb 7, 2017

Values with units need to be converted to the same unit before comparison. Currently 2s != 2000ms.

Loading

@lwrage lwrage reopened this Feb 7, 2017
@lwrage lwrage added this to todo in AADL 2.2 Compatibility Feb 7, 2017
@lwrage lwrage added the backlog label Jan 9, 2018
@lwrage lwrage removed this from the 2016.1 milestone Aug 17, 2018
@lwrage lwrage added the core label Aug 17, 2018
@lwrage lwrage removed their assignment Oct 17, 2018
@AaronGreenhouse
Copy link
Contributor

@AaronGreenhouse AaronGreenhouse commented Jun 10, 2019

Look in org.osate.alisa.common.typing.InterpreterUtil for inspiration.

Loading

@AaronGreenhouse
Copy link
Contributor

@AaronGreenhouse AaronGreenhouse commented Jun 13, 2019

This checking occurs in CachePropertyAssociationsSwitch.cacheConnectionPropertyAssociation().

Loading

@AaronGreenhouse
Copy link
Contributor

@AaronGreenhouse AaronGreenhouse commented Jun 14, 2019

Need to update RealLiteralImpl.sameAs() and IntegerLiteralImpl.sameAs()

Loading

@AaronGreenhouse
Copy link
Contributor

@AaronGreenhouse AaronGreenhouse commented Jun 14, 2019

Fixed the sameAs() methods to use this

		final UnitLiteral myUnit = getUnit();
		final UnitLiteral otherUnit = other.getUnit();
		final UnitLiteral smallerUnit = NumberValueOperations.smallerUnit(myUnit, otherUnit);
		if (smallerUnit == null) { // no units at all
			return value == other.value;
		} else {
			return NumberValueOperations.getScaledValue(this, smallerUnit) == NumberValueOperations
					.getScaledValue(other, smallerUnit);
		}

It seems that the base attribute of IntegerLiteral is useless. It is always zero.

I'm concerned that this technique may cause problems at some point due to loss of information in floating point operations, but we will have to wait and see. Can always switch to using java.lang.math.BigDecimal.

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants