Skip to content

Commit dbf05ab

Browse files
v4.1.5
1 parent 4b3f99c commit dbf05ab

49 files changed

Lines changed: 888 additions & 403 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ Also, in the folder 'doc' some documentation is provided.
5555
2. Download the installer of the SysMD Notebook from the 'releases' page in GitHub (https://github.com/tukcps/SysMD/releases)
5656
3. Run the Installer and use the SysMD Notebook.
5757

58+
Note that eventually on Windows or OS X you have to permit installation of non-signed software in the security settings.
59+
5860
### Via Gradle
5961

6062
To run the frontend, just use the build system Gradle:

build.gradle.kts

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
21
import org.gradle.internal.os.OperatingSystem
32
import org.jetbrains.compose.ExperimentalComposeLibrary
4-
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
53

64
/*
75
* Gradle build file for SysMD Notebook.
@@ -16,7 +14,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
1614
* - also set the value standalone according to your setup
1715
*/
1816
group = "com.github.tukcps"
19-
version = "4.1.4" // must be number.number.number
17+
version = "4.1.5" // must be number.number.number
2018
val aaddVersion = "0.1.11"
2119
val sysmlapiVersion = "3.9.5"
2220
val useMavenAADD = true
@@ -53,6 +51,9 @@ repositories {
5351
maven ("https://jitpack.io")
5452
}
5553

54+
kotlin {
55+
jvmToolchain(21)
56+
}
5657

5758
// Dependencies
5859
dependencies {
@@ -72,7 +73,7 @@ dependencies {
7273
println(" *** using SysMLv2API from project clone in ./sysmlapi ***")
7374
implementation(project(":sysmlapi"))
7475
} else {
75-
println(" *** using SysML API $sysmlapiVersion from the Maven repository ***")
76+
println(" *** using SysML API $sysmlapiVersion from Maven repository ***")
7677
implementation("io.github.tukcps:sysmlapi:$sysmlapiVersion")
7778
}
7879

@@ -152,17 +153,6 @@ tasks.test {
152153
useJUnitPlatform()
153154
}
154155

155-
// Generate Bytecode for v17
156-
kotlin {
157-
compilerOptions {
158-
jvmTarget.set(JvmTarget.JVM_21)
159-
}
160-
}
161-
162-
tasks.withType<JavaCompile> {
163-
options.release.set(21)
164-
}
165-
166156
/**
167157
* Task that generates an installer package for SysMD Notebook.
168158
* For Windows, WiX-Tools 3.0 to 3.11.2 must be installed.

doc/AvailableUnits.md

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
11
# Table of all supported units
22

33
# Basic units
4-
| Dimension | Unit | Symbol |
5-
|:---------------------------|:-------------------------|:-------------:|
6-
| **Area** | Square Meter | m^2 |
7-
| | Acre | ac |
8-
| **BitRate** | Bits per Second | bps or b/s |
9-
| **Density** | Kilogram per Cubic Meter | kg/m^3 |
10-
| **InformationCapacity** | Bit | bit or Bit |
11-
| | Byte | B or Byte |
12-
| **Length** | Meter | m |
13-
| | Inch | inch |
14-
| | Feet | ft |
15-
| | Yard | yd |
16-
| | Mile | mi |
17-
| | Nautical mile | nmi |
18-
| **Mass** | Kilogram | kg |
19-
| | Tonne (metric ton) | t |
20-
| | Short Ton | tn |
21-
| | Grain | gr |
22-
| | Carat | ct |
23-
| | Ounce | oz |
24-
| | Pound | lb |
25-
| **MassFlow** | Kilogram per Second | kg/s |
26-
| **QuantityOfDimensionOne** | Percent | % |
27-
| | Decibel | dB |
28-
| | Degree | ° or deg |
29-
| | Radiant | rad |
30-
| | Pi | Pi or pi or π |
31-
| **SolidAngle** | Steradian | sr |
32-
| **Time** | Second | s |
33-
| | Minute | min |
34-
| | Hour | h |
35-
| | Day | d |
36-
| | Year (= 365 days) | a or yr or y |
37-
| **Volume** | Cubic Meter | m^3 |
38-
| | Litre | l |
39-
| | Pint | pt |
40-
| | Quart | qt |
41-
| | Gallon | gal |
42-
| | Barrel | bbl |
4+
| Domain | Unit | Symbol |
5+
|:------------------------|:-------------------------|:-------------:|
6+
| **Area** | Square Meter | m^2 |
7+
| | Acre | ac |
8+
| **BitRate** | Bits per Second | bps or b/s |
9+
| **Density** | Kilogram per Cubic Meter | kg/m^3 |
10+
| **InformationCapacity** | Bit | bit or Bit |
11+
| | Byte | B or Byte |
12+
| **Length** | Meter | m |
13+
| | Inch | inch |
14+
| | Feet | ft |
15+
| | Yard | yd |
16+
| | Mile | mi |
17+
| | Nautical mile | nmi |
18+
| **Mass** | Kilogram | kg |
19+
| | Tonne (metric ton) | t |
20+
| | Short Ton | tn |
21+
| | Grain | gr |
22+
| | Carat | ct |
23+
| | Ounce | oz |
24+
| | Pound | lb |
25+
| **MassFlow** | Kilogram per Second | kg/s |
26+
| **QuantityOfDomainOne** | Percent | % |
27+
| | Decibel | dB |
28+
| | Degree | ° or deg |
29+
| | Radiant | rad |
30+
| | Pi | Pi or pi or π |
31+
| **SolidAngle** | Steradian | sr |
32+
| **Time** | Second | s |
33+
| | Minute | min |
34+
| | Hour | h |
35+
| | Day | d |
36+
| | Year (= 365 days) | a or yr or y |
37+
| **Volume** | Cubic Meter | m^3 |
38+
| | Litre | l |
39+
| | Pint | pt |
40+
| | Quart | qt |
41+
| | Gallon | gal |
42+
| | Barrel | bbl |
4343

4444
# Atomic units
4545

46-
| Dimension | Unit | Symbol |
46+
| Domain | Unit | Symbol |
4747
|-----------------------|-----------|:------:|
4848
| **AbsorbedDose** | Gray | Gy |
4949
| **AmountOfSubstance** | Mole | mol |
@@ -52,7 +52,7 @@
5252
| **DoseEquivalent** | Sievert | Sv |
5353

5454
## Mechanic units
55-
| **Dimension** | **Unit** | **Symbol** |
55+
| **Domain** | **Unit** | **Symbol** |
5656
|------------------------|---------------------------|:----------:|
5757
| **Acceleration** | Meter per Second squared | m/s^2 |
5858
| **Energy** | Joule | J |
@@ -77,7 +77,7 @@
7777
| | Miles per hour | mph |
7878

7979
## Electricity and magnetism units
80-
| **Dimension** | **Unit** | **Symbol** |
80+
| **Domain** | **Unit** | **Symbol** |
8181
|---------------------------|--------------------|:----------:|
8282
| **Capacitance** | Farad | F |
8383
| **ElectricalConductance** | Siemens | S |
@@ -95,7 +95,7 @@
9595

9696
# Photometry units
9797

98-
| **Dimension** | **Unit** | **Symbol** |
98+
| **Domain** | **Unit** | **Symbol** |
9999
|-----------------------|----------------|:----------:|
100100
| **Illuminance** | Lux | lx |
101101
| **Luminance** | Stilb | sb |
@@ -106,7 +106,7 @@
106106

107107
# Thermodynamics
108108

109-
| **Dimension** | **Unit** | **Symbol** |
109+
| **Domain** | **Unit** | **Symbol** |
110110
|-----------------|-------------------|:----------:|
111111
| **Temperature** | Kelvin | K |
112112
| | Degree Celsius | °C |

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ kotlin.code.style=official
22
org.gradle.jvmargs=-Xmx4096M -Djava.awt.headless=true
33

44
org.jetbrains.dokka.experimental.gradle.pluginMode.nowarn=true
5+
org.gradle.java.installations.auto-download=true
6+
org.gradle.java.installations.auto-detect=true

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

install/1-SysMD-Kickstart/SysMD-Modeling.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ by its simple name as follows:
3232
```SysML::kickstart
3333
private import ScalarValues::*; // Allows us shortcuts to Real, Integer, etc.
3434
private import SI::*; // Allows us shortcuts to use Units.
35-
private import ISQ::*; // Allows us to use ISQ dimensions.
35+
private import ISQ::*; // Allows us to use ISQ domains.
3636
private import Ranges::*; // Allows us to specify constraints & co/contravariance
3737
attribute r: Real = oneOf(2.0 .. 3.0); // assigns r a value, constraine to the range 2 to 3.
3838
attribute i: Integer = 2; // assigns i the value 2.
@@ -137,7 +137,7 @@ The library SI of SysMD supports
137137
- logarithmic units (Decibel).
138138
- units for digital information (e.g., KiB, MB)
139139

140-
Note that in SysML v2 standard the package with dimensions is ```ISQ```.
140+
Note that in SysML v2 standard the package with domains is ```ISQ```.
141141
We will change the name in future versions.
142142

143143
Units are converted automatically before computations are done, and the consistency of units in equations is checked:

install/3-SysMLv2Tutorial/img.png

-5.18 KB
Binary file not shown.

src/main/kotlin/com/github/tukcps/sysmd/compiler/semantics/kerml/KerMLExpression.kt

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
package com.github.tukcps.sysmd.compiler.semantics.kerml
22

3+
import com.github.tukcps.sysmd.compiler.semantics.ActionsContext
4+
//import com.github.tukcps.sysmd.compiler.semantics.ActionsContextImplementation
35
import com.github.tukcps.sysmd.model.expression.AstNode
6+
import com.github.tukcps.sysmd.model.expression.AstRoot
7+
import com.github.tukcps.sysmd.model.expression.ConstructorExpression
8+
import com.github.tukcps.sysmd.model.expression.Expression
9+
import com.github.tukcps.sysmd.model.expression.InstantiationExpression
10+
import com.github.tukcps.sysmd.model.expression.InvocationExpression
11+
import com.github.tukcps.sysmd.model.expression.OperatorExpression
412
import com.github.tukcps.sysmd.model.expression.functions.AstIte
5-
import com.github.tukcps.sysmd.compiler.semantics.ActionsContext
13+
import com.github.tukcps.sysmd.model.util.SimpleName
14+
15+
//import com.github.tukcps.sysmd.compiler.semantics.ActionsContext
616

717
/**
818
* Generates an ITE-Statement from an if-else expression.
@@ -17,3 +27,59 @@ class ConditionalExpressionActions(
1727
return AstIte(context.model, arrayListOf(condExpr!!, thenExpr!!, elseExpr!!))
1828
}
1929
}
30+
31+
open class ExpressionActions<T: Expression>(
32+
context: ActionsContext,
33+
creator: (SimpleName?, SimpleName?) -> T,
34+
defaultType: String = "Base::Anything",
35+
valuePart: AstRoot? = null
36+
//production: FeatureActions<T>.() -> Unit,
37+
): FeatureActions<T>(context, creator, defaultType, valuePart
38+
) {
39+
//TODO!
40+
}
41+
42+
//Base semantic functions for Constructor- and Operator(Invocation)Expressions
43+
abstract class InstantiationExpressionActions<T: InstantiationExpression>(
44+
context: ActionsContext,
45+
creator: (SimpleName?, SimpleName?) -> T,
46+
defaultType: String = "Base::Anything",
47+
valuePart: AstRoot? = null
48+
//production: FeatureActions<T>.() -> Unit,
49+
): FeatureActions<T>(context, creator, defaultType, valuePart
50+
) {
51+
//TODO!
52+
}
53+
54+
open class ConstructorExpressionActions<T: ConstructorExpression>(
55+
context: ActionsContext,
56+
creator: (SimpleName?, SimpleName?) -> T,
57+
defaultType: String = "Base::Anything",
58+
valuePart: AstRoot? = null
59+
//production: FeatureActions<T>.() -> Unit,
60+
): FeatureActions<T>(context, creator, defaultType, valuePart
61+
) {
62+
//TODO!
63+
}
64+
65+
open class InvocationExpressionActions<T: InvocationExpression>(
66+
context: ActionsContext,
67+
creator: (SimpleName?, SimpleName?) -> T,
68+
defaultType: String = "Base::Anything",
69+
valuePart: AstRoot? = null
70+
//production: FeatureActions<T>.() -> Unit,
71+
): FeatureActions<T>(context, creator, defaultType, valuePart
72+
) {
73+
//TODO!
74+
}
75+
76+
open class OperatorExpressionActions<T: OperatorExpression>(
77+
context: ActionsContext,
78+
creator: (SimpleName?, SimpleName?) -> T,
79+
defaultType: String = "Base::Anything",
80+
valuePart: AstRoot? = null
81+
//production: FeatureActions<T>.() -> Unit,
82+
): FeatureActions<T>(context, creator, defaultType, valuePart
83+
) {
84+
//TODO!
85+
}

src/main/kotlin/com/github/tukcps/sysmd/cspsolver/VariableImplementation.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@ open class VariableImplementation (
120120
}
121121
val values = mutableListOf<AADD>()
122122
rangeSpecs.forEach{values.add(feature.model!!.builder.real(it,elementId.toString()))}
123-
//Test, if there is a dimension (in namespace SI) defined in the definition of the attribute
123+
//Test, if there is a domain (in namespace SI) defined in the definition of the attribute
124124
if(feature.type.firstOrNull()!=null){
125-
val unitDimension = feature.type.firstOrNull { it.qualifiedName?.startsWith("SI::") == true }
125+
val unitDomain = feature.type.firstOrNull { it.qualifiedName?.startsWith("SI::") == true }
126126
?.qualifiedName?.replace("SI::","")
127127
?: feature.type.first().qualifiedName!!
128-
vectorQuantity = VectorQuantity(values, unitSpec, unitDimension)
128+
vectorQuantity = VectorQuantity(values, unitSpec, unitDomain)
129129
} else
130130
vectorQuantity = VectorQuantity(values, unitSpec)
131131
}

src/main/kotlin/com/github/tukcps/sysmd/model/expression/AstRoot.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@ class AstRoot(
122122
/** This may be causing errors with the IntegerRange / IDD datatype(s) */
123123
override fun evalUpRec() {
124124
dependency.evalUpRec()
125-
//add predefined dimension to the unit
125+
//add predefined domain to the unit
126126
if(feature.specializes(feature.model!!.repo.realType)&& feature.type.size==1) {
127127
val type = feature.type[0].declaredName.toString()
128128
if((feature.type[0] as Type?)?.generalization?.firstOrNull()?.declaredName=="Quantity")
129-
dependency.upQuantity.unit.unitDimension = type
129+
dependency.upQuantity.unit.unitDomain = type
130130
}
131131
evalUp()
132132
}
@@ -160,11 +160,11 @@ class AstRoot(
160160
override fun evalDownRec() {
161161
evalDown()
162162
dependency.evalDownRec()
163-
//add predefined dimension to the unit in the leaves (changed by evalDown)
163+
//add predefined domain to the unit in the leaves (changed by evalDown)
164164
if(feature.specializes(feature.model!!.repo.realType)&& feature.type.size==1) {
165165
dependency.getLeaves().forEach {
166-
val type = it.upQuantity.unit.unitDimension
167-
it.variable?.vectorQuantity?.unit?.unitDimension = type
166+
val type = it.upQuantity.unit.unitDomain
167+
it.variable?.vectorQuantity?.unit?.unitDomain = type
168168
}
169169
}
170170
}

0 commit comments

Comments
 (0)