Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Navigation
- Tecnomatix
- Forums
- Blogs
- Knowledge Bases
- Groups

- Siemens PLM Community
- Tecnomatix
- Plant Simulation
- Irritating application of real and integer values

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Irritating application of real and integer values

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-19-2015 04:16 AM

Hi guys!

I am hugely irritated by the usage of real and integer values in PlantSimulation. First of all I do not see, why an integer division in PlantSimulation ("//") is restricted to integer values by default, but that's one thing.

Let's have a look at the following small piece of code:

is

do

local v1 := z_uniform(1, 1, 100);

local v2 := floor(v1);

v2 := v2 // 10;

end;

Even when the commands "floor()" and "ceil()" are looking for the next lower / upper integer value, the result is returned as a real value. I know it is mentioned in the manual, but I do not see any sense in that.

On the other hand, PlantSimulation is clearly distinguishing between integer and real results with respect to the implemented probability distributions. z_uniform and z_negexp are returining real values while z_binomial or z_poisson are explicitly returning integer results.

Maybe to rethink the approach to achieve a higher consistency?

3 REPLIES

Re: Irritating application of real and integer values

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-19-2015 04:47 AM - edited 08-19-2015 04:52 AM

*floor*and*ceil*can be called with an argument that is out of the integer range. You are right that "floor(3.3)" could return the integer value 3. But "floor(pi*1e9)" would be out of the integer range and must therefore return a real value. We decided that it is better to always return the same data type.

If you want to convert a real value into an integer value, simply assign that real value to a local integer variable:

local v2 : integer := floor(v1);- You are wrong about
*z_poisson*. It returns a real value, like it should.*z_binomial*on the other hand is a discrete distribution, that generates integer values. So why should it return a real value?

_________________________________________________________________

Did you like the answer? Then click the Thumbs Up button.

Did the answer solve your problem? Then accept the answer as solution.

Did you like the answer? Then click the Thumbs Up button.

Did the answer solve your problem? Then accept the answer as solution.

Re: Irritating application of real and integer values

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-19-2015 04:57 AM

Just have a look into the manual or help-file concerning the z_poisson distribution!

Citing: "The return value k of the distribution is the number of events (integer)."

Re: Irritating application of real and integer values

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-19-2015 05:29 AM

I was wrong. Both, *z_poisson* and *z_binomial*, are discrete distributions that only generate "integer" values. The values are returned as data type real, so that all z_-functions return the same data type for consistency reasons. That's a matter of argument, but I don't think we will change it.

The online-help is in fact misleading. With the term "integer" we probably wanted to express that the distributions only return natural numbers (positive values without places after the decimal point). We will change the online-help and explain this better.

_________________________________________________________________

Did you like the answer? Then click the Thumbs Up button.

Did the answer solve your problem? Then accept the answer as solution.

Did you like the answer? Then click the Thumbs Up button.

Did the answer solve your problem? Then accept the answer as solution.

Follow Siemens PLM Software

© 2019 Siemens Product Lifecycle Management Software Inc