modify_xml: Modify the xml according to your Co-simulation requirements.

Description Usage Arguments Value

View source: R/modify_xml.R

Description

Four parts, including Simulation time, ArraryExtract, EnergyPlus simulator and SystemCommand actor, can be modified.

Usage

1
2
3
modify_xml(xmlpath, timeStep = 15 * 60, beginTime = 0, endTime = 4 *
  24 * 3600, extractLength = 2, idf, epw, outname,
  programname = "Rscript", programArgs, workingDir, cpp = FALSE)

Arguments

xmlpath

... see copy_xml

timeStep

default = 15*60 secs. It depends on your timestep parameters in Energyplus file. By the way, both of the numerical value 15*60 and string "15*60" are supported. But if you want view your xml file, the string form is adviced since it makes you know your step is 15mins while the numerical value will show confused 900 secs in the BCVTB view.

beginTime

default = 0. Zero means it begin with the date you set in the EnergyPlus file. Similarly, input a string ''1*24*3600'' is more recommended than a numerical value 1*24*3600.

endTime

default = 4*24*3600. It indicates the co-simulation period is 4 days.

extractLength

default = 2. It equals to the variables you want input to the EnergyPlus.

idf

The idf path. Generally speaking, the idf should be in the root directory of your co-simulation project. Therefore, you can use ‘paste0(xmlpath,’/SmOffPSZ.idf')' to indicate your idf path if your idf name is SmOffPSZ.

epw

The weather file path.

outname

default = 'eplusout'. You can use outname to specify the name of messy simulation results files.

programname

default = 'Rscript'. It means you use R exchange data with EnergyPlus. If you set up R path in your environment variable, you can leave it alone. Or you need specify the complete path of Rscript as 'Your path/R/bin/Rscript'. Similarly, you could set programname as 'python' if you use python to do the co-simulation with Energyplus. It is worth noting that you should list the complete path if you use your own C/C++ based application since there is no environment variable to specify its path.

programArgs
  1. If your programname is 'Rscript', the programArgs should be 'YourScriptName.R'

  2. If your programname is 'python', the programArgs should be 'YourScriptName.py'

  3. If your programname is 'path/to/your/application', the programArgs should be "", an empty char.

workingDir

The subfolder path (usually under your xmlpath) you place your script or application. If you use R, ‘paste0(xmlpath,’/R')' is a good choice. For python user, it is ‘paste0(xmlpath,’/python')‘. For cpp user, it is 'paste0(xmlpath,’/cpp')'. If there is no folder path as you specified, the function will create a new one.

cpp

default = FALSE. If the external program is .exe or .sh, which is developed by yourself, the cpp should be set as TRUE

Value

The rootnode of the modified xml. It will be imported as the rootnode parameter. See write_xml.


jywang2016/CosimR documentation built on May 13, 2019, 9:52 p.m.