Frequently Asked Questions
From SysCADWiki
Navigation: User Guide -> Frequently Asked Questions
Project related questions
Can SysCAD 9.0 project be upgraded to 9.1 easily?
SysCAD 9.0 projects can be easily upgraded. The best way to upgrade a SysCAD 9.0 project is to use the file manager to copy it (with corresponding configuration files) to the new equivalent SysCAD91 folder. You can then start SysCAD 9.1 and open the copy of the project. SysCAD will upgrade the configuration file and the project. Often the project will be ready to run or solve. However, once the project is loaded and solved you may need to check the results because of changes in SysCAD. It is also a good idea to check the error messages window for any messages. For more information see Upgrading Projects.
Can SysCAD 8.2 project be upgraded to 9.0 easily?
The best way to upgrade a SysCAD 8.2 project is to use the file manager to copy it (with corresponding configuration files) to the new equivalent SysCAD90 folder. You can then start SysCAD 9.0 and open the copy of the project. SysCAD will upgrade the project. Often the project will be ready to run or solve. However, once the project is loaded you may need to look at a couple of things because of changes in SysCAD. List of things to check are documented in Project Structure. Converting an older 8.2 Project.
How do I create a new project?
Once SysCAD is started, go to File | New, and create a project from there. In SysCAD whenever a new project is created you are first asked to select a configuration file. The configuration file is used for options, data and settings that would be used by many projects. Please see Creating a New Project.
The SysCAD Tutorial documentation has step-by-step instructions on this, which new users should have completed before attempting to create their first project.
What is a configuration file?
A configuration file can only be edited when all the projects are closed, from the Project menu, select Edit|Project Configuration. It has the following sections:
- It allows the user to select Unit Operations to be used in the project. For example, if SysCAD is running in ProBal Mode only, all the Dynamic Models can be deselected to make the list shorter. One thing to note is that the unit operation models are normally limited by the license as well, so this page need not be changed very often.
- It allows the user to set up information such as the normal temperature, pressure, atmospheric pressure, default species model and so on.
- It allows the user to select chemical compounds (already defined in the specie database syscad.mdb) to be used in the project.
- If required, it allows the sieve series and size distribution data to be defined. Only valid for users with the Size Distribution Module (add-on).
What is in the SysCAD.mdb file?
The SysCAD.mdb file contains chemical and thermodynamic properties for compounds used in the project. The user can define many compounds in the database but use a subset of these in a project. The compounds used by the project are selected via the Configuration file. (See What is a configuration file?) To use species in the example database default.mdb, the import option must be used when editing the database. See Editing SysCAD Database and Species Table for further information. NOTE: for new compounds to be visible in the project, they must be selected via the configuration file.
How do I add a new compound to the project?
The tutorial has step-by-step instruction on how to add a new compound to the SysCAD project. Please see chapter 'Project Configuration ' Edit| SysCAD Database.
How do I add particle size distribution data to a project?
Firstly, you need to add size distribution to your project configuration before you can use it in a project.
Open SysCAD, but do not have a project open, and then go to ‘Edit - Project Configuration’ and choose to ‘Edit’ the project of interest.
When the configuration window opens, ensure that ‘SizeDst1.dll’ and ‘Separ2.dll’ are selected in the list of required DLL’s (just click on the left hand side of these dlls and a tick will show)
Click on the Next>>> button
You will now have a number of tabs to choose from. The first step is to select the sieve series, then set the size distribution and the actual solids species that will have a size distribution – please refer to Models Configuration - Sieve Series and Size Distribution
When you have finished setting the size data in the configuration file, you can close the configuration editor.
How do I distribute or send the project to another user elsewhere?
Sender should
- zip the entire project folder preferably with relative path names. (eg, zip up the FullPlantModel.spf as FullPlantModel.spf.zip).
- Delete any Hist_Dat.xxx files (historian data files) to reduce the size of the zip file if required.
Receiver should
- Unzip the file following the relative path names or unzip to a new folder with the correct project name and extension (thus FullPlantModel.spf).
- After the project is unzipped, using Windows Explorer, go to the project folder (eg FullPlantModel.spf) and open the file RmtFilesBackup.zip. This zip file contains all the remote files the project needs to run correctly, eg the SysCAD.mdb, the project configuration file and so on. If the user has not these files already on their computer, then it should be extracted also. Please refer to Location of Project Files if you are not sure of the location of the files. NOTE: your path for these reference files may differ to the sender, so if you have used a different path, then go on to step (5)
- If the paths of the configuration file have changed (for example the configuration file was sitting on the network server under many layers of folders, but have been sent to a remote computer and the user decided to place it at a different location) then File. Open - Open Project (Alt Cfg) must be used to open the project.
What are referenced files?
The referenced files are those written by the user, external to SysCAD. These include any Excel Reports, PGM files, reactions files, script files and driver files.
The referenced files are normally stored within the project folder.
- Reaction files, .rct, are stored in a folder within the project called Reactions.
- Control files, .pgm, are stored in a folder within the project called Controls.
It is a good idea to also store other reference files within the project folder as this will help to keep the project self-contained. However, it is possible to store them under other designated folders, eg, the cfgfiles folder.
It is up to the user to keep to a consistent format for good project management.
How do I create SysCAD reference files, are there any templates available?
The SysCAD tutorial has step-by-step instructions on how to create these reference files. These files are stored under the \Tutorial\cfgfiles folder. The user can use these files as templates for future work. As well, the tutorial.xls has many examples on the SysCAD reports.
When I run a project, I get this message Required pressure out of project Range (50>350), what is this referring to?
This relates to the configuration file, where the minimum and maximum pressure expected or allowed in a project is specified. In this example the maximum pressure was 350kPa (which was the default in SysCAD 8.1). This should generally not cause any problems in the project, but from SysCAD 8.2 a warning is given wherever the pressure is outside of the user specified limits. To fix this warning, check the operating pressure are change the cfg file as follows:
- Start SysCAD but do not load any projects.
- From Project, choose Edit Configuration. Find the correct xxxx.cfg file that you are using.
- Select the file and press the Edit button.
- On the Configuration tab page, change the maximum (and minimum) pressure to a reasonable number.
- press OK to close.
- You can now load up the project again and the pressure warning messages should disappear.
My project crashed during a save, now when I tried to load the project again, it fails, can this be fixed?
In many cases, if the crash was during the project save step where the model is being saved to the MS Access database file (Scd_Mdls.Mdb in SysCAD 9.1 or ModelData.Mdb in SysCAD 9.2, the project can be recovered at the previous state of the model. This requires MS Access to be installed on the computer so that you can edit the database file directly. Please follow the instruction given on SysCAD Models Database. Note that this will not work on projects that have never been saved before, that is where the failure occurred on the first project save. The project recovered will be back to the last revision, thus you will lose any work you have done prior to the crash.
On loading a project I get History Version Number Mismatch error messages. How do I make these go away?
Open the project folder in Explorer and delete the files Hist.001 and Hist_Cfg.hed
How do I change a project from ProBal to Dynamic or vice-versa?
Firstly, ensure that your license allows you to use the desired mode.
Secondly, check the configuration file of the project to ensure that the desired mode is allowed (see Edit Configuration). Note that both modes can be enabled in the one configuration file (see Configuration file (.cfg)). Your project must be closed for you to be able to edit the configuration file.
Finally, again with your project closed, edit the project settings and change the Network Solution to the desired mode. You can now reopen your project.
General questions:
Why does it take a long time to check the license?
If SysCAD is taking a long time, say around 10 seconds (anything more than 5 seconds), to check the license at startup, then it is likely that an older version of the crypkey license service is installed. You need to force an install of the correct version of crypkey. This requires administrator rights. See Re-installing the Crypkey Licensing Software for details. It should usually take about 2 or 3 seconds (or up to 4 or 5 seconds) to check the license when SysCAD is started. The time taken depends on the PC and whether it is a stand-alone or network license.
How do I check what License I have?
Information can be obtained from menu command License | License Information. For more information see Licensing.
How do I transfer the SysCAD license from one machine to another?
In the User Manual, there is a section on Licence Transfer, please refer to that for step-by-step instructions. Please refer to the License section for general information on licenses.
Can I have two projects opened at the same time?
If you have a stand-alone SysCAD license, then yes, it is possible. Simply start up another instance of SysCAD and load the second project. It is also possible to do this if you have a multi-user network license, but for each copy of SysCAD that is started, you will be using one of the licenses. Please note that since SysCAD together with the project can take a large amount of memory, you may be limited by the RAM you have on your PC.
I have a multi-core or dual processor machine, will I notice a speed increase during solve and can I control how the machine uses the processors?
Since the introduction of SysCAD 8.1 the solver was designed to take advantage of multiple processors. The SysCAD software has been programmed to create 'worker threads' to divide the workload and take advantage of multiple processors. This capability has been improved in subsequent SysCAD versions.
In a flowsheet this division is done at the model level and is based on the ability to solve models in parallel given that all inputs are known. Hence if a flowsheet topology is such that after tearing (breaking recycles), a number of parallel paths exist, gains will be achieved. If on the other hand the flowsheet consists of one long sequence of unit operations few gains will be had.
In this case the only improvement will be that due to graphics, historian queries and main application loop overhead etc. being processed by the 'other' processor/s.
The tag 'PlantModel.NoOfSolveThreadsRqd' in Plant Model allows control of Multiprocessor's for use by the network solver. The options are:
- -1 : (Recommended option) SysCAD will automatically use the NonThreaded Solver option if 1 processor or 'M' sets of worker threads, where M is the number of processors.
- 0 : Use the NonThreaded Solver
- 1,2... : Use the Threaded Solver with user specified number of worker threads
What are PGM files?
PGM files are programmable files that allow the user to extend the functionality of the SysCAD models. It is used extensively in SysCAD Dynamic modelling. In Process Balancing mode, the user can use the PGM files to put in simple ratio controls or calculate user-defined variables and so on. See PGM Introduction.
My Floating Toolbars are not visible - How can I recover them?
If SysCAD users with differing monitor setups work on the same project, it does sometimes happen that the floating toolbars are not visible to some of the users. This is because when the project is saved the floating toolbar position may be saved according to the monitor setup. The next person working on the project may not be able to see the floating toolbar for the 'Delete', 'Move', 'Scale / Rotate', etc commands.
Do the following:
- Close the project and using Windows Explorer find the following file in the project:
- Scd_Prj.ini
- Right click on this file and open it using a text editor such as Textpad or Notepad++.
- Find the phrase 'GrfDynamicToolbar' and below it there will be values set for XPos and YPos.
- Either set both of these values to 10, or delete them.
- Save the file.
When you re-open the project, you will be able ot access the floating toolbars again.
Flash Train related questions
Why is the display colour of some models white?
Under Options | General | Colour tab page, the user can select different colours to display the unit operation's status. Generally, when the display colour of a model is white, they are part of a macro model, or a Flash Train model.
What are macro models?
Macro model is the name given to a Flash Train. When models such as Flash Tanks, heat exchanger are correctly connected together, a flash train will be formed. For example, a flash Tank and a shell and tube heat exchanger has formed a Flash Train, these two unit operations will be displayed in white. When models are under the flash train mode, SysCAD calculates the amount of steam being flashed off the flash tank based on the shell and tube exchanger configuration.
For more information see Flash Train.
I have added a tie in the middle of a flash train; now the pressure for the flash train is atmospheric, why is that?
By default, a newly inserted tie is at atmospheric pressure. To change this, the user should open the tie Access Window and select a different method for the OperatingP (PBPress in SysCAD 9.1 or earlier).
I have added a tie in the middle of a flash train; now the flash train is broken, why is that?
For example, if the tie is added in the vapour line connecting the flash tank to the heat exchanger steam inlet, a flash train will not be formed automatically. To activate the flash train, the user should open the tie Access Window, and turn on the GM model. Also, the GM model must be left in the General operation model and the QmMode must be in Demand.
I have connected the flash tank vapours to a Barometric condenser, SysCAD automatically puts them in a flash train configuration, is there any way of breaking the association? I want to control the flash tank pressure manually.
To do that, the user can put in a tie in the vapour line to the Barometric condenser, do not turn on the GM model in the tie and the flash train configuration will be broken.
I have a stand-alone direct contact heater with steam feed coming from a tie. The heater is not part of a flash train and therefore it does not know the correct amount of steam to add given the required temperature. What can be done to get just enough steam addition without having to vent off excess steam?
First, we need to understand what happens in the direct contact heater. When steam is added, enough of it is condensed to achieve the required temperature or temperature rise. A built-in controller is used to do this work. Now, a problem arises when there is too much steam added, as SysCAD does not know how to reduce this normally, so the excess steam is vented. This is done either through the Excess steam vent or if one is not connected, then it either goes out with the hotliquor or is vented (disappears) if the VentExcessSteam tick box is selected.
The problem arises when the user want to add just enough steam to the contact heater without having to loose this excess steam. When a contact heater is in demand mode, an extra built in PID controller is used to control the amount of steam added so that there is no excess steam.
A direct contact heater is in the demand mode when 1) it is part of a flash train, 2) when its steam supply comes directly from a feeder with the demand mode ticked (see models help for more explanations). If the steam comes from a tie that's not part of a flash train, it is not in demand mode.
Under this situation, the only way to fix the excess steam problem is to add a user defined PID controller to control the amount of steam added so that a required hotliquor temperature is met. Now, as mentioned before, the direct contact heater has already a built in controller to control its hotliquor temperature, therefore, once the user defined controller is added, there will be a conflict between the two controllers.
To avoid this, we have to make the user-defined controller take control. To do this, we will purposely set a temperature in the contact heater that will be unachievable, thus slightly higher than the actual required T. For example, if the set point for the user defined PID controller is 125 C. Then we will put in 125.01 for the Required Temperature in Contact heater.
The idea behind this is to never let the contact heater internal controller arrive at its setpoint. If your internal contact heater never gets "enough" steam, then there will be NO excess steam.
I have a flash train configuration as shown below, when I solve the flowsheet, I get an energy balance problem in the heat exchanger (marked red). Why and what can I do to eliminate the problem?
First, we need to understand what SysCAD does in a Flash Train configuration. When a Flash Tank | Heat Exchanger | Reflash configuration is formed, the amount of flashing is controlled by how much the Heat Exchanger can FULLY condense. Now, when a heat exchanger is in the fully condensing mode inside a flash train, it condenses ALL the steam to saturation conditions thus the condensate will NOT flash again. So in theory having the Reflash 1 there will do NOTHING and the reflash steam should be 0. Now the problem with SysCAD is that it cannot handle a flash tank having 0 steam in this situation, and it will try to solve to a solution and in doing so gets in a loop and ends up with an incorrect answer.
What we can do to help SysCAD is to avoid this unnecessary complication by either Turning the Reflash 1 Offline or remove Reflash 1 altogether. In both cases, the Shell & Tube HX 1 condensate will feed directly into Reflash 2 where a solution can be obtained.
Modelling related questions
I have a user defined species model available, how do I go about changing species models?
If additional species models are available to the user, then the species model can be set; following are a few notes on the selection of species model in a project:
- The DEFAULT species model for the project needs to be set in the models configuration file (.cfg). For more information on the models configuration file, please see Configuration (.cfg) - Configuration.
- Once the default species model has been set, any new unit operations inserted into SysCAD will carry this species model.
- In practice, only feeders and Makeup Sources need to have the species model information defined, if the species model used differs to that of the default. Any other units will use the species model of its inlet streams.
- To set the species model in the Feeder or the Makeup Source, under the Contents tab page, select the modeltype. If a species model is selected, then (Reqd) will appear after the word Model as a reminder that the user has manually set the species model. If the user wants to set the species model back to its default, then Inherit should be chosen, when this happens, (heritage) will appear after the word Model as a reminder that the species model is determined by SysCAD.
- In the case of two different species model entering the same unit operation, SysCAD will decide what to use for its outlets. In these cases, the user can manually set the species models in the outlet pipes if they prefer to use a different species model.
I have a number of graphics pages in the project representing different areas in the plant. How do I join the flows between pages?
This is done via the Feeder-Cross Page Connector unit operation, in the Cross Page Connection section, which is located on the first tab page of the Feeder unit operation access window. Simply type in the Tag name of the unit operation (must be another Feeder/Cross Page unit op) to be connected to in the Conn_to field.
NOTE that you can only have one connection made at any one time. Deselecting the ConnectionOn check box can break connections.
For more information on this, please refer to the Cross Page Connector.
Can I select the graphics pages that I want to run?
You can activate and deactivate graphics pages in either of the following ways:
- Via the Project - ProBal Setup - Active Pages tab page. To deactivate all pages, select the Plant model option and press the Deactivate button, (or press Activate if you want to reactivate them.) To activate/deactivate individual pages, select them one at a time and press activate/deactivate; or
- Via the Explorer Window, by right clicking on the required Graphics name and clicking on Active. See Manipulating Graphics and Trend Windows.
NOTE: When running the pages separately, please make sure all feeders to individual pages are configured properly. NOTE also if these feeders were cross page connected prior to being deactivated, users can use the Composition Fetch option in the access page to get the solved flows. See the next question for more information.
How do I set up feeder information automatically when running flowsheets separately?
If the project has never been solved before, user must set up the feeder information manually. However, if information is available elsewhere in the project, user can use Data Transfer to copy the information across.
If the project has been solved prior, user will notice that there is intermediate information available in the feeder. In these cases, the user can use the feeder CF.Fetch Self Flows option to copy the intermediate image and use it as feeder configuration.
See Feeder-Cross Page connector - Composition Fetch for more information.
I would like to define a feed stream containing solids based on its dry weight percentage and also have the ability to change the Liquid fraction in the stream. How do I do this easily?
In the Feeder unit, use the Phase option on the MF Tab page, (see Material Fraction Section).
Here the solids dry weight can be entered directly and the liquid mass fraction can be easily changed by modifying the total liquids field.
See the Access Window below, and Feeder-Cross Page Connector for more information.
How do I add or remove particle size distribution data from a Stream?
Add Size Distribution Data
You must have already added the size distribution information to the project configuration file (see How do I add particle size distribution data to a project?).
You can then open the project and access the relevant feeder with solids - this is where you will set the size of the solids entering the plant. On the second tab of the Feeder, called ‘Content’, you will see a heading called Qualities. If this has a + box on the left side, click on this and it will show the qualities that you can set in this feeder – one of which is ‘SzDistAct’.
Click on the arrow next to the SzDistAct box and select ‘Create’ from the drop down list.
You will now see that you have quite a few extra tabs visible in the feeder, the first two are Sz and MSz. Go to the Sz tab and you will see that you can now input the size distributions for the solids that you selected in the configuration file.
You will now have size distribution information in all streams with these solids in your project.
Remove Size Distribution Data
There are times when you only need this information at the front end of the project, e.g. for the crushing, screening and milling sections. Thereafter you may not be interested in the size distribution data. You can remove this information in the following way:
Go to the stream where you would like to remove the size distribution information and click on the Qi tab.
Go to Qualities and got to ‘SzDistAct’ and then select ‘Remove’ from the drop down list.
Please also see Common Content Section
What do the coloured triangles displayed on an Access Window mean?
If a value is either controlled or referenced by a control unit in SysCAD, then a coloured triangle will be displayed next to the tag in the Access Window.
If the triangle is directed INTO the value, >, and it is either blue, magenta or red, then the value is being controlled, or Set, by a controller. In this case, the user cannot set the value manually, as it will be overwritten by the controller.
If the triangle is directed OUT of the value, <, and it is green, then the value is referenced, or measured, by a control unit.
The user may right click on the value and the pop-up menu will display the tag of the control unit that is referencing the value. The user can then navigate to the control unit, if required. (See Controlled and Referenced Variables.
Mass and Energy Balance related questions
Where can I get information for Mass and Energy Balances?
In SysCAD ProBal, since the operation mode is steady state, thus no mass accumulation will occur, any flow information are provided in the pipe models, ie, flowrate, temperature, pressure, enthalpy, specific heat, etc can be found by right clicking on the PIPES.
For individual unit operations, SysCAD does give a summary of the total input and output mass and energy numbers. Thus to check the energy balance around an individual unit, the user can look in the individual model. These do not include the Feeder/Cross Page connector unit operation as it acts either as an input or output, thus there if no balance across it.
For more information about mass and energy balances, please see section Mass and Energy Balance.
Graphics related questions
Where and how is the Graphics Symbol (used for insert unit) stored?
The graphics symbols are stored in the folder \SysCAD91\BaseFiles\Symbols. They are grouped into folders of related symbols, each containing .dxf files for each symbol. The dxf file is the actual drawing file SysCAD uses when inserting the unit when using Insert Unit dialog box. For more information on graphics symbols, please see topic Data Libraries - Graphics Database.
Can I create my own Graphics Symbol (used for insert unit)?
Yes, as long as you have access to a drawing package that can save or export in an AutoCAD dxf format. Some examples are AutoCAD, Microstation, Powerdraft and IntelliCAD. Follow the naming convention and other precautions as mentioned in Data Libraries - Graphics Database the graphics symbol will be ready for use as soon as it is created and stored in the correct location. You will need to close the Insert Unit dialog box and re-open this before a new symbol will be available for use.
Can I use Graphics Symbol other than the default set for the unit operation?
Yes, just click the All Symbols tick box on the Insert Unit dialog box before inserting the unit operation and you can choose anything from the entire graphics symbol list.
Can I have a drawing border for my flowsheet?
A drawing border will always add to the presentation of the flowsheet. The best way to do this is to add the border as symbol. Use the Insert Symbol function and select the Extras drawing group. Choose A1/A2/A3/A4FrameSymbol, depending on the Size of the flowsheet.
After the border has been inserted it can be rescaled using the Scale/Rotate function and it can be positioned using Move function.
Can I add a title to my flowsheet?
The best way to do this is to use the graphics command Insert Text. Another option that can be used when a box, frame or symbol is also required is to "cheat" by adding a TIE using the titlebox (or other) symbol and use the tie unit operation name as the title.
Can I add a table of numbers to my PFD flowsheet?
Technically, yes. The function is called Create Annotation. Use Graphics | Dynamic fill | Create Annotation to create the table. Use Graphics | Dynamic fill | Update Annotation to edit the table and Refresh Annotation or Refresh All Annotation to update the numbers during solve as the table is only updated on stop.
Can I copy the graphics page as a bitmap?
This is very easy to do, and there are a number of ways of achieving this:
- RIGHT CLICK on the BLACK BACKGROUND of the ACTIVE flowsheet in SysCAD and choose Copy Bitmap (it is the last option on the pop up menu). A "Print screen" of the graphics flowsheet window only (see note below) will be copied onto the clipboard.
- Right Click on the Graphics name in the SysCAD Explorer window and select 'Copy Bitmap to Clipboard' (also see Explorer Window)
NOTE: This will copy what is on the active graphics page as is. Thus if the graphics page is zoomed into an area, it will only copy that particular section. Also, SysCAD puts this bitmap in mono colour i.e. black lines on white background.
You can paste the bitmap into other applications.
The standard "Print Screen" keyboard key can also be used to copy a full screen colour image to the clipboard.
What do I need to do to import an external drawing?
If you have access to a pre-drawn CAD drawing, whether it was created in AutoCAD, Microstation or Visio (and so on), as long as you can export the drawing to a DXF format, you can import it into SysCAD. However, there are a few things to keep in mind:
- All blocks on the CAD drawing must be exploded, these include polylines and hatches.
- Any external references must be removed; these will often include any frames used. Frames can exist on the drawing, but only if it is part of the drawing, not as a reference drawing.
- After all the blocks are exploded, it is best to do a purge on the drawing to remove any unused layers and styles; this will keep the drawing as small as possible.
Once you have the DXF drawing ready, create a blank graphics page in SysCAD, use menu option Graphics More Load Drawing and select the dxf drawing you have created, see Load Drawing. Check that all the lines and symbol have been imported properly, if not, go back to the other drawing package and fix any unexploded symbols and try again.
PGM Frequently Asked Questions
What is the difference between GetTag(), SetTag() and GetDynTag() and SetDynTag() and when do you use them?
The difference between GetTag() and GetDynTag(); SetTag and SetDynTag is subtle. It is NOT related to dynamic mode. It is called GetDynTag() and SetDynTag() because you can "dynamically" build a string based on logic using strcat that you want to set/get. Now at startup when you press solve, SysCAD has a list of all tags used in SetTag() and GetTag() which it checks to see if they can legally be set/read always. However, for SetDynTag() and GetDynTag() the checking of the tag is done at runtime when the command is called. Please see Keywords, Functions and Classes in the PGM section.
How do I avoid a 'Divide by Zero' error?
At times a user may get a 'Divide by Zero' error in their general controller. This can be caused in a number of ways:
- When the code uses a variable that has been read in from the SysCAD model, using a GetTag() command, and the measured variable is unexpectedly zero; or
- The code uses a User defined variable and the user types in zero; or
- The denominator is the result of a previous calculation which produces a zero value.
It is good practice to ALWAYS ensure that the denominator is not zero when doing a division. The following example shows methods of avoiding a zero denominator when using a measured SysCAD variable as the denominator, but these methods can be used for all of the above cases.
Example: The following two variables are measured in a PGM:
SolidMassFlow = GetTag("P_001.Qo.SQMt (t/h)")
SlurryMassFlow = GetTag("P_001.Qo.SLQMt (t/h)")
The user wishes to find the fraction of solids in the slurry, and therefore wants to divide the solids mass by the mass of slurry. However, if for some unexpected reason there is zero flow in stream P_001, this will produce a 'Divide by Zero' error. You can avoid this in PGM code in a number of ways:
1. Check that the denominator is greater than some small number before carrying out the calculation (You may check that it is greater than zero, but rather choose a reasonable small number, because otherwise you may end up dividing by a number such as 1e-7 and still get silly results)):
if (SlurryMassFlow > 0.001)
SolidInSlurryMF = SolidMassFlow / SlurryMassFlow
else
SolidInSlurryMF = 0
endif
2. The above code can also be written as follows (it is exactly the same, just really a shorter way of putting it in the code. See IIf Command for a description of the use of the 'iif' command):
SolidInSlurryMF = iif (SlurryMassFlow > 0.001, SolidMassFlow / SlurryMassFlow, 0)
3. Use the 'Max' command to ensure that you never divide by a very small number:
SolidInSlurryMF = SolidMassFlow / MAX(SlurryMassFlow, 0.001)
This command will compare the value of 'SlurryMassFlow' and 0.001 and use whichever is the greater value of the two. Therefore, if 'SlurryMassFlow' is zero, or less than 0.001, it will use 0.001 and you will not have an error in your code.





