Posted Mon, 22 Jun 2015 13:02:30 GMT by E.Ramin
Hello,

I have encountered some problems in defining a new block/unit in WEST.
I would like to create a unit process that appears only if e.g. ASM1_AN model is chosen, similar to activated_sludge_unit but with different design. 

To start with, I have created a new unit through Block editor and added it to the palette library (the IconName is set to activated_sludge_unit until I define a new model).

To create the new model:

1.  I have just first copy/pasted the activated_sludge_unit model folder and definition file and renamed them (forlder: ActiveX, msl file: wwtp.base.ABC.msl).
2.  Added the line "#include wwtp.base.ABC.msl" in the wwtp.msl file

However as soon as I refresh the treeview, I get the error "cannot find file: wwtp.base.ABC.msl).

Could you please help find out if I am missing a step here?
Posted Mon, 22 Jun 2015 13:25:51 GMT by Enrico Remigi WEST Product Owner
[quote author=E.Ramin link=topic=2501.msg5831#msg5831 date=1434978150]
.. a unit process that appears [b]only[/b] if e.g. ASM1_AN model is chosen ..
[/quote]
If the icon should not be available e.g. for ASM1 then you will need to create a new Palette for ASM1_AN - because they currently use the same.
You can duplicate the "WEST.WWTP.CN.PaletteLib.xml" and call it e.g. "WEST.WWTP.CN.AN.PaletteLib.xml".
In the BlockLib.xml file, point to the new palette for the ASM1_AN instance.

[quote author=E.Ramin link=topic=2501.msg5831#msg5831 date=1434978150]
.. the IconName is set to activated_sludge_unit until I define a new model
[/quote]
No: the IconName property should be unique.

[quote author=E.Ramin link=topic=2501.msg5831#msg5831 date=1434978150]
1.  I have just first copy/pasted the activated_sludge_unit model folder and definition file and renamed them (forlder: ActiveX, msl file: wwtp.base.ABC.msl).
2.  Added the line "#include wwtp.base.ABC.msl" in the wwtp.msl file

However as soon as I refresh the treeview, I get the error "cannot find file: wwtp.base.ABC.msl).
[/quote]
Not sure how you plan to implement your model, but you certainly don't need to duplicate the entire activated_sludge_unit folder. You may want to have a dedicated sub-folder for your new unit process (e.g. "ActiveX"), ok. Then you can save the new files pertaining to your new unit process in ActiveX.
What does the "wwtp.base.ABC.msl" actually implement? Is "ABC" the unit process model? And could "DEF" be a different implementation for the same unit process? If so, then I would imagine the following structure:
[list]
[li]sub-folder ActiveX containing one or more models: ABC, DEF, etc.[/li]
[li]a 'header' file for the new unit process, "wwtp.base.ActiveX.msl" located one level above the folder "ActiveX and containing include statements for ABC, DEF, etc.[/li]
[li]one single include statement (for "wwtp.base.ActiveX.msl") in the rootfile[/li]
[/list]
If you have placed your "wwtp.base.ABC.msl" inside the "ActiveX" folder, the correct include statement should be:
#include "[b]ActiveX/[/b]wwtp.base.ABC.msl"
Posted Tue, 23 Jun 2015 15:01:48 GMT by E.Ramin
Thanks for the reply, Enrico! Things are more clear now.

It would also be great if you could also explain how I can associate the new block to the new model.

I have now the folder ActiveX with ABC submodel, which is defined as:

CLASS ABC (* icon = "ABC" *) extends WWTPAtomicModelWithoutVolume with ...

And I set the IconName for the new block to "activex" in block editor, however I am not able to select the submodel ABC in the WEST simulation model, it is set to REAL by default, and the block details are blank.

Thanks again for the help!




Posted Tue, 23 Jun 2015 21:34:34 GMT by Enrico Remigi WEST Product Owner
To avoid confusion with the identifiers ..

If your model is declared as follows:
CLASS ABCModel (* icon = "ABCIcon" *) extends WWTPAtomicModelWithoutVolume WITH

Then the IconName should be [b]ABCIcon[/b] - i.e. the string used for the 'icon' annotation in the above class definition.

You must be signed in to post in this forum.