Turn on suggestions

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
- Count number of control patients for every week in...

Options

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

Count number of control patients for every week in the year

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

06-19-2015 08:18 AM

Dear all,

I have a question.

My model is an appointment system. I want to count the total number of control patients for every week of the year and put them in table. week 1 = 10 , week 2 = 15.

But it doesn't work.

I hope someon can help me with this.

Martin

11 REPLIES

Re: Count number of control patients for every week in the year

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

06-19-2015 08:30 AM

Hi Martin,

the attached model uses the function CalendarWeek to calculate a sum of all parts arriving in a certain week and writes them to the corresponding row in a table file.

Regards,

Ralf

Regards,

Ralf

------------------------------------------------------------------------------------------------------

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

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

Ralf

------------------------------------------------------------------------------------------------------

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

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

Re: Count number of control patients for every week in the year

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

06-19-2015 09:37 AM

Thans Ralf for your help!

And how how do i separate only the control patients in a column and not the total amount of patients?

Thank you advance,

Martin

Re: Count number of control patients for every week in the year

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

06-19-2015 09:48 AM

You can put an if condition around the line which increments the number.

To differentiate the types you can define a custom attribute on the patient and set it to the correct type. Then you can check for the value of this attribute in the if condition.

Regards,

Ralf

Regards,

Ralf

------------------------------------------------------------------------------------------------------

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

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

Ralf

------------------------------------------------------------------------------------------------------

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

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

Re: Count number of control patients for every week in the year

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

06-19-2015 10:00 AM

So when the state of the patient is Control_short and the table has the name Number_of_short_term then i can use the following formula?

is

do

local currentWeek := CalendarWeek(EventController.Date+EventController.SimTime);

Inspect @.state

When "Control_short" then Number_of_short_term[1, currentWeek] := Number_of_short_term[1, currentWeek] + 1;

end;

Or is this wrong?

Re: Count number of control patients for every week in the year

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

06-19-2015 10:21 AM

Your code is missing one "end;" at the end. But otherwise it looks fine.

Instead of the inspect statement you might want to use a simpler if statement:

if @.state = "Control_short" then Number_of_short_term[1,currentWeek] := Number_of_short_term[1,currentWeek] + 1; end;

Regards,

Ralf

------------------------------------------------------------------------------------------------------

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

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

Ralf

------------------------------------------------------------------------------------------------------

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

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

Re: Count number of control patients for every week in the year

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

06-19-2015 10:33 AM

Dear Ralf,

Now I get the following error: unknow identifier see attachment.

Do you know what is wrong?

Kind regards,

Martin

Re: Count number of control patients for every week in the year

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

06-19-2015 10:38 AM

It seems that the table Number_of_short_term cannot be found.

The method Slot_assignment is in the frame .Models.Main_Model.Planner.

The table has to be in this frame as well otherwise you have to specify the path to the table.

Ralf

------------------------------------------------------------------------------------------------------

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

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

Re: Count number of control patients for every week in the year

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

06-19-2015 10:48 AM

Dear Ralf,

Thank you! this works.

Now I have one last question. Now i have the total nummber of control_short patients in the table file. But how do I get only the short-term control patients in that table that had an appointment in the specific weeks?( I have attached my model and maybe makes that is easier to take a look.)

I hope you can help me and then I'm really happy haha!

Martin

Re: Count number of control patients for every week in the year

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

06-19-2015 11:25 AM

You could add another custom attribute at the patient of type table where you collect all the weeks where the patient had an appointment.

Then you can check this attribute later.

Ralf

------------------------------------------------------------------------------------------------------

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