ptolemy.cg
has a lot of classes, but the FMIMA work consists of only a few classes.See: Description
Class | Description |
---|---|
FMIMACodeGenerator |
Generate a Functional Mockup Interface Master Algorithm (FMIMA) description of a model.
|
FMIMACodeGeneratorAdapter |
Base class for a Functional Mockup Interface Master Algorithm code
generator adapter.
|
$PTII/bin/ptcg -generatorPackage ptolemy.cg.kernel.generic.program.procedural.fmima \ -generatorPackagelist generic.program.procedural.fmima \ $PTII/ptolemy/cg/kernel/generic/program/procedural/fmima/test/auto/FMUIncScale20RC1pt.xml
The ptolemy.cg
has a lot of classes, but the FMIMA work consists of only a few classes.
The easist way to work with the code is to look for the fmima
directories and then the .java
files
bash-3.2$ cd $PTII/ptolemy/cg bash-3.2$ find . -name fmima ./adapter/generic/program/procedural/fmima ./kernel/generic/program/procedural/fmima bash-3.2$ find ./adapter/generic/program/procedural/fmima -name "*.java" ./adapter/generic/program/procedural/fmima/adapters/ptolemy/actor/Director.java ./adapter/generic/program/procedural/fmima/adapters/ptolemy/actor/lib/fmi/FMUImport.java ./adapter/generic/program/procedural/fmima/adapters/ptolemy/actor/TypedCompositeActor.java ./adapter/generic/program/procedural/fmima/test/junit/JUnitTclTest.java bash-3.2$ find ./kernel/generic/program/procedural/fmima -name "*.java" ./kernel/generic/program/procedural/fmima/FMIMACodeGenerator.java ./kernel/generic/program/procedural/fmima/FMIMACodeGeneratorAdapter.java ./kernel/generic/program/procedural/fmima/test/junit/JUnitTclTest.java bash-3.2$
The main entry point is $PTII/ptolemy/cg/kernel/generic/program/procedural/fmima/FMIMACodeGenerator.java
. When the code generator is invoked, that class is instantiated.
Below is the command to run a sample model:
$PTII/bin/ptcg -generatorPackage ptolemy.cg.kernel.generic.program.procedural.fmima \ -generatorPackagelist generic.program.procedural.fmima \ $PTII/ptolemy/cg/kernel/generic/program/procedural/fmima/test/auto/FMUIncScale20RC1pt.xml
$PTII/bin/ptcg
-generatorPackage ptolemy.cg.kernel.generic.program.procedural.fmima
-generatorPackagelist generic.program.procedural.fmima
Run $PTII/bin/ptcg -help
to see other command line arguments.
In a nut shell, the code iterates through the model, finding actors and attributes. An adapter class is searched for that will handle each actor and attribute. If an adapter is not found, then an adapter for the parent class of the actor or attribute is searched for.