Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question
2

The measure I wrote doesn't work

asked 2018-06-28 02:33:12 -0600

rtsuchiya's avatar

updated 2018-06-28 08:54:38 -0600

Dear all,

Now I am trying to develop a measure to change the dirt correction value to be used in PAT. Actually, I am not a trained programmer but in this project using OS, I have to program some codes. So, this question might be just the basic one for Ruby coding, but I need someone's help.

When my measure is ran, the error message was shown "Error: wrong number of arguments (0 for 1)". This pointed the line of "xxx=workspace.getStandardGlazing" has problems.

I think, maybe, this is because there's no function ".getStandardGlazing". (I wrote this statement, because I found that .getStandardOpaqueMaterials worked in another measure, and there's a class "StandardGlazing" stated at this page.)

Here, my questions are:

  • What kind of function should be used here?
  • Where can I find the appropriate functions to be used for OS measures?

I will wait for any tips from you.

Thanks.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
5

answered 2018-06-28 11:39:11 -0600

updated 2018-06-29 08:38:28 -0600

In addition to the answer by @mdahlhausen, the model method you want is getStandardGlazings with an 's' at the end.

EDIT: These methods aren't explicitly documented anywhere. They're alluded to in the Measure Writer's Reference Guide in this section. The method templates are documented as getModelObject or getModelObjects (or getModelObjectByName/getModelObjectsByName), where you replace 'ModelObject' with the object class name. You can refer to the documentation for those methods for the required arguments, e.g. an object handle for getModelObject. If you want a list of all the methods available to the model (or any) class, you can list them from Ruby by calling model.methods.

edit flag offensive delete link more

Comments

Thank you. By adding "s" the measure worked. By the way, where can I find those functions? Are there any documentations?

rtsuchiya's avatar rtsuchiya  ( 2018-06-28 20:07:52 -0600 )edit

See edit above.

ericringold's avatar ericringold  ( 2018-06-29 08:25:16 -0600 )edit

Thank you very much for kind reply. I will check "model.methods".

rtsuchiya's avatar rtsuchiya  ( 2018-06-29 21:16:21 -0600 )edit
2

answered 2018-06-28 11:19:58 -0600

Looks like the this is the same problem you had earlier referenced in this question: https://unmethours.com/question/31184/new-measure-crashed/.

You are trying to call model methods on a workspace object. You should pass in a model object to your measure, not a workspace object, and make sure you are writing an OpenStudio Model measure not an EnergyPlus measure.

edit flag offensive delete link more

Comments

Thank you for your comment. Maybe I am still confused in both... I will check again those points. Thank you.

rtsuchiya's avatar rtsuchiya  ( 2018-06-28 20:08:03 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Training Workshops

Careers

Question Tools

2 followers

Stats

Asked: 2018-06-28 02:33:12 -0600

Seen: 650 times

Last updated: Jun 29 '18