Mass views exports

Hello @Thierry_Poupon ,
Concerning EIE type, you can use something like this :
For EIE in all_EIE:
EIE_Type = EIE.get_type()
EIE_Type_elem = EIE_Type[0].get_name()

Best regards,

Sophie

@Sophie_Plazant
Thanks Sophie

Hi Sophie
I’m trying to get the list of SCE: System Component exchanges:
I managed to get those outgoing from system actors… but now I need to append the ones outgoing from system… (Some CE are crossing from one actor to the next, so O can’t really take the inputs without having doublons)
Then for system: I tried to reuse same as for actors, but it does not work…

Currently this script has already 3 loops and 3 browses because I had to use component ports

The ā€œget_outgoing component_exchange()ā€ don’t run: issue in capella.py

Thanks for any help…
May be I’ll try to save a loop and run with connected componenent from CE…

Last try with this kind of script:

for elem_SAC in all_SAC:
Acteur = elem_SAC
#print(Acteur)

#SACOGCE = elem_SAC.get_outgoing_component_exchanges()
#print('found sourced CE')
ACPort = elem_SAC.get_contained_component_ports()
for elem_CP in ACPort:
    
    SACPO=elem_CP.get_orientation()
    if SACPO == "OUT" or SACPO == "INOUT":
        SACOGCE=elem_CP.get_component_exchanges()
            
        for elem_CE in SACOGCE:
                                       
            i = i + 1  
            worksheet.cell(row = i, column = 1).value = elem_CE.get_name()

All_SYS=[System]
for elem_SYS in All_SYS:
SYSCPort = elem_SYS.get_contained_component_ports()
print(elem_SYS)
for elem_CP in SYSCPort:
SYCPO=elem_CP.get_orientation()
print(SYCPO)
ā€˜ā€™ā€™
for elem_CE in SYSOGCE:
i = i + 1
worksheet.cell(row = i, column = 1).value = elem_CE.get_name()

ā€˜ā€™ā€™
Python wants a ā€œselfā€ as argument in get_contained_component_ports(self), but this generates another one, I tried as well the string ā€˜self’ but the string doesn’t fit either.
So now I try yours for EIE…
Regards
Thierry

Here is the result:

py4j.Py4JException: An exception was raised by the Python Proxy. Return Message: Traceback (most recent call last):
File ā€œC:\c520x\capella\plugins\org.eclipse.ease.lang.python.py4j_0.7.0.I201907020902\pysrc\ease_py4j_main.pyā€, line 186, in runcode
exec(compiled, self.locals)
File ā€œL/Python4Capella/Scripts for MAEVA/Export_MAEVA_EI-EIE.pyā€, line 117, in
return _pyease_ListConverter().convert([
File ā€œL/Python4Capella/simplified_api/capella.pyā€, line 202, in get_element_type
AttributeError: TODO

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File ā€œC:\c520x\capella\plugins\py4j-python_0.10.9.3-bnd-2odeag\src\py4j\clientserver.pyā€, line 581, in _call_proxy
return_value = getattr(self.pool[obj_id], method)(*params)
File ā€œC:\c520x\capella\plugins\org.eclipse.ease.lang.python.py4j_0.7.0.I201907020902\pysrc\ease_py4j_main.pyā€, line 335, in executeScript
return self.executeCommon(code_text, self.interp.runcode, filename)
File ā€œC:\c520x\capella\plugins\org.eclipse.ease.lang.python.py4j_0.7.0.I201907020902\pysrc\ease_py4j_main.pyā€, line 313, in executeCommon
execution_result = code_exec(code_text, filename)
File ā€œC:\c520x\capella\plugins\org.eclipse.ease.lang.python.py4j_0.7.0.I201907020902\pysrc\ease_py4j_main.pyā€, line 213, in runcode
except Exception:
TypeError: catching classes that do not inherit from BaseException is not allowed

at py4j.Protocol.getReturnValue(Protocol.java:476)
at py4j.reflection.PythonProxyHandler.invoke(PythonProxyHandler.java:108)
at com.sun.proxy.$Proxy25.executeScript(Unknown Source)
at org.eclipse.ease.lang.python.py4j.internal.Py4jScriptEngine.internalExecute(Py4jScriptEngine.java:236)
at org.eclipse.ease.lang.python.py4j.internal.Py4jScriptEngine.execute(Py4jScriptEngine.java:226)
at org.eclipse.ease.AbstractScriptEngine.inject(AbstractScriptEngine.java:245)
at org.eclipse.ease.AbstractScriptEngine.run(AbstractScriptEngine.java:309)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

Have a good WE
Regards
Thierry

Hello @Thierry_Poupon ,
you can use as an alternative to get outgoing component exchanges : capella_query_by_name(e_object,ā€˜Outgoing Component Exchanges’).
To see the available query, you can use available_query_names(e_object).

For ā€˜get_contained_components_ports()’, do you have an error with elem_SYS.get_contained_components_ports()?

Best regards

Sophie

Hello@Sophie
I understood that system is not an item but a singleton where a system element is…
This is causing me an additional browse and loop while getting modes and states.
For SCE, what I did is pretend I wanted all CE, then add them on list when connected component was system actor. Doing this, SCE between system actors are seen twice. I solve it in the excel part by removing duplicates while reading export. The constraint there is not to have several with the same name.
I consider this point as solved.
Thanks anyway :slight_smile:
I tried to continue exchange items checks…
I’m still missing a solution that alerts untyped EIE, and for untyped properties should be OK, but…
Reference value seems to be a project alone: each kind has to be separate (boolean; enumeration; string and numerical). On the other hand I couldn’t get the list of literals for each detail kind (some don’t have like physical quantities, they use numerics which have units…)
Class operation parameter is toot complicated for the moment, and needs imbricated loops… parameter have no accessible attribute.
As you can see, it’s not finished!
To come back to state machines: in my project I have a governed (modes driven by system of interest) way bigger than system of interest (which is ā€œsystemā€), so under system I have one state machine for the governed system lifecycle (with 2 main regions), one mode machine for its modes (with 2 main regions), then the mode machine for my system… each time I have imbricated mode or states.
The target is to lists all modes or states for each machine, and then check the traces linking governed system phase; governed system mode and system of interest modes.
Next step is to check that system functions involved in required capacity during a phase are woken up by the relevant system of interest mode… (then I’m speaking only about system, not actors)…
In this part I just begin…
Many thanks again for your support and your time
Best regards
Thierry

Hi there,
As mentionned in preceding answer to Sophie Plazanet, I’m looking for a way to find incoming traces to states (and modes which seems to be same class).
There is no get_traces in states, and I’m lacking B-plan…
Thanks for any help.
Thierry

Hello @Thierry_Poupon ,
You can use capella_query_by_name(e_object,ā€˜Outgoing Generic Traces’) et capella_query_by_name(e_object,ā€˜Incoming Generic Traces’).

Best regards

Sophie

Thanks Sophie
Can you tell me more about exact syntax?
Regards
Thierry
Edit1: Could this work for EI mechanism or data type?
Edit2: Found the syntax, incoming works, not outgoing but that’s enough for me.

Hi there
I’m still looking to get the typing element of parameters, reference values…
So far parameters seem to have not data field accessible, neither trough python functions , capella query… I tried to take it the other way round, from detail to what they type: the table is empty. Thinking again, the relation ā€œtypingā€ has several item class at the origin and several at the target… on one side you have EIE, Class properties, collections, on the other side you have classes, collections, details (booleans; enumeration; strings, numerics; physical quantities)… may be separately you have referenced values to literals, and then the relation between literals and the detail they belong to…
I just noticed that trying to get values belonging to numerics, I had an error message about Physical quantities…
Thanks for any help

Thierry

Hi there!
Does someone have a clue about how much table export we can add in the same script:
I was trying to assembly them all and save browsing time… but the result is still not complete and has already 8 browse operations, creates 12 excel files.
The point is it ran into infinte loop with an incident about memory size.
Should I see a link?
Thanks for answers
Thierry

Wouaw, this sounds so heavy.
By the way, I don’t know if you are exporting using Mass view or a python script, if you are using a script then I could say this:
be careful with the function (get_all_contents_by_type()), try instead getting into the data directly and adding them into a list, instead of using the function.

Don’t know if that’s of any help.
Good luck with it.

Best R
Kabe

In fact I used both… csv exports are stronger but you need to perform again and again a painful selection that is forgotten each time you close the bench.
Here I’m speaking about scripts.
There are two reason for assemblying my scripts: launch all at once, and save browsing operations.
I have seen already that in fact you just need the one for the initial table… but I did not yet audit which "get_all_content_by _type()) I could remove.
So far I couldn’t avoid to build the name list, then add a second field in another file (name+2nd filed)*, then if I need a third one restart another (name+3rd field).
Thus, in the Excel part I need to append or joint the results to build the complete picture. My Excel model analysis systems runs 5 books containing something like 50 sheets, including data import, joints, appends, pivots…
My aim is detect inconsistent EI nature to FE (air in electronic network); unused EI; FE; CE (univoked in scenarios; empty); relations life phase to mode: ensure involved functions are active while capabilities are required. All this is not in validation tool…

Thanks for your response
(*) If I don’t, I get only the list having something in the second field and what I want to see mostly is those having it empty…

Thierry

Why?

You are generating this using mass or just a script?

If I am understanding this correctly, your problem is jointing all this files in one single one? (which takes too much long time)
I guess i would suggest to make one single excel (with python) that contains them all, then generates it once by runing the script once. Maybe that would remove your problem.

I do this because I do not find empty secondary field… I want FE that have no category, or CE allocating nothing: If I run a complete matrix, I couldn’t have the incomplete rows, so I need the key list to compare.
Anyway this part is big but easy in Excel
Before with the csv, I took the almost complete matrix (without long texts) and picked up the columns I used in SQL queries in Excel. But This process needed 20 tables to do it all, some being painful to select like states; function instances and scenarios; or exchanges; data types and property value group that takes variant data in my model…
Thierry

Thierry

Some screen shots (without revealing the confidential names/words), could prove really helpful.