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

initial decapodes typing #2039

Merged
merged 11 commits into from
Oct 31, 2023
32 changes: 32 additions & 0 deletions packages/client/hmi-client/src/types/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down
Original file line number Diff line number Diff line change
@@ -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<String> modelInterface;
private DecapodesExpression model;
private String _type;
}
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -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<Object> context;
private List<DecapodesEquation> equations;
private String _type;
}
Original file line number Diff line number Diff line change
@@ -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<String> fs;

@TSOptional
private DecapodesTerm arg;

@TSOptional
private String f;

@TSOptional
private DecapodesTerm arg1;

@TSOptional
private DecapodesTerm arg2;

@TSOptional
private List<DecapodesTerm> args;

private String _type;
}