Posted Mon, 14 Apr 2014 12:04:58 GMT by Claus Vieira Andersen
Hello

I'm trying to create a new model. The model I want to create is a controller which controls whether the waste water stream is bypassed or led to the bio reactors depending on the flow.

Using the model editor I've tried copying the information from a PI-controller, rewriting the necessary equations etc. and hereafter saving the msl file in the controller directory. Furthermore, I've used the #include command in the block library explorer (under wwtp.base.controllers.msl) referring to the msl file in the controller directory.

However, it does not seem to work. When opening my model in WESTforOPTIMIZATION 2014 I get the following errors:

- Errors detected while processing the model library
- Loading layout failed, see logging for details

Furthermore, in the Model Editor when moving the cursor above the different included controllers in the Block Library Explorer while pressing down the CTRL key they all appears as hyperlinks which can be clicked on except for the one that I included.

Any help is much appreciated.

Best regards,
Claus Vieira B. Andersen   
Posted Mon, 14 Apr 2014 13:07:21 GMT by Enrico Remigi WEST Product Owner
Impossible for me to say what may be wrong in your case, if you don't post the relevant lines of the logbook:

[quote author=CVBA link=topic=2043.msg4626#msg4626 date=1397477098]
- Loading layout failed, see logging for details
[/quote]

If you look into the logbook (F6 if it's not visible), you should find one or more line, flagged as "error" or "warning" which should actually give some more details.

However, I can briefly explain how you should go about [b]creating a new control model[/b] (assuming that you'd be using one of the existing icons - so bypassing the complication of creating a new, ad-hoc, icon).
[list type=decimal]
[li]Duplicate one of the existing control models, e.g. PI_Saturation
- you could copy the "wwtp.base.controllers.pi_saturation.msl"
- store it (ideally) in a dedicated folder (for your own development): e.g. "AddOns" at the same level as the rootfile (wwtp.msl)
- rename it "wwtp.controllers.ABC.msl" (I would remove "base" from the file name)
[/li]
[li]Rename the CLASS appropriately - and preferably use the same ID for the filename and the class name.
In this case, e.g. "CLASS ABC"
[/li]
[li]Update the "sentinel" accordingly: something like
#ifndef WWTP_CONTROLLERS_ABC
#define WWTP_CONTROLLERS_ABC
[/li]
[li]Implement the model. Make sure you respect the syntax, avoid name duplication (i.e. OBJ with the same name, even if in different sections, are not allowed), use every interface variable (cannot define an interface OBJ and not use it in the equation section), ...
[/li]
[li]Add the appropriate #include statement, either
- in the "wwtp.base.controllers.msl": it will then appear in the treeview, with the other control models; or
- in the "wwtp.msl": it will appear as a branch of the rootfile, but it may be better to "isolate" your own development from the default libraries
[/li]
[li]Save the file(s)
- you may want to "Check Model Library", prior to saving
- no need to save or regenerate the BlockLib.xml in this case
[/li]
[li]Close and reopen your project: the new model should be available
[/li]
[/list]
Posted Tue, 15 Apr 2014 08:16:50 GMT by Claus Vieira Andersen
Thank you.

I've created a new block in the block editor and added it to the palette library. When I open WEST the block shows, however with none of the assigned information.

In the model editor i rewritten the name of the *icon to the name of my new block (*icon = CVBA_controller), however I must be missing something.

Does anybody have an idea?

Best regards,
Claus
Posted Tue, 15 Apr 2014 10:17:23 GMT by Enrico Remigi WEST Product Owner
If you have used the "IconName" property of the icon (pay attention to lower and upper case!), it must work.
Not sure if it was intentional, but the annotation should read:
[code](* icon = "CVBA_controller" *)[/code]
(note the inverted commas)
Posted Tue, 15 Apr 2014 10:42:18 GMT by Claus Vieira Andersen
Thank you very much

I had filled in the DisplayName and the Name but had forgotten to fill in the IconName...

Best regards,
Claus

You must be signed in to post in this forum.