Cancel
Showing results for 
Search instead for 
Did you mean: 

code problems

Creator
Creator

I'm having problems with "inspect....when":

 

inspect machine01.EnergyTargetState
when "working"
then
wait tU;
machine02.EnergyTargetState := "operational";
end;

 

can someone help me?

thanks

8 REPLIES

Re: code problems

Phenom
Phenom

I assume you are working with Psi v12.x and "inspect" is not highlighted

 

I think -for what ever reason- "inspect" is not interpreted as simtalk code in v12.x

 

work around

  for the time being work with simtalk 2.0 -code ( e.g. switch...case)

Re: code problems

Siemens Phenom Siemens Phenom
Siemens Phenom

What do you mean with "having problems"? Could you be a bit more specific?

 

Do you get a compilation error when you apply the source code (then you are probably using a SimTalk 2.0 Method in Plant Simulation 12.x), or do get an error when executing the Method, or does the Method not do what you expect?

_________________________________________________________________
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.

Re: code problems

Creator
Creator

The Method doesn't do what I expect. The machines never go operational. When the machine goes standby then never back operational.

Re: code problems

Siemens Phenom Siemens Phenom
Siemens Phenom

The string comparison is case-sensitive. So you must write:

 

inspect machine01.EnergyTargetState
when "Working" then

...

 

 Alternatively you can write:

 

inspect toLower(machine01.EnergyTargetState)
when "working" then

 

_________________________________________________________________
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.

Re: code problems

Creator
Creator

Thanks Michael, I tried both suggestions but unfortunately the Method still doesn't work.

Re: code problems

Siemens Phenom Siemens Phenom
Siemens Phenom

Could you upload a small example model?

Without it I cannot help you.

_________________________________________________________________
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.

Re: code problems

Creator
Creator

Of course

Re: code problems

Siemens Phenom Siemens Phenom
Siemens Phenom

when the singleproc is failed the energyState also is failed; the inspect statement works correct;

 

I guess your intention is to wait for the end of the failure of the singleproc. Therefore I have changed the inspect to a waituntil.

 

Kind regards

Karola

------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.