diff --git a/packages/client/hmi-client/src/types/Types.ts b/packages/client/hmi-client/src/types/Types.ts index 89088e6343..42e74af22c 100644 --- a/packages/client/hmi-client/src/types/Types.ts +++ b/packages/client/hmi-client/src/types/Types.ts @@ -266,6 +266,38 @@ export interface TypingSemantics { system: any; } +export interface DecapodesComponent { + modelInterface: string[]; + model: DecapodesExpression; + _type: string; +} + +export interface DecapodesEquation { + lhs: any; + rhs: any; + _type: string; +} + +export interface DecapodesExpression { + context: any[]; + equations: DecapodesEquation[]; + _type: string; +} + +export interface DecapodesTerm { + name?: string; + var?: DecapodesTerm; + symbol?: string; + space?: string; + fs?: string[]; + arg?: DecapodesTerm; + f?: string; + arg1?: DecapodesTerm; + arg2?: DecapodesTerm; + args?: DecapodesTerm[]; + _type: string; +} + export interface PetriNetModel { states: PetriNetState[]; transitions: PetriNetTransition[]; diff --git a/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/multiphysics/DecapodesComponent.java b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/multiphysics/DecapodesComponent.java new file mode 100644 index 0000000000..3c1ceffd62 --- /dev/null +++ b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/multiphysics/DecapodesComponent.java @@ -0,0 +1,17 @@ +package software.uncharted.terarium.hmiserver.models.dataservice.multiphysics; + +import lombok.Data; +import lombok.experimental.Accessors; +import software.uncharted.terarium.hmiserver.annotations.TSModel; +import com.fasterxml.jackson.annotation.JsonAlias; +import java.util.List; + +@Data +@Accessors(chain = true) +@TSModel +public class DecapodesComponent { + @JsonAlias("interface") + private List modelInterface; + private DecapodesExpression model; + private String _type; +} diff --git a/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/multiphysics/DecapodesEquation.java b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/multiphysics/DecapodesEquation.java new file mode 100644 index 0000000000..b9d117edfb --- /dev/null +++ b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/multiphysics/DecapodesEquation.java @@ -0,0 +1,14 @@ +package software.uncharted.terarium.hmiserver.models.dataservice.multiphysics; + +import lombok.Data; +import lombok.experimental.Accessors; +import software.uncharted.terarium.hmiserver.annotations.TSModel; + +@Data +@Accessors(chain = true) +@TSModel +public class DecapodesEquation { + private Object lhs; + private Object rhs; + private String _type; +} diff --git a/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/multiphysics/DecapodesExpression.java b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/multiphysics/DecapodesExpression.java new file mode 100644 index 0000000000..6d7a2e2eca --- /dev/null +++ b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/multiphysics/DecapodesExpression.java @@ -0,0 +1,21 @@ +package software.uncharted.terarium.hmiserver.models.dataservice.multiphysics; + +import lombok.Data; +import lombok.experimental.Accessors; +import software.uncharted.terarium.hmiserver.annotations.TSModel; +import java.util.List; + +/** + * See + * https://algebraicjulia.github.io/SyntacticModels.jl/dev/generated/composite_models_examples/#Specifying-the-Component-Systems + * https://algebraicjulia.github.io/SyntacticModels.jl/dev/generated/decapodes_examples/ +**/ + +@Data +@Accessors(chain = true) +@TSModel +public class DecapodesExpression { + private List context; + private List equations; + private String _type; +} diff --git a/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/multiphysics/DecapodesTerm.java b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/multiphysics/DecapodesTerm.java new file mode 100644 index 0000000000..fec85689ac --- /dev/null +++ b/packages/server/src/main/java/software/uncharted/terarium/hmiserver/models/dataservice/multiphysics/DecapodesTerm.java @@ -0,0 +1,64 @@ +package software.uncharted.terarium.hmiserver.models.dataservice.multiphysics; + +import lombok.Data; +import lombok.experimental.Accessors; +import software.uncharted.terarium.hmiserver.annotations.TSModel; +import software.uncharted.terarium.hmiserver.annotations.TSOptional; + +import java.util.List; + +////// +// Note: Decapode term can be one of many different types. As in +// term = A or B or C or ... wher A, B, C, D ... are different objects. +// +// Since Java does not have type-disjunctions this is represented as a +// union of all the known types. See below +// +// October 2023: +// Var(name::Symbol) +// Lit(name::Symbol) +// Judgement(var::Var, dim::Symbol, space::Symbol) +// AppCirc1(fs::Vector{Symbol}, arg::Term) +// App1(f::Symbol, arg::Term) +// App2(f::Symbol, arg1::Term, arg2::Term) +// Plus(args::Vector{Term}) +// Mult(args::Vector{Term}) +// Tan(var::Term) +////// + +@Data +@Accessors(chain = true) +@TSModel +public class DecapodesTerm { + @TSOptional + private String name; + + @TSOptional + private DecapodesTerm var; + + @TSOptional + private String symbol; + + @TSOptional + private String space; + + @TSOptional + private List fs; + + @TSOptional + private DecapodesTerm arg; + + @TSOptional + private String f; + + @TSOptional + private DecapodesTerm arg1; + + @TSOptional + private DecapodesTerm arg2; + + @TSOptional + private List args; + + private String _type; +}