Class StatementGeneratorContainer


  • public class StatementGeneratorContainer
    extends Object
    • Field Detail

      • errorReporter

        public static final BiFunction<org.intocps.maestro.ast.node.PExp,​String,​org.intocps.maestro.ast.node.PStm> errorReporter
      • FMIWARNINGANDFATALERRORCODES

        public static final Integer[] FMIWARNINGANDFATALERRORCODES
      • startTime

        public org.intocps.maestro.ast.node.PExp startTime
      • endTime

        public org.intocps.maestro.ast.node.PExp endTime
      • absoluteTolerance

        public double absoluteTolerance
      • relativeTolerance

        public double relativeTolerance
    • Method Detail

      • reset

        public static void reset()
      • statusCheck

        public static org.intocps.maestro.ast.node.PStm statusCheck​(org.intocps.maestro.ast.node.PExp status,
                                                                    Integer[] statusCodes,
                                                                    String message,
                                                                    boolean breakOut,
                                                                    boolean setGlobalExecution)
      • fmiTypeToMablType

        public org.intocps.maestro.ast.node.SPrimitiveTypeBase fmiTypeToMablType​(org.intocps.maestro.fmi.Fmi2ModelDescription.Types type)
      • createSetupExperimentStatement

        public org.intocps.maestro.ast.node.PStm createSetupExperimentStatement​(String instanceName,
                                                                                boolean toleranceDefined,
                                                                                double tolerance,
                                                                                boolean stopTimeDefined)
      • exitInitializationMode

        public org.intocps.maestro.ast.node.PStm exitInitializationMode​(String instanceName)
      • createFixedPointIteration

        public List<org.intocps.maestro.ast.node.PStm> createFixedPointIteration​(List<org.intocps.maestro.framework.fmi2.RelationVariable> loopVariables,
                                                                                 int iterationMax,
                                                                                 int sccNumber,
                                                                                 org.intocps.maestro.framework.fmi2.Fmi2SimulationEnvironment env)
                                                                          throws ExpandException
        Throws:
        ExpandException
      • setValueOnPortStm

        public List<org.intocps.maestro.ast.node.PStm> setValueOnPortStm​(org.intocps.maestro.ast.LexIdentifier comp,
                                                                         org.intocps.maestro.fmi.Fmi2ModelDescription.Types type,
                                                                         List<org.intocps.maestro.fmi.Fmi2ModelDescription.ScalarVariable> variables,
                                                                         long[] scalarValueIndices,
                                                                         org.intocps.maestro.framework.fmi2.Fmi2SimulationEnvironment env)
                                                                  throws ExpandException
        Throws:
        ExpandException
      • enterInitializationMode

        public org.intocps.maestro.ast.node.PStm enterInitializationMode​(String instanceName)
      • setInputOutputMapping

        public void setInputOutputMapping​(Map<org.intocps.maestro.framework.fmi2.ModelConnection.ModelInstance,​Map<org.intocps.maestro.fmi.Fmi2ModelDescription.ScalarVariable,​AbstractMap.SimpleEntry<org.intocps.maestro.framework.fmi2.ModelConnection.ModelInstance,​org.intocps.maestro.fmi.Fmi2ModelDescription.ScalarVariable>>> inputOutputMapping)
      • generateInstanceVariablesValueLocator

        public IntFunction<org.apache.commons.lang3.tuple.Pair<org.intocps.maestro.ast.node.PExp,​List<org.intocps.maestro.ast.node.PStm>>> generateInstanceVariablesValueLocator​(String instanceName,
                                                                                                                                                                                       long[] valRefs,
                                                                                                                                                                                       IntFunction<org.intocps.maestro.ast.node.PExp> literalExp,
                                                                                                                                                                                       org.intocps.maestro.fmi.Fmi2ModelDescription.Types targetType)
        This creates a function (valueLocator) that is used to locate an output corresponding to the given input that is to be set. If the co-simulation has entered instancesLookupDependencies then it will determine the variable using the inputs to outputs map (inputOutputMapping2) and locate it using instanceVariables. Otherwise it uses the argument literalExp to return a valueLocator. It uses to
        Parameters:
        instanceName - name of the instance on which the FMI-function is invoked.
        valRefs - value reference argument to the FMI function
        literalExp - Function to apply the int to, if the co-simulation has not entered instancesLookupDependencies mode.
        Returns:
        a function (valueLocator) that, given an int representing the index of valRefs, will locate the corresponding output
      • setRealsStm

        public List<org.intocps.maestro.ast.node.PStm> setRealsStm​(String instanceName,
                                                                   long[] longs,
                                                                   double[] doubles)
      • setBooleansStm

        public List<org.intocps.maestro.ast.node.PStm> setBooleansStm​(String instanceName,
                                                                      long[] longs,
                                                                      boolean[] booleans)
      • setIntegersStm

        public List<org.intocps.maestro.ast.node.PStm> setIntegersStm​(String instanceName,
                                                                      long[] longs,
                                                                      int[] ints)
      • setStringsStm

        public List<org.intocps.maestro.ast.node.PStm> setStringsStm​(String instanceName,
                                                                     long[] longs,
                                                                     String[] strings)
      • generateAssignmentStmForSet

        public List<org.intocps.maestro.ast.node.PStm> generateAssignmentStmForSet​(String instanceName,
                                                                                   long[] longs,
                                                                                   org.intocps.maestro.ast.LexIdentifier valueArray,
                                                                                   org.intocps.maestro.ast.LexIdentifier valRefs,
                                                                                   String setCommand)
      • generateIfConditionForSetGet

        public org.intocps.maestro.ast.node.PStm generateIfConditionForSetGet()
      • getValues

        public Object[] getValues​(List<org.intocps.maestro.fmi.Fmi2ModelDescription.ScalarVariable> variables,
                                  org.intocps.maestro.framework.fmi2.ModelConnection.ModelInstance modelInstance)
      • getValueStm

        public List<org.intocps.maestro.ast.node.PStm> getValueStm​(String instanceName,
                                                                   org.intocps.maestro.ast.LexIdentifier valueArray,
                                                                   long[] longs,
                                                                   org.intocps.maestro.fmi.Fmi2ModelDescription.Types type)
                                                            throws ExpandException
        Throws:
        ExpandException