コード例 #1
0
ファイル: avm.designer.cs プロジェクト: neemask/meta-core
 public static bool LoadFromFile(string fileName, out PrimitiveProperty obj) {
     System.Exception exception = null;
     return LoadFromFile(fileName, out obj, out exception);
 }
コード例 #2
0
ファイル: avm.designer.cs プロジェクト: neemask/meta-core
 /// <summary>
 /// Deserializes xml markup from file into an PrimitiveProperty object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output PrimitiveProperty object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out PrimitiveProperty obj, out System.Exception exception) {
     exception = null;
     obj = default(PrimitiveProperty);
     try {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (System.Exception ex) {
         exception = ex;
         return false;
     }
 }
コード例 #3
0
ファイル: avm.designer.cs プロジェクト: neemask/meta-core
 /// <summary>
 /// Deserializes workflow markup into an PrimitiveProperty object
 /// </summary>
 /// <param name="xml">string workflow markup to deserialize</param>
 /// <param name="obj">Output PrimitiveProperty object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string xml, out PrimitiveProperty obj, out System.Exception exception) {
     exception = null;
     obj = default(PrimitiveProperty);
     try {
         obj = Deserialize(xml);
         return true;
     }
     catch (System.Exception ex) {
         exception = ex;
         return false;
     }
 }
コード例 #4
0
ファイル: avm.designer.cs プロジェクト: neemask/meta-core
 public static bool Deserialize(string xml, out PrimitiveProperty obj) {
     System.Exception exception = null;
     return Deserialize(xml, out obj, out exception);
 }
コード例 #5
0
        private void createAVMCyberParameter(List<avm.modelica.Parameter> avmCyberModelParameterList, Cyber.ParameterRef cyberModelParameterRef)
        {
            string idString = "ID" + _idCounter;
            _idCounter++;

            // Initialize a avmCyber Parameter
            avm.modelica.Parameter avmCyberParameter = new avm.modelica.Parameter();
            
            ////
            // Set avm cyber parameter Value
            avmCyberParameter.Value = new avm.Value();
            
            // Assign ValueExpressionType for avm Value
            avm.DerivedValue avmDerivedValue = new avm.DerivedValue();
            avmDerivedValue.ValueSource = idString;
            avmCyberParameter.Value.ValueExpression = avmDerivedValue;    

            // Assign ID attr content
            avmCyberParameter.Value.ID = META2AVM_Util.UtilFuncs.ensureMetaIDAttribute(cyberModelParameterRef);
            ////
            
            // Assign Locator relative to the parent cyberModel
            avmCyberParameter.Locator = cyberModelParameterRef.Name;

            /// Now do the outer representation
            avm.PrimitiveProperty avmProperty = new avm.PrimitiveProperty();
            avmProperty.Name = avmCyberParameter.Locator;
            avmProperty.ID = "property." + idString;
            avmProperty.Notes = avmCyberParameter.Notes;

            avmProperty.Value = new avm.Value();
            avmProperty.Value.ID = idString;
            
            
            // Three cases for getting the data type and/or value of the parameter object
            //  TODO: JEP The Simulink case is extremely messy - assume that the value is a real-type scalar for now, and we'll take care of it later
            avmProperty.Value.DimensionType = DimensionTypeEnum.Scalar;
            avmProperty.Value.DataType = DataTypeEnum.Real;
            avm.ParametricValue avmParametricValue = new avm.ParametricValue();
            
            //avm.FixedValue maxVal = new avm.FixedValue();
            //maxVal.Value = "1.0e10";
    
            //avmParametricValue.Maximum = maxVal;
            //avm.FixedValue minVal = new avm.FixedValue();
            //minVal.Value = "-1.0e10";
            //avmParametricValue.Minimum = minVal;
            //avm.FixedValue avmFixedValue = new avm.FixedValue();
            //avmFixedValue.Value = "0";
            /* Cyber.ParameterBase pbase = cyberModelParamterRef.Referred as Cyber.ParameterBase;
            if (pbase.Kind == "VFL_Parameter")
            {
                Simulink.SF_Parameter sfparam = pbase as Simulink.SF_Parameter;

            }
            else if (pbase.Kind == "Data")
            {

            }
            else if (pbase.Kind == "SFData")
            {

            } */
            avmProperty.Value.ValueExpression = avmParametricValue;
            

            // Add avm param to the given List
            avmCyberModelParameterList.Add(avmCyberParameter);
            _avmComponent.Property.Add(avmProperty);
        }