Class FMULogUtilities


  • public class FMULogUtilities
    extends java.lang.Object
    Utilities for the FMU Logger.

    This file contains a method based on fmusdk/src/shared/sim_support.c by Jakob Mauss, which has the following license:

    FMU SDK license

    Copyright (c) 2011, QTronic GmbH. All rights reserved. The FmuSdk is licensed by the copyright holder under the BSD License (http://www.opensource.org/licenses/bsd-license.html): Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
    - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
    - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

    THIS SOFTWARE IS PROVIDED BY QTRONIC GMBH "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL QTRONIC GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

    Since:
    Ptolemy II 10.0
    Version:
    $Id$, $Id$
    Author:
    Christopher Brooks, based on shared/sim_support.c
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (cxh)
    • Constructor Summary

      Constructors 
      Constructor Description
      FMULogUtilities()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String fmiStatusToString​(int status)
      Given a fmiStatus value, return a string description.
      static java.lang.String replaceVariableReferences​(FMIModelDescription modelDescription, java.lang.String messageString)
      Replace FMI variable references with the name of the variable.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FMULogUtilities

        public FMULogUtilities()
    • Method Detail

      • replaceVariableReferences

        public static java.lang.String replaceVariableReferences​(FMIModelDescription modelDescription,
                                                                 java.lang.String messageString)
        Replace FMI variable references with the name of the variable.

        The FMI log method optionally takes a variable number of arguments and handles #TypevalueReference#, specially where Type is one of r, i, b or s. To print a #, use ##.

        This method is based on based on a method by the same name in shared/sim_support.c from FMUSDK.

        Parameters:
        modelDescription - The model description that contains the names of the variables.
        messageString - The string that has had the % directed processed. The input will be of the format "foo #r1234# bar".
        Returns:
        a String with the variable references replaced.
      • fmiStatusToString

        public static java.lang.String fmiStatusToString​(int status)
        Given a fmiStatus value, return a string description.
        Parameters:
        status - One of the values from FMILibrary.FMIStatus
        Returns:
        A string that describes the status.