Skip to content

CemGEMS web app tutorial

Redefining recipes, materials, constituents, and formulae (using jsoneditor)

Not all JSON data fields of the recipe, material, or constituent are accessible through the tree-like inputRecipe table. Working with CemGEMS recipes, an expert/engineer may also need to introduce more clinker constituents or SCMs or even materials, or extend shortcut lists of chemical formulae that were not previously available in any of the provided recipe templates.

This kind of "deep editing" at the expert level is possible in CemGEMS by invoking the jsoneditor widget, powered by Json Editor. In this way, you can access all data fields in Recipe, Process, and Plot JSON documents that were created in your user profile database. For instance, in a cement recipe, you can work with arrays of recipes, materials, constituents and formulae by deleting, cloning, or moving their respective elements.

Invoking jsoneditor

Working in the "Expert" view and looking at the expanded tree-like inputRecipes table, the user may notice many small pencil-like icons located immediately to the left of data object names (e.g. a name in Material, Constituent or Formula columns). The pop-up jsoneditor widget opens up upon clicking on any such icon, transforming it into a green "tick". To close the jsoneditor widget (possibly accepting the changes), simply click on that green "tick", which then tuns back into the "pencil".

Screenshot

Important!

The jsoneditor widget only give access to a JSON subdocument at the level of data object where the editor was invoked, along with any subordinate objects at deeper levels. The overarching part of the whole document remains invisible and inaccessible.

For example, clicking on the "pencil" at the Formula "SiO2" will only show the content of this formula as an element of the "formulae" list.

CLicking on the "pencil" at the Constituent "Belite" will show contents of the respective JSON object as an element of "constituents" list; by scrolling down the widget, the user can find a "formulae" list which, when expanded, shows all included elements for chemical formulae.

Clicking on the "pencil" at "Cement" Material will open the jsoneditor widget that shows the properties of this material. In a recipe with data of "min" type, this list contains all constituents comprising this material. In a recipe of "xrf" data type, the list will contain a list of shortcut "formulae" that define chemical composition of this material.

By expanding a constituent, the user gets into its properties down to the regular "formulae" list and then into each formula (e.g. Al2O3), Quantites of which define the bulk chemical composition of this constituent.

Using jsoneditor

Using the menu symbols on the left side of the jsoneditor widget, the user can delete, duplicate or create any data field, a list, or a list element, or change its type if necessary.

Screenshot

This remove and duplicate functionality can be applied to any element of any list at any level. For instance, a formula "SrO" with its Quantity needs to be added to the "formulae" list for a "Limestone" constituent. To do this, expand the "formulae" list to its elements, select any element, and click "Duplicate" in the left-hand menu against that selected element, as seen in the screen image below.

The cloned list element will appear immediately below the selected one. It is possible to dive into the cloned element and modify its fields (e.g. TiO2 to MnO, Quantity field) and then leave the jsoneditor widget, or leave it first and edit the cloned formula contents in the tree-like table.

In the same way, by invoking jsoneditor widget for a chosen Material, the user can find the "constituents" list, and clone one of constituents, then edit to make desired changes in the new constituent. This can save a lot of time by obviating the need to know exactly how the JSON object for a constituent is organized, and only changing those fields that need to be changed. A typical case is that the user wants to use a specific slag that has the composition different from the GGBFS composition provided in recipe templates in the "SCM" material. The constituent object used for cloning can be retained as well. Constituents that will never be used can surely be removed from the list.

To clone or remove a Material, use the "pencil" icon located to the left of Recipe name (in expanded Recipe section), and scroll down to find the "materials" list to expand it. A whole recipe can be cloned using the "pencil" icon in the topmost table of the "inputRecipes" section.

!!! warning "A word of caution:: When using the jsoneditor widget, be careful with deleting or re-naming the keywords of data fields provided in the inputRecipes document, as this may render your recipe impossible to Equilibrate. Normally it is safe to change values (located to the right of a keyword) and clone or delete elements of lists, as described below. To change units of measurement, better use the tree-like table where possible units are available as drop-down lists.

Saving contents to disk using jsoneditor

The jsoneditor allows to copy-paste a JSON subdocument into a text file open on your desktop. To do so, open the jsoneditor widget somewhere in the recipe inputs and find the "Tree" switch located in the upper bar, then switch it to "Text":

Screenshot

This JSON document in text form is not editable, but you can select it all or part of it, copy (Ctrl-V) and paste into a normal text editor available in your desktop PC. More data export options may be added in future.


Last update: June 9, 2020