@@ -26,51 +26,6 @@ def arguments(model)
2626 return args
2727 end
2828
29- def create_input ( model , name , freq )
30- # The purpose of this function is to create an Alfalfa input that is accessible via python plugins
31-
32- global = OpenStudio ::Model ::EnergyManagementSystemGlobalVariable . new ( model , name )
33- global . setExportToBCVTB ( true )
34-
35- # The global variable's value must be sent to output an variable so that python programs can read it
36- # don't be mistaken, An OuputVariable object is created, but this is "input" to the simulation, from Alfalfa clients
37- global_ems_output = OpenStudio ::Model ::EnergyManagementSystemOutputVariable . new ( model , global )
38- global_ems_output . setName ( name + "_EMS_Value" )
39- global_ems_output . setUpdateFrequency ( "SystemTimestep" )
40-
41- # Request the custom ems output var creaed in the previous step
42- global_output = OpenStudio ::Model ::OutputVariable . new ( global_ems_output . nameString ( ) , model )
43- global_output . setName ( name + "_Value" )
44- global_output . setReportingFrequency ( freq )
45- global_output . setKeyValue ( "EMS" )
46- # Setting exportToBCVTB to true is optional, and will result in the output variable showing up in the Alfalfa api,
47- # this might be useful for confirmation of the input
48- global_output . setExportToBCVTB ( true )
49-
50- # repeat the previous steps for an "Enable" input
51- # This value will be 1 (instead of 0) anytime a client writes to the input via the Alfalfa api
52- global_enable = OpenStudio ::Model ::EnergyManagementSystemGlobalVariable . new ( model , name + "_Enable" )
53- global_enable . setExportToBCVTB ( true )
54-
55- global_enable_ems_output = OpenStudio ::Model ::EnergyManagementSystemOutputVariable . new ( model , global_enable )
56- global_enable_ems_output . setName ( name + "_Enable_EMS_Value" )
57- global_enable_ems_output . setUpdateFrequency ( "SystemTimestep" )
58-
59- global_enable_output = OpenStudio ::Model ::OutputVariable . new ( global_enable_ems_output . nameString ( ) , model )
60- global_enable_output . setName ( name + "_Enable_Value" )
61- global_enable_output . setReportingFrequency ( freq )
62- global_enable_output . setKeyValue ( "EMS" )
63- global_enable_output . setExportToBCVTB ( true )
64- end
65-
66- def create_output ( model , var , key , name , freq )
67- new_var = OpenStudio ::Model ::OutputVariable . new ( var , model )
68- new_var . setName ( name )
69- new_var . setReportingFrequency ( freq )
70- new_var . setKeyValue ( key )
71- new_var . setExportToBCVTB ( true )
72- end
73-
7429 # define what happens when the measure is run
7530 def run ( model , runner , user_arguments )
7631 super ( model , runner , user_arguments )
@@ -79,11 +34,8 @@ def run(model, runner, user_arguments)
7934 # These can be set through the Alfalfa API, they will be available as OutputVariables
8035 # in the simulation. Use them as you will
8136 # Also see comments on the create_input method
82- create_input ( model , "Test_Point_1" , "Timestep" )
83-
84- # other OutputVariables might be custom python defined output variables,
85- # you should still be able to request them here, and as long as exportToBCVTB is true they will be available via Alfalfa
86-
37+ test_point_1 = OpenStudio ::Model ::EnergyManagementSystemGlobalVariable . new ( model , 'Test_Point_1' )
38+ runner . alfalfa . exposeFromObject ( test_point_1 , "Test_Point_1" )
8739 return true
8840 end
8941end
0 commit comments