Skip to content

Commit db04460

Browse files
authored
Merge pull request #75 from ModelDriven/ST6RI-64
ST6RI-64: Added 15.01, 15.02, 15.12, and 15.19 validation cases
2 parents e516f43 + 0cbde80 commit db04460

6 files changed

Lines changed: 188 additions & 1 deletion

File tree

sysml.library/Domain Libraries/Quantities and Units/SI.sysml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ package SI {
5858
/*
5959
* Prefixed units - incomplete list
6060
*/
61+
part mm = LengthUnit(name => "millimetre", unitConversion => ConversionByPrefix(prefix => milli, referenceUnit => m));
6162
part km = LengthUnit(name => "kilometre", unitConversion => ConversionByPrefix(prefix => kilo, referenceUnit => m));
6263
part mN = ForceUnit(name => "millinewton", unitConversion => ConversionByPrefix(prefix => milli, referenceUnit => N));
6364
part kJ = EnergyUnit(name => "kilojoule", unitConversion => ConversionByPrefix(prefix => kilo, referenceUnit => J));

sysml.library/Kernel Library/RealFunctions.kerml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ package RealFunctions {
1919

2020
function '='(x: Real, y: Real): Boolean specializes BaseFunctions::'==';
2121
function '!='(x: Real, y: Real): Boolean specializes BaseFunctions::'!=';
22-
22+
23+
function Sqrt(x: Real): Real;
24+
2325
function Floor(x: Real): Integer;
2426
function Round(x: Real): Integer;
2527

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package '15_01-Constants' {
2+
import SI::*;
3+
import USCustomaryUnits::*;
4+
5+
/* Math and physical constants should be defined in the model library. */
6+
7+
/**
8+
Examples of mathematical constants
9+
Note: There should be a way to mark these as "invariant"
10+
*/
11+
package 'Mathematical Constants' {
12+
value e: Real = 2.71828182845904523536;
13+
value pi: Real = 3.14159265358979323846;
14+
}
15+
16+
/**
17+
* Should this be in the ISQ library model?
18+
*/
19+
value type DimensionOneValue :> QuantityValue {
20+
value magnitude: Real redefines QuantityValue::magnitude;
21+
ref scale: UnitOfDimensionOne redefines QuantityValue::scale;
22+
}
23+
24+
/**
25+
* Should this ibe in the ISQ library model?
26+
*/
27+
block AccelerationUnit :> SIDerivedUnit {
28+
value lengthPowerFactor :> SIDerivedUnit::lengthPowerFactor {
29+
value exponent redefines UnitPowerFactor::exponent = 1;
30+
}
31+
value timePowerFactor :> SIDerivedUnit::timePowerFactor {
32+
value exponent redefines UnitPowerFactor::exponent = -2;
33+
}
34+
}
35+
value type AccelerationValue :> QuantityValue {
36+
value magnitude: Real redefines QuantityValue::magnitude;
37+
ref scale: AccelerationUnit redefines QuantityValue::scale;
38+
}
39+
40+
/**
41+
Examples of fundamental physical constants
42+
Note: There should be a way to mark these as "invariant"
43+
*/
44+
/**
45+
* The reference source is:
46+
CODATA - Task Group on Fundamental Physical Constants (TGFC) - 2010 Recommended Values - See http://www.codata.org/committees-and-groups/fundamental-physical-constants/tgfc-previous-values-and-publications
47+
*/
48+
package 'Fundamental Physical Constants' {
49+
value 'fine structure constant': DimensionOneValue = 7.297352569824E-3;
50+
value 'electron to proton mass ratio': DimensionOneValue = 5.446170217822E-4;
51+
value 'speed of light in vacuum': SpeedValue = 299792458@[m/s];
52+
}
53+
54+
package 'Global Context' {
55+
value 'nominal earth gravitational acceleration': AccelerationValue = 9.80665@[m/(s^2)];
56+
}
57+
58+
package 'Model X Context' {
59+
value 'amplifier gain': DimensionOneValue = 3.5;
60+
}
61+
62+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package '15_02-Basic Properties with Default Values' {
2+
import SI::*;
3+
import USCustomaryUnits::*;
4+
import '15_12-Compound Value Type'::CartesianAxisPlacement3D;
5+
6+
block Wheel {
7+
value width: LengthValue = 245@[mm];
8+
value diameter: LengthValue = 18@['in'];
9+
value placement: CartesianAxisPlacement3D[0..1];
10+
}
11+
12+
block Vehicle {
13+
value mass: MassValue = 1200@[kg];
14+
value length: LengthValue = 4.82@[m];
15+
part leftFrontWheel : Wheel;
16+
part rightFrontWheel : Wheel;
17+
}
18+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package '15_12-Compound Value Type' {
2+
import ISQ::*;
3+
import RealFunctions::Sqrt;
4+
import '15_01-Constants'::'Mathematical Constants'::pi;
5+
6+
value type CartesianLocation3D {
7+
value x: LengthValue;
8+
value y: LengthValue;
9+
value z: LengthValue;
10+
}
11+
12+
/* Is this supposed to be a QuantityValue? */
13+
value type DirectionValue :> Real;
14+
15+
value type CartesianDirection3D {
16+
value dirX: DirectionValue;
17+
value dirY: DirectionValue;
18+
value dirZ: DirectionValue;
19+
20+
assert constraint { Sqrt(dirX**2 + dirY**2 + dirZ**2) == 1.0 }
21+
}
22+
23+
/*
24+
Axis placement is modeled after the ISO 10303 (STEP) standard
25+
way of defining numerically stable coordinate
26+
transformations. The corresponding STEP concept is
27+
AxisPlacement3D.
28+
*/
29+
value type CartesianAxisPlacement3D {
30+
value location: CartesianLocation3D;
31+
value dirZAxis: CartesianDirection3D;
32+
value dirXAxis: CartesianDirection3D;
33+
}
34+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
package '15_19-Materials with Properties' {
2+
import SI::*;
3+
4+
/** This needs to be fully defined. */
5+
block AtomicMassUnit :> MeasurementUnit;
6+
7+
part Da = AtomicMassUnit();
8+
9+
value type AtomicMassValue :> QuantityValue {
10+
value magnitude: Real redefines QuantityValue::magnitude;
11+
ref scale: AtomicMassUnit redefines QuantityValue::scale;
12+
}
13+
14+
block TensileStrengthUnit :> MeasurementUnit {
15+
value lengthPowerFactor redefines SIDerivedUnit::lengthPowerFactor {
16+
value exponent redefines UnitPowerFactor::exponent = -1;
17+
}
18+
value massPowerFactor redefines SIDerivedUnit::massPowerFactor {
19+
value exponent redefines UnitPowerFactor::exponent = 1;
20+
}
21+
value timePowerFactor redefines SIDerivedUnit::timePowerFactor {
22+
value exponent redefines UnitPowerFactor::exponent = -2;
23+
}
24+
}
25+
26+
value type TensileStrengthValue :> QuantityValue {
27+
value magnitude: Real redefines QuantityValue::magnitude;
28+
ref scale: TensileStrengthUnit redefines QuantityValue::scale;
29+
}
30+
31+
block Substance;
32+
33+
block Material :> Substance;
34+
35+
value type MassFractionValue;
36+
37+
value type MaterialFraction {
38+
ref material: Material;
39+
value massFraction: MassFractionValue;
40+
}
41+
42+
block Metal :> Material {
43+
value atomicMass: AtomicMassValue;
44+
}
45+
46+
part Iron: Metal { // Individual
47+
value atomicMass redefines Metal::atomicMass = 55.845@[Da];
48+
}
49+
50+
part Carbon: Metal { // Individual
51+
value atomicMass redefines Metal::atomicMass = 12.011@[Da];
52+
}
53+
54+
part Manganese: Metal { // Individual
55+
value atomicMass redefines Metal::atomicMass = 54.938@[Da];
56+
}
57+
58+
block Alloy :> Material {
59+
value fractions: MaterialFraction[2..*];
60+
}
61+
62+
part Steel_980: Alloy { // Individual
63+
value fractions redefines Alloy::fractions = {
64+
MaterialFraction(Iron, 0.9862),
65+
MaterialFraction(Carbon, 0.0018),
66+
MaterialFraction(Manganese, 0.012)
67+
};
68+
value tensileStrength: TensileStrengthValue = 980@[N/(mm^2)];
69+
}
70+
}

0 commit comments

Comments
 (0)