File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -1045,3 +1045,41 @@ end
10451045    @test  Example. structure[:constraints ] ==  [" (EvalAt(0.3))(x) ~ 3" " y ≲ 4" 
10461046    @test  Example. structure[:costs ] ==  [" x + y" " (EvalAt(1))(y) ^ 2" 
10471047end 
1048+ 
1049+ @testset  " Model Level Metadata" begin 
1050+     struct  Author end 
1051+     struct  MyVersion end 
1052+     struct  License end 
1053+     struct  Category end 
1054+     struct  Tags end 
1055+ 
1056+     @mtkmodel  TestMetadataModel begin 
1057+         @metadata  begin 
1058+             Author =  " Test Author" 
1059+             MyVersion =  " 1.0.0" 
1060+             License =  " MIT" 
1061+             Category =>  " example" 
1062+             Tags =  [" test" " demo" " metadata" 
1063+         end 
1064+         
1065+         @parameters  begin 
1066+             k =  1.0 , [description =  " Gain parameter" 
1067+         end 
1068+         
1069+         @variables  begin 
1070+             x (t), [description =  " State variable" 
1071+             y (t), [description =  " Output variable" 
1072+         end 
1073+         
1074+         @equations  begin 
1075+             D (x) ~  - k *  x
1076+             y ~  x
1077+         end 
1078+     end 
1079+     @named  test_model =  TestMetadataModel ()
1080+ 
1081+     struct  UnknownMetaKey end 
1082+     @test  ModelingToolkit. getmetadata (test_model, Author, nothing ) ==  " Test Author" 
1083+     @test  ModelingToolkit. getmetadata (test_model, MyVersion, nothing ) ==  " 1.0.0" 
1084+     @test  ModelingToolkit. getmetadata (test_model, UnknownMetaKey, nothing ) ===  nothing 
1085+ end 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments