-
Notifications
You must be signed in to change notification settings - Fork 2
Front End
All front end code is located inside src/frontEnd directory. It consists of 2 main steps preprocessing and generating the internal representation.
In this step complex Simulink blocks are simplified and replaced with basic blocks that can be handled by the translator to Lustre. The PP consists of:
-
src/frondEnd/pp/cocosim_pp.m
: processes a Simulink model in order to make it simpler for the translator. It changes complex blocks into simple blocks that are supported by the translator. The function receives three arguments:- file_name : the path of the mdl or slx file
- constant_file : the path of the .m file which gives the values of constants used in the model
- Options: [to be completed]
This step reads the contents of the preprocessed model and outputs them in json format. The IR consists of
-
src/frondEnd/IR/IR_Config.m
: [to be completed] -
src/frondEnd/IR/cocosim_IR.m
: This function creates a json file of the internal representation of the model, and returns the json representationjson_model = COCOSIM_IR(model_path)
-
src/frondEnd/IR/blocks/subsystems_struct.m
: This function recursively constructs the internal representation of subsystems or block_diagrams.S = subsystems_struct(file_name)
for the IR of a simulink block. -
src/frondEnd/IR/blocks/chart_struct.m
: This function handles stateflow blocks. It receives the path to a stateflow block and returns a MATLAB structure with the contents of the stateflow block. This function depends onsrc/frondEnd/IR/utils/ChartParser.jar
to parse the labels of states and transitions inside the stateflow block using the following 2 functions:- edu.uiowa.chart.state.StateParser.parse: This function receives the label string of state and returns an object containing state actions.
- edu.uiowa.chart.transition.TransitionParser.parse: This function receives the label string of a transition and returns an object that contains its event, condition, condition action and transition action.
The source code for src/frondEnd/IR/utils/ChartParser.jar
is written in Java and is located here.